请把下面代码套一层非空判断:iftgetNum4compareTotProjectSystemOutCountgetNum4 -1 tsetNum4ObjUtildecSubtgetNum4tProjectSystemOutCountgetNum4 2; else tsetNum4BigDecimalvalueOf0;
if(t.getNum4()!=null && tProjectSystemOutCount.getNum4()!=null){ if(t.getNum4().compareTo(tProjectSystemOutCount.getNum4())> -1){ t.setNum4(ObjUtil.decSub(t.getNum4(),tProjectSystemOutCount.getNum4(), 2)); } else { t.setNum4(BigDecimal.valueOf(0)); } } if(t.getDomestic()!=null && tProjectSystemOutCount.getDomestic()!=null){ if(t.getDomestic().compareTo(tProjectSystemOutCount.getDomestic())> -1){ t.setDomestic(ObjUtil.decSub(t.getDomestic(),tProjectSystemOutCount.getDomestic(), 2)); }else { t.setDomestic(BigDecimal.valueOf(0)); } } if(t.getAbroad()!=null && tProjectSystemOutCount.getAbroad()!=null){ if(t.getAbroad().compareTo(tProjectSystemOutCount.getAbroad())> -1){ t.setAbroad(ObjUtil.decSub(t.getAbroad(),tProjectSystemOutCount.getAbroad(), 2)); } else { t.setAbroad(BigDecimal.valueOf(0)); } } if(t.getEpc()!=null && tProjectSystemOutCount.getEpc()!=null){ if(t.getEpc().compareTo(tProjectSystemOutCount.getEpc())> -1){ t.setEpc(ObjUtil.decSub(t.getEpc(),tProjectSystemOutCount.getEpc(), 2)); }else { t.setEpc(BigDecimal.valueOf(0)); } } if(t.getDesignPurchase()!=null && tProjectSystemOutCount.getDesignPurchase()!=null){ if(t.getDesignPurchase().compareTo(tProjectSystemOutCount.getDesignPurchase())> -1){ t.setDesignPurchase(ObjUtil.decSub(t.getDesignPurchase(),tProjectSystemOutCount.getDesignPurchase(), 2)); }else { t.setDesignPurchase(BigDecimal.valueOf(0)); } } if(t.getPurchaseConstruction()!=null && tProjectSystemOutCount.getPurchaseConstruction()!=null){ if(t.getPurchaseConstruction().compareTo(tProjectSystemOutCount.getPurchaseConstruction())> -1){ t.setPurchaseConstruction(ObjUtil.decSub(t.getPurchaseConstruction(),tProjectSystemOutCount.getPurchaseConstruction(), 2)); } else { t.setPurchaseConstruction(BigDecimal.valueOf(0)); } } if(t.getDesign()!=null && tProjectSystemOutCount.getDesign()!=null){ if(t.getDesign().compareTo(tProjectSystemOutCount.getDesign())> -1){ t.setDesign(ObjUtil.decSub(t.getDesign(),tProjectSystemOutCount.getDesign(), 2)); }else { t.setDesign(BigDecimal.valueOf(0)); } } if(t.getPurchase()!=null && tProjectSystemOutCount.getPurchase()!=null){ if(t.getPurchase().compareTo(tProjectSystemOutCount.getPurchase())> -1){ t.setPurchase(ObjUtil.decSub(t.getPurchase(),tProjectSystemOutCount.getPurchase(), 2)); }else { t.setPurchase(BigDecimal.valueOf(0)); } } if(t.getConstruction()!=null && tProjectSystemOutCount.getConstruction()!=null){ if(t.getConstruction().compareTo(tProjectSystemOutCount.getConstruction())> -1){ t.setConstruction(ObjUtil.decSub(t.getConstruction(),tProjectSystemOutCount.getConstruction(), 2)); } else { t.setConstruction(BigDecimal.valueOf(0)); } } if(t.getConsultation()!=null && tProjectSystemOutCount.getConsultation()!=null){ if(t.getConsultation().compareTo(tProjectSystemOutCount.getConsultation())> -1){ t.setConsultation(ObjUtil.decSub(t.getConsultation(),tProjectSystemOutCount.getConsultation(), 2)); }else { t.setConsultation(BigDecimal.valueOf(0)); } } if(t.getSurvey()!=null && tProjectSystemOutCount.getSurvey()!=null){ if(t.getSurvey().compareTo(tProjectSystemOutCount.getSurvey())> -1){ t.setSurvey(ObjUtil.decSub(t.getSurvey(),tProjectSystemOutCount.getSurvey(), 2)); }else { t.setSurvey(BigDecimal.valueOf(0)); } } if(t.getSupervision()!=null && tProjectSystemOutCount.getSupervision()!=null){ if(t.getSupervision().compareTo(tProjectSystemOutCount.getSupervision())> -1){ t.setSupervision(ObjUtil.decSub(t.getSupervision(),tProjectSystemOutCount.getSupervision(), 2)); } else { t.setSupervision(BigDecimal.valueOf(0)); } } if(t.getNdt()!=null && tProjectSystemOutCount.getNdt()!=null){ if(t.getNdt().compareTo(tProjectSystemOutCount.getNdt())> -1){ t.setNdt(ObjUtil.decSub(t.getNdt(),tProjectSystemOutCount.getNdt(), 2)); }else { t.setNdt(BigDecimal.valueOf(0)); }
原文地址: https://www.cveoy.top/t/topic/fF5w 著作权归作者所有。请勿转载和采集!