From d3cf78f537c86cfdd5b8f285e990370351c50c66 Mon Sep 17 00:00:00 2001 From: "pref_mail@163.com" Date: Mon, 9 Sep 2024 22:28:51 +0800 Subject: [PATCH 1/2] =?UTF-8?q?add:=E5=A2=9E=E5=8A=A0=E5=88=B0=E8=BE=BE?= =?UTF-8?q?=E7=9A=84=E5=9D=90=E6=A0=87=E5=92=8C=E5=9C=B0=E7=90=86=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=E4=BF=A1=E6=81=AF=20=E4=BF=AE=E6=94=B9=E7=AD=BE?= =?UTF-8?q?=E6=94=B6=20=E8=A3=85=E8=BD=A6=E8=8A=82=E7=82=B9=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/model/ConsigneeArriveVO.java | 33 ++++++++++ .../common/model/DistributionSignforVO.java | 5 ++ .../springblade/common/model/GAddressVo.java | 41 ++++++++++++ .../common/utils/GaoDeApiUtil.java | 25 ++++++-- .../DistributionSignforController.java | 5 +- .../receiver/report/PlanReportListener.java | 64 ++++++++++++++----- .../report/QualityDeliverListener.java | 32 +++++----- .../receiver/report/StockReportListener.java | 62 +++++++++++------- .../DistributionDeliveryListServiceImpl.java | 50 +++++++++------ .../DistributionReservationServiceImpl.java | 2 +- .../impl/DistributionSignforServiceImpl.java | 31 +++++---- .../impl/DistributionStockupServiceImpl.java | 16 +++-- 12 files changed, 271 insertions(+), 95 deletions(-) create mode 100644 blade-biz-common/src/main/java/org/springblade/common/model/GAddressVo.java diff --git a/blade-biz-common/src/main/java/org/springblade/common/model/ConsigneeArriveVO.java b/blade-biz-common/src/main/java/org/springblade/common/model/ConsigneeArriveVO.java index 536a6e632..12c01e911 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/model/ConsigneeArriveVO.java +++ b/blade-biz-common/src/main/java/org/springblade/common/model/ConsigneeArriveVO.java @@ -26,11 +26,44 @@ public class ConsigneeArriveVO { */ private String vehicleName; + + /** * 预约单号 */ private String reservationCode; + /** + * 省 + */ + private String province; + + /** + * 市 + */ + private String city; + + /** + * 区 + */ + private String district; + + /** + * 街道 + * + */ + private String township; + + /** + * 完整详细地址 + */ + private String address; + + /** + * 打卡坐标 + */ + private String positioning; + } diff --git a/blade-biz-common/src/main/java/org/springblade/common/model/DistributionSignforVO.java b/blade-biz-common/src/main/java/org/springblade/common/model/DistributionSignforVO.java index 52c756a29..5defe9fe9 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/model/DistributionSignforVO.java +++ b/blade-biz-common/src/main/java/org/springblade/common/model/DistributionSignforVO.java @@ -19,6 +19,11 @@ public class DistributionSignforVO implements Serializable { */ private String vehicleName; + /** + * 签收车次 + */ + private String trainNumber; + /** * 预约单号 */ diff --git a/blade-biz-common/src/main/java/org/springblade/common/model/GAddressVo.java b/blade-biz-common/src/main/java/org/springblade/common/model/GAddressVo.java new file mode 100644 index 000000000..7a9a38cfb --- /dev/null +++ b/blade-biz-common/src/main/java/org/springblade/common/model/GAddressVo.java @@ -0,0 +1,41 @@ +package org.springblade.common.model; + +import lombok.Data; + +/** + * 高德返回信息 + */ +@Data +public class GAddressVo { + + /** + * 省 + */ + private String province; + + /** + * 市 + */ + private String city; + + /** + * 区 + */ + private String district; + + /** + * 街道 + * + */ + private String township; + + /** + * 完整详细地址 + */ + private String address; + + /** + * 打卡坐标 + */ + private String positioning; +} diff --git a/blade-biz-common/src/main/java/org/springblade/common/utils/GaoDeApiUtil.java b/blade-biz-common/src/main/java/org/springblade/common/utils/GaoDeApiUtil.java index a81e0f47f..862909a10 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/utils/GaoDeApiUtil.java +++ b/blade-biz-common/src/main/java/org/springblade/common/utils/GaoDeApiUtil.java @@ -2,6 +2,7 @@ package org.springblade.common.utils; import com.alibaba.fastjson.JSONObject; +import org.springblade.common.model.GAddressVo; import java.net.URL; @@ -16,8 +17,9 @@ public class GaoDeApiUtil { * @param lat * @return */ - public static String getAdd(String positioning ){ + public static GAddressVo getAdd(String positioning ){ //lat 小 log 大 + GAddressVo gAddressVo = new GAddressVo(); //注意key是在高德/百度开放平台申请的key,高德地图具体获得key的步骤请查看网址:https://developer.amap.com/api/webservice/guide/create-project/get-key //百度地图开放平台的网址:https://lbsyun.baidu.com/index.php 在该平台注册即可 String key = "40448f21dfc7a531e9db4c405d955bea"; @@ -42,18 +44,31 @@ public class GaoDeApiUtil { in.close(); //解析结果 JSONObject jsonObject = JSONObject.parseObject(res); -// logger.info(jsonObject.toJSONString()); // 这个是高德的 JSONObject jsonObject1 = jsonObject.getJSONObject("regeocode"); //// 这个是百度的 -// JSONObject jsonObject1 = jsonObject.getJSONObject("result"); res =jsonObject1.getString("formatted_address"); + + JSONObject t = jsonObject1.getJSONObject("addressComponent"); + gAddressVo.setProvince(t.getString("province")); + gAddressVo.setCity(t.getString("city")); + gAddressVo.setDistrict(t.getString("district")); + gAddressVo.setTownship(t.getString("township"));; + + gAddressVo.setAddress(res); + gAddressVo.setPositioning(positioning); + } catch (Exception e) { // logger.error("获取地址信息异常{}",e.getMessage()); return null; } - System.out.println("通过API获取到具体位置:"+res); - return res; + return gAddressVo; + } + + public static void main(String[] args) { + + String pods ="104.185875,30.533806"; + getAdd(pods); } } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java index 17ca28f41..97a314903 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java @@ -43,6 +43,7 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springblade.common.model.GAddressVo; import org.springblade.common.model.NodeFanoutMsg; import org.springblade.common.utils.GaoDeApiUtil; import org.springblade.core.boot.ctrl.BladeController; @@ -287,8 +288,8 @@ public class DistributionSignforController extends BladeController { @ApiOperationSupport(order = 3) @ApiOperation(value = "分页", notes = "传入distributionSignfor") public R getLocationAddress(String positioning) { - String address = GaoDeApiUtil.getAdd(positioning); - return R.data(address); + GAddressVo address = GaoDeApiUtil.getAdd(positioning); + return R.data(address.getAddress()); } /** diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/PlanReportListener.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/PlanReportListener.java index a9d7cd5f2..391766529 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/PlanReportListener.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/PlanReportListener.java @@ -32,7 +32,7 @@ import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; -import java.util.List; +import java.util.*; /** * 配送计划生成明细报表 @@ -56,7 +56,7 @@ public class PlanReportListener { )) @Transactional(rollbackFor = Exception.class) public void buildReport(String msg) { - log.info("预约计划生成明细报表: {}", msg); + log.info("配送计划生成明细报表: {}", msg); if (StrUtil.isEmpty(msg)) { return; } @@ -68,6 +68,9 @@ public class PlanReportListener { BizOperationEnums bizOperation = bean.getBizOperation(); List reservationVOList = vo.getReservationVOList(); if (CollUtil.isNotEmpty(reservationVOList)) { + Set reservationSet = new HashSet<>(); + Map invMap = new HashMap<>(); + Map ltlMap = new HashMap<>(); for (ReservationVO reservationVO : reservationVOList) { List details = reservationVO.getPackageDataList(); if (BizOperationEnums.MODIFY.equals(bizOperation) || BizOperationEnums.DELETE.equals(bizOperation)) { @@ -83,6 +86,7 @@ public class PlanReportListener { .set(QualityDeliverEntity::getDeliveryPlanTime, null) .set(QualityDeliverEntity::getDeliveryCreateUserName, null) .eq(QualityDeliverEntity::getPlanTrainNumber, vo.getTrainNumber()) + .eq(QualityDeliverEntity::getPlanReservationCode, reservationVO.getReservationCode()) .ne(QualityDeliverEntity::getBizStatus, 110); qualityDeliverService.update(wrapper); } @@ -121,34 +125,60 @@ public class PlanReportListener { qualityDeliverEntity.setConditions(2); qualityDeliverEntity.setPlanNum(detail.getNumber()); if (BizOperationEnums.ADD.equals(bizOperation) || BizOperationEnums.MODIFY.equals(bizOperation)) { - ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build(); - factoryDataClient.sendMessage(SendMsg.builder() - .exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE) - .routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY) - .message(JSONUtil.toJsonStr(dto)) - .delay(3000) - .build()); +// ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build(); +// factoryDataClient.sendMessage(SendMsg.builder() +// .exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE) +// .routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY) +// .message(JSONUtil.toJsonStr(dto)) +// .delay(3000) +// .build()); + ltlMap.put(detail.getOrderCode()+detail.getProductName(), qualityDeliverEntity); } } else if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.INV)) { + invMap.put(detail.getMallName()+detail.getMaterialCode(), qualityDeliverEntity); + qualityDeliverEntity.setPlanReservationCode(reservationVO.getReservationCode()); qualityDeliverEntity.setIncomingBatch(detail.getPickupBatch()); qualityDeliverEntity.setMallName(detail.getMallName()); qualityDeliverEntity.setMaterielCode(detail.getMaterialCode()); qualityDeliverEntity.setMaterielName(detail.getMaterialName()); qualityDeliverEntity.setConditions(3); - qualityDeliverEntity.setPlanNum(detail.getNumber()); + qualityDeliverEntity.setPlanNum(1); if (BizOperationEnums.ADD.equals(bizOperation) || BizOperationEnums.MODIFY.equals(bizOperation)) { - ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build(); - factoryDataClient.sendMessage(SendMsg.builder() - .exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE) - .routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY) - .message(JSONUtil.toJsonStr(dto)) - .delay(3000) - .build()); + invMap.put(detail.getMallName()+detail.getMaterialCode(), qualityDeliverEntity); +// ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build(); +// factoryDataClient.sendMessage(SendMsg.builder() +// .exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE) +// .routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY) +// .message(JSONUtil.toJsonStr(dto)) +// .delay(3000) +// .build()); } } } } } + if (CollUtil.isNotEmpty(invMap)) { + for (Map.Entry entry : invMap.entrySet()) { + QualityDeliverEntity qualityDeliverEntity = entry.getValue(); + qualityDeliverService.update(qualityDeliverEntity, Wrappers.lambdaUpdate() + .eq(QualityDeliverEntity::getPlanReservationCode,qualityDeliverEntity.getPlanReservationCode()) + .eq(QualityDeliverEntity::getMallName,qualityDeliverEntity.getMallName()) + .eq(QualityDeliverEntity::getMaterielCode,qualityDeliverEntity.getMaterielCode()) + .lt(QualityDeliverEntity::getBizStatus, 110) + ); + } + } + if (CollUtil.isNotEmpty(ltlMap)) { + for (Map.Entry entry : ltlMap.entrySet()) { + QualityDeliverEntity qualityDeliverEntity = entry.getValue(); + qualityDeliverService.update(qualityDeliverEntity, Wrappers.lambdaUpdate() + .eq(QualityDeliverEntity::getPlanReservationCode,qualityDeliverEntity.getPlanReservationCode()) + .eq(QualityDeliverEntity::getOrderCode,qualityDeliverEntity.getOrderCode()) + .eq(QualityDeliverEntity::getCostCategory,qualityDeliverEntity.getCostCategory()) + .lt(QualityDeliverEntity::getBizStatus, 110) + ); + } + } } } 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 3a7c4bb45..419d4ef27 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 @@ -52,6 +52,7 @@ public class QualityDeliverListener { case MODIFY: Integer conditions = qualityDeliverEntity.getConditions(); if (1 == conditions) { + // 定制品 QualityDeliverEntity entity = qualityDeliverService.getOne(Wrappers.lambdaQuery() .eq(QualityDeliverEntity::getOrderPackageCode, qualityDeliverEntity.getOrderPackageCode()) .lt(QualityDeliverEntity::getBizStatus, 110)); @@ -63,27 +64,28 @@ public class QualityDeliverListener { // 获取基础数据赋值 qualityDeliverService.save(qualityDeliverEntity); } - } else if (2 == conditions) { - QualityDeliverEntity entity = qualityDeliverService.getOne(Wrappers.lambdaQuery() - // .eq(QualityDeliverEntity::getIncomingBatch, qualityDeliverEntity.getIncomingBatch()) - .eq(QualityDeliverEntity::getMallName, qualityDeliverEntity.getMallName()) - .eq(QualityDeliverEntity::getMaterielCode, qualityDeliverEntity.getMaterielCode()) - .lt(QualityDeliverEntity::getBizStatus, 110)); + } else if (3 == conditions) { + // 库存品 + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery() + .lt(QualityDeliverEntity::getBizStatus, 110); + if(StrUtil.isNotEmpty(qualityDeliverEntity.getOrderPackageCode())){ + wrapper.eq(QualityDeliverEntity::getOrderPackageCode, qualityDeliverEntity.getOrderPackageCode()); + }else{ + wrapper.eq(QualityDeliverEntity::getMallName, qualityDeliverEntity.getMallName()) + .eq(QualityDeliverEntity::getMaterielCode, qualityDeliverEntity.getMaterielCode()); + } + if(StrUtil.isNotEmpty(qualityDeliverEntity.getPlanReservationCode())){ + wrapper.eq(QualityDeliverEntity::getPlanReservationCode, qualityDeliverEntity.getPlanReservationCode()); + } + QualityDeliverEntity entity = qualityDeliverService.getOne(wrapper); if (ObjectUtil.isNotEmpty(entity)) { - LambdaUpdateWrapper wrapper = Wrappers.lambdaUpdate() - .eq(QualityDeliverEntity::getIncomingBatch, qualityDeliverEntity.getIncomingBatch()) - .eq(QualityDeliverEntity::getMallName, qualityDeliverEntity.getMallName()) - .eq(QualityDeliverEntity::getMaterielCode, qualityDeliverEntity.getMaterielCode()) - .lt(QualityDeliverEntity::getBizStatus, 110); - if(StrUtil.isNotEmpty(qualityDeliverEntity.getOrderPackageCode())){ - wrapper.eq(QualityDeliverEntity::getOrderPackageCode, qualityDeliverEntity.getOrderPackageCode()); - } qualityDeliverService.update(qualityDeliverEntity, wrapper); } else { // 获取基础数据赋值 qualityDeliverService.save(qualityDeliverEntity); } - } else if (3 == conditions) { + } else if (2 == conditions) { + // 零担 LambdaQueryWrapper wrapper = Wrappers.lambdaQuery() .eq(QualityDeliverEntity::getOrderCode, qualityDeliverEntity.getOrderCode()) .eq(QualityDeliverEntity::getCostCategory, qualityDeliverEntity.getCostCategory()) diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/StockReportListener.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/StockReportListener.java index 7dd054943..53c7d84a7 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/StockReportListener.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/StockReportListener.java @@ -5,7 +5,6 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.logpm.distribution.dto.ReportQualityDeliverDTO; import com.logpm.distribution.entity.QualityDeliverEntity; @@ -31,7 +30,9 @@ import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * 备货生成明细报表 @@ -67,20 +68,21 @@ public class StockReportListener { BizOperationEnums bizOperation = bean.getBizOperation(); ReservationVO reservationVO = vo.getReservationVO(); List details = reservationVO.getPackageDataList(); - if (BizOperationEnums.MODIFY.equals(bizOperation) || BizOperationEnums.DELETE.equals(bizOperation)) { - // 根据预约单号查询出所有这个预约单下的数据 先置空 - LambdaUpdateWrapper wrapper = Wrappers.lambdaUpdate() - .set(QualityDeliverEntity::getStockupCode, null) - .set(QualityDeliverEntity::getStockupUserName, null) - .set(QualityDeliverEntity::getStockupFinishTime, null) - .set(QualityDeliverEntity::getStockNum, null) - .set(QualityDeliverEntity::getStockAllocation, null) - .set(QualityDeliverEntity::getStockupCreateTime, null) - .eq(QualityDeliverEntity::getStockupCode, vo.getStockupCode()) - .ne(QualityDeliverEntity::getBizStatus, 110); - qualityDeliverService.update(wrapper); - } +// if (BizOperationEnums.MODIFY.equals(bizOperation) || BizOperationEnums.DELETE.equals(bizOperation)) { +// // 根据预约单号查询出所有这个预约单下的数据 先置空 +// LambdaUpdateWrapper wrapper = Wrappers.lambdaUpdate() +// .set(QualityDeliverEntity::getStockupCode, null) +// .set(QualityDeliverEntity::getStockupUserName, null) +// .set(QualityDeliverEntity::getStockupFinishTime, null) +// .set(QualityDeliverEntity::getStockNum, null) +// .set(QualityDeliverEntity::getStockAllocation, null) +// .set(QualityDeliverEntity::getStockupCreateTime, null) +// .eq(QualityDeliverEntity::getStockupCode, vo.getStockupCode()) +// .ne(QualityDeliverEntity::getBizStatus, 110); +// qualityDeliverService.update(wrapper); +// } if (CollUtil.isNotEmpty(details)) { + Map invMap = new HashMap<>(); for (PackageData detail : details) { QualityDeliverEntity qualityDeliverEntity = QualityDeliverEntity.builder() .warehouseName(bean.getWarehouse()) @@ -120,20 +122,36 @@ public class StockReportListener { .build()); } } else if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.INV)) { + qualityDeliverEntity.setPlanReservationCode(reservationVO.getReservationCode()); qualityDeliverEntity.setIncomingBatch(detail.getPickupBatch()); qualityDeliverEntity.setMallName(detail.getMallName()); qualityDeliverEntity.setMaterielCode(detail.getMaterialCode()); qualityDeliverEntity.setMaterielName(detail.getMaterialName()); qualityDeliverEntity.setConditions(3); - qualityDeliverEntity.setStockNum(detail.getNumber()); + qualityDeliverEntity.setStockNum(1); if (BizOperationEnums.ADD.equals(bizOperation) || BizOperationEnums.MODIFY.equals(bizOperation)) { - ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build(); - factoryDataClient.sendMessage(SendMsg.builder() - .exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE) - .routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY) - .message(JSONUtil.toJsonStr(dto)) - .delay(3000) - .build()); + List list = qualityDeliverService.list(Wrappers.lambdaQuery() + .select(QualityDeliverEntity::getId) + .eq(QualityDeliverEntity::getPlanReservationCode, qualityDeliverEntity.getPlanReservationCode()) + .eq(QualityDeliverEntity::getMallName, qualityDeliverEntity.getMallName()) + .eq(QualityDeliverEntity::getMaterielCode, qualityDeliverEntity.getMaterielCode()) + .isNull(QualityDeliverEntity::getOrderPackageCode) + .lt(QualityDeliverEntity::getBizStatus, 110) + .last(" limit 1") + ); + if(CollUtil.isNotEmpty(list)){ + QualityDeliverEntity qualityDeliverEntity1 = list.get(0); + qualityDeliverService.update(qualityDeliverEntity, Wrappers.lambdaUpdate() + .eq(QualityDeliverEntity::getId,qualityDeliverEntity1.getId()) + ); + } +// ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build(); +// factoryDataClient.sendMessage(SendMsg.builder() +// .exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE) +// .routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY) +// .message(JSONUtil.toJsonStr(dto)) +// .delay(3000) +// .build()); } } } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java index 423648b11..fc5cba226 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java @@ -29,7 +29,9 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.logpm.aftersales.vo.AftersalesAbnormalPackageVO; +import com.logpm.basic.entity.BasicMaterialEntity; import com.logpm.basic.entity.BasicPrintTemplateEntity; +import com.logpm.basic.feign.IBasicMaterialClient; import com.logpm.basic.feign.IBasicPrintTemplateClient; import com.logpm.basicdata.entity.BasicdataDriverArteryEntity; import com.logpm.basicdata.entity.BasicdataWarehouseEntity; @@ -277,6 +279,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl selectDistributionDeliveryListPage(IPage page, DistributionDeliveryListDTO distributionDeliveryList) { //转换创建时间 @@ -1111,7 +1116,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl data = new ArrayList<>(); for (DistributionLoadscaninvnEntity distributionParcelListEntity : ts) { @@ -1250,7 +1257,11 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl planDriverbindCarVOS = buildDeliveryCarDriverInfor(distributionDeliveryListEntity); @@ -4694,7 +4705,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl planDriverbindCarVOS = buildDeliveryCarDriverInfor(distributionDeliveryListEntity); @@ -4702,7 +4713,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl { - DistributionReservationEntity reservationEntity = new DistributionReservationEntity(); - reservationEntity.setId(Long.parseLong(map.get("reservationId").toString())); + DistributionReservationEntity reservationEntity = distributionReservationService.getById(map.get("reservationId").toString()); + + ReservationVO reservationVO = checkListForReservationVO(data, reservationEntity); List packageDataList = reservationVO.getPackageDataList(); @@ -8249,8 +8261,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl map : broadcastDataByStock) { - DistributionReservationEntity reservationEntity = new DistributionReservationEntity(); - reservationEntity.setId(Long.parseLong(map.get("reservationId").toString())); + DistributionReservationEntity reservationEntity = distributionReservationService.getById(map.get("reservationId").toString()); + ReservationVO reservationVO = checkListForReservationVO(data, reservationEntity); List packageDataList = reservationVO.getPackageDataList(); @@ -8271,8 +8283,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl> broadcastDataByZeroOrder = baseMapper.getBroadcastDataByZeroOrder(id, warehouseId); if (!broadcastDataByZeroOrder.isEmpty()) { broadcastDataByZeroOrder.forEach(map -> { - DistributionReservationEntity reservationEntity = new DistributionReservationEntity(); - reservationEntity.setId(Long.parseLong(map.get("reservationId").toString())); + DistributionReservationEntity reservationEntity = distributionReservationService.getById(map.get("reservationId").toString()); + ReservationVO reservationVO = checkListForReservationVO(data, reservationEntity); List packageDataList = reservationVO.getPackageDataList(); @@ -8310,13 +8322,15 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl data = new ArrayList<>(); @@ -4685,26 +4686,26 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl().lambda() .eq(DistributionSignforEntity::getReservationId, distributionSignfor.getReservationId()) .eq(DistributionSignforEntity::getDeliveryId, distributionSignfor.getDeliveryId()) .set(StringUtils.isNotBlank(distributionSignfor.getPositioning()), DistributionSignforEntity::getPositioning, distributionSignfor.getPositioning()) - .set(StringUtils.isNotBlank(add), DistributionSignforEntity::getPositioningAdr, add) + .set(StringUtils.isNotBlank(add.getAddress()), DistributionSignforEntity::getPositioningAdr, add.getAddress()) ); DistributionDeliveryListEntity deliveryListEntity = distributionDeliveryListService.getById(distributionSignforEntity.getDeliveryId()); - DistributionReservationEntity reservationEntity = distributionReservationService.getById(deliveryListEntity.getReservationId()); + DistributionReservationEntity reservationEntity = distributionReservationService.getById(distributionSignforEntity.getReservationId()); BladeUser user = AuthUtil.getUser(); - NodeFanoutMsg nodeFanoutMsg= buildConsigneeArriveVO(deliveryListEntity,reservationEntity,user); + NodeFanoutMsg nodeFanoutMsg= buildConsigneeArriveVO(deliveryListEntity,reservationEntity,add,user); iDistributionNodeWorkService.carArrived(nodeFanoutMsg,user); return Resp.scanSuccess("打卡成功", "打卡成功"); } - private NodeFanoutMsg buildConsigneeArriveVO(DistributionDeliveryListEntity deliveryListEntity, DistributionReservationEntity reservationEntity, BladeUser user) { + private NodeFanoutMsg buildConsigneeArriveVO(DistributionDeliveryListEntity deliveryListEntity, DistributionReservationEntity reservationEntity,GAddressVo add, BladeUser user) { NodeFanoutMsg nodeFanoutMsg = new NodeFanoutMsg(); nodeFanoutMsg.setBizOperation(BizOperationEnums.ADD); @@ -4720,7 +4721,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl Date: Tue, 10 Sep 2024 14:13:48 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat(all):=20=E4=BF=AE=E6=94=B9=E9=85=8D?= =?UTF-8?q?=E9=80=81=E5=9F=BA=E7=A1=80=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/model/ConsigneeArriveVO.java | 6 -- .../common/model/DistributionTaskVO.java | 14 ++--- .../common/model/PlanDriverbindCarVO.java | 2 + .../entity/QualityDeliverEntity.java | 14 ++++- .../report/ConsigneeArriveReportListener.java | 14 ++++- .../report/LoadingReportListener.java | 2 +- .../receiver/report/PlanReportListener.java | 49 +++++++---------- .../report/QualityDeliverListener.java | 41 +++++++++++--- .../receiver/report/ReViewReportListener.java | 11 +--- .../report/SignforReportListener.java | 13 +---- .../receiver/report/StockReportListener.java | 55 +++++-------------- 11 files changed, 103 insertions(+), 118 deletions(-) diff --git a/blade-biz-common/src/main/java/org/springblade/common/model/ConsigneeArriveVO.java b/blade-biz-common/src/main/java/org/springblade/common/model/ConsigneeArriveVO.java index 12c01e911..4f99a29ef 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/model/ConsigneeArriveVO.java +++ b/blade-biz-common/src/main/java/org/springblade/common/model/ConsigneeArriveVO.java @@ -3,8 +3,6 @@ package org.springblade.common.model; import lombok.Data; -import java.util.List; - /** * 客户到达 */ @@ -26,8 +24,6 @@ public class ConsigneeArriveVO { */ private String vehicleName; - - /** * 预约单号 */ @@ -64,6 +60,4 @@ public class ConsigneeArriveVO { */ private String positioning; - - } diff --git a/blade-biz-common/src/main/java/org/springblade/common/model/DistributionTaskVO.java b/blade-biz-common/src/main/java/org/springblade/common/model/DistributionTaskVO.java index ba57090eb..d50019fe4 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/model/DistributionTaskVO.java +++ b/blade-biz-common/src/main/java/org/springblade/common/model/DistributionTaskVO.java @@ -12,20 +12,18 @@ import java.util.List; public class DistributionTaskVO implements Serializable { private Long id; + /** 配送种类 */ private String kind; + /** 配送时间 */ private String taskTime; + /** 车次 */ private String trainNumber; + /** 配送类型 */ private String type; + /** 配送公司 */ private String distributionCompany; - /** - * 司机名 - */ - private String driverName; - /** - * 车牌号 - */ - private String vehicleName; + /** 司机和车辆信息 */ private List planDriverbindCars; /** diff --git a/blade-biz-common/src/main/java/org/springblade/common/model/PlanDriverbindCarVO.java b/blade-biz-common/src/main/java/org/springblade/common/model/PlanDriverbindCarVO.java index 0a4cd9cb2..b8942bd46 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/model/PlanDriverbindCarVO.java +++ b/blade-biz-common/src/main/java/org/springblade/common/model/PlanDriverbindCarVO.java @@ -7,8 +7,10 @@ import java.io.Serializable; @Data public class PlanDriverbindCarVO implements Serializable { + /** 司机 */ private String driverName; + /** 车牌 */ private String carPlate; } diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/QualityDeliverEntity.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/QualityDeliverEntity.java index 19f844250..8159af4c4 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/QualityDeliverEntity.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/QualityDeliverEntity.java @@ -144,9 +144,9 @@ public class QualityDeliverEntity extends TenantEntity { @ApiModelProperty(value = "客户车次号") private String trainNumber; /** - * 数据类型 1 定制品 2 库存品 3零担 + * 数据类型 1 定制品 3 库存品 2零担 */ - @ApiModelProperty(value = "数据类型 1 定制品 2 库存品 3零担") + @ApiModelProperty(value = "数据类型 1 定制品 3 库存品 2零担") private Integer conditions; /** * 一级品 @@ -389,6 +389,16 @@ public class QualityDeliverEntity extends TenantEntity { */ @ApiModelProperty(value = "到达区/县") private String arriveDistrict; + /** + * 到达街道 + */ + @ApiModelProperty(value = "到达街道") + private String arriveTownship; + /** + * 到达打卡经纬度 + */ + @ApiModelProperty(value = "到达打卡经纬度") + private String arrivePositioning; /** * 到达地址 */ diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ConsigneeArriveReportListener.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ConsigneeArriveReportListener.java index 0e84bd332..cade33904 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ConsigneeArriveReportListener.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ConsigneeArriveReportListener.java @@ -57,12 +57,18 @@ public class ConsigneeArriveReportListener { Object main = bean.getMain(); JSONObject entries = JSONUtil.parseObj(main); ConsigneeArriveVO vo = JSONUtil.toBean(entries, ConsigneeArriveVO.class); - Long warehouseId = bean.getWarehouseId(); BizOperationEnums bizOperation = bean.getBizOperation(); if (BizOperationEnums.DELETE.equals(bizOperation)) { LambdaUpdateWrapper wrapper = Wrappers.lambdaUpdate() .set(QualityDeliverEntity::getArriveCarUserName, null) .set(QualityDeliverEntity::getArriveCarTime, null) + .set(QualityDeliverEntity::getArriveProvince, null) + .set(QualityDeliverEntity::getArriveCity, null) + .set(QualityDeliverEntity::getArriveDistrict, null) + .set(QualityDeliverEntity::getArriveTownship, null) + .set(QualityDeliverEntity::getArriveAddress, null) + .set(QualityDeliverEntity::getArrivePositioning, null) + .eq(QualityDeliverEntity::getLoadLicensePlate, vo.getVehicleName()) .eq(QualityDeliverEntity::getLoadTrainNumber, vo.getTrainNumber()) .eq(QualityDeliverEntity::getPlanReservationCode, vo.getReservationCode()) .ne(QualityDeliverEntity::getBizStatus, 110); @@ -72,6 +78,12 @@ public class ConsigneeArriveReportListener { LambdaUpdateWrapper wrapper = Wrappers.lambdaUpdate() .set(QualityDeliverEntity::getArriveCarUserName, vo.getDriverName()) .set(QualityDeliverEntity::getArriveCarTime, bean.getOperatorTime()) + .set(QualityDeliverEntity::getArriveProvince, vo.getProvince()) + .set(QualityDeliverEntity::getArriveCity, vo.getCity()) + .set(QualityDeliverEntity::getArriveDistrict, vo.getDistrict()) + .set(QualityDeliverEntity::getArriveTownship, vo.getTownship()) + .set(QualityDeliverEntity::getArriveAddress, vo.getAddress()) + .set(QualityDeliverEntity::getArrivePositioning, vo.getPositioning()) .eq(QualityDeliverEntity::getLoadTrainNumber, vo.getTrainNumber()) .eq(QualityDeliverEntity::getPlanReservationCode, vo.getReservationCode()) .ne(QualityDeliverEntity::getBizStatus, 110); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/LoadingReportListener.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/LoadingReportListener.java index c4c8ec825..1c881e9b3 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/LoadingReportListener.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/LoadingReportListener.java @@ -52,7 +52,7 @@ public class LoadingReportListener { )) @Transactional(rollbackFor = Exception.class) public void buildReport(String msg) { - log.info("备货生成明细报表: {}", msg); + log.info("装车生成明细报表: {}", msg); if (StrUtil.isEmpty(msg)) { return; } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/PlanReportListener.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/PlanReportListener.java index 391766529..8a080ec8a 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/PlanReportListener.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/PlanReportListener.java @@ -22,6 +22,7 @@ import org.springblade.common.enums.PackageTypeEnums; import org.springblade.common.model.DistributionTaskVO; import org.springblade.common.model.NodeFanoutMsg; import org.springblade.common.model.PackageData; +import org.springblade.common.model.PlanDriverbindCarVO; import org.springblade.common.model.ReservationVO; import org.springframework.amqp.core.ExchangeTypes; import org.springframework.amqp.rabbit.annotation.Exchange; @@ -33,6 +34,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.*; +import java.util.stream.Collectors; /** * 配送计划生成明细报表 @@ -68,9 +70,15 @@ public class PlanReportListener { BizOperationEnums bizOperation = bean.getBizOperation(); List reservationVOList = vo.getReservationVOList(); if (CollUtil.isNotEmpty(reservationVOList)) { - Set reservationSet = new HashSet<>(); + List planDriverbindCars = vo.getPlanDriverbindCars(); + String vehicleName = ""; + String driverName = ""; + if(CollUtil.isNotEmpty(planDriverbindCars)){ + // 用逗号拼接 车辆和司机 + vehicleName = planDriverbindCars.stream().map(PlanDriverbindCarVO::getCarPlate).collect(Collectors.joining(",")); + driverName = planDriverbindCars.stream().map(PlanDriverbindCarVO::getDriverName).collect(Collectors.joining(",")); + } Map invMap = new HashMap<>(); - Map ltlMap = new HashMap<>(); for (ReservationVO reservationVO : reservationVOList) { List details = reservationVO.getPackageDataList(); if (BizOperationEnums.MODIFY.equals(bizOperation) || BizOperationEnums.DELETE.equals(bizOperation)) { @@ -100,8 +108,8 @@ public class PlanReportListener { .deliveryTime(DateUtil.parseDate(vo.getTaskTime())) .deliveryType(vo.getType()) .deliveryKind(vo.getKind()) - .vehicleName(vo.getVehicleName()) - .driverName(vo.getDriverName()) + .vehicleName(vehicleName) + .driverName(driverName) .distributionCompany(vo.getDistributionCompany()) .deliveryPlanTime(bean.getOperatorTime()) .deliveryCreateUserName(bean.getOperator()) @@ -125,14 +133,13 @@ public class PlanReportListener { qualityDeliverEntity.setConditions(2); qualityDeliverEntity.setPlanNum(detail.getNumber()); if (BizOperationEnums.ADD.equals(bizOperation) || BizOperationEnums.MODIFY.equals(bizOperation)) { -// ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build(); -// factoryDataClient.sendMessage(SendMsg.builder() -// .exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE) -// .routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY) -// .message(JSONUtil.toJsonStr(dto)) -// .delay(3000) -// .build()); - ltlMap.put(detail.getOrderCode()+detail.getProductName(), qualityDeliverEntity); + ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build(); + factoryDataClient.sendMessage(SendMsg.builder() + .exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE) + .routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY) + .message(JSONUtil.toJsonStr(dto)) + .delay(3000) + .build()); } } else if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.INV)) { invMap.put(detail.getMallName()+detail.getMaterialCode(), qualityDeliverEntity); @@ -145,13 +152,6 @@ public class PlanReportListener { qualityDeliverEntity.setPlanNum(1); if (BizOperationEnums.ADD.equals(bizOperation) || BizOperationEnums.MODIFY.equals(bizOperation)) { invMap.put(detail.getMallName()+detail.getMaterialCode(), qualityDeliverEntity); -// ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build(); -// factoryDataClient.sendMessage(SendMsg.builder() -// .exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE) -// .routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY) -// .message(JSONUtil.toJsonStr(dto)) -// .delay(3000) -// .build()); } } } @@ -168,17 +168,6 @@ public class PlanReportListener { ); } } - if (CollUtil.isNotEmpty(ltlMap)) { - for (Map.Entry entry : ltlMap.entrySet()) { - QualityDeliverEntity qualityDeliverEntity = entry.getValue(); - qualityDeliverService.update(qualityDeliverEntity, Wrappers.lambdaUpdate() - .eq(QualityDeliverEntity::getPlanReservationCode,qualityDeliverEntity.getPlanReservationCode()) - .eq(QualityDeliverEntity::getOrderCode,qualityDeliverEntity.getOrderCode()) - .eq(QualityDeliverEntity::getCostCategory,qualityDeliverEntity.getCostCategory()) - .lt(QualityDeliverEntity::getBizStatus, 110) - ); - } - } } } 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 419d4ef27..9a441f25f 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 @@ -4,7 +4,6 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.logpm.distribution.dto.ReportQualityDeliverDTO; import com.logpm.distribution.entity.QualityDeliverEntity; @@ -41,7 +40,7 @@ public class QualityDeliverListener { key = ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY )) public void data(String msg) { - log.info("明细报表: {}", msg); + log.info("配送明细基础表处理: {}", msg); if (StrUtil.isEmpty(msg)) { return; } @@ -68,15 +67,39 @@ public class QualityDeliverListener { // 库存品 LambdaQueryWrapper wrapper = Wrappers.lambdaQuery() .lt(QualityDeliverEntity::getBizStatus, 110); - if(StrUtil.isNotEmpty(qualityDeliverEntity.getOrderPackageCode())){ - wrapper.eq(QualityDeliverEntity::getOrderPackageCode, qualityDeliverEntity.getOrderPackageCode()); - }else{ - wrapper.eq(QualityDeliverEntity::getMallName, qualityDeliverEntity.getMallName()) - .eq(QualityDeliverEntity::getMaterielCode, qualityDeliverEntity.getMaterielCode()); + if (ObjectUtil.isNotEmpty(qualityDeliverEntity.getId())) { + // 库存品更新优先按id更新 + wrapper.eq(QualityDeliverEntity::getId, qualityDeliverEntity.getId()); + } else { + if (StrUtil.isNotEmpty(qualityDeliverEntity.getOrderPackageCode())) { + // 没有id,按包条码更新 + wrapper.eq(QualityDeliverEntity::getOrderPackageCode, qualityDeliverEntity.getOrderPackageCode()); + } else { + if (StrUtil.isEmpty(qualityDeliverEntity.getMallName())) { + // 没有id,没有包条码。没有商场,不处理。 + return; + } else { + // 否则加上商场过滤 + wrapper.eq(QualityDeliverEntity::getMallName, qualityDeliverEntity.getMallName()); + } + if (StrUtil.isEmpty(qualityDeliverEntity.getMaterielCode()) && StrUtil.isEmpty(qualityDeliverEntity.getMaterielName())) { + // 没有id,没有包条码,没有商场,没有物料,不处理。 + return; + } + if (StrUtil.isNotEmpty(qualityDeliverEntity.getMaterielCode())) { + // 优先按物料编码更新 + wrapper.eq(QualityDeliverEntity::getMaterielCode, qualityDeliverEntity.getMaterielCode()); + } else { + // 按物料名称更新 + wrapper.eq(QualityDeliverEntity::getMaterielName, qualityDeliverEntity.getMaterielName()); + } + } } - if(StrUtil.isNotEmpty(qualityDeliverEntity.getPlanReservationCode())){ + if (StrUtil.isNotEmpty(qualityDeliverEntity.getPlanReservationCode())) { + // 有预约单号时加上预约单号过滤:存在同一个库存品在多个预约单中,只根据库存品本身的信息无法查询出对应的数据的情况。 wrapper.eq(QualityDeliverEntity::getPlanReservationCode, qualityDeliverEntity.getPlanReservationCode()); } + // 查询不存在时更新,存在时修改 QualityDeliverEntity entity = qualityDeliverService.getOne(wrapper); if (ObjectUtil.isNotEmpty(entity)) { qualityDeliverService.update(qualityDeliverEntity, wrapper); @@ -90,7 +113,7 @@ public class QualityDeliverListener { .eq(QualityDeliverEntity::getOrderCode, qualityDeliverEntity.getOrderCode()) .eq(QualityDeliverEntity::getCostCategory, qualityDeliverEntity.getCostCategory()) .lt(QualityDeliverEntity::getBizStatus, 110); - if(StrUtil.isNotEmpty(qualityDeliverEntity.getPlanReservationCode())){ + if (StrUtil.isNotEmpty(qualityDeliverEntity.getPlanReservationCode())) { wrapper.eq(QualityDeliverEntity::getPlanReservationCode, qualityDeliverEntity.getPlanReservationCode()); } QualityDeliverEntity entity = qualityDeliverService.getOne(wrapper); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ReViewReportListener.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ReViewReportListener.java index 2a579831f..5ab6d279b 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ReViewReportListener.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ReViewReportListener.java @@ -63,16 +63,6 @@ public class ReViewReportListener { Long warehouseId = bean.getWarehouseId(); BizOperationEnums bizOperation = bean.getBizOperation(); List details = vo.getPackageDataList(); - // if (BizOperationEnums.MODIFY.equals(bizOperation) || BizOperationEnums.DELETE.equals(bizOperation)) { - // // 根据预约单号查询出所有这个预约单下的数据 先置空 - // LambdaUpdateWrapper wrapper = Wrappers.lambdaUpdate() - // .set(QualityDeliverEntity::getLoadUserName, null) - // .set(QualityDeliverEntity::getLoadTime, null) - // .set(QualityDeliverEntity::getLoadLicensePlate, null) - // .set(QualityDeliverEntity::getLoadNum, null) - // .ne(QualityDeliverEntity::getBizStatus, 110); - // qualityDeliverService.update(wrapper); - // } if (CollUtil.isNotEmpty(details)) { for (PackageData detail : details) { QualityDeliverEntity qualityDeliverEntity = QualityDeliverEntity.builder() @@ -81,6 +71,7 @@ public class ReViewReportListener { .orderPackageCode(detail.getPackageCode()) .reviewUserName(bean.getOperator()) .reviewTime(bean.getOperatorTime()) + .bizStatus(100) .build(); if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.CMP)) { qualityDeliverEntity.setConditions(1); 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 4b2d359ef..256208c9e 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 @@ -63,16 +63,6 @@ public class SignforReportListener { Long warehouseId = bean.getWarehouseId(); BizOperationEnums bizOperation = bean.getBizOperation(); List details = vo.getPackageDataList(); - // if (BizOperationEnums.MODIFY.equals(bizOperation) || BizOperationEnums.DELETE.equals(bizOperation)) { - // // 根据预约单号查询出所有这个预约单下的数据 先置空 - // LambdaUpdateWrapper wrapper = Wrappers.lambdaUpdate() - // .set(QualityDeliverEntity::getLoadUserName, null) - // .set(QualityDeliverEntity::getLoadTime, null) - // .set(QualityDeliverEntity::getLoadLicensePlate, null) - // .set(QualityDeliverEntity::getLoadNum, null) - // .ne(QualityDeliverEntity::getBizStatus, 110); - // qualityDeliverService.update(wrapper); - // } if (CollUtil.isNotEmpty(details)) { for (PackageData detail : details) { QualityDeliverEntity qualityDeliverEntity = QualityDeliverEntity.builder() @@ -82,6 +72,9 @@ public class SignforReportListener { .signUserName(bean.getOperator()) .signTime(bean.getOperatorTime()) .signCarNumber(vo.getVehicleName()) + .signTrainNumber(vo.getTrainNumber()) + .signReservationCode(vo.getReservationCode()) + .bizStatus(90) .build(); if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.CMP)) { qualityDeliverEntity.setConditions(1); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/StockReportListener.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/StockReportListener.java index 53c7d84a7..6ad40554c 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/StockReportListener.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/StockReportListener.java @@ -30,9 +30,7 @@ import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; -import java.util.HashMap; import java.util.List; -import java.util.Map; /** * 备货生成明细报表 @@ -68,21 +66,7 @@ public class StockReportListener { BizOperationEnums bizOperation = bean.getBizOperation(); ReservationVO reservationVO = vo.getReservationVO(); List details = reservationVO.getPackageDataList(); -// if (BizOperationEnums.MODIFY.equals(bizOperation) || BizOperationEnums.DELETE.equals(bizOperation)) { -// // 根据预约单号查询出所有这个预约单下的数据 先置空 -// LambdaUpdateWrapper wrapper = Wrappers.lambdaUpdate() -// .set(QualityDeliverEntity::getStockupCode, null) -// .set(QualityDeliverEntity::getStockupUserName, null) -// .set(QualityDeliverEntity::getStockupFinishTime, null) -// .set(QualityDeliverEntity::getStockNum, null) -// .set(QualityDeliverEntity::getStockAllocation, null) -// .set(QualityDeliverEntity::getStockupCreateTime, null) -// .eq(QualityDeliverEntity::getStockupCode, vo.getStockupCode()) -// .ne(QualityDeliverEntity::getBizStatus, 110); -// qualityDeliverService.update(wrapper); -// } if (CollUtil.isNotEmpty(details)) { - Map invMap = new HashMap<>(); for (PackageData detail : details) { QualityDeliverEntity qualityDeliverEntity = QualityDeliverEntity.builder() .warehouseName(bean.getWarehouse()) @@ -98,13 +82,7 @@ public class StockReportListener { qualityDeliverEntity.setConditions(1); qualityDeliverEntity.setStockNum(1); if (BizOperationEnums.ADD.equals(bizOperation) || BizOperationEnums.MODIFY.equals(bizOperation)) { - ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build(); - factoryDataClient.sendMessage(SendMsg.builder() - .exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE) - .routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY) - .message(JSONUtil.toJsonStr(dto)) - .delay(3000) - .build()); + sendReport(qualityDeliverEntity); } } else if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.LTL)) { qualityDeliverEntity.setOrderCode(detail.getOrderCode()); @@ -113,13 +91,7 @@ public class StockReportListener { qualityDeliverEntity.setConditions(2); qualityDeliverEntity.setStockNum(detail.getNumber()); if (BizOperationEnums.ADD.equals(bizOperation) || BizOperationEnums.MODIFY.equals(bizOperation)) { - ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build(); - factoryDataClient.sendMessage(SendMsg.builder() - .exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE) - .routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY) - .message(JSONUtil.toJsonStr(dto)) - .delay(3000) - .build()); + sendReport(qualityDeliverEntity); } } else if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.INV)) { qualityDeliverEntity.setPlanReservationCode(reservationVO.getReservationCode()); @@ -140,22 +112,23 @@ public class StockReportListener { .last(" limit 1") ); if(CollUtil.isNotEmpty(list)){ - QualityDeliverEntity qualityDeliverEntity1 = list.get(0); - qualityDeliverService.update(qualityDeliverEntity, Wrappers.lambdaUpdate() - .eq(QualityDeliverEntity::getId,qualityDeliverEntity1.getId()) - ); + qualityDeliverEntity.setId(list.get(0).getId()); + sendReport(qualityDeliverEntity); } -// ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build(); -// factoryDataClient.sendMessage(SendMsg.builder() -// .exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE) -// .routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY) -// .message(JSONUtil.toJsonStr(dto)) -// .delay(3000) -// .build()); } } } } } + private void sendReport(QualityDeliverEntity qualityDeliverEntity) { + ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build(); + factoryDataClient.sendMessage(SendMsg.builder() + .exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE) + .routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY) + .message(JSONUtil.toJsonStr(dto)) + .delay(3000) + .build()); + } + }