|
|
@@ -2433,54 +2433,32 @@ public class KwtLogisticsConsignmentService {
|
|
|
//根据物流订单号查询运单信息
|
|
|
List<KwtWaybillOrderSubtask> waybillOrderSubtasks = logisticsOrderSubtaskRepository.queryByLogId(logisticsOrder.getId());
|
|
|
|
|
|
- LogisticsOrderDetailResp logisticsOrderDetailResp = new LogisticsOrderDetailResp();
|
|
|
- LogisticsOrderDetailResp.ContractInfoVO contractInfoVO = new LogisticsOrderDetailResp.ContractInfoVO();
|
|
|
- if (Objects.nonNull(orderContract)){
|
|
|
- contractInfoVO.setContractNo(orderContract.getContractNo());
|
|
|
- contractInfoVO.setContractName(orderContract.getContractName());
|
|
|
- }
|
|
|
- logisticsOrderDetailResp.setContractInfoVO(contractInfoVO);
|
|
|
+ //获取返回信息
|
|
|
+ return getLogisticsOrderDetailResp(orderContract, logOrderIdUnitTypeKeyAndUnitMap, logisticsOrder, kwpGoods,
|
|
|
+ logOrderIdAndUnitTypeKeyAndAddressMap, waybillOrderSubtasks);
|
|
|
|
|
|
- LogisticsOrderDetailResp.UnitInfoVO unitInfoVO = new LogisticsOrderDetailResp.UnitInfoVO();
|
|
|
- KwtLogisticsOrderUnit consignUnit =
|
|
|
- logOrderIdUnitTypeKeyAndUnitMap.getOrDefault(logisticsOrder.getId() + "-" + NumberConstant.ONE,
|
|
|
- new KwtLogisticsOrderUnit());
|
|
|
- unitInfoVO.setConsignUnitId(String.valueOf(consignUnit.getEntId()));
|
|
|
- unitInfoVO.setConsignUnitName(consignUnit.getFirmName());
|
|
|
- unitInfoVO.setConsignUnitPhone(consignUnit.getPhone());
|
|
|
- KwtLogisticsOrderUnit carriageUnit =
|
|
|
- logOrderIdUnitTypeKeyAndUnitMap.getOrDefault(logisticsOrder.getId() + "-" + NumberConstant.TWO,
|
|
|
- new KwtLogisticsOrderUnit());
|
|
|
- unitInfoVO.setCarriageUnitId(String.valueOf(carriageUnit.getEntId()));
|
|
|
- unitInfoVO.setCarriageUnitName(carriageUnit.getFirmName());
|
|
|
- unitInfoVO.setCarriageUnitPhone(carriageUnit.getPhone());
|
|
|
- logisticsOrderDetailResp.setUnitInfoVO(unitInfoVO);
|
|
|
+ }
|
|
|
|
|
|
+ @NotNull
|
|
|
+ private static LogisticsOrderDetailResp getLogisticsOrderDetailResp(KwtLogisticsOrderContract orderContract, Map<String, KwtLogisticsOrderUnit> logOrderIdUnitTypeKeyAndUnitMap, KwtLogisticsOrder logisticsOrder, KwpGoods kwpGoods, Map<String, KwtLogisticsOrderAddress> logOrderIdAndUnitTypeKeyAndAddressMap, List<KwtWaybillOrderSubtask> waybillOrderSubtasks) {
|
|
|
+ LogisticsOrderDetailResp logisticsOrderDetailResp = new LogisticsOrderDetailResp();
|
|
|
+ //设置合同信息
|
|
|
+ setContractInfo(orderContract, logisticsOrderDetailResp);
|
|
|
+ //设置单位信息
|
|
|
+ setUnitInfo(logOrderIdUnitTypeKeyAndUnitMap, logisticsOrder, logisticsOrderDetailResp);
|
|
|
|
|
|
- LogisticsOrderDetailResp.GoodsInfoVO goodsInfoVO = new LogisticsOrderDetailResp.GoodsInfoVO();
|
|
|
- if (Objects.nonNull(kwpGoods)){
|
|
|
- goodsInfoVO.setGoodsName(kwpGoods.getName());
|
|
|
+ //设置贸易信息
|
|
|
+ setGoodsInfo(kwpGoods, logisticsOrder, logisticsOrderDetailResp);
|
|
|
|
|
|
- }
|
|
|
- goodsInfoVO.setUnitPrice(Objects.nonNull(logisticsOrder.getPrice())? logisticsOrder.getPrice().setScale(2,RoundingMode.HALF_UP).toPlainString() : "0.00");
|
|
|
- goodsInfoVO.setOrderAmount(Objects.nonNull(logisticsOrder.getAmount()) ? logisticsOrder.getAmount().setScale(2,RoundingMode.HALF_UP).toPlainString() : "0.00");
|
|
|
- BigDecimal carriageCost = Objects.nonNull(logisticsOrder.getAmount()) && Objects.nonNull(logisticsOrder.getPrice()) ?
|
|
|
- logisticsOrder.getAmount().multiply(logisticsOrder.getPrice()) : BigDecimal.ZERO;
|
|
|
- goodsInfoVO.setCarriageCost(carriageCost.setScale(2,RoundingMode.HALF_UP).toPlainString());
|
|
|
- logisticsOrderDetailResp.setGoodsInfoVO(goodsInfoVO);
|
|
|
+ //设置装卸货地址信息
|
|
|
+ setAddressInfo(logOrderIdAndUnitTypeKeyAndAddressMap, logisticsOrder, logisticsOrderDetailResp);
|
|
|
|
|
|
- LogisticsOrderDetailResp.LoadingInfoVO loadingInfoVO = new LogisticsOrderDetailResp.LoadingInfoVO();
|
|
|
- KwtLogisticsOrderAddress loadAdd = logOrderIdAndUnitTypeKeyAndAddressMap.getOrDefault(logisticsOrder.getId() + "-" + AddressTypeEnum.SHIPMENT.getCode(),
|
|
|
- new KwtLogisticsOrderAddress());
|
|
|
- loadingInfoVO.setLoadAddress(loadAdd.getDetailAddress());
|
|
|
- KwtLogisticsOrderAddress unloadAdd =
|
|
|
- logOrderIdAndUnitTypeKeyAndAddressMap.getOrDefault(logisticsOrder.getId() + "-" + AddressTypeEnum.TAKE.getCode(),
|
|
|
- new KwtLogisticsOrderAddress());
|
|
|
- loadingInfoVO.setUnloadAddress(unloadAdd.getDetailAddress());
|
|
|
- loadingInfoVO.setUnloadContacts(unloadAdd.getContacts());
|
|
|
- loadingInfoVO.setUnloadPhone(unloadAdd.getPhone());
|
|
|
- logisticsOrderDetailResp.setLoadingInfoVO(loadingInfoVO);
|
|
|
+ //设置履约信息
|
|
|
+ setPerformInfo(logisticsOrder, waybillOrderSubtasks, logisticsOrderDetailResp);
|
|
|
+ return logisticsOrderDetailResp;
|
|
|
+ }
|
|
|
|
|
|
+ private static void setPerformInfo(KwtLogisticsOrder logisticsOrder, List<KwtWaybillOrderSubtask> waybillOrderSubtasks, LogisticsOrderDetailResp logisticsOrderDetailResp) {
|
|
|
LogisticsOrderDetailResp.PerformanceInfoVO performanceInfoVO = new LogisticsOrderDetailResp.PerformanceInfoVO();
|
|
|
performanceInfoVO.setBillingMode(logisticsOrder.getBillingMode());
|
|
|
performanceInfoVO.setBillingModeDesc(DictEnum.getLabel(DictTypeEnum.CHARGING_TYPE.getType(),
|
|
|
@@ -2517,7 +2495,59 @@ public class KwtLogisticsConsignmentService {
|
|
|
logisticsOrder.getAmount().subtract(loadAmount).setScale(2,RoundingMode.HALF_UP).toPlainString() : "0.00");
|
|
|
|
|
|
logisticsOrderDetailResp.setPerformanceInfoVO(performanceInfoVO);
|
|
|
+ }
|
|
|
|
|
|
- return null;
|
|
|
+ private static void setAddressInfo(Map<String, KwtLogisticsOrderAddress> logOrderIdAndUnitTypeKeyAndAddressMap, KwtLogisticsOrder logisticsOrder, LogisticsOrderDetailResp logisticsOrderDetailResp) {
|
|
|
+ LogisticsOrderDetailResp.LoadingInfoVO loadingInfoVO = new LogisticsOrderDetailResp.LoadingInfoVO();
|
|
|
+ KwtLogisticsOrderAddress loadAdd = logOrderIdAndUnitTypeKeyAndAddressMap.getOrDefault(logisticsOrder.getId() + "-" + AddressTypeEnum.SHIPMENT.getCode(),
|
|
|
+ new KwtLogisticsOrderAddress());
|
|
|
+ loadingInfoVO.setLoadAddress(loadAdd.getDetailAddress());
|
|
|
+ KwtLogisticsOrderAddress unloadAdd =
|
|
|
+ logOrderIdAndUnitTypeKeyAndAddressMap.getOrDefault(logisticsOrder.getId() + "-" + AddressTypeEnum.TAKE.getCode(),
|
|
|
+ new KwtLogisticsOrderAddress());
|
|
|
+ loadingInfoVO.setUnloadAddress(unloadAdd.getDetailAddress());
|
|
|
+ loadingInfoVO.setUnloadContacts(unloadAdd.getContacts());
|
|
|
+ loadingInfoVO.setUnloadPhone(unloadAdd.getPhone());
|
|
|
+ logisticsOrderDetailResp.setLoadingInfoVO(loadingInfoVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ private static void setGoodsInfo(KwpGoods kwpGoods, KwtLogisticsOrder logisticsOrder, LogisticsOrderDetailResp logisticsOrderDetailResp) {
|
|
|
+ LogisticsOrderDetailResp.GoodsInfoVO goodsInfoVO = new LogisticsOrderDetailResp.GoodsInfoVO();
|
|
|
+ if (Objects.nonNull(kwpGoods)){
|
|
|
+ goodsInfoVO.setGoodsName(kwpGoods.getName());
|
|
|
+
|
|
|
+ }
|
|
|
+ goodsInfoVO.setUnitPrice(Objects.nonNull(logisticsOrder.getPrice())? logisticsOrder.getPrice().setScale(2,RoundingMode.HALF_UP).toPlainString() : "0.00");
|
|
|
+ goodsInfoVO.setOrderAmount(Objects.nonNull(logisticsOrder.getAmount()) ? logisticsOrder.getAmount().setScale(2,RoundingMode.HALF_UP).toPlainString() : "0.00");
|
|
|
+ BigDecimal carriageCost = Objects.nonNull(logisticsOrder.getAmount()) && Objects.nonNull(logisticsOrder.getPrice()) ?
|
|
|
+ logisticsOrder.getAmount().multiply(logisticsOrder.getPrice()) : BigDecimal.ZERO;
|
|
|
+ goodsInfoVO.setCarriageCost(carriageCost.setScale(2,RoundingMode.HALF_UP).toPlainString());
|
|
|
+ logisticsOrderDetailResp.setGoodsInfoVO(goodsInfoVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ private static void setUnitInfo(Map<String, KwtLogisticsOrderUnit> logOrderIdUnitTypeKeyAndUnitMap, KwtLogisticsOrder logisticsOrder, LogisticsOrderDetailResp logisticsOrderDetailResp) {
|
|
|
+ LogisticsOrderDetailResp.UnitInfoVO unitInfoVO = new LogisticsOrderDetailResp.UnitInfoVO();
|
|
|
+ KwtLogisticsOrderUnit consignUnit =
|
|
|
+ logOrderIdUnitTypeKeyAndUnitMap.getOrDefault(logisticsOrder.getId() + "-" + NumberConstant.ONE,
|
|
|
+ new KwtLogisticsOrderUnit());
|
|
|
+ unitInfoVO.setConsignUnitId(String.valueOf(consignUnit.getEntId()));
|
|
|
+ unitInfoVO.setConsignUnitName(consignUnit.getFirmName());
|
|
|
+ unitInfoVO.setConsignUnitPhone(consignUnit.getPhone());
|
|
|
+ KwtLogisticsOrderUnit carriageUnit =
|
|
|
+ logOrderIdUnitTypeKeyAndUnitMap.getOrDefault(logisticsOrder.getId() + "-" + NumberConstant.TWO,
|
|
|
+ new KwtLogisticsOrderUnit());
|
|
|
+ unitInfoVO.setCarriageUnitId(String.valueOf(carriageUnit.getEntId()));
|
|
|
+ unitInfoVO.setCarriageUnitName(carriageUnit.getFirmName());
|
|
|
+ unitInfoVO.setCarriageUnitPhone(carriageUnit.getPhone());
|
|
|
+ logisticsOrderDetailResp.setUnitInfoVO(unitInfoVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ private static void setContractInfo(KwtLogisticsOrderContract orderContract, LogisticsOrderDetailResp logisticsOrderDetailResp) {
|
|
|
+ LogisticsOrderDetailResp.ContractInfoVO contractInfoVO = new LogisticsOrderDetailResp.ContractInfoVO();
|
|
|
+ if (Objects.nonNull(orderContract)){
|
|
|
+ contractInfoVO.setContractNo(orderContract.getContractNo());
|
|
|
+ contractInfoVO.setContractName(orderContract.getContractName());
|
|
|
+ }
|
|
|
+ logisticsOrderDetailResp.setContractInfoVO(contractInfoVO);
|
|
|
}
|
|
|
}
|