From 13510b3dabf864583f038c5115fe68e03143db50 Mon Sep 17 00:00:00 2001 From: "pref_mail@163.com" Date: Wed, 6 Nov 2024 23:40:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E9=A2=84=E7=BB=93?= =?UTF-8?q?=E7=AE=97=E6=98=8E=E7=BB=86=E5=93=81=E7=B1=BB=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vo/WaybillDetailByWaybillNoVo.java | 42 +++++++++- .../mapper/StatisticsOrderInfoMapper.xml | 28 ++----- .../impl/StatisticsOrderInfoServiceImpl.java | 82 +++++++++++-------- 3 files changed, 92 insertions(+), 60 deletions(-) diff --git a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/vo/WaybillDetailByWaybillNoVo.java b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/vo/WaybillDetailByWaybillNoVo.java index cbf3eec2f..1d9ecff5d 100644 --- a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/vo/WaybillDetailByWaybillNoVo.java +++ b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/vo/WaybillDetailByWaybillNoVo.java @@ -2,6 +2,8 @@ package com.logpm.statistics.vo; import lombok.Data; +import java.math.BigDecimal; + @Data public class WaybillDetailByWaybillNoVo { @@ -11,9 +13,43 @@ public class WaybillDetailByWaybillNoVo { private Long waybillId; /** - * 凭借的产品数量 - * @Detail 木门(3),木门配件(17) + * 运单号 + */ + private String waybillNo; + + /** + * 产品ID + */ + private String productId; + + /** + * 产品名称 + */ + private String productName; + + /** + * 运单产婆开单数量 + */ + private Integer num; + + /** + * 体积 + */ + private BigDecimal volume; + + /** + * 重量 + */ + private BigDecimal weight; + + /** + * 单价 + */ + private BigDecimal price; + + /** + * 小计 */ - private String goodsName; + private String subtotalFreight; } diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.xml b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.xml index 0579665d4..42ec6e398 100644 --- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.xml +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.xml @@ -18,11 +18,6 @@ lww.consignee_name consigneePerson, lww.consignee_mobile consigneeMobile, lww.consignee_address consigneeAddress, - concat(GROUP_CONCAT(lwwd.product_name)) as goodsName, - concat( - group_concat( lwwd.num )) AS goodsNum, - concat( - group_concat( lwwd.price )) AS goodsPrice, lsoi.sign_status signStatus, lsoi.sign_date signDate, lww.create_time openTime, @@ -47,7 +42,6 @@ from logpm_statistics_order_info lsoi left join logpm_basicdata_client lbc on lbc.id = lsoi.consignee_id left join logpm_warehouse_waybill lww on lww.id = lsoi.waybill_id - LEFT JOIN logpm_warehouse_waybill_detail lwwd on lwwd.waybill_id=lww.id where 1=1 and lsoi.create_reconciliation_order_status = 0 @@ -462,6 +456,7 @@ diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsOrderInfoServiceImpl.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsOrderInfoServiceImpl.java index 83909201c..9aa741ce0 100644 --- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsOrderInfoServiceImpl.java +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsOrderInfoServiceImpl.java @@ -26,12 +26,7 @@ import com.logpm.statistics.dto.MerchantStatisticsDTO; import com.logpm.statistics.entity.*; import com.logpm.statistics.mapper.StatisticsOrderInfoMapper; import com.logpm.statistics.service.*; -import com.logpm.statistics.vo.StatisticsChangesRecordVO; -import com.logpm.statistics.vo.StatisticsOrderInfoExportVO; -import com.logpm.statistics.vo.StatisticsOrderInfoVO; -import com.logpm.statistics.vo.StatisticsPackageFeeInfoVO; -import com.logpm.statistics.vo.StatisticsReconciliationOrderInfoVO; -import com.logpm.statistics.vo.WaybillDetailByWaybillNoVo; +import com.logpm.statistics.vo.*; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.common.enums.BooleanZeroOneEnums; @@ -46,16 +41,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; +import java.util.*; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @@ -110,12 +96,17 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl records = statisticsOrderInfoVOIPage.getRecords(); //把records中所有的orderInfoId放入一个集合 List orderInfoIdList = records.stream().map(StatisticsOrderInfoVO::getOrderInfoId).collect(Collectors.toList()); + // 得到运单ID + Set waybillIds = records.stream().map(StatisticsOrderInfoVO::getWaybillId).collect(Collectors.toSet()); + + // 查询运单明细集合 + List waybillDetailByWaybillId = baseMapper.findWaybillDetailByWaybillId(waybillIds); + + // 通过运单号进行分组 + Map> waybillDetailByWaybillIdMap = waybillDetailByWaybillId.stream().collect(Collectors.groupingBy(WaybillDetailByWaybillNoVo::getWaybillId)); + - List waybillNoList = records.stream().map(StatisticsOrderInfoVO::getOrderCode).collect(Collectors.toList()); - // 运单ID集合 -// Set warehouseIdSet = records.stream().map(StatisticsOrderInfoVO::getWaybillId).collect(Collectors.toSet()); -// List waybillDetailByWaybillNoVoList; Map orderPackageInfoMap; if(CollUtil.isNotEmpty(orderInfoIdList)){ List orderPackageInfoList = baseMapper.findPackageListByOrderIdsGroupById(orderInfoIdList); @@ -129,32 +120,55 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl { - Long waybillId = statisticsOrderInfoVO.getWaybillId(); - WaybillDetailByWaybillNoVo waybillDetailByWaybillNoVo1 = null; +// Long waybillId = statisticsOrderInfoVO.getWaybillId(); + + + Long orderInfoId = statisticsOrderInfoVO.getOrderInfoId(); if(orderPackageInfoMap!=null){ StatisticsPackageFeeInfoVO statisticsPackageFeeInfoVO = orderPackageInfoMap.get(orderInfoId); + + if(statisticsPackageFeeInfoVO!=null){ - statisticsPackageFeeInfoVO.setGoodsName(statisticsOrderInfoVO.getGoodsName()); +// statisticsPackageFeeInfoVO.setGoodsName(statisticsOrderInfoVO.getGoodsName()); BeanUtil.copy(statisticsPackageFeeInfoVO, statisticsOrderInfoVO); + + String[] split = statisticsOrderInfoVO.getGoodsName().split(","); + List waybillDetailByWaybillNoVos = waybillDetailByWaybillIdMap.get(statisticsOrderInfoVO.getWaybillId()); + + StringBuffer sb = new StringBuffer(); + StringBuffer sb1 = new StringBuffer(); + + for (String s : split) { + + Optional first = waybillDetailByWaybillNoVos.stream().filter(waybillDetailByWaybillNoVo -> waybillDetailByWaybillNoVo.getProductName().equals(s)).findFirst(); + + if(first.isPresent()){ + WaybillDetailByWaybillNoVo waybillDetailByWaybillNoVo = first.get(); + + if(!sb.toString().isEmpty()){ + sb.append(","); + } + sb.append(waybillDetailByWaybillNoVo.getNum()); + + if(!sb1.toString().isEmpty()){ + sb1.append(","); + } + sb1.append(waybillDetailByWaybillNoVo.getPrice()); + } + } + + statisticsOrderInfoVO.setGoodsNum(sb.toString()); + statisticsOrderInfoVO.setGoodsPrice(sb1.toString()); + } } -// if(waybillDetailByWaybillNoVoList!=null){ -// waybillDetailByWaybillNoVo1 = waybillDetailByWaybillNoVoList.stream().filter(waybillDetailByWaybillNoVo -> Objects.equals(waybillDetailByWaybillNoVo.getWaybillId(), waybillId)).findFirst().orElse(null); -// } -// if(waybillDetailByWaybillNoVo1!=null){ -// statisticsOrderInfoVO.setGoodsName(waybillDetailByWaybillNoVo1.getGoodsName()); -// } }); statisticsOrderInfoVOIPage.setRecords(records);