From 64b2bb2ae23029c6fdf4159cd6cd2161b5936cb0 Mon Sep 17 00:00:00 2001 From: aike <17730485278@139.com> Date: Wed, 3 Sep 2025 13:57:23 +0800 Subject: [PATCH] =?UTF-8?q?demand:=20tms-=E8=BF=90=E5=8D=95=E7=AE=A1?= =?UTF-8?q?=E7=90=86-=E6=96=B0=E5=A2=9E=E6=89=B9=E9=87=8F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E8=BF=90=E5=8D=95=E6=8E=A5=E5=8F=A3-=E6=89=B9?= =?UTF-8?q?=E9=87=8F=E4=BF=AE=E5=A4=8D=E5=8E=86=E5=8F=B2=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=A2=84=E8=AE=A1=E9=80=81=E8=BE=BE=E6=97=B6=E9=97=B4=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E4=B8=8D=E5=87=86=E7=A1=AE=E7=9A=84=E8=BF=90=E5=8D=95?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit committer: heyu --- .../erp/web/emis/EmisWaybillController.java | 27 ++++++++++++-- .../mapper/EmisWaybillProblemInfoMapper.java | 36 ++++++++++++------- .../service/impl/EmisWaybillServiceImpl.java | 20 +++++++++-- .../mapper/EmisWaybillProblemInfoMapper.xml | 15 ++++++++ 4 files changed, 81 insertions(+), 17 deletions(-) diff --git a/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisWaybillController.java b/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisWaybillController.java index 40b31ba21..c4ee11fae 100644 --- a/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisWaybillController.java +++ b/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisWaybillController.java @@ -14,6 +14,7 @@ package com.xdadan.erp.web.emis; import java.io.*; import java.nio.charset.Charset; import java.util.*; +import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; @@ -34,6 +35,7 @@ import com.xdadan.erp.emis.domain.exception.EmisBizError; import com.xdadan.erp.emis.domain.stat.ScanStatInfoDtl; import com.xdadan.erp.emis.domain.vo.*; import com.xdadan.erp.emis.mapper.EmisWaybillMapper; +import com.xdadan.erp.emis.mapper.EmisWaybillProblemInfoMapper; import com.xdadan.erp.emis.service.*; import com.xdadan.erp.emis.service.print.IXddTplPrint; import com.xdadan.erp.emis.service.print.cpcl.CvtTplToCpcl; @@ -105,6 +107,9 @@ public class EmisWaybillController extends EmisBaseController @Autowired private EmisWaybillMapper emisWaybillMapper; + @Autowired + private EmisWaybillProblemInfoMapper emisWaybillProblemInfoMapper; + @GetMapping(value = "/checkWaybillIsExists") public AjaxResult checkWaybillIsExists(String billCode){ @@ -1476,17 +1481,35 @@ public class EmisWaybillController extends EmisBaseController List successList = new ArrayList<>(); List failList = new ArrayList<>(); + // 批量查询所有运单的延迟天数 + List billCodes = waybillList.stream() + .map(EmisWaybill::getBillCode) + .collect(Collectors.toList()); + + List> delayDaysList = emisWaybillProblemInfoMapper + .selectWaybillTotalDelayDays(billCodes); + Map billCodeToDelayDaysMap = new HashMap<>(); + + for (Map delayInfo : delayDaysList) { + String billCode = (String) delayInfo.get("billCode"); + Integer totalDelayDays = ((Number) delayInfo.get("totalDelayDays")).intValue(); + billCodeToDelayDaysMap.put(billCode, totalDelayDays); + } + for (EmisWaybill waybill : waybillList) { try { + // 获取该运单的总延迟天数 + Integer otherAddDay = billCodeToDelayDaysMap.getOrDefault(waybill.getBillCode(), 0); + // 重新计算预估到达时间 Date newEstimateDate = emisBaseService.getEstimateDate( waybill.getSendDate(), waybill.getProductType(), waybill.getSendCountry(), waybill.getReceiveCountry(), - 0); + otherAddDay); - // 只更新estimateDate字段 + // 只更新estimateDate字段 EmisWaybill updateWaybill = new EmisWaybill(); updateWaybill.setId(waybill.getId()); updateWaybill.setEstimateDate(newEstimateDate); diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisWaybillProblemInfoMapper.java b/emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisWaybillProblemInfoMapper.java index b7850818f..b0c9f7ee3 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisWaybillProblemInfoMapper.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisWaybillProblemInfoMapper.java @@ -1,16 +1,18 @@ -/** +/** * @Project: emis * @Title: EmisWaybillProblemInfoMapper.java * @author linfso * @date 2024-03-01 08:55:01 * @Copyright: ShangHai Doitinfo 2022 All rights reserved. - * @version v1.0 + * @version v1.0 * @Description:

问题件 Mapper 接口

* Warning : This file is generate by ai tools,don't edit!!! */ package com.xdadan.erp.emis.mapper; import java.util.List; +import java.util.Map; + import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.xdadan.erp.emis.domain.EmisWaybillProblemInfo; import org.apache.ibatis.annotations.Param; @@ -26,7 +28,7 @@ public interface EmisWaybillProblemInfoMapper extends BaseMapper selectEmisWaybillProblemInfoList(EmisWaybillProblemInfo emisWaybillProblemInfo); /** - * 新增 - * + * 新增 + * * @param emisWaybillProblemInfo - * @return + * @return */ public int insertEmisWaybillProblemInfo(EmisWaybillProblemInfo emisWaybillProblemInfo); /** * 修改 - * - * @param emisWaybillProblemInfo - * @return + * + * @param emisWaybillProblemInfo + * @return */ public int updateEmisWaybillProblemInfo(EmisWaybillProblemInfo emisWaybillProblemInfo); /** * 删除 - * + * * @param id 主键 * @return 结果 */ @@ -75,7 +77,7 @@ public interface EmisWaybillProblemInfoMapper extends BaseMapper selectEmisWaybillProblemInfoByBillCodes(@Param("billCodes") List billCodes); + + /** + * 根据运单号列表统计每个运单的总延迟天数 + * + * @param billCodes 运单号列表 + * @return 运单号与总延迟天数的映射 + */ + List> selectWaybillTotalDelayDays(@Param("billCodes") List billCodes); } diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java index 3b41339ae..47f6c3d63 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java @@ -2707,11 +2707,27 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb + // 查询运单的延迟天数 + Integer otherAddDay = 0; + if (!StringUtils.isEmpty(emisWaybillSave.getBillCode())) { + List billCodes = Arrays.asList(emisWaybillSave.getBillCode()); + List> delayDaysList = emisWaybillProblemInfoMapper + .selectWaybillTotalDelayDays(billCodes); + if (!delayDaysList.isEmpty()) { + Map delayInfo = delayDaysList.get(0); + otherAddDay = ((Number) delayInfo.get("totalDelayDays")).intValue(); + } + } + // 开单当天不算时效 Date estDate = getEstimateDate( - emisWaybillSave.getSendDate(),emisWaybillSave.getProductType(), + emisWaybillSave.getSendDate(), emisWaybillSave.getProductType(), emisWaybillSave.getSendCountry(), - emisWaybillSave.getReceiveCountry(),0); + emisWaybillSave.getReceiveCountry(), otherAddDay); + + // 预计到达时间 + log.info("预估到达时间==>" + DateUtils.dateTime(estDate)); + emisWaybillSave.setEstimateDate(estDate); // 预计到达时间 log.info("预估到达时间==>"+ DateUtils.dateTime(estDate)); diff --git a/emis-biz/src/main/resources/mapper/EmisWaybillProblemInfoMapper.xml b/emis-biz/src/main/resources/mapper/EmisWaybillProblemInfoMapper.xml index 0dce8d299..a7f15c37e 100644 --- a/emis-biz/src/main/resources/mapper/EmisWaybillProblemInfoMapper.xml +++ b/emis-biz/src/main/resources/mapper/EmisWaybillProblemInfoMapper.xml @@ -279,4 +279,19 @@ #{id} + + + \ No newline at end of file