Browse Source

fix(boiler): 修复锅炉设备检查日期设置的空指针异常

- 在设置下次内检日期时添加null检查
- 在设置下次外检日期时添加null检查
- 在设置下次压力检查日期时添加null检查
- 在管道设备的法定检查日期设置中添加null检查
- 在管道设备的年度检查日期设置中添加null检查
- 防止DateUtils解析失败时导致的空指针异常
xuzhancheng 6 days ago
parent
commit
2719d4332f

+ 21 - 7
tz-module-pressure2/tz-module-pressure2-biz/src/main/java/cn/start/tz/module/pressure2/service/boilertaskorderitemreport/BoilerTaskOrderItemReportServiceImpl.java

@@ -881,15 +881,21 @@ public class BoilerTaskOrderItemReportServiceImpl extends ServiceImpl<BoilerTask
 //
                 if (map.getString("nextInCheckDate") != null) {
                     LocalDate nextInCheckDate = DateUtils.parseDateWithMultipleFormats(map.getString("nextInCheckDate"));
-                    equipBoilerDO.setNextcheckdate(nextInCheckDate.atStartOfDay());
+                    if (nextInCheckDate != null) {
+                        equipBoilerDO.setNextcheckdate(nextInCheckDate.atStartOfDay());
+                    }
                 }
                 if (map.getString("sh3_custom_3") != null) {
                     LocalDate nextInCheckDate = DateUtils.parseDateWithMultipleFormats(map.getString("sh3_custom_3"));
-                    equipBoilerDO.setNextInCheckDate(nextInCheckDate.atStartOfDay());
+                    if (nextInCheckDate != null) {
+                        equipBoilerDO.setNextInCheckDate(nextInCheckDate.atStartOfDay());
+                    }
                 }
                 if (map.getString("nextInCheckDate1") != null) {
                     LocalDate nextPressureCheckDate = DateUtils.parseDateWithMultipleFormats(map.getString("nextInCheckDate1"));
-                    equipBoilerDO.setNextInCheckDate(nextPressureCheckDate.atStartOfDay());
+                    if (nextPressureCheckDate != null) {
+                        equipBoilerDO.setNextInCheckDate(nextPressureCheckDate.atStartOfDay());
+                    }
                 }
                 if (map.getString("checkResult") != null) {
                     equipBoilerDO.setLastInCheckConclusion(map.getString("checkResult"));
@@ -906,15 +912,21 @@ public class BoilerTaskOrderItemReportServiceImpl extends ServiceImpl<BoilerTask
 
                 if (map.getString("nextOutCheckDate") != null) {
                     LocalDate nextOutCheckDate = DateUtils.parseDateWithMultipleFormats(map.getString("nextOutCheckDate"));
-                    equipBoilerDO.setNextOutCheckDate(nextOutCheckDate.atStartOfDay());
+                    if (nextOutCheckDate != null) {
+                        equipBoilerDO.setNextOutCheckDate(nextOutCheckDate.atStartOfDay());
+                    }
                 }
                 if (map.getString("sh2_val_12") != null) {
                     LocalDate nextOutCheckDate = DateUtils.parseDateWithMultipleFormats(map.getString("sh2_val_12"));
-                    equipBoilerDO.setNextOutCheckDate(nextOutCheckDate.atStartOfDay());
+                    if (nextOutCheckDate != null) {
+                        equipBoilerDO.setNextOutCheckDate(nextOutCheckDate.atStartOfDay());
+                    }
                 }
                 if (map.getString("nextOutCheckDate1") != null) {
                     LocalDate nextOutCheckDate = DateUtils.parseDateWithMultipleFormats(map.getString("nextOutCheckDate1"));
-                    equipBoilerDO.setNextOutCheckDate(nextOutCheckDate.atStartOfDay());
+                    if (nextOutCheckDate != null) {
+                        equipBoilerDO.setNextOutCheckDate(nextOutCheckDate.atStartOfDay());
+                    }
                 }
                 if (map.getString("checkResult") != null) {
                     equipBoilerDO.setLastOutCheckConclusion(map.getString("checkResult"));
@@ -931,7 +943,9 @@ public class BoilerTaskOrderItemReportServiceImpl extends ServiceImpl<BoilerTask
 
                 if (map.getString("nextDate") != null) {
                     LocalDate nextPressureCheckDate = DateUtils.parseDateWithMultipleFormats(map.getString("nextDate"));
-                    equipBoilerDO.setNextPressureCheckDate(nextPressureCheckDate.atStartOfDay());
+                    if (nextPressureCheckDate != null) {
+                        equipBoilerDO.setNextPressureCheckDate(nextPressureCheckDate.atStartOfDay());
+                    }
                 }
                 if (map.getString("checkResult") != null) {
                     equipBoilerDO.setLastPressureCheckConclusion(map.getString("checkResult"));

+ 6 - 2
tz-module-pressure2/tz-module-pressure2-biz/src/main/java/cn/start/tz/module/pressure2/service/pipetaskorderitemreport/PipeTaskOrderItemReportServiceImpl.java

@@ -776,7 +776,9 @@ public class PipeTaskOrderItemReportServiceImpl extends ServiceImpl<PipeTaskOrde
                     String lastCheckReportNo = taskOrderItemReportDO.getReportNo();
                     if (map.getString("nextLegalCheckDate") != null) {
                         LocalDate nextLegalCheckDate = DateUtils.parseDateWithMultipleFormats(map.getString("nextLegalCheckDate"));
-                        equipPipeDetailDO.setNextLegalCheckDate(nextLegalCheckDate.atStartOfDay());
+                        if (nextLegalCheckDate != null) {
+                            equipPipeDetailDO.setNextLegalCheckDate(nextLegalCheckDate.atStartOfDay());
+                        }
                     }
                     if (map.getString("checkResult") != null) {
                         equipPipeDetailDO.setLegalInspectionConclusion(map.getString("checkResult"));
@@ -794,7 +796,9 @@ public class PipeTaskOrderItemReportServiceImpl extends ServiceImpl<PipeTaskOrde
                     String lastCheckReportNo = taskOrderItemReportDO.getReportNo();
                     if (map.getString("nextYearCheckDate") != null) {
                         LocalDate nextYearCheckDate = DateUtils.parseDateWithMultipleFormats(map.getString("nextYearCheckDate"));
-                        equipPipeDetailDO.setNextYearCheckDate(nextYearCheckDate.atStartOfDay());
+                        if (nextYearCheckDate != null) {
+                            equipPipeDetailDO.setNextYearCheckDate(nextYearCheckDate.atStartOfDay());
+                        }
                     }
                     if (map.getString("checkResult") != null) {
                         equipPipeDetailDO.setYearInspectionConclusion(map.getString("checkResult"));