zxl
2 天以前 6db5d5a8fca3aa7e08190c2cfde2fa6cc72cfea2
framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java
@@ -27,6 +27,7 @@
import cn.lili.modules.goods.entity.dos.Goods;
import cn.lili.modules.goods.entity.dto.GoodsCompleteMessage;
import cn.lili.modules.goods.service.GoodsService;
import cn.lili.modules.lmk.domain.vo.OrderCountVO;
import cn.lili.modules.lmk.enums.general.AdminRoleEnum;
import cn.lili.modules.member.entity.dos.Member;
import cn.lili.modules.member.entity.dto.MemberAddressDTO;
@@ -97,6 +98,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;
@@ -251,6 +253,41 @@
    }
    @Override
    public OrderCountVO countByIdOrder(String id) {
        OrderSearchParams orderSearchParams = new OrderSearchParams();
        orderSearchParams.setOrderStatus(OrderStatusEnum.COMPLETED.name());
        orderSearchParams.setMemberId(id);
        QueryWrapper queryWrapper = orderSearchParams.queryWrapper();
        queryWrapper.groupBy("o.id");
        queryWrapper.orderByDesc("o.id");
        List<OrderSimpleVO> list =  this.baseMapper.queryByParamsCount(queryWrapper);
        OrderCountVO orderCountVO = new OrderCountVO();
        orderCountVO.setOrderNumCount(0);
        orderCountVO.setOrderPriceCount(BigDecimal.ZERO);
        if (CollectionUtil.isEmpty(list)) {
            return orderCountVO;
        }else {
            for (OrderSimpleVO vo : list) {
                if (vo == null) {
                    System.out.println("出现空元素");
                    continue; // 跳过null元素,或根据业务处理
                }
                orderCountVO.setOrderNumCount(orderCountVO.getOrderNumCount() + 1);
                // 金额累加:用BigDecimal处理,避免精度问题
                BigDecimal flowPrice = vo.getFlowPrice() != null ?
                        BigDecimal.valueOf(vo.getFlowPrice()) : BigDecimal.ZERO;
                // 用BigDecimal的add方法累加
                BigDecimal totalPrice = orderCountVO.getOrderPriceCount().add(flowPrice);
                orderCountVO.setOrderPriceCount(totalPrice);
            }
        }
        return orderCountVO;
    }
    @Override
    public IPage<OrderSimpleVO> queryByParams(OrderSearchParams orderSearchParams,Boolean needHide) {
        QueryWrapper queryWrapper = orderSearchParams.queryWrapper();
        queryWrapper.groupBy("o.id");
@@ -265,17 +302,8 @@
            }
        }
        for (OrderSimpleVO vo : page.getRecords()){
            Member member = memberMapperMapper.selectById(vo.getMemberId());
            if (member != null){
                vo.setNickName(member.getNickName());
            }
        }
        return page;
    }
    @Override
    public IPage<OrderSimpleXcxVO> queryByXcxParams(OrderSearchXcxParams orderSearchParams) {
        QueryWrapper queryWrapper = orderSearchParams.queryWrapper();
@@ -424,8 +452,6 @@
                vo.setConsigneeMobile(CommonUtil.maskMobile(vo.getConsigneeMobile()));
            }
        }
        XSSFWorkbook workbook = initOrderExportData(orderExportDTOS);
        try {
            // 设置响应头
@@ -517,6 +543,7 @@
            throw new ServiceException(ResultCode.ORDER_CAN_NOT_CANCEL);
        }
    }
    @Override
@@ -1436,7 +1463,7 @@
        // 创建表头
        Row header = sheet.createRow(0);
        String[] headers = {"主订单编号", "子订单编号", "选购商品", "商品数量", "商品ID", "商品单价", "订单应付金额",
                "运费", "优惠总金额", "平台优惠", "商家优惠", "商家改价", "支付方式", "收件人", "收件人手机号",
                "运费", "优惠总金额", "平台优惠", "商家优惠", "商家改价", "支付方式","买家名称", "收件人", "收件人手机号",
                "省", "市", "区", "街道", "详细地址", "买家留言", "订单提交时间", "支付完成时间", "来源",
                "订单状态", "订单类型", "售后状态", "取消原因", "发货时间", "完成时间", "店铺"};
@@ -1461,24 +1488,27 @@
            row.createCell(10).setCellValue(dto.getStoreMarketingCost()!=null?dto.getStoreMarketingCost():0);
            row.createCell(11).setCellValue(dto.getUpdatePrice()!=null?dto.getUpdatePrice():0);
            row.createCell(12).setCellValue(dto.getPaymentMethod());
            row.createCell(13).setCellValue(dto.getConsigneeName());
            row.createCell(14).setCellValue(dto.getConsigneeMobile());
            row.createCell(15).setCellValue(dto.getProvince());
            row.createCell(16).setCellValue(dto.getCity());
            row.createCell(17).setCellValue(dto.getDistrict());
            row.createCell(18).setCellValue(dto.getStreet());
            row.createCell(19).setCellValue(dto.getConsigneeDetail());
            row.createCell(20).setCellValue(dto.getRemark());
            row.createCell(21).setCellValue(dto.getCreateTime());
            row.createCell(22).setCellValue(dto.getPaymentTime());
            row.createCell(23).setCellValue(dto.getClientType());
            row.createCell(24).setCellValue(dto.getOrderStatus());
            row.createCell(25).setCellValue(dto.getOrderType());
            row.createCell(26).setCellValue(dto.getAfterSaleStatus());
            row.createCell(27).setCellValue(dto.getCancelReason());
            row.createCell(28).setCellValue(dto.getLogisticsTime());
            row.createCell(29).setCellValue(dto.getCompleteTime());
            row.createCell(30).setCellValue(dto.getStoreName());
            row.createCell(13).setCellValue(dto.getNickName());
            row.createCell(14).setCellValue(dto.getConsigneeName());
            row.createCell(15).setCellValue(dto.getConsigneeMobile());
            row.createCell(16).setCellValue(dto.getProvince());
            row.createCell(17).setCellValue(dto.getCity());
            row.createCell(18).setCellValue(dto.getDistrict());
            row.createCell(19).setCellValue(dto.getStreet());
            row.createCell(20).setCellValue(dto.getConsigneeDetail());
            row.createCell(21).setCellValue(dto.getRemark());
            row.createCell(22).setCellValue(dto.getCreateTime());
            row.createCell(23).setCellValue(dto.getPaymentTime());
            row.createCell(24).setCellValue(dto.getClientType());
            row.createCell(25).setCellValue(dto.getOrderStatus());
            row.createCell(26).setCellValue(dto.getOrderType());
            row.createCell(27).setCellValue(dto.getAfterSaleStatus());
            row.createCell(28).setCellValue(dto.getCancelReason());
            row.createCell(29).setCellValue(dto.getLogisticsTime());
            row.createCell(30).setCellValue(dto.getCompleteTime());
            row.createCell(31).setCellValue(dto.getStoreName());
        }
        //修改列宽