From 3f3e2dff662c1319908b6d4460127231943ecb01 Mon Sep 17 00:00:00 2001 From: liujun Date: Wed, 20 Mar 2024 16:08:59 +0800 Subject: [PATCH] =?UTF-8?q?bug=EF=BC=9A=E5=9B=A0=E4=B8=BB=E7=AE=A1?= =?UTF-8?q?=E9=83=A8=E9=97=A8=E5=8F=98=E5=A4=9A=E4=B8=AA=EF=BC=8C=E9=80=A0?= =?UTF-8?q?=E6=88=90=E4=BA=BA=E5=91=98=E6=8E=A8=E9=80=81=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/xgf/impl/XgfUserServiceImpl.java | 47 +++++++++++++++---- .../mybatis/datasource/xgf/XgfUserMapper.xml | 1 + 2 files changed, 38 insertions(+), 10 deletions(-) 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'