fix(module-datafill): 修复空指针异常
- 在 ReportShowController 类中,对 entry.getValue() 进行了空值检查- 避免在值为空时调用 toString() 方法导致的空指针异常 - 优化了数据处理逻辑,提高代码的健壮性
正在显示
1 个修改的文件
包含
7 行增加
和
24 行删除
... | @@ -456,7 +456,10 @@ public class ReportShowController { | ... | @@ -456,7 +456,10 @@ public class ReportShowController { |
456 | while (entries.hasNext()) { | 456 | while (entries.hasNext()) { |
457 | Map.Entry entry = (Map.Entry) entries.next(); | 457 | Map.Entry entry = (Map.Entry) entries.next(); |
458 | String key = entry.getKey().toString(); | 458 | String key = entry.getKey().toString(); |
459 | String value = entry.getValue().toString(); | 459 | String value = ""; |
460 | if(ConvertUtils.isNotEmpty(entry.getValue())){ | ||
461 | value = entry.getValue().toString(); | ||
462 | } | ||
460 | if(!key.equals("reportId")&&!key.equals("time")){ | 463 | if(!key.equals("reportId")&&!key.equals("time")){ |
461 | FReportItem fReportItem = fReportItemService.getItemInfoByItemCode(key,reportId); | 464 | FReportItem fReportItem = fReportItemService.getItemInfoByItemCode(key,reportId); |
462 | if(fReportItem!=null){ | 465 | if(fReportItem!=null){ |
... | @@ -551,33 +554,13 @@ public class ReportShowController { | ... | @@ -551,33 +554,13 @@ public class ReportShowController { |
551 | String key = entry.getKey().toString(); | 554 | String key = entry.getKey().toString(); |
552 | String value = null; | 555 | String value = null; |
553 | if(!key.equals("recordMsg")){ | 556 | if(!key.equals("recordMsg")){ |
554 | value = entry.getValue().toString(); | 557 | if(ConvertUtils.isNotEmpty(entry.getValue())){ |
558 | value = entry.getValue().toString(); | ||
559 | } | ||
555 | } | 560 | } |
556 | if(!key.equals("id")||!key.equals("time")||!key.equals("reportId")){ | 561 | if(!key.equals("id")||!key.equals("time")||!key.equals("reportId")){ |
557 | keys = keys+","+key; | 562 | keys = keys+","+key; |
558 | formMap.put(key, value); | 563 | formMap.put(key, value); |
559 | // FReportItem fReportItem = fReportItemService.getItemInfoByItemCode(key,reportId); | ||
560 | // if(fReportItem!=null) { | ||
561 | // String reitId = fReportItem.getId(); | ||
562 | // FReportItemv reportItemv = itemvMap.get(reitId); | ||
563 | // if(reportItemv==null) { | ||
564 | // reportItemv = new FReportItemv(); | ||
565 | // reportItemv.setDataId(dataId); | ||
566 | // reportItemv.setReitId(reitId); | ||
567 | // reportItemv.setItemValue(value); | ||
568 | // reportItemv.setDepartId(departId); | ||
569 | // reportItemv.setCreateDept(orgCode); | ||
570 | // reportItemv.setDelFlag(1); | ||
571 | // reportItemv.setDataTime(dataTime); | ||
572 | // reportItemv.setCreateTime(createTime); | ||
573 | // itemvList.add(reportItemv); | ||
574 | // }else { | ||
575 | // reportItemv.setItemValue(value); | ||
576 | // reportItemv.setDataTime(dataTime); | ||
577 | // reportItemv.setDepartId(departId); | ||
578 | // reportItemv.setCreateTime(createTime); | ||
579 | // } | ||
580 | // } | ||
581 | } | 564 | } |
582 | } | 565 | } |
583 | if(!StringUtils.isEmpty(keys)) { | 566 | if(!StringUtils.isEmpty(keys)) { | ... | ... |
-
请 注册 或 登录 后发表评论