|
@@ -3108,6 +3108,14 @@ public class KwtWaybillOrderV1Service {
|
|
|
logOrderIds.add(Long.parseLong(req.getLogisticsOrderId()));
|
|
logOrderIds.add(Long.parseLong(req.getLogisticsOrderId()));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(req.getBillingMethod() )){
|
|
|
|
|
+ List<KwtLogisticsOrder> kwtLogisticsOrder = logisticsOrderRepository.queryByBillMethod(req.getBillingMethod());
|
|
|
|
|
+ if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(kwtLogisticsOrder)){
|
|
|
|
|
+ logOrderIds.addAll(kwtLogisticsOrder.stream()
|
|
|
|
|
+ .map(KwtLogisticsOrder::getId)
|
|
|
|
|
+ .collect(Collectors.toSet()));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
if (StringUtils.isNotBlank(req.getLogisticsOrderNo()) && StringUtils.isBlank(req.getLogisticsOrderId())){
|
|
if (StringUtils.isNotBlank(req.getLogisticsOrderNo()) && StringUtils.isBlank(req.getLogisticsOrderId())){
|
|
|
KwtLogisticsOrder kwtLogisticsOrder = logisticsOrderRepository.queryByLogisticsOrderNo(req.getLogisticsOrderNo());
|
|
KwtLogisticsOrder kwtLogisticsOrder = logisticsOrderRepository.queryByLogisticsOrderNo(req.getLogisticsOrderNo());
|
|
|
if (Objects.nonNull(kwtLogisticsOrder)){
|
|
if (Objects.nonNull(kwtLogisticsOrder)){
|
|
@@ -3409,7 +3417,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
waybillOrderDetailResp.setBillInfo(billInfo);
|
|
waybillOrderDetailResp.setBillInfo(billInfo);
|
|
|
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(billOrders)){
|
|
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(billOrders)){
|
|
|
List<Long> billOrderIdList = billOrders.stream()
|
|
List<Long> billOrderIdList = billOrders.stream()
|
|
|
- .filter(b -> Objects.equals(b.getStatus(), CarWaybillV1Enum.COMPLETION_LOADING.getCode()))
|
|
|
|
|
|
|
+ .filter(b -> Objects.equals(b.getStatus(), CarWaybillV1Enum.COMPLETION_LOADING.getCode()) && !Objects.equals(b.getId(),billOrder.getId()))
|
|
|
.map(KwtWaybillOrder::getId)
|
|
.map(KwtWaybillOrder::getId)
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
waybillOrderDetailResp.setBillOrderIdList(billOrderIdList);
|
|
waybillOrderDetailResp.setBillOrderIdList(billOrderIdList);
|
|
@@ -3445,13 +3453,13 @@ public class KwtWaybillOrderV1Service {
|
|
|
updateSubtask.setRemark(req.getRemark());
|
|
updateSubtask.setRemark(req.getRemark());
|
|
|
updateSubtask.setUnloadAmount(org.apache.commons.lang3.StringUtils.isBlank(req.getUnloadAmount()) ? null : new BigDecimal(req.getUnloadAmount()));
|
|
updateSubtask.setUnloadAmount(org.apache.commons.lang3.StringUtils.isBlank(req.getUnloadAmount()) ? null : new BigDecimal(req.getUnloadAmount()));
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(req.getAddressUrl())){
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(req.getAddressUrl())){
|
|
|
- subtask.setUnloadUrl(req.getAddressUrl());
|
|
|
|
|
|
|
+ updateSubtask.setUnloadUrl(req.getAddressUrl());
|
|
|
}
|
|
}
|
|
|
if(org.apache.commons.lang3.StringUtils.isNotBlank(req.getUploadUser())){
|
|
if(org.apache.commons.lang3.StringUtils.isNotBlank(req.getUploadUser())){
|
|
|
- subtask.setUnloadOperator(Long.valueOf(req.getUploadUser()));
|
|
|
|
|
|
|
+ updateSubtask.setUnloadOperator(Long.valueOf(req.getUploadUser()));
|
|
|
}
|
|
}
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(req.getUploadTime())){
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(req.getUploadTime())){
|
|
|
- subtask.setUnloadUploadTime(DateUtils.parse(req.getUploadTime(), DateUtils.DATE_TIME_PATTERN));
|
|
|
|
|
|
|
+ updateSubtask.setUnloadUploadTime(DateUtils.parse(req.getUploadTime(), DateUtils.DATE_TIME_PATTERN));
|
|
|
}
|
|
}
|
|
|
boolean b = kwtWaybillOrderRepository.updateById(updateOrder) && kwtWaybillOrderSubtaskRepository.updateById(updateSubtask);
|
|
boolean b = kwtWaybillOrderRepository.updateById(updateOrder) && kwtWaybillOrderSubtaskRepository.updateById(updateSubtask);
|
|
|
//修改物流订单数据
|
|
//修改物流订单数据
|
|
@@ -3459,6 +3467,11 @@ public class KwtWaybillOrderV1Service {
|
|
|
//获取更新 订单状态
|
|
//获取更新 订单状态
|
|
|
KwtLogisticsOrder kwtLogisticsOrder = getKwtLogisticsOrder(kwtLogistics, subtask);
|
|
KwtLogisticsOrder kwtLogisticsOrder = getKwtLogisticsOrder(kwtLogistics, subtask);
|
|
|
boolean b1 = kwtLogisticsOrderRepository.updateById(kwtLogisticsOrder);
|
|
boolean b1 = kwtLogisticsOrderRepository.updateById(kwtLogisticsOrder);
|
|
|
|
|
+ //如果物流订单状态是已完成需要通知贸易订单完成
|
|
|
|
|
+ if (Objects.equals(kwtLogisticsOrder.getStatus(),LogisticsOrderV1Enum.HAVE_RECONCILED.getCode())){
|
|
|
|
|
+ //todo cxf通知贸易订单完成
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 存储记录
|
|
// 存储记录
|
|
|
String remark = null;
|
|
String remark = null;
|
|
|
if (Objects.equals(status, CarWaybillV1Enum.COMPLETION_UNLOADING.getCode())){
|
|
if (Objects.equals(status, CarWaybillV1Enum.COMPLETION_UNLOADING.getCode())){
|
|
@@ -3483,13 +3496,13 @@ public class KwtWaybillOrderV1Service {
|
|
|
updateSubtask.setRemark(req.getRemark());
|
|
updateSubtask.setRemark(req.getRemark());
|
|
|
updateSubtask.setUnloadAmount(org.apache.commons.lang3.StringUtils.isNotBlank(req.getUnloadAmount()) ? new BigDecimal(req.getUnloadAmount()) : null);
|
|
updateSubtask.setUnloadAmount(org.apache.commons.lang3.StringUtils.isNotBlank(req.getUnloadAmount()) ? new BigDecimal(req.getUnloadAmount()) : null);
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(req.getAddressUrl())){
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(req.getAddressUrl())){
|
|
|
- subtask.setUnloadUrl(req.getAddressUrl());
|
|
|
|
|
|
|
+ updateSubtask.setUnloadUrl(req.getAddressUrl());
|
|
|
}
|
|
}
|
|
|
if(org.apache.commons.lang3.StringUtils.isNotBlank(req.getUploadUser())){
|
|
if(org.apache.commons.lang3.StringUtils.isNotBlank(req.getUploadUser())){
|
|
|
- subtask.setUnloadOperator(Long.valueOf(req.getUploadUser()));
|
|
|
|
|
|
|
+ updateSubtask.setUnloadOperator(Long.valueOf(req.getUploadUser()));
|
|
|
}
|
|
}
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(req.getUploadTime())){
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(req.getUploadTime())){
|
|
|
- subtask.setUnloadUploadTime(DateUtils.parse(req.getUploadTime(), DateUtils.DATE_TIME_PATTERN));
|
|
|
|
|
|
|
+ updateSubtask.setUnloadUploadTime(DateUtils.parse(req.getUploadTime(), DateUtils.DATE_TIME_PATTERN));
|
|
|
}
|
|
}
|
|
|
boolean b = kwtWaybillOrderRepository.updateById(updateOrder) && kwtWaybillOrderSubtaskRepository.updateById(updateSubtask);
|
|
boolean b = kwtWaybillOrderRepository.updateById(updateOrder) && kwtWaybillOrderSubtaskRepository.updateById(updateSubtask);
|
|
|
// kwtWaybillOrderTicket.setWOrderId(waybillId);
|
|
// kwtWaybillOrderTicket.setWOrderId(waybillId);
|
|
@@ -3527,10 +3540,16 @@ public class KwtWaybillOrderV1Service {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@NotNull
|
|
@NotNull
|
|
|
- private static KwtLogisticsOrder getKwtLogisticsOrder(KwtLogisticsOrder kwtLogistics, KwtWaybillOrderSubtask subtask) {
|
|
|
|
|
|
|
+ private KwtLogisticsOrder getKwtLogisticsOrder(KwtLogisticsOrder kwtLogistics, KwtWaybillOrderSubtask subtask) {
|
|
|
if (Objects.isNull(kwtLogistics)){
|
|
if (Objects.isNull(kwtLogistics)){
|
|
|
throw new BusinessException("物流订单信息不存在");
|
|
throw new BusinessException("物流订单信息不存在");
|
|
|
}
|
|
}
|
|
|
|
|
+ //调物流订单完结订单
|
|
|
|
|
+ List<KwtWaybillOrderSubtask> waybillOrderSubtasks = kwtWaybillOrderSubtaskRepository.queryByLogId(subtask.getLOrderId());
|
|
|
|
|
+ boolean b2 = waybillOrderSubtasks.stream()
|
|
|
|
|
+ .allMatch(x -> Arrays.asList(CarWaybillV1Enum.WAIT_UNLOADING.getCode(), CarWaybillV1Enum.APPROVAL_TREAT.getCode()).contains(x.getStatus()));
|
|
|
|
|
+ // KwtLogisticsOrder logisticsOrder = kwtLogisticsOrderRepository.queryByLogisticsOrderId(subtask.getLOrderId());
|
|
|
|
|
+
|
|
|
BigDecimal entrustAmount = Objects.isNull(kwtLogistics.getEntrustAmount()) ? BigDecimal.ZERO: kwtLogistics.getEntrustAmount();
|
|
BigDecimal entrustAmount = Objects.isNull(kwtLogistics.getEntrustAmount()) ? BigDecimal.ZERO: kwtLogistics.getEntrustAmount();
|
|
|
BigDecimal subEntrustAmount = Objects.isNull(subtask.getEntrustAmount()) ? BigDecimal.ZERO: subtask.getEntrustAmount();
|
|
BigDecimal subEntrustAmount = Objects.isNull(subtask.getEntrustAmount()) ? BigDecimal.ZERO: subtask.getEntrustAmount();
|
|
|
BigDecimal loadAmount = Objects.isNull(kwtLogistics.getLoadAmount()) ? BigDecimal.ZERO: kwtLogistics.getLoadAmount();
|
|
BigDecimal loadAmount = Objects.isNull(kwtLogistics.getLoadAmount()) ? BigDecimal.ZERO: kwtLogistics.getLoadAmount();
|
|
@@ -3544,6 +3563,10 @@ public class KwtWaybillOrderV1Service {
|
|
|
kwtLogisticsOrder.setEntrustAmount(entrustAmount.add(subEntrustAmount));
|
|
kwtLogisticsOrder.setEntrustAmount(entrustAmount.add(subEntrustAmount));
|
|
|
kwtLogisticsOrder.setLoadAmount(loadAmount.add(subLoadAmount));
|
|
kwtLogisticsOrder.setLoadAmount(loadAmount.add(subLoadAmount));
|
|
|
kwtLogisticsOrder.setUnloadAmount(unloadAmount.add(subUnloadAmount));
|
|
kwtLogisticsOrder.setUnloadAmount(unloadAmount.add(subUnloadAmount));
|
|
|
|
|
+ if (b2){
|
|
|
|
|
+ //调物流订单完结订单
|
|
|
|
|
+ kwtLogisticsOrder.setStatus(LogisticsOrderV1Enum.HAVE_RECONCILED.getCode());
|
|
|
|
|
+ }
|
|
|
return kwtLogisticsOrder;
|
|
return kwtLogisticsOrder;
|
|
|
}
|
|
}
|
|
|
|
|
|