cczhang 1 month ago
parent
commit
4320cca2df
1 changed files with 8 additions and 4 deletions
  1. 8
    4
      src/main/java/com/horizon/custom/GroupOrPositionUtil.java

+ 8
- 4
src/main/java/com/horizon/custom/GroupOrPositionUtil.java View File

46
             Map<String, String> userMap = organization.getUserById(userId, HorizonCore.TENANT_IDENTIFIER.value());
46
             Map<String, String> userMap = organization.getUserById(userId, HorizonCore.TENANT_IDENTIFIER.value());
47
             String deptId = userMap.get("dept_id");
47
             String deptId = userMap.get("dept_id");
48
             String fDeptId =  GroupOrPositionUtil.queryFDept(deptId);
48
             String fDeptId =  GroupOrPositionUtil.queryFDept(deptId);
49
-
49
+            LOGGER.info("deptId:{}_fDeptId:{}", deptId, fDeptId);
50
             // 对比用户所属部门,如果相同,则添加到userIds中
50
             // 对比用户所属部门,如果相同,则添加到userIds中
51
             for (Map<String, String> user : userByIDs) {
51
             for (Map<String, String> user : userByIDs) {
52
                 String fDeptIdTmp =  GroupOrPositionUtil.queryFDept(user.get("dept_id"));
52
                 String fDeptIdTmp =  GroupOrPositionUtil.queryFDept(user.get("dept_id"));
53
+                LOGGER.info("deptId:{}_fDeptIdTmp:{}_fDeptIdTmp:{}", user.get("dept_id"), fDeptIdTmp, fDeptId);
53
                 if (fDeptIdTmp.equals(fDeptId)) {
54
                 if (fDeptIdTmp.equals(fDeptId)) {
54
                     userIds += user.get("id") + "/" + orgId + ";";
55
                     userIds += user.get("id") + "/" + orgId + ";";
55
                     LOGGER.info("获取到{}里同步人员id:{}", orgId, user.get("id"));
56
                     LOGGER.info("获取到{}里同步人员id:{}", orgId, user.get("id"));
101
 
102
 
102
     public static String queryFDept(String deptId){
103
     public static String queryFDept(String deptId){
103
         // 机关部门,不取父ID,直接返回
104
         // 机关部门,不取父ID,直接返回
104
-        if(deptId.startsWith("D0101")){
105
-            return deptId;
106
-        }
107
         //D0110  D011003 质计中心
105
         //D0110  D011003 质计中心
108
         //D0101  D010101机关
106
         //D0101  D010101机关
109
         String dbIdentifier = "jl_sgiip";
107
         String dbIdentifier = "jl_sgiip";
116
 
114
 
117
 
115
 
118
         String fDeptId = (String) resmap.get("f_id");
116
         String fDeptId = (String) resmap.get("f_id");
117
+        String deptCode= (String) resmap.get("dept_code");
119
 
118
 
120
         if(fDeptId.length() > 4){
119
         if(fDeptId.length() > 4){
121
             fDeptId = fDeptId.substring(0, 5); // 截取前5位
120
             fDeptId = fDeptId.substring(0, 5); // 截取前5位
121
+        } else {
122
+            fDeptId = deptCode;
123
+        }
124
+        if(deptCode.startsWith("D0101")){
125
+            return deptCode;
122
         }
126
         }
123
         return fDeptId;
127
         return fDeptId;
124
     }
128
     }

Loading…
Cancel
Save