peng
5 天以前 4eeeb59f6c514b61c78aec2acc95cff4807810e1
framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java
@@ -71,6 +71,7 @@
import cn.lili.trigger.util.DelayQueueTools;
import cn.lili.utils.COSUtil;
import cn.lili.utils.CommonUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -98,6 +99,7 @@
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.util.*;
import java.util.concurrent.TimeUnit;
@@ -263,7 +265,7 @@
        List<OrderSimpleVO> list =  this.baseMapper.queryByParamsCount(queryWrapper);
        OrderCountVO orderCountVO = new OrderCountVO();
        orderCountVO.setOrderNumCount(0);
        orderCountVO.setOrderPriceCount(0.0);
        orderCountVO.setOrderPriceCount(BigDecimal.ZERO);
        if (CollectionUtil.isEmpty(list)) {
            return orderCountVO;
        }else {
@@ -273,9 +275,14 @@
                    continue; // 跳过null元素,或根据业务处理
                }
                orderCountVO.setOrderNumCount(orderCountVO.getOrderNumCount() + 1);
                Double flowPrice = vo.getFlowPrice() != null ? vo.getFlowPrice() : 0.0;
                orderCountVO.setOrderPriceCount(orderCountVO.getOrderPriceCount() + flowPrice);;
                // 金额累加:用BigDecimal处理,避免精度问题
                BigDecimal flowPrice = vo.getFlowPrice() != null ?
                        BigDecimal.valueOf(vo.getFlowPrice()) : BigDecimal.ZERO;
                // 用BigDecimal的add方法累加
                BigDecimal totalPrice = orderCountVO.getOrderPriceCount().add(flowPrice);
                orderCountVO.setOrderPriceCount(totalPrice);
            }
        }
@@ -666,9 +673,12 @@
    public Order delivery(String orderSn, String logisticsNo, String logisticsId) {
        Order order = OperationalJudgment.judgment(this.getBySn(orderSn));
        //如果订单未发货,并且订单状态值等于待发货
        log.info("获取到的订单信息为{}", JSON.toJSONString(order));
        if (order.getDeliverStatus().equals(DeliverStatusEnum.UNDELIVERED.name()) && order.getOrderStatus().equals(OrderStatusEnum.UNDELIVERED.name())) {
            //获取对应物流
            Logistics logistics = logisticsService.getById(logisticsId);
            log.info("获取到的物流信息id为{}", logisticsId);
            log.info("获取到的物流信息为{}", JSON.toJSONString(logistics));
            if (logistics == null) {
                throw new ServiceException(ResultCode.ORDER_LOGISTICS_ERROR);
            }
@@ -1457,7 +1467,7 @@
        // 创建表头
        Row header = sheet.createRow(0);
        String[] headers = {"主订单编号", "子订单编号", "选购商品", "商品数量", "商品ID", "商品单价", "订单应付金额",
                "运费", "优惠总金额", "平台优惠", "商家优惠", "商家改价", "支付方式","卖家名称", "收件人", "收件人手机号",
                "运费", "优惠总金额", "平台优惠", "商家优惠", "商家改价", "支付方式","买家名称", "收件人", "收件人手机号",
                "省", "市", "区", "街道", "详细地址", "买家留言", "订单提交时间", "支付完成时间", "来源",
                "订单状态", "订单类型", "售后状态", "取消原因", "发货时间", "完成时间", "店铺"};