Forráskód Böngészése

fix(hr): 修复岗位数据统计逻辑空指针异常

- 调整人员列表判空逻辑,避免空指针异常
- 优化在岗数和兼职数计算流程
- 确保编制数计算不受人员列表影响
- 完善缺岗数计算逻辑的健壮性
Tyx 1 napja
szülő
commit
27aca060c3

+ 14 - 15
code/jyyy/nckd-jimin-jyyy-hr/src/main/java/nckd/jimin/jyyy/hr/hrmp/hbpm/opplugin/web/position/PositionDataProviderEx.java

@@ -49,29 +49,28 @@ public class PositionDataProviderEx extends ListDataProvider {
             Long positionId = position.getLong("id");
             //在岗数:
             List<DynamicObject> personList = map.get(positionId);
-            if(personList == null)
-                continue;
-            //获取在岗数,排除兼职
-            List filterList = personList.stream().filter(dyx -> dyx.getString("postype.number").equals("1010_S")).collect(Collectors.toList());
-            personCount = filterList.size();
-            position.set("nckd_personcount", personCount);
-            //获取兼职数
-            List filterList1 = personList.stream().filter(dyx -> dyx.getString("postype.number").equals("1020_S")).collect(Collectors.toList());
-            personCountPart = filterList1.size();
-            position.set("nckd_personcountpart", personCountPart);
+            if(personList != null) {
+                //获取在岗数,排除兼职
+                List filterList = personList.stream().filter(dyx -> dyx.getString("postype.number").equals("1010_S")).collect(Collectors.toList());
+                personCount = filterList.size();
+                position.set("nckd_personcount", personCount);
+                //获取兼职数
+                List filterList1 = personList.stream().filter(dyx -> dyx.getString("postype.number").equals("1020_S")).collect(Collectors.toList());
+                personCountPart = filterList1.size();
+                position.set("nckd_personcountpart", personCountPart);
+                //人员姓名拼接:
+                String personName = personList.stream().map(dyx -> dyx.getString("postype.number").equals("1010_S") ? dyx.getString("person.name") : dyx.getString("person.name") + "(兼)")
+                        .collect(Collectors.joining(", "));
+                position.set("nckd_personname", personName);
+            }
             //获取编制数
             if(staffMap.keySet().contains(positionId.toString())) {
                 staffCount = (int) ((Map) staffMap.get(positionId.toString())).get("staffNum");
                 position.set("nckd_staffcount", staffCount);
             }
-            //人员姓名拼接:
-            String personName = personList.stream().map(dyx -> dyx.getString("postype.number").equals("1010_S") ? dyx.getString("person.name") : dyx.getString("person.name") + "(兼)")
-                    .collect(Collectors.joining(", "));
-            position.set("nckd_personname", personName);
             //缺岗数 = 编制数 - 在岗数
             position.set("nckd_lackcount", staffCount - personCount);
         }
-
         return rows;
     }