处理空值

This commit is contained in:
jie.lu
2025-08-15 14:07:26 +08:00
parent 9d2ae2d599
commit f34ac3c9ee

View File

@@ -315,7 +315,7 @@ public class ClaimVerificationServiceImpl implements ClaimVerificationService {
private String getPartHoursList(JSONObject warrantyJson) { private String getPartHoursList(JSONObject warrantyJson) {
if (warrantyJson == null || !warrantyJson.containsKey("warrantyReport")) { if (warrantyJson == null || !warrantyJson.containsKey("warrantyReport")) {
return null; return " ";
} }
// 获取warrantyReport对象 // 获取warrantyReport对象
@@ -323,11 +323,11 @@ public class ClaimVerificationServiceImpl implements ClaimVerificationService {
// 检查partItems是否存在且是数组 // 检查partItems是否存在且是数组
if (!warrantyReport.containsKey("partItems")) { if (!warrantyReport.containsKey("partItems")) {
return null; return " ";
} else { } else {
Object value = warrantyReport.get("partItems"); Object value = warrantyReport.get("partItems");
if (!(value instanceof JSONArray)) { if (!(value instanceof JSONArray)) {
return null; return " ";
} }
} }
@@ -345,11 +345,11 @@ public class ClaimVerificationServiceImpl implements ClaimVerificationService {
} }
} }
if (partNoList.isEmpty()) { if (partNoList.isEmpty()) {
return null; return " ";
} }
List<ClaimVerificationPartHoursDTO> result = tmClaimVerificationPartHoursMappingMapper.queryConfigByPartId(partNoList); List<ClaimVerificationPartHoursDTO> result = tmClaimVerificationPartHoursMappingMapper.queryConfigByPartId(partNoList);
if (result.isEmpty()) { if (result.isEmpty()) {
return null; return " ";
} }
return JSONObject.toJSONString(result); return JSONObject.toJSONString(result);
} }