Explorar o código

利润结算表空指针异常问题处理

yzc hai 1 ano
pai
achega
46491efe80

+ 5 - 4
hx-sale/src/main/java/com/fjhx/sale/service/contract/impl/ContractServiceImpl.java

@@ -500,7 +500,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
 
         //赋值模板名称
         ContractTemplate contractTemplate = contractTemplateService.getById(result.getContractTemplateId());
-        if(ObjectUtil.isNotEmpty(contractTemplate)) {
+        if (ObjectUtil.isNotEmpty(contractTemplate)) {
             result.setContractTemplateName(contractTemplate.getTemplateName());
         }
         // 卖方信息
@@ -516,7 +516,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
         }
         //赋值收款账号
         AccountManagement accountManagement = accountManagementService.getById(result.getShroffAccountId());
-        if(ObjectUtil.isNotEmpty(accountManagement)){
+        if (ObjectUtil.isNotEmpty(accountManagement)) {
             result.setShroffAccountName(accountManagement.getName());
         }
 
@@ -1289,7 +1289,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
             productIndo.setAmount(item.getAmount());
             productIndo.setProductName(item.getProductName());
 
-            if(ObjectUtil.isNotEmpty(productInfo)) {
+            if (ObjectUtil.isNotEmpty(productInfo)) {
                 productIndo.setProductRemark(productInfo.getRemark());
                 productIndo.setProductSpec(productInfo.getSpec());
                 JSONObject ehsdJson = JSONObject.parseObject(productInfo.getEhsdJson());
@@ -1514,7 +1514,8 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
 
         if (CollectionUtils.isNotEmpty(list)) {
             for (AccountRequestFundsDetailVo c : list) {
-                switch (c.getCostType()) {
+                String costType = c.getCostType() == null ? "" : c.getCostType();
+                switch (costType) {
                     case "1"://拖车费
                         trailerFee = trailerFee.add(c.getAmount().multiply(currencyRatesMap.getOrDefault(c.getCurrency(), BigDecimal.ONE)));
                         break;