tao.mo

biz-customer | 修改 | 根据运单号查找30天之内运单信息

mt
2024年12月19日16:22:46
...@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
19 import org.springframework.stereotype.Component; 19 import org.springframework.stereotype.Component;
20 import org.springframework.util.StringUtils; 20 import org.springframework.util.StringUtils;
21 21
22 +import java.time.LocalDate;
22 import java.util.Date; 23 import java.util.Date;
23 import java.util.Objects; 24 import java.util.Objects;
24 25
...@@ -51,7 +52,13 @@ public class ConsignmentUtil { ...@@ -51,7 +52,13 @@ public class ConsignmentUtil {
51 Date nowDate = new Date(); 52 Date nowDate = new Date();
52 //如果没有运单id,则是通过add添加进来的运单 53 //如果没有运单id,则是通过add添加进来的运单
53 if (Objects.isNull(consignment)) { 54 if (Objects.isNull(consignment)) {
54 - consignment = new Consignment(); 55 + //根据运单号查询运单表最近30天内是否存在已提交的运单
56 + LocalDate thirtyDaysAgo = LocalDate.now().minusDays(30);
57 + consignment = consignmentRepository.findByConsignmentCode(consignmentBo.getConsignmentCode(),thirtyDaysAgo);
58 + //如果最近30天内没有提交过该运单,则新建
59 + if(consignment == null){
60 + consignment = new Consignment();
61 + }
55 //用户录入数据拷贝 62 //用户录入数据拷贝
56 BeanUtils.copyProperties(consignmentBo, consignment); 63 BeanUtils.copyProperties(consignmentBo, consignment);
57 //用户录入shipperaccount 64 //用户录入shipperaccount
......