|
@@ -808,6 +808,7 @@ public class KwoTradeOrderService {
|
|
|
contractInfo.setContractName(c.getContactName());
|
|
contractInfo.setContractName(c.getContactName());
|
|
|
contractInfo.setContractSigningWay(c.getSigningWayName());
|
|
contractInfo.setContractSigningWay(c.getSigningWayName());
|
|
|
contractInfo.setContractStatus(c.getStatusName());
|
|
contractInfo.setContractStatus(c.getStatusName());
|
|
|
|
|
+ contractInfo.setDispatchWay(c.getDispatchWay());
|
|
|
});
|
|
});
|
|
|
return contractInfo;
|
|
return contractInfo;
|
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
@@ -824,9 +825,41 @@ public class KwoTradeOrderService {
|
|
|
return transportUnitInfo;
|
|
return transportUnitInfo;
|
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
|
detail.setUnitInfoList(collect1);
|
|
detail.setUnitInfoList(collect1);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //自动派单
|
|
|
|
|
+ if (detail.getContractInfo() != null && DispatchWayEnums.AUTO_DISPATCH.getCode().equals(detail.getContractInfo().getDispatchWay())) {
|
|
|
|
|
+ //查询销售企业
|
|
|
|
|
+ KwoTradeOrderUnit tradeOrderUnit = units.stream().filter(unit -> String.valueOf(Global.NUMERICAL_TWO).equals(unit.getUnitType())).findFirst().orElse(null);
|
|
|
|
|
+ //
|
|
|
|
|
+ Long goodsId = detail.getGoodsInfo().getGoodsId();
|
|
|
|
|
+ //查询满足自动派单的物流合同
|
|
|
|
|
+ List<LogisticsEntDtoVO> contractLogisticsList = remoteContractService.queryAutoContractLogOrder(tradeOrderUnit.getEntId(), Lists.newArrayList(goodsId));
|
|
|
|
|
+ List<LogisticsEntDtoVO> validContractLogList = contractLogisticsList.stream().filter(Objects::nonNull)
|
|
|
|
|
+ .filter(log -> log.getStartTime() != null)
|
|
|
|
|
+ .filter(log -> {
|
|
|
|
|
+ // 有效期:物流合同开始时间 <= 当前时间
|
|
|
|
|
+ return !log.getStartTime().after(new Date());
|
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
|
+ if (CollectionUtils.isEmpty(validContractLogList)) {
|
|
|
|
|
+ throw new BusinessException("未找到该商品有效的自动派车物流合同,请先签订自动派车物流合同");
|
|
|
|
|
+ }
|
|
|
|
|
+ List<ContractInfo> contractInfoList = validContractLogList.stream().map(d -> {
|
|
|
|
|
+ ContractInfo contractInfo = new ContractInfo();
|
|
|
|
|
+ contractInfo.setContractId(d.getContractId());
|
|
|
|
|
+ contractInfo.setContractNo(d.getContractNo());
|
|
|
|
|
+
|
|
|
|
|
+ contractInfo.setContractName(d.getContractName());
|
|
|
|
|
+ contractInfo.setContractSigningWay(d.getContractSigningWay());
|
|
|
|
|
+ contractInfo.setContractStatus(d.getContractStatus());
|
|
|
|
|
+ contractInfo.setDispatchWay(DispatchWayEnums.AUTO_DISPATCH.getCode());
|
|
|
|
|
|
|
|
|
|
+ return contractInfo;
|
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
|
+ detail.setContractInfoList(contractInfoList);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
//todo 关联物流订单信息
|
|
//todo 关联物流订单信息
|
|
|
return detail;
|
|
return detail;
|
|
|
}
|
|
}
|
|
@@ -2414,11 +2447,8 @@ public class KwoTradeOrderService {
|
|
|
List<LogisticsEntDtoVO> validContractLog = contractLogisticsList.stream().filter(Objects::nonNull)
|
|
List<LogisticsEntDtoVO> validContractLog = contractLogisticsList.stream().filter(Objects::nonNull)
|
|
|
.filter(log -> log.getStartTime() != null)
|
|
.filter(log -> log.getStartTime() != null)
|
|
|
.filter(log -> {
|
|
.filter(log -> {
|
|
|
- // 开始时间:物流合同开始时间 ≥ 贸易合同开始时间
|
|
|
|
|
- boolean startTimeOk = !log.getStartTime().before(tradeContractResDto.getStartTime());
|
|
|
|
|
- // 结束时间:物流合同开始时间 <= 贸易合同开始时间
|
|
|
|
|
- boolean endTimeOk = log.getEndTime() == null || tradeContractResDto.getEndTime() == null || !log.getEndTime().after(tradeContractResDto.getEndTime());
|
|
|
|
|
- return startTimeOk && endTimeOk;
|
|
|
|
|
|
|
+ // 有效期:物流合同开始时间 <= 当前时间
|
|
|
|
|
+ return !log.getStartTime().after(new Date());
|
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
|
if (CollectionUtils.isEmpty(validContractLog)) {
|
|
if (CollectionUtils.isEmpty(validContractLog)) {
|
|
|
throw new BusinessException("未找到该商品有效的自动派车物流合同,请先签订自动派车物流合同");
|
|
throw new BusinessException("未找到该商品有效的自动派车物流合同,请先签订自动派车物流合同");
|