xiaoyong931011
2021-06-25 38d980c51678f8eca8486a83a6667f9075edb08f
gc-shop/src/main/java/com/xzx/gc/shop/service/OrderService.java
@@ -8,6 +8,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xzx.gc.common.utils.StringUtils;
import com.xzx.gc.common.constant.Constants;
import com.xzx.gc.common.exception.RestException;
import com.xzx.gc.common.utils.IdUtils;
@@ -69,6 +70,12 @@
        Date createdTimeEnd = model.getCreatedTimeEnd();
        PageHelper.startPage(model.getPage(), model.getLimit());
        List<QueryOrderListVo> maps = scoreOrderMapper.queryOrderList(name,orderNo,status,createdTimeStart,createdTimeEnd);
        if(CollUtil.isNotEmpty(maps)){
            for(QueryOrderListVo queryOrderListVo : maps){
                String decode = StringUtils.decode(queryOrderListVo.getName());
                queryOrderListVo.setName(decode);
            }
        }
        PageInfo pageInfo = new PageInfo(maps);
        int count = Convert.toInt(pageInfo.getTotal());
        Map<String, Object> map = new HashMap<>();
@@ -96,17 +103,17 @@
            viewOrderVo.setVoucherImgs(lists);
            //2-待收货3-已收货4-已完成5-已评价,获取物流信息
            Integer status = scoreOrder.getStatus() == null ? 0:scoreOrder.getStatus();
            if(ScoreOrder.STATUS_DOING == status
                    || ScoreOrder.STATUS_DONE == status
                    || ScoreOrder.STATUS_ON == status
                    || ScoreOrder.STATUS_EVALUATE == status){
//            if(ScoreOrder.STATUS_DOING == status
//                    || ScoreOrder.STATUS_DONE == status
//                    || ScoreOrder.STATUS_ON == status
//                    || ScoreOrder.STATUS_EVALUATE == status){
                Example exampleExpress = new Example(ScoreExpressInfo.class);
                Example.Criteria criteriaExpress = exampleExpress.createCriteria();
                criteriaExpress.andEqualTo("orderId",id);
                ScoreExpressInfo scoreExpressInfo = scoreExpressInfoMapper.selectOneByExample(exampleExpress);
                ExpressInfoVo expressInfoVo = objectMapper.convertValue(scoreExpressInfo, ExpressInfoVo.class);
                viewOrderVo.setExpressInfoVo(expressInfoVo);
            }
//            }
            //订单详情
            Example exampleDetails = new Example(ScoreOrderDetails.class);
            Example.Criteria criteriaDetails = exampleDetails.createCriteria();
@@ -215,11 +222,9 @@
        expressInfo.setCreatedTime(new Date());
        scoreExpressInfoMapper.insert(expressInfo);
        AccountInfo update = new AccountInfo();
        update.setAccountId(accountInfo.getAccountId());
        BigDecimal remianScore = score.subtract(totalPrice);
        update.setCollectScore(remianScore.toString());
        accountInfoMapper.updateByPrimaryKey(update);
        BigDecimal remianScore = score.subtract(totalPrice).setScale(0, BigDecimal.ROUND_DOWN);
        accountInfo.setCollectScore(remianScore.toString());
        accountInfoMapper.updateByPrimaryKey(accountInfo);
        ScoreDetails scoreDetails = new ScoreDetails();
        scoreDetails.setOrderNo(order.getOrderNo());