Prechádzať zdrojové kódy

处理空指针报错的bug修复

hxl13994548489 1 rok pred
rodič
commit
a8ea9142e2

+ 4 - 3
src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementProductCostsNewServiceImpl.java

@@ -42,6 +42,7 @@ import com.ydtech.modules.protocols.entity.po.*;
 import com.ydtech.modules.protocols.entity.vo.*;
 import com.ydtech.modules.protocols.service.*;
 import com.ydtech.utils.idgen.IdGenerate;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -2407,16 +2408,16 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
 
         ptlAgreementProductCostsNews.forEach(item -> {
             if (item.getProductId().equals(ProductsType.PT_0330.getCode())) {
-                if (item.getSyCostsProportion().equals("0")) {
+                if (StringUtils.isBlank(item.getSyCostsProportion()) || item.getSyCostsProportion().equals("0")) {
                     item.setSyCostsProportion(null);
                 }
 
             } else if (item.getProductId().equals(ProductsType.PT_034002.getCode()) || item.getProductId().equals(ProductsType.PT_034001.getCode())) {
-                if (item.getJqCostsProportion().equals("0")) {
+                if (StringUtils.isBlank(item.getJqCostsProportion()) || item.getJqCostsProportion().equals("0")) {
                     item.setJqCostsProportion(null);
                 }
             }
-            if (item.getNoCarCostsProportion().equals("0")) {
+            if (StringUtils.isBlank(item.getNoCarCostsProportion()) || item.getNoCarCostsProportion().equals("0")) {
                 item.setNoCostsProportion(null);
             }
         });