From 6f434eefa81360b72e5c1e7c3aa7fc1ebc775a2e Mon Sep 17 00:00:00 2001 From: zhaoqiaobo <583671871@qq.com> Date: Thu, 19 Sep 2024 19:38:28 +0800 Subject: [PATCH] =?UTF-8?q?feat(all):=20=E5=A2=9E=E5=8A=A0=E9=85=8D?= =?UTF-8?q?=E9=80=81=E8=BD=A6=E6=AC=A1=E5=AE=8C=E7=BB=93=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E6=88=90=E6=9C=AC=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IBasicdataFactoryCategoryClient.java | 3 ++ .../feign/IWarehouseWaybillDetailClient.java | 3 ++ .../BasicdataFactoryCategoryEntityClient.java | 23 +++++++++- .../report/DeliverFinishReportListener.java | 11 ++++- .../report/QualityDeliverListener.java | 35 ++++++++++++++- .../report/SignforReportListener.java | 2 + .../IDistributionAddvaluePackageService.java | 4 ++ ...istributionAddvaluePackageServiceImpl.java | 44 +++++++++++++++++-- .../impl/DistributionSignforServiceImpl.java | 4 ++ .../feign/WarehouseWaybillDetailClient.java | 21 +++++++++ 10 files changed, 142 insertions(+), 8 deletions(-) diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataFactoryCategoryClient.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataFactoryCategoryClient.java index f2e2c92c3..a0faa71eb 100644 --- a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataFactoryCategoryClient.java +++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataFactoryCategoryClient.java @@ -43,4 +43,7 @@ public interface IBasicdataFactoryCategoryClient { */ @PostMapping(API_PREFIX+"/findEntityByCategoryName") BasicdataFactoryCategoryEntity findEntityByCategoryName(@RequestBody BasicdataFactoryCategoryEntity entity3); + + @PostMapping(API_PREFIX+"/findEntityByBrandAndMaterielName") + BasicdataFactoryCategoryEntity findEntityByBrandAndMaterielName(@RequestBody BasicdataFactoryCategoryEntity factoryCategoryEntity); } diff --git a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseWaybillDetailClient.java b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseWaybillDetailClient.java index 02f463493..f498609d0 100644 --- a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseWaybillDetailClient.java +++ b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseWaybillDetailClient.java @@ -69,4 +69,7 @@ public interface IWarehouseWaybillDetailClient { List findByWaybillIds(@RequestBody List waybillIds); @PostMapping(API_PREFIX+"/deleteByWaybillNo") void deleteByWaybillNo(String waybillNo); + + @GetMapping(API_PREFIX+"/findENtityByCodeAndName") + WarehouseWayBillDetail findENtityByCodeAndName(@RequestParam String orderCode, @RequestParam String category); } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataFactoryCategoryEntityClient.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataFactoryCategoryEntityClient.java index ccb1c6e7b..ad52fcde9 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataFactoryCategoryEntityClient.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataFactoryCategoryEntityClient.java @@ -1,5 +1,7 @@ package com.logpm.basicdata.feign; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.logpm.basicdata.entity.BasicdataFactoryCategoryEntity; import com.logpm.basicdata.service.IBasicdataFactoryCategoryService; @@ -7,7 +9,7 @@ import lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.RestController; import springfox.documentation.annotations.ApiIgnore; -import java.util.concurrent.locks.Condition; +import java.util.List; @ApiIgnore() @RestController @@ -51,4 +53,23 @@ public class BasicdataFactoryCategoryEntityClient implements IBasicdataFactoryCa .eq(BasicdataFactoryCategoryEntity::getFirsts,entity3.getFirsts()) ); } + + @Override + public BasicdataFactoryCategoryEntity findEntityByBrandAndMaterielName(BasicdataFactoryCategoryEntity factoryCategoryEntity) { + if(StrUtil.isEmpty(factoryCategoryEntity.getBrand())){ + return null; + } + if(StrUtil.isEmpty(factoryCategoryEntity.getMaterielName())){ + return null; + } + List list = factoryCategoryService.list(Wrappers.query().lambda() + .eq(BasicdataFactoryCategoryEntity::getBrand, factoryCategoryEntity.getBrand()) + .eq(BasicdataFactoryCategoryEntity::getMaterielName, factoryCategoryEntity.getMaterielName()) + .eq(BasicdataFactoryCategoryEntity::getType, factoryCategoryEntity.getType()) + ); + if(CollUtil.isNotEmpty(list)){ + return list.get(0); + } + return null; + } } 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 c052e3dce..77391e7f2 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 @@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.logpm.basicdata.feign.IBasicdataDrivermiddleClient; import com.logpm.distribution.dto.ReportQualityDeliverDTO; import com.logpm.distribution.entity.QualityDeliverEntity; +import com.logpm.distribution.service.IDistributionAddvaluePackageService; import com.logpm.distribution.service.IQualityDeliverService; import com.logpm.factorydata.feign.IFactoryDataClient; import com.logpm.factorydata.vo.SendMsg; @@ -66,6 +67,8 @@ public class DeliverFinishReportListener { private IBasicdataDrivermiddleClient drivermiddleClient; @Resource private IExpenseDispatchClient expenseDispatchClient; + @Resource + private IDistributionAddvaluePackageService addvaluePackageService; @RabbitListener(bindings = @QueueBinding( value = @Queue(name = FanoutConstants.DeliveryOfPickup.BillAndFinish.QUEUE.REPORT, durable = "true"), @@ -218,6 +221,8 @@ public class DeliverFinishReportListener { List addPriceList = priceVO.getAddPriceList(); if (CollUtil.isNotEmpty(addPriceList)) { Map addPriceMap = addPriceList.stream().collect(Collectors.toMap(ExpenseDispatchPriceCategoryVO::getCategoryId, v -> v)); + Set collect1 = value.stream().map(v -> v.getOrderPackageCode()).collect(Collectors.toSet()); + Map addvaluePackageMap = addvaluePackageService.findMapByPackageCode(collect1); for (QualityDeliverEntity entity : value) { if (ObjectUtil.isNotEmpty(entity.getCostCategoryId()) && addPriceMap.containsKey(entity.getCostCategoryId())) { ExpenseDispatchPriceCategoryVO expenseDispatchPriceCategoryVO = addPriceMap.get(entity.getCostCategoryId()); @@ -231,7 +236,11 @@ public class DeliverFinishReportListener { // 装卸费单价 String loadingUnloadingFee = expenseDispatchPriceCategoryVO.getLoadingUnloadingFee(); // 上楼层数 - Integer stairsNumber = entity.getStairsNumber(); + // 查询出上楼层数 + Integer stairsNumber = 0; + if (addvaluePackageMap.containsKey(entity.getOrderPackageCode())) { + stairsNumber = Convert.toInt(addvaluePackageMap.get(entity.getOrderPackageCode())); + } // 签收数量 Integer signNum = entity.getSignNum(); if (ObjectUtil.isNotEmpty(signNum)) { diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/QualityDeliverListener.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/QualityDeliverListener.java index 0cb71ff82..3b2fd62af 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/QualityDeliverListener.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/QualityDeliverListener.java @@ -20,8 +20,12 @@ import com.logpm.distribution.service.IDistributionParcelListService; import com.logpm.distribution.service.IDistributionStockArticleService; import com.logpm.distribution.service.IDistributionStockListService; import com.logpm.distribution.service.IQualityDeliverService; +import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; +import com.logpm.trunkline.feign.ITrunklineAdvanceDetailClient; +import com.logpm.warehouse.entity.WarehouseWayBillDetail; import com.logpm.warehouse.entity.WarehouseWaybillEntity; import com.logpm.warehouse.feign.IWarehouseWaybillClient; +import com.logpm.warehouse.feign.IWarehouseWaybillDetailClient; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.Nullable; @@ -71,6 +75,12 @@ public class QualityDeliverListener { @Resource private IBasicdataFactoryCategoryClient factoryCategoryClient; + @Resource + private ITrunklineAdvanceDetailClient advanceDetailClient; + + @Resource + private IWarehouseWaybillDetailClient waybillDetailClient; + @RabbitListener(bindings = @QueueBinding( value = @Queue(name = ReportConstants.REPORT_QUALITY_DELIVER_QUEUE, durable = "true"), exchange = @Exchange(name = ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE, type = ExchangeTypes.TOPIC), @@ -205,6 +215,13 @@ public class QualityDeliverListener { } if (ObjectUtil.equals(PackageTypeEnums.LTL.getCode(), conditions)) { // 零担 + WarehouseWayBillDetail wayBillDetail = waybillDetailClient.findENtityByCodeAndName(qualityDeliverEntity.getOrderCode(), qualityDeliverEntity.getCategory()); + if (ObjectUtil.isNotEmpty(wayBillDetail)) { + qualityDeliverEntity.setCostCategoryId(wayBillDetail.getProductId()); + qualityDeliverEntity.setRevenueCategoryId(wayBillDetail.getProductId()); + qualityDeliverEntity.setCostCategory(wayBillDetail.getProductName()); + qualityDeliverEntity.setRevenueCategory(wayBillDetail.getProductName()); + } DistributionParcelListEntity parcelListEntity = parcelListService.findByOrderCodeAndCategory(qualityDeliverEntity.getOrderCode(), qualityDeliverEntity.getCategory(), qualityDeliverEntity.getWarehouseId()); buildCmpBasicInfo(qualityDeliverEntity, parcelListEntity); // buildOrderInfo(qualityDeliverEntity, qualityDeliverEntity.getWarehouseId(), qualityDeliverEntity.getOrderCode()); @@ -238,11 +255,17 @@ public class QualityDeliverListener { BasicdataFactoryCategoryEntity factoryCategoryEntity = new BasicdataFactoryCategoryEntity(); factoryCategoryEntity.setMaterielName(materielName); factoryCategoryEntity.setBrand(brandName); - BasicdataFactoryCategoryEntity categoryEntity = factoryCategoryClient.findEntityByMaterielName(factoryCategoryEntity); + factoryCategoryEntity.setType(2); + BasicdataFactoryCategoryEntity categoryEntity = factoryCategoryClient.findEntityByBrandAndMaterielName(factoryCategoryEntity); + factoryCategoryEntity.setType(1); + BasicdataFactoryCategoryEntity categoryEntity1 = factoryCategoryClient.findEntityByBrandAndMaterielName(factoryCategoryEntity); if (ObjectUtil.isNotEmpty(categoryEntity)) { - // TODO 存id + qualityDeliverEntity.setCostCategoryId(categoryEntity.getCategoryId()); qualityDeliverEntity.setCostCategory(categoryEntity.getCategory()); + } + if (ObjectUtil.isNotEmpty(categoryEntity1)) { qualityDeliverEntity.setRevenueCategory(categoryEntity.getCategory()); + qualityDeliverEntity.setRevenueCategoryId(categoryEntity1.getCategoryId()); } // TODO 从入库单上查询入库时间 } @@ -287,6 +310,14 @@ public class QualityDeliverListener { // 构建运单相关信息 buildWaybillInfo(qualityDeliverEntity, waybillNumber); } + // 暂存单查询结算品类 + TrunklineAdvanceDetailEntity advanceDetailEntity = advanceDetailClient.findEntityByOrderPackageCode(qualityDeliverEntity.getOrderPackageCode()); + if (ObjectUtil.isNotEmpty(advanceDetailEntity)) { + qualityDeliverEntity.setCostCategoryId(advanceDetailEntity.getCostCategoryId()); + qualityDeliverEntity.setCostCategory(advanceDetailEntity.getCostCategoryName()); + qualityDeliverEntity.setRevenueCategoryId(advanceDetailEntity.getIncomeCategoryId()); + qualityDeliverEntity.setRevenueCategory(advanceDetailEntity.getIncomeCategoryName()); + } // 构建订单相关信息 buildOrderInfo(qualityDeliverEntity, qualityDeliverEntity.getWarehouseId(), qualityDeliverEntity.getOrderCode()); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/SignforReportListener.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/SignforReportListener.java index 6d5999c9f..de65e887c 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/SignforReportListener.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/SignforReportListener.java @@ -1,6 +1,7 @@ package com.logpm.distribution.receiver.report; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.convert.Convert; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONObject; @@ -72,6 +73,7 @@ public class SignforReportListener { .signUserName(bean.getOperator()) .signTime(bean.getOperatorTime()) .signCarNumber(vo.getVehicleName()) + .signCarId(StrUtil.isNotEmpty(vo.getVehicleId()) ? Convert.toLong(vo.getVehicleId()) : null) .signTrainNumber(vo.getTrainNumber()) .signReservationCode(vo.getReservationCode()) .signType(vo.getOperatMode()) diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAddvaluePackageService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAddvaluePackageService.java index 804a99e8f..7e4cd86d3 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAddvaluePackageService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAddvaluePackageService.java @@ -24,6 +24,8 @@ import com.logpm.distribution.excel.DistributionAddvaluePackageExcel; import com.logpm.distribution.vo.DistributionAddvaluePackageVO; import java.util.List; +import java.util.Map; +import java.util.Set; /** * 增值服务包件表 服务类 @@ -50,4 +52,6 @@ public interface IDistributionAddvaluePackageService extends IService exportDistributionAddvaluePackage(Wrapper queryWrapper); + Map findMapByPackageCode(Set collect1); + } 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 4054b6a2d..26eb7e04b 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 @@ -16,17 +16,26 @@ */ package com.logpm.distribution.service.impl; +import cn.hutool.core.collection.CollUtil; +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; +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.springframework.stereotype.Service; -import com.baomidou.mybatisplus.core.conditions.Wrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +import javax.annotation.Resource; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; /** * 增值服务包件表 服务实现类 @@ -37,6 +46,9 @@ import java.util.List; @Service public class DistributionAddvaluePackageServiceImpl extends BaseServiceImpl implements IDistributionAddvaluePackageService { + @Resource + private IDistributionAddvalueDetailService addvalueDetailService; + @Override public IPage selectDistributionAddvaluePackagePage(IPage page, DistributionAddvaluePackageVO distributionAddvaluePackage) { return page.setRecords(baseMapper.selectDistributionAddvaluePackagePage(page, distributionAddvaluePackage)); @@ -46,10 +58,34 @@ public class DistributionAddvaluePackageServiceImpl extends BaseServiceImpl exportDistributionAddvaluePackage(Wrapper queryWrapper) { List distributionAddvaluePackageList = baseMapper.exportDistributionAddvaluePackage(queryWrapper); - //distributionAddvaluePackageList.forEach(distributionAddvaluePackage -> { + // distributionAddvaluePackageList.forEach(distributionAddvaluePackage -> { // distributionAddvaluePackage.setTypeName(DictCache.getValue(DictEnum.YES_NO, DistributionAddvaluePackage.getType())); //}); return distributionAddvaluePackageList; } + @Override + public Map findMapByPackageCode(Set collect1) { + Map result = new HashMap<>(); + List list = this.list(Wrappers.lambdaQuery() + .select(DistributionAddvaluePackageEntity::getAddvalueDetailId) + .in(DistributionAddvaluePackageEntity::getOrderPackageCode, collect1)); + if (CollUtil.isNotEmpty(list)) { + // 转map + Map map = list.stream().collect(Collectors.toMap(DistributionAddvaluePackageEntity::getAddvalueDetailId, DistributionAddvaluePackageEntity::getOrderPackageCode)); + 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) + ""); + }); + } + } + return result; + } + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java index 6b4d4c8ce..ca568e810 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java @@ -2959,6 +2959,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl list = warehouseWayBillDetailService.list(Wrappers.lambdaQuery() + .eq(WarehouseWayBillDetail::getWaybillNo, orderCode) + .eq(WarehouseWayBillDetail::getProductName, category) + ); + if(CollUtil.isNotEmpty(list)){ + return list.get(0); + } + return null; + } }