yusm 1 місяць тому
батько
коміт
d5c4a10eec

+ 11 - 9
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/controller/WxCorpInfoController.java

@@ -365,16 +365,18 @@ public class WxCorpInfoController {
                         if(control.equals("Contact")){
                             JSONArray departments = value.getJSONArray("departments");
                             String openapi_id = departments.getJSONObject(0).getString("openapi_id");
-                            Optional<Department> first1 = departmentList.stream().filter(d -> d.getCorpwxDeptid().equals(Integer.valueOf(openapi_id))).findFirst();
-                            if(first1.isPresent()){
-                                plan.setStationId(first1.get().getDepartmentId());
-                                plan.setStationName(first1.get().getDepartmentName());
-                                plan.setForemanId(first1.get().getManagerId());
-                                Optional<User> first2 = userList.stream().filter(u -> u.getId().equals(first1.get().getManagerId())).findFirst();
-                                if(first2.isPresent()){
-                                    plan.setForemanName(first2.get().getName());
+                            if (org.apache.commons.lang3.StringUtils.isNotEmpty(openapi_id)){
+                                Optional<Department> first1 = departmentList.stream().filter(d -> d.getCorpwxDeptid().equals(Integer.valueOf(openapi_id))).findFirst();
+                                if(first1.isPresent()){
+                                    plan.setStationId(first1.get().getDepartmentId());
+                                    plan.setStationName(first1.get().getDepartmentName());
+                                    plan.setForemanId(first1.get().getManagerId());
+                                    Optional<User> first2 = userList.stream().filter(u -> u.getId().equals(first1.get().getManagerId())).findFirst();
+                                    if(first2.isPresent()){
+                                        plan.setForemanName(first2.get().getName());
+                                    }
+                                    deptId=first1.get().getDepartmentId();
                                 }
-                                deptId=first1.get().getDepartmentId();
                             }
                         }
                     }