From e166ca2ab7c8ccf4b16f11635b48018eddf8f638 Mon Sep 17 00:00:00 2001 From: zhaoqiaobo <583671871@qq.com> Date: Thu, 19 Dec 2024 01:51:40 +0800 Subject: [PATCH] =?UTF-8?q?feat(all):=20=E8=BD=A6=E6=AC=A1=E6=88=90?= =?UTF-8?q?=E6=9C=AC=E6=98=8E=E7=BB=86=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1 修改报表逻辑 --- .../DistributionAddvaluePackageMapper.java | 4 +++ .../DistributionAddvaluePackageMapper.xml | 18 ++++++++++ .../report/DeliverFinishReportListener.java | 28 +++++++++------ ...istributionAddvaluePackageServiceImpl.java | 36 +++++-------------- 4 files changed, 49 insertions(+), 37 deletions(-) diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvaluePackageMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvaluePackageMapper.java index 0919b15ae..e7dea1170 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvaluePackageMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvaluePackageMapper.java @@ -16,6 +16,7 @@ */ package com.logpm.distribution.mapper; +import cn.hutool.json.JSONObject; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -24,6 +25,7 @@ import com.logpm.distribution.excel.DistributionAddvaluePackageExcel; import com.logpm.distribution.vo.DistributionAddvaluePackageVO; import org.apache.ibatis.annotations.Param; import java.util.List; +import java.util.Set; /** * 增值服务包件表 Mapper 接口 @@ -73,4 +75,6 @@ public interface DistributionAddvaluePackageMapper extends BaseMapper findMapByPackageCode(@Param("collect1") Set collect1); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvaluePackageMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvaluePackageMapper.xml index aba9bf6ed..432439ef1 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvaluePackageMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvaluePackageMapper.xml @@ -47,4 +47,22 @@ resultType="com.logpm.distribution.excel.DistributionAddvaluePackageExcel"> SELECT * FROM logpm_distribution_addvalue_package ${ew.customSqlSegment} + + diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/DeliverFinishReportListener.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/DeliverFinishReportListener.java index 91ef847a2..7e624de0a 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/DeliverFinishReportListener.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/DeliverFinishReportListener.java @@ -174,7 +174,7 @@ public class DeliverFinishReportListener implements ReportService { if (StrUtil.isNotEmpty(deliveryKind) && StrUtil.equals(deliveryKind, "自主配送")) { if (StrUtil.isNotEmpty(qualityDeliverEntity.getDeliveryType()) && (StrUtil.equals(qualityDeliverEntity.getDeliveryType(), "商配") || StrUtil.equals(qualityDeliverEntity.getDeliveryType(), "市配"))) { - if(StrUtil.isEmpty(qualityDeliverEntity.getSignCarType())){ + if (StrUtil.isEmpty(qualityDeliverEntity.getSignCarType())) { continue; } ExpenseDispatchClientDTO expenseDispatchClientDTO = expenseDispatchClient.findPriceByDriverId(qualityDeliverEntity.getWarehouseId(), driverId, qualityDeliverEntity.getSignCarTypeId(), qualityDeliverEntity.getDeliveryType()); @@ -186,7 +186,7 @@ public class DeliverFinishReportListener implements ReportService { // 整车计费,则车内的每个包件分摊整车成本费用 if (ynWholeVehicle) { String wholeVehicleCost = priceVO.getWholeVehicleCost(); - if(StrUtil.isNotEmpty(wholeVehicleCost)){ + if (StrUtil.isNotEmpty(wholeVehicleCost)) { BigDecimal div = NumberUtil.div(new BigDecimal(wholeVehicleCost), totalNum); for (Map.Entry entityEntry : valueMap.entrySet()) { QualityDeliverEntity value2 = entityEntry.getValue(); @@ -283,10 +283,14 @@ public class DeliverFinishReportListener implements ReportService { // 装卸费单价 String loadingUnloadingFee = expenseDispatchPriceCategoryVO.getLoadingUnloadingFee(); // 上楼层数 - // Integer stairsNumber = 0; - if (addvaluePackageMap.containsKey(entity.getOrderPackageCode())) { - stairsNumber = Convert.toInt(addvaluePackageMap.get(entity.getOrderPackageCode())); + if (addvaluePackageMap.containsKey(entity.getOrderPackageCode() + "1")) { + stairsNumber = Convert.toInt(addvaluePackageMap.get(entity.getOrderPackageCode() + "1")); + } + // 平移米数 + Integer translationNumber = 0; + if (addvaluePackageMap.containsKey(entity.getOrderPackageCode() + "3")) { + translationNumber = Convert.toInt(addvaluePackageMap.get(entity.getOrderPackageCode() + "3")); } // 签收数量 Integer signNum = entity.getSignNum(); @@ -294,15 +298,15 @@ public class DeliverFinishReportListener implements ReportService { // 上楼费成本 = 上楼费单价 * 上楼层数 * 签收件数 QualityDeliverEntity qualityDeliverEntity1 = valueMap.get(entity.getId()); if (ObjectUtil.isNotEmpty(stairsNumber) && StrUtil.isNotEmpty(stairsCharge)) { - qualityDeliverEntity1.setApstairsCost(NumberUtil.mul(stairsNumber, new BigDecimal(stairsCharge))); + qualityDeliverEntity1.setApstairsCost(NumberUtil.mul(stairsNumber, new BigDecimal(stairsCharge), signNum)); } // 分货费成本 = 分货费单价 * 签收件数 if (StrUtil.isNotEmpty(cargoSplittingFee)) { qualityDeliverEntity1.setApartCost(NumberUtil.mul(signNum, new BigDecimal(cargoSplittingFee))); } - // 平移费成本 = 平移费单价 * 签收件数 + // 平移费成本 = 平移费单价 * 平移米数 * 签收件数 if (StrUtil.isNotEmpty(translationFee)) { - qualityDeliverEntity1.setMoveCost(NumberUtil.mul(signNum, new BigDecimal(translationFee))); + qualityDeliverEntity1.setMoveCost(NumberUtil.mul(translationNumber, new BigDecimal(translationFee), signNum)); } // 装卸费成本 = 装卸费单价 * 签收件数 if (StrUtil.isNotEmpty(loadingUnloadingFee)) { @@ -742,18 +746,22 @@ public class DeliverFinishReportListener implements ReportService { } } - // 是否点位补贴成本 是 计算成本 + // 是否点位补贴成本 是 打卡点位数 * 单价 / 总件数 Integer ynSiteSubsidy = rule.getYnSiteSubsidy(); if (NumberUtil.equals(ynSiteSubsidy, BooleanZeroOneEnums.YES.getCode())) { if (CollUtil.isEmpty(allRouteMap) || CollUtil.isEmpty(firstRouteMap)) { initRule(value, allRouteMap, firstRouteMap); } Set longs = valueMap.keySet(); + Integer dkp = 0; + if(CollUtil.isNotEmpty(allRouteMap)){ + dkp = allRouteMap.keySet().size(); + } for (Map.Entry entityEntry : valueMap.entrySet()) { QualityDeliverEntity value2 = entityEntry.getValue(); String siteSubsidyCost = priceVO.getSiteSubsidyCost(); if (StrUtil.isNotEmpty(siteSubsidyCost)) { - value2.setPointAllowCost(NumberUtil.div(NumberUtil.mul(longs.size(), new BigDecimal(siteSubsidyCost)), totalNum)); + value2.setPointAllowCost(NumberUtil.div(NumberUtil.mul(dkp, new BigDecimal(siteSubsidyCost)), totalNum)); } } } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAddvaluePackageServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAddvaluePackageServiceImpl.java index 71f66a94c..22d6383c9 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAddvaluePackageServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAddvaluePackageServiceImpl.java @@ -17,10 +17,9 @@ package com.logpm.distribution.service.impl; import cn.hutool.core.collection.CollUtil; +import cn.hutool.json.JSONObject; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.logpm.distribution.entity.DistributionAddvalueDetailEntity; import com.logpm.distribution.entity.DistributionAddvaluePackageEntity; import com.logpm.distribution.excel.DistributionAddvaluePackageExcel; import com.logpm.distribution.mapper.DistributionAddvaluePackageMapper; @@ -28,7 +27,6 @@ import com.logpm.distribution.service.IDistributionAddvalueDetailService; import com.logpm.distribution.service.IDistributionAddvaluePackageService; import com.logpm.distribution.vo.DistributionAddvaluePackageVO; import org.springblade.core.mp.base.BaseServiceImpl; -import org.springblade.core.tool.utils.ObjectUtil; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -36,7 +34,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.stream.Collectors; /** * 增值服务包件表 服务实现类 @@ -68,29 +65,14 @@ public class DistributionAddvaluePackageServiceImpl extends BaseServiceImpl findMapByPackageCode(Set collect1) { Map result = new HashMap<>(); - List list = this.list(Wrappers.lambdaQuery() - .select(DistributionAddvaluePackageEntity::getAddvalueDetailId, DistributionAddvaluePackageEntity::getOrderPackageCode) - .in(DistributionAddvaluePackageEntity::getOrderPackageCode, collect1)); - if (CollUtil.isNotEmpty(list)) { - // 转map - Map map = list.stream() - .filter(it -> ObjectUtil.isNotEmpty(it.getAddvalueDetailId())) - .collect(Collectors.toMap( - DistributionAddvaluePackageEntity::getAddvalueDetailId, - DistributionAddvaluePackageEntity::getOrderPackageCode, - (existingValue, newValue) -> existingValue // 处理键冲突 - )); - List list1 = addvalueDetailService.list( - Wrappers.lambdaQuery() - .select(DistributionAddvalueDetailEntity::getFloolNum, DistributionAddvalueDetailEntity::getId) - .in(DistributionAddvalueDetailEntity::getId, map.keySet()) - ); - if (CollUtil.isNotEmpty(list1)) { - Map map1 = list1.stream().collect(Collectors.toMap(DistributionAddvalueDetailEntity::getId, DistributionAddvalueDetailEntity::getFloolNum)); - map.forEach((k, v) -> { - result.put(v, map1.get(k) + ""); - }); - } + if(CollUtil.isEmpty(collect1)){ + return null; + } + List list = baseMapper.findMapByPackageCode(collect1); + if(CollUtil.isNotEmpty(list)){ + list.stream().forEach(item -> { + result.put(item.getStr("orderPackageCode") + item.getStr("addvalueId"), item.getStr("num")); + }); } return result; }