xiaoyong931011
2021-07-07 6c5a9e94f11c5ce05336303129a21886383967a6
gc-user/src/main/java/com/xzx/gc/user/service/UserService.java
@@ -5,6 +5,7 @@
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.github.pagehelper.PageHelper;
@@ -401,6 +402,36 @@
        orderStatus2.add("5");
        orderStatus2.add("7");
        for (UserModel mx : map) {
            //推广人数(暂时没有推广关系为空),订单数,环保金,积分
            if (userModel.getExportFlag() == 0) {
                //订单数
                Integer orderNum = 0;
                Example exampleOrder = new Example(OrderInfo.class);
                Example.Criteria criteriaOrder = exampleOrder.createCriteria();
                criteriaOrder.andEqualTo("userId",mx.getUserId());
                criteriaOrder.andNotEqualTo("orderStatus",6);
                List<OrderInfo> orderInfos = orderMapper.selectByExample(exampleOrder);
                if(CollUtil.isNotEmpty(orderInfos)){
                    orderNum = orderNum + orderInfos.size();
                }
                List<JhyOrder> jhyOrders =  orderMapper.selectJhyOrderByUserId(mx.getUserId());
                if(CollUtil.isNotEmpty(jhyOrders)){
                    orderNum = orderNum + jhyOrders.size();
                }
                mx.setAllOrderNum(orderNum);
                //环保金,积分
                AccountInfo accountInfo = accountService.findByUserId(mx.getUserId());
                if(ObjectUtil.isNotEmpty(accountInfo)){
                    String money = accountInfo.getMoney();
                    mx.setMoney(new BigDecimal(StrUtil.isEmpty(money) ? "0" : money).setScale( 2, BigDecimal.ROUND_DOWN ));
                    String collectScore = StrUtil.isEmpty(accountInfo.getCollectScore()) ? "0":accountInfo.getCollectScore();
                    mx.setCollectScore(new BigDecimal(collectScore).setScale( 2, BigDecimal.ROUND_DOWN ));
                }
            }
            //设置登录时间
            if (userModel.getExportFlag() == 0) {
@@ -819,9 +850,14 @@
        List<Map<String, Object>> odlist = orderMapper.queryCuserOrderFinishList(userId, x);
        PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(odlist);
        for (Map<String, Object> map : odlist) {
            map.put("money", DoubleUtil.roundTwo(map.get("money").toString()));
            map.put("weight", DoubleUtil.roundThree(map.get("weight").toString()));
            map.put("orderid", map.get("orderId").toString());
            map.put("address", map.get("address").toString());
            map.put("status", map.get("status"));
            map.put("type", map.get("type"));
            map.put("money", DoubleUtil.roundTwo(map.get("money").toString()));
            map.put("score", DoubleUtil.roundTwo(map.get("score").toString()));
            map.put("weight", DoubleUtil.roundThree(map.get("weight").toString()));
            map.put("name", map.get("name").toString());
            map.put("createtime", map.get("createTime").toString());
        }
        m.put("orderList", odlist);