diff --git a/src/main/java/com/zcloud/service/xgf/impl/XgfUserServiceImpl.java b/src/main/java/com/zcloud/service/xgf/impl/XgfUserServiceImpl.java index 4d494ec6..9c2d798e 100644 --- a/src/main/java/com/zcloud/service/xgf/impl/XgfUserServiceImpl.java +++ b/src/main/java/com/zcloud/service/xgf/impl/XgfUserServiceImpl.java @@ -1,5 +1,6 @@ package com.zcloud.service.xgf.impl; +import com.alibaba.fastjson.JSONObject; import com.yomahub.liteflow.core.FlowExecutor; import com.yomahub.liteflow.flow.LiteflowResponse; import com.zcloud.entity.Page; @@ -102,17 +103,25 @@ public class XgfUserServiceImpl implements XgfUserService { /* 主管部门 */ // 2024-03-20 liu jun :为了兼容新老数据这里做特殊处理 if (x.get("MAIN_DEPARTMENT_ID") != null && StringUtils.isNotBlank(x.get("MAIN_DEPARTMENT_ID").toString())) { - if (x.getString("MAIN_DEPARTMENT_ID").contains(",")) { - String[] mainDepartmentIds = x.getString("MAIN_DEPARTMENT_ID").split(","); + if (x.getString("MAIN_DEPARTMENT_ID").contains("]")) { + List mainDepartmentIds = JSONObject.parseArray(x.getString("MAIN_DEPARTMENT_ID"),String.class); + List mainDepartmentNames = new ArrayList<>(); for (String mainDepartmentId : mainDepartmentIds) { condition.clear(); condition.put("DEPARTMENT_ID", mainDepartmentId); regDepartmentEntity = departmentService.getCorpDepartment(condition); if (regDepartmentEntity != null && regDepartmentEntity.size() > 0) { - x.put("MAIN_DEPARTMENT_NAME", x.getString("MAIN_DEPARTMENT_NAME") + "," + regDepartmentEntity.get("NAME")); - break; + mainDepartmentNames.add(regDepartmentEntity.getString("NAME")); } } + x.put("MAIN_DEPARTMENT_NAME", StringUtils.join(mainDepartmentNames, ",")); + }else { + condition.clear(); + condition.put("DEPARTMENT_ID", x.get("MAIN_DEPARTMENT_ID")); + regDepartmentEntity = departmentService.getCorpDepartment(condition); + if (regDepartmentEntity != null && regDepartmentEntity.size() > 0) { + x.put("MAIN_DEPARTMENT_NAME", regDepartmentEntity.get("NAME")); + } } } else { throw new RuntimeException("主管部门ID不能为空"); @@ -136,12 +145,30 @@ public class XgfUserServiceImpl implements XgfUserService { x.put("MANAGER_DEPARTMENT_NAME", regDepartmentEntity.get("NAME")); } /* 主管部门 */ - condition.clear(); - condition.put("DEPARTMENT_ID", x.get("MAIN_DEPARTMENT_ID")); - regDepartmentEntity = departmentService.getCorpDepartment(condition); - x.put("MAIN_DEPARTMENT_NAME", regDepartmentEntity.get("NAME")); - if (regDepartmentEntity.size() > 0) { - x.put("MAIN_DEPARTMENT_NAME", regDepartmentEntity.get("NAME")); + // 2024-03-20 liu jun :为了兼容新老数据这里做特殊处理 + if (x.get("MAIN_DEPARTMENT_ID") != null && StringUtils.isNotBlank(x.get("MAIN_DEPARTMENT_ID").toString())) { + if (x.getString("MAIN_DEPARTMENT_ID").contains("]")) { + List mainDepartmentIds = JSONObject.parseArray(x.getString("MAIN_DEPARTMENT_ID"), String.class); + List mainDepartmentNames = new ArrayList<>(); + for (String mainDepartmentId : mainDepartmentIds) { + condition.clear(); + condition.put("DEPARTMENT_ID", mainDepartmentId); + regDepartmentEntity = departmentService.getCorpDepartment(condition); + if (regDepartmentEntity != null && regDepartmentEntity.size() > 0) { + mainDepartmentNames.add(regDepartmentEntity.getString("NAME")); + } + } + x.put("MAIN_DEPARTMENT_NAME", StringUtils.join(mainDepartmentNames, ",")); + } else { + condition.clear(); + condition.put("DEPARTMENT_ID", x.get("MAIN_DEPARTMENT_ID")); + regDepartmentEntity = departmentService.getCorpDepartment(condition); + if (regDepartmentEntity != null && regDepartmentEntity.size() > 0) { + x.put("MAIN_DEPARTMENT_NAME", regDepartmentEntity.get("NAME")); + } + } + } else { + throw new RuntimeException("主管部门ID不能为空"); } x.put("IS_DELETE", "0"); x.put("VALID_FLAG", "1"); diff --git a/src/main/resources/mybatis/datasource/xgf/XgfUserMapper.xml b/src/main/resources/mybatis/datasource/xgf/XgfUserMapper.xml index 8a4169db..a2a2e44c 100644 --- a/src/main/resources/mybatis/datasource/xgf/XgfUserMapper.xml +++ b/src/main/resources/mybatis/datasource/xgf/XgfUserMapper.xml @@ -380,6 +380,7 @@ or (c.APPOINT_SIX_USER_ID = #{USER_ID} and c.FLOWS_STEP = '6') or (c.APPOINT_SEVEN_USER_ID = #{USER_ID} and c.FLOWS_STEP = '7') ) + and a.VALID_FLAG = '1'