Просмотр исходного кода

运费对账结算周期,处理获取null

lengfaqiang 2 лет назад
Родитель
Сommit
921530eb0b

+ 18 - 14
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/TransportCommonService.java

@@ -627,9 +627,9 @@ public class TransportCommonService {
                  */
                  */
                 BigDecimal actualAmount = new BigDecimal("0.00");
                 BigDecimal actualAmount = new BigDecimal("0.00");
                 if (DictEnum.CHARGING_TYPE_1.getValue().equals(billingMode)) {
                 if (DictEnum.CHARGING_TYPE_1.getValue().equals(billingMode)) {
-                    actualAmount = (logisticsOrderDTO.getTotalLoadAmount()==null?new BigDecimal("0.00"):logisticsOrderDTO.getTotalLoadAmount()).multiply(price);
+                    actualAmount = (logisticsOrderDTO.getTotalLoadAmount() == null ? new BigDecimal("0.00") : logisticsOrderDTO.getTotalLoadAmount()).multiply(price);
                 } else if (DictEnum.CHARGING_TYPE_2.getValue().equals(billingMode)) {
                 } else if (DictEnum.CHARGING_TYPE_2.getValue().equals(billingMode)) {
-                    actualAmount = (logisticsOrderDTO.getTotalUnloadAmount()==null?new BigDecimal("0.00"):logisticsOrderDTO.getTotalUnloadAmount()).multiply(price).subtract(fineValue);
+                    actualAmount = (logisticsOrderDTO.getTotalUnloadAmount() == null ? new BigDecimal("0.00") : logisticsOrderDTO.getTotalUnloadAmount()).multiply(price).subtract(fineValue);
                 }
                 }
                 logisticsOrderDTO.setTaxMoney(actualAmount);
                 logisticsOrderDTO.setTaxMoney(actualAmount);
 //                logisticsOrderDTO.setContractId();
 //                logisticsOrderDTO.setContractId();
@@ -651,27 +651,31 @@ public class TransportCommonService {
                 logisticsOrderDTO.setConsignCompany(consignOrderUnit == null ? null : consignOrderUnit.getFirmName());
                 logisticsOrderDTO.setConsignCompany(consignOrderUnit == null ? null : consignOrderUnit.getFirmName());
                 logisticsOrderDTO.setConsignPhone(consignOrderUnit == null ? null : consignOrderUnit.getPhone());
                 logisticsOrderDTO.setConsignPhone(consignOrderUnit == null ? null : consignOrderUnit.getPhone());
                 logisticsOrderDTO.setConsignContacts(consignOrderUnit == null ? null : consignOrderUnit.getContacts());
                 logisticsOrderDTO.setConsignContacts(consignOrderUnit == null ? null : consignOrderUnit.getContacts());
-                logisticsOrderDTO.setSettlementCycleLabel(settlementDictData.get(logisticsOrderDTO.getSettlementCycle().toString()));
+                logisticsOrderDTO.setSettlementCycleLabel(logisticsOrderDTO.getSettlementCycle() == null ? null : settlementDictData.get(logisticsOrderDTO.getSettlementCycle().toString()));
                 logisticsOrderDTO.setBillingModeLabel(chargingDictData.get(logisticsOrderDTO.getBillingMode()));
                 logisticsOrderDTO.setBillingModeLabel(chargingDictData.get(logisticsOrderDTO.getBillingMode()));
                 logisticsOrderDTO.setPriceLabel(priceDictData.get(logisticsOrderDTO.getPriceType()));
                 logisticsOrderDTO.setPriceLabel(priceDictData.get(logisticsOrderDTO.getPriceType()));
                 logisticsOrderDTO.setLossUnitLabel(taxRateTypeDictData.get(logisticsOrderDTO.getLossUnit()));
                 logisticsOrderDTO.setLossUnitLabel(taxRateTypeDictData.get(logisticsOrderDTO.getLossUnit()));
                 logisticsOrderDTO.setAmountLabel(unitTypeDictData.get(logisticsOrderDTO.getUnit()));
                 logisticsOrderDTO.setAmountLabel(unitTypeDictData.get(logisticsOrderDTO.getUnit()));
                 logisticsOrderDTO.setIgnoreAmountLabel(unitTypeDictData.get(logisticsOrderDTO.getUnit()));
                 logisticsOrderDTO.setIgnoreAmountLabel(unitTypeDictData.get(logisticsOrderDTO.getUnit()));
                 if (logisticsOrderDTO.getTOrderId() != null) {
                 if (logisticsOrderDTO.getTOrderId() != null) {
-                    OrderDetailRes orderDetailRes = tradeOrderInfoService.getOrderDetailById(Long.valueOf(logisticsOrderDTO.getTOrderId()));
-                    if (orderDetailRes != null) {
-                        List<UnitInfoDetailRes> unitInfo = orderDetailRes.getUnitInfo();
-                        if (CollectionUtils.isNotEmpty(unitInfo)) {
-                            for (UnitInfoDetailRes unitInfoDetailRes : unitInfo) {
-                                if (String.valueOf(NumberConstant.ONE).equals(unitInfoDetailRes.getUnitType())) {
-                                    logisticsOrderDTO.setShipmentsUnitId(String.valueOf(unitInfoDetailRes.getEntId()));
-                                    logisticsOrderDTO.setShipmentsUnit(unitInfoDetailRes.getFirmName());
-                                } else if (String.valueOf(NumberConstant.TWO).equals(unitInfoDetailRes.getUnitType())) {
-                                    logisticsOrderDTO.setReceiveGoodsUnitId(String.valueOf(unitInfoDetailRes.getEntId()));
-                                    logisticsOrderDTO.setReceiveGoodsUnit(unitInfoDetailRes.getFirmName());
+                    try {
+                        OrderDetailRes orderDetailRes = tradeOrderInfoService.getOrderDetailById(Long.valueOf(logisticsOrderDTO.getTOrderId()));
+                        if (orderDetailRes != null) {
+                            List<UnitInfoDetailRes> unitInfo = orderDetailRes.getUnitInfo();
+                            if (CollectionUtils.isNotEmpty(unitInfo)) {
+                                for (UnitInfoDetailRes unitInfoDetailRes : unitInfo) {
+                                    if (String.valueOf(NumberConstant.TWO).equals(unitInfoDetailRes.getUnitType())) {
+                                        logisticsOrderDTO.setShipmentsUnitId(String.valueOf(unitInfoDetailRes.getEntId()));
+                                        logisticsOrderDTO.setShipmentsUnit(unitInfoDetailRes.getFirmName());
+                                    } else if (String.valueOf(NumberConstant.ONE).equals(unitInfoDetailRes.getUnitType())) {
+                                        logisticsOrderDTO.setReceiveGoodsUnitId(String.valueOf(unitInfoDetailRes.getEntId()));
+                                        logisticsOrderDTO.setReceiveGoodsUnit(unitInfoDetailRes.getFirmName());
+                                    }
                                 }
                                 }
                             }
                             }
                         }
                         }
+                    } catch (Exception e) {
+                        log.error("tradeOrderInfoService.getOrderDetailById error id:{},errorMessage:{}",logisticsOrderDTO.getTOrderId(),e.getMessage(),e);
                     }
                     }
                 }
                 }
 //                logisticsOrderDTO.setCount(waybillOrderMapper.selectCount(new LambdaQueryWrapper<KwtWaybillOrder>().eq(KwtWaybillOrder::getLOrderId, logisticsOrderDTO.getLOrderId())));
 //                logisticsOrderDTO.setCount(waybillOrderMapper.selectCount(new LambdaQueryWrapper<KwtWaybillOrder>().eq(KwtWaybillOrder::getLOrderId, logisticsOrderDTO.getLOrderId())));