机构人员关系及相关接口修改
正在显示
14 个修改的文件
包含
188 行增加
和
33 行删除
... | @@ -53,4 +53,8 @@ public interface CommonSqlMapper { | ... | @@ -53,4 +53,8 @@ public interface CommonSqlMapper { |
53 | * @return | 53 | * @return |
54 | */ | 54 | */ |
55 | String getChildDepartId(@Param(value="departId") String departId); | 55 | String getChildDepartId(@Param(value="departId") String departId); |
56 | |||
57 | String getChildFactorys(@Param(value="departId") String departId); | ||
58 | |||
59 | String getChildDepartByUserId(@Param(value="userId") String userId); | ||
56 | } | 60 | } | ... | ... |
... | @@ -50,7 +50,6 @@ | ... | @@ -50,7 +50,6 @@ |
50 | delete from ${tableName} ${ew.customSqlSegment} | 50 | delete from ${tableName} ${ew.customSqlSegment} |
51 | </delete> | 51 | </delete> |
52 | 52 | ||
53 | |||
54 | <!-- 获取子部门集合--> | 53 | <!-- 获取子部门集合--> |
55 | <select id="getChildDepartId" resultType="java.lang.String"> | 54 | <select id="getChildDepartId" resultType="java.lang.String"> |
56 | SELECT | 55 | SELECT |
... | @@ -73,4 +72,31 @@ | ... | @@ -73,4 +72,31 @@ |
73 | ) | 72 | ) |
74 | </select> | 73 | </select> |
75 | 74 | ||
75 | <select id="getChildFactorys" resultType="java.lang.String"> | ||
76 | SELECT | ||
77 | GROUP_CONCAT( id SEPARATOR ',' ) AS depart_ids | ||
78 | FROM | ||
79 | sys_depart | ||
80 | WHERE | ||
81 | depart_type = '1' | ||
82 | AND ( | ||
83 | parent_id IN | ||
84 | <foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")"> | ||
85 | '${item}' | ||
86 | </foreach> | ||
87 | OR id IN | ||
88 | <foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")"> | ||
89 | '${item}' | ||
90 | </foreach> | ||
91 | OR parent_id IN ( SELECT id FROM sys_depart WHERE parent_id IN | ||
92 | <foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")"> | ||
93 | '${item}' | ||
94 | </foreach> | ||
95 | )) | ||
96 | </select> | ||
97 | <select id="getChildDepartByUserId" resultType="java.lang.String"> | ||
98 | select CONCAT(dep_id,',',dep_ids) AS ids | ||
99 | from sys_user_depart | ||
100 | where user_id = #{userId} | ||
101 | </select> | ||
76 | </mapper> | 102 | </mapper> | ... | ... |
... | @@ -91,4 +91,9 @@ public class CommonSqlServiceImpl implements ICommonSqlService { | ... | @@ -91,4 +91,9 @@ public class CommonSqlServiceImpl implements ICommonSqlService { |
91 | return commonSqlMapper.getChildDepartId(departId); | 91 | return commonSqlMapper.getChildDepartId(departId); |
92 | } | 92 | } |
93 | 93 | ||
94 | @Override | ||
95 | public String getChildFactorys(String departId) { | ||
96 | return commonSqlMapper.getChildFactorys(departId); | ||
97 | } | ||
98 | |||
94 | } | 99 | } | ... | ... |
... | @@ -83,15 +83,12 @@ public class ScreenDataController { | ... | @@ -83,15 +83,12 @@ public class ScreenDataController { |
83 | * 获取累计流量 | 83 | * 获取累计流量 |
84 | * | 84 | * |
85 | * @param departId | 85 | * @param departId |
86 | * @param req | ||
87 | * @return | 86 | * @return |
88 | */ | 87 | */ |
89 | @AutoLog(value = "污水处理情况") | 88 | @AutoLog(value = "污水处理情况") |
90 | @ApiOperation(value = "污水处理情况", notes = "污水处理情况") | 89 | @ApiOperation(value = "污水处理情况", notes = "污水处理情况") |
91 | @GetMapping(value = "/getWsclqk") | 90 | @GetMapping(value = "/getWsclqk") |
92 | public Result<Map<String, Object>> getWsclqk(String departId, | 91 | public Result<Map<String, Object>> getWsclqk(String departId) { |
93 | HttpServletRequest req) { | ||
94 | |||
95 | Result<Map<String, Object>> result = new Result<Map<String, Object>>(); | 92 | Result<Map<String, Object>> result = new Result<Map<String, Object>>(); |
96 | Map<String, Object> resultMap = new HashMap<String, Object>(); | 93 | Map<String, Object> resultMap = new HashMap<String, Object>(); |
97 | JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master"); | 94 | JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master"); | ... | ... |
... | @@ -331,7 +331,8 @@ public class LoginController { | ... | @@ -331,7 +331,8 @@ public class LoginController { |
331 | 331 | ||
332 | // 获取用户部门信息 | 332 | // 获取用户部门信息 |
333 | JSONObject obj = new JSONObject(); | 333 | JSONObject obj = new JSONObject(); |
334 | List<SysDepart> departs = sysDepartService.queryUserDeparts(sysUser.getId()); | 334 | // List<SysDepart> departs = sysDepartService.queryUserDeparts(sysUser.getId()); |
335 | List<SysDepart> departs = sysDepartService.queryUserDepartList(sysUser.getId()); | ||
335 | obj.put("departs", departs); | 336 | obj.put("departs", departs); |
336 | // 获取用户角色信息 | 337 | // 获取用户角色信息 |
337 | List<SysRole> roles = sysRoleService.queryUserRoles(sysUser.getId()); | 338 | List<SysRole> roles = sysRoleService.queryUserRoles(sysUser.getId()); | ... | ... |
... | @@ -13,6 +13,7 @@ import javax.servlet.http.HttpServletRequest; | ... | @@ -13,6 +13,7 @@ import javax.servlet.http.HttpServletRequest; |
13 | import javax.servlet.http.HttpServletResponse; | 13 | import javax.servlet.http.HttpServletResponse; |
14 | 14 | ||
15 | import com.alibaba.fastjson.JSONObject; | 15 | import com.alibaba.fastjson.JSONObject; |
16 | import com.skua.modules.common.service.ICommonSqlService; | ||
16 | import com.skua.modules.system.service.ISysAreaService; | 17 | import com.skua.modules.system.service.ISysAreaService; |
17 | import com.skua.modules.system.service.ISysDictService; | 18 | import com.skua.modules.system.service.ISysDictService; |
18 | import com.skua.modules.system.vo.SysFactoryInfo.*; | 19 | import com.skua.modules.system.vo.SysFactoryInfo.*; |
... | @@ -68,7 +69,7 @@ public class SysFactoryInfoController { | ... | @@ -68,7 +69,7 @@ public class SysFactoryInfoController { |
68 | @Autowired | 69 | @Autowired |
69 | private IWaterQualityInLevelService waterQualityInLevelService; | 70 | private IWaterQualityInLevelService waterQualityInLevelService; |
70 | @Autowired | 71 | @Autowired |
71 | private ISequenceService sequenceService; | 72 | private ICommonSqlService iCommonSqlService; |
72 | @Autowired | 73 | @Autowired |
73 | private ISysAreaService sysAreaService; | 74 | private ISysAreaService sysAreaService; |
74 | @Autowired | 75 | @Autowired |
... | @@ -480,6 +481,13 @@ public class SysFactoryInfoController { | ... | @@ -480,6 +481,13 @@ public class SysFactoryInfoController { |
480 | @GetMapping(value = "/queryByDepartId") | 481 | @GetMapping(value = "/queryByDepartId") |
481 | public Result queryByDepartId(@RequestParam(name = "departId", required = true) String departId) { | 482 | public Result queryByDepartId(@RequestParam(name = "departId", required = true) String departId) { |
482 | Result result = new Result(); | 483 | Result result = new Result(); |
484 | String departs = iCommonSqlService.getChildFactorys(departId); | ||
485 | if(StringUtils.isNotEmpty(departs)){ | ||
486 | String[] departArray = departs.split(","); | ||
487 | if(departArray.length>1){ | ||
488 | departId = departs.split(",")[0]; | ||
489 | } | ||
490 | } | ||
483 | SysFactoryInfoVO sysFactoryInfo = sysFactoryInfoService.getByDepartId(departId); | 491 | SysFactoryInfoVO sysFactoryInfo = sysFactoryInfoService.getByDepartId(departId); |
484 | JSONObject jsonObject = sysDictService.translateTDictValue(sysFactoryInfo); | 492 | JSONObject jsonObject = sysDictService.translateTDictValue(sysFactoryInfo); |
485 | if (sysFactoryInfo == null) { | 493 | if (sysFactoryInfo == null) { | ... | ... |
... | @@ -201,7 +201,7 @@ public class SysUserController { | ... | @@ -201,7 +201,7 @@ public class SysUserController { |
201 | String departs = jsonObject.getString("selecteddeparts"); | 201 | String departs = jsonObject.getString("selecteddeparts"); |
202 | String manageDeparts = jsonObject.getString("selectedmanagedeparts"); | 202 | String manageDeparts = jsonObject.getString("selectedmanagedeparts"); |
203 | sysUserService.editUserWithRole(user, roles); | 203 | sysUserService.editUserWithRole(user, roles); |
204 | sysUserService.editUserWithDepart(user, departs,manageDeparts); | 204 | sysUserService.editUserWithDepart(user, departs, manageDeparts); |
205 | result.success("修改成功!"); | 205 | result.success("修改成功!"); |
206 | } | 206 | } |
207 | } catch (Exception e) { | 207 | } catch (Exception e) { | ... | ... |
... | @@ -158,4 +158,8 @@ public interface SysDepartMapper extends BaseMapper<SysDepart> { | ... | @@ -158,4 +158,8 @@ public interface SysDepartMapper extends BaseMapper<SysDepart> { |
158 | 158 | ||
159 | @Anonymous | 159 | @Anonymous |
160 | SysDepart getById(@Param("pid") String pid); | 160 | SysDepart getById(@Param("pid") String pid); |
161 | |||
162 | List<SysDepart> getChildDepartList(@Param("departIds") String departIds); | ||
163 | |||
164 | List<SysDepart> queryDepartsByIds(@Param("ids") String ids); | ||
161 | } | 165 | } | ... | ... |
... | @@ -332,4 +332,36 @@ | ... | @@ -332,4 +332,36 @@ |
332 | depart_type, | 332 | depart_type, |
333 | depart_order | 333 | depart_order |
334 | </select> | 334 | </select> |
335 | <select id="getChildDepartList" resultType="com.skua.modules.system.entity.SysDepart"> | ||
336 | SELECT | ||
337 | * | ||
338 | FROM | ||
339 | sys_depart | ||
340 | WHERE | ||
341 | parent_id IN | ||
342 | <foreach item="item" index="index" collection="departIds.split(',')" open="(" separator="," close=")"> | ||
343 | '${item}' | ||
344 | </foreach> | ||
345 | OR id IN | ||
346 | <foreach item="item" index="index" collection="departIds.split(',')" open="(" separator="," close=")"> | ||
347 | '${item}' | ||
348 | </foreach> | ||
349 | OR parent_id IN ( SELECT id FROM sys_depart WHERE parent_id IN | ||
350 | <foreach item="item" index="index" collection="departIds.split(',')" open="(" separator="," close=")"> | ||
351 | '${item}' | ||
352 | </foreach> | ||
353 | ) | ||
354 | </select> | ||
355 | |||
356 | <select id="queryDepartsByIds" resultType="com.skua.modules.system.entity.SysDepart"> | ||
357 | SELECT | ||
358 | * | ||
359 | FROM | ||
360 | sys_depart | ||
361 | WHERE | ||
362 | id IN | ||
363 | <foreach item="item" index="index" collection="ids.split(',')" open="(" separator="," close=")"> | ||
364 | '${item}' | ||
365 | </foreach> | ||
366 | </select> | ||
335 | </mapper> | 367 | </mapper> | ... | ... |
... | @@ -180,4 +180,6 @@ public interface ISysDepartService extends IService<SysDepart>{ | ... | @@ -180,4 +180,6 @@ public interface ISysDepartService extends IService<SysDepart>{ |
180 | String getChildDepartId(String departIds); | 180 | String getChildDepartId(String departIds); |
181 | 181 | ||
182 | List<SysDeptUserVO> queryDeptAndUserTreeList(String departId,String userType); | 182 | List<SysDeptUserVO> queryDeptAndUserTreeList(String departId,String userType); |
183 | |||
184 | List<SysDepart> queryUserDepartList(String userId); | ||
183 | } | 185 | } | ... | ... |
... | @@ -10,9 +10,12 @@ import com.skua.core.service.ISequenceService; | ... | @@ -10,9 +10,12 @@ import com.skua.core.service.ISequenceService; |
10 | import com.skua.core.util.ConvertUtils; | 10 | import com.skua.core.util.ConvertUtils; |
11 | import com.skua.core.util.JwtUtil; | 11 | import com.skua.core.util.JwtUtil; |
12 | import com.skua.core.util.YouBianCodeUtil; | 12 | import com.skua.core.util.YouBianCodeUtil; |
13 | import com.skua.modules.common.mapper.CommonSqlMapper; | ||
13 | import com.skua.modules.system.entity.SysDepart; | 14 | import com.skua.modules.system.entity.SysDepart; |
14 | import com.skua.modules.system.entity.SysUser; | 15 | import com.skua.modules.system.entity.SysUser; |
16 | import com.skua.modules.system.entity.SysUserDepart; | ||
15 | import com.skua.modules.system.mapper.SysDepartMapper; | 17 | import com.skua.modules.system.mapper.SysDepartMapper; |
18 | import com.skua.modules.system.mapper.SysUserDepartMapper; | ||
16 | import com.skua.modules.system.mapper.SysUserMapper; | 19 | import com.skua.modules.system.mapper.SysUserMapper; |
17 | import com.skua.modules.system.model.DepartIdModel; | 20 | import com.skua.modules.system.model.DepartIdModel; |
18 | import com.skua.modules.system.model.SysDepartTreeModel; | 21 | import com.skua.modules.system.model.SysDepartTreeModel; |
... | @@ -28,6 +31,7 @@ import org.springframework.cache.annotation.Cacheable; | ... | @@ -28,6 +31,7 @@ import org.springframework.cache.annotation.Cacheable; |
28 | import org.springframework.stereotype.Service; | 31 | import org.springframework.stereotype.Service; |
29 | import org.springframework.transaction.annotation.Transactional; | 32 | import org.springframework.transaction.annotation.Transactional; |
30 | 33 | ||
34 | import javax.annotation.Resource; | ||
31 | import java.util.*; | 35 | import java.util.*; |
32 | 36 | ||
33 | /** | 37 | /** |
... | @@ -41,6 +45,10 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart | ... | @@ -41,6 +45,10 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart |
41 | private ISequenceService sequenceService; | 45 | private ISequenceService sequenceService; |
42 | @Autowired | 46 | @Autowired |
43 | private SysUserMapper sysUserMapper; | 47 | private SysUserMapper sysUserMapper; |
48 | @Autowired | ||
49 | private SysUserDepartMapper sysUserDepartMapper; | ||
50 | @Resource | ||
51 | private CommonSqlMapper commonSqlMapper; | ||
44 | 52 | ||
45 | /*** | 53 | /*** |
46 | * 查询子集所有的部门 | 54 | * 查询子集所有的部门 |
... | @@ -83,7 +91,14 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart | ... | @@ -83,7 +91,14 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart |
83 | sysDepartQueryWrapper.orderByAsc("depart_order"); | 91 | sysDepartQueryWrapper.orderByAsc("depart_order"); |
84 | list = list(sysDepartQueryWrapper); | 92 | list = list(sysDepartQueryWrapper); |
85 | // 调用wrapTreeDataToTreeList方法生成树状数据 | 93 | // 调用wrapTreeDataToTreeList方法生成树状数据 |
86 | List<SysDepartTreeModel> listResult = FindsDepartsChildrenUtil.wrapTreeDataToTreeList(list,orgCode); | 94 | List<SysDepartTreeModel> listResult = new ArrayList<>(); |
95 | String[] orgCodeArr = orgCode.split(","); | ||
96 | for (String jtCode : orgCodeArr) { | ||
97 | List<SysDepartTreeModel> jtList = FindsDepartsChildrenUtil.wrapTreeDataToTreeList(list,jtCode); | ||
98 | if(jtList.size() > 0){ | ||
99 | listResult.addAll(jtList); | ||
100 | } | ||
101 | } | ||
87 | if (!StringUtils.isBlank(departType)) { | 102 | if (!StringUtils.isBlank(departType)) { |
88 | listResult = filterDepartList(listResult); | 103 | listResult = filterDepartList(listResult); |
89 | } | 104 | } |
... | @@ -121,10 +136,14 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart | ... | @@ -121,10 +136,14 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart |
121 | public String getJTCodeByUserId(String userId) { | 136 | public String getJTCodeByUserId(String userId) { |
122 | String jtCode = ""; | 137 | String jtCode = ""; |
123 | List<SysDepart> list = new ArrayList<>(); | 138 | List<SysDepart> list = new ArrayList<>(); |
124 | list = sysDepartMapper.queryUserDeparts(userId); | 139 | String ids = commonSqlMapper.getChildDepartByUserId(userId); |
140 | list = sysDepartMapper.queryDepartsByIds(ids); | ||
141 | // list = sysDepartMapper.queryUserDeparts(userId); | ||
125 | if(list.size() > 0){ | 142 | if(list.size() > 0){ |
126 | //jtCode = list.get(0).getOrgCode().substring(0,3); | 143 | // jtCode = list.get(0).getOrgCode(); |
127 | jtCode = list.get(0).getOrgCode(); | 144 | for (SysDepart sysDepart : list) { |
145 | jtCode = sysDepart.getOrgCode() + "," + jtCode; | ||
146 | } | ||
128 | }else{ | 147 | }else{ |
129 | jtCode = ""; | 148 | jtCode = ""; |
130 | } | 149 | } |
... | @@ -141,7 +160,15 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart | ... | @@ -141,7 +160,15 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart |
141 | query.orderByAsc(SysDepart::getDepartOrder); | 160 | query.orderByAsc(SysDepart::getDepartOrder); |
142 | List<SysDepart> list = this.list(query); | 161 | List<SysDepart> list = this.list(query); |
143 | // 调用wrapTreeDataToTreeList方法生成树状数据 | 162 | // 调用wrapTreeDataToTreeList方法生成树状数据 |
144 | List<DepartIdModel> listResult = FindsDepartsChildrenUtil.wrapTreeDataToDepartIdTreeList(list,jtCode); | 163 | // List<DepartIdModel> listResult = FindsDepartsChildrenUtil.wrapTreeDataToDepartIdTreeList(list,jtCode); |
164 | List<DepartIdModel> listResult = new ArrayList<>(); | ||
165 | String[] orgCodeArr = jtCode.split(","); | ||
166 | for (String orgCode : orgCodeArr) { | ||
167 | List<DepartIdModel> jtList = FindsDepartsChildrenUtil.wrapTreeDataToDepartIdTreeList(list,orgCode); | ||
168 | if(jtList.size() > 0){ | ||
169 | listResult.addAll(jtList); | ||
170 | } | ||
171 | } | ||
145 | return listResult; | 172 | return listResult; |
146 | } | 173 | } |
147 | 174 | ||
... | @@ -365,11 +392,18 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart | ... | @@ -365,11 +392,18 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart |
365 | if(BaseContextHandler.getUserId().equals("superadmin")){ | 392 | if(BaseContextHandler.getUserId().equals("superadmin")){ |
366 | list = sysDepartMapper.getSuperDepartTree(); | 393 | list = sysDepartMapper.getSuperDepartTree(); |
367 | }else{ | 394 | }else{ |
368 | //String jtCode = getJTCodeByUserId(BaseContextHandler.getUserCode()); | ||
369 | list = sysDepartMapper.getDepartTree(jtCode); | 395 | list = sysDepartMapper.getDepartTree(jtCode); |
370 | } | 396 | } |
371 | // 调用wrapTreeDataToTreeList方法生成树状数据 | 397 | // 调用wrapTreeDataToTreeList方法生成树状数据 |
372 | List<DepartIdModel> listResult = FindsDepartsChildrenUtil.wrapTreeDataToDepartIdTreeList(list,jtCode); | 398 | // List<DepartIdModel> listResult = FindsDepartsChildrenUtil.wrapTreeDataToDepartIdTreeList(list,jtCode); |
399 | List<DepartIdModel> listResult = new ArrayList<>(); | ||
400 | String[] orgCodeArr = jtCode.split(","); | ||
401 | for (String orgCode : orgCodeArr) { | ||
402 | List<DepartIdModel> jtList = FindsDepartsChildrenUtil.wrapTreeDataToDepartIdTreeList(list,orgCode); | ||
403 | if(jtList.size() > 0){ | ||
404 | listResult.addAll(jtList); | ||
405 | } | ||
406 | } | ||
373 | return listResult; | 407 | return listResult; |
374 | } | 408 | } |
375 | 409 | ||
... | @@ -454,12 +488,21 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart | ... | @@ -454,12 +488,21 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart |
454 | @Override | 488 | @Override |
455 | public Map<String,String> getAllDepartByUserId(String userId) { | 489 | public Map<String,String> getAllDepartByUserId(String userId) { |
456 | Map<String,String> map = new HashMap<String,String>(); | 490 | Map<String,String> map = new HashMap<String,String>(); |
491 | String departs = ""; | ||
457 | //获取用户所属部门 | 492 | //获取用户所属部门 |
458 | Map<String,Object> sysDepartsMap = sysDepartMapper.queryUserDepartsMap(userId); | 493 | Map<String,Object> sysDepartsMap = sysDepartMapper.queryUserDepartsMap(userId); |
459 | //获取用户部门情况 | 494 | //获取用户部门情况 |
460 | map.put("orgCode", ConvertUtils.getString(sysDepartsMap.get("orgCode"))); | 495 | map.put("orgCode", ConvertUtils.getString(sysDepartsMap.get("orgCode"))); |
461 | map.put("realDepartId", ConvertUtils.getString(sysDepartsMap.get("depId")));//去重 | 496 | map.put("realDepartId", ConvertUtils.getString(sysDepartsMap.get("depId")));//去重 |
462 | map.put("departIds", ConvertUtils.getString(sysDepartsMap.get("depIds")));//去重 | 497 | List<SysDepart> departList = queryUserDepartList(userId); |
498 | if(departList.size() > 0){ | ||
499 | for (SysDepart sysDepart : departList) { | ||
500 | departs = sysDepart.getId() + "," + departs; | ||
501 | } | ||
502 | }else{ | ||
503 | departs = ConvertUtils.getString(sysDepartsMap.get("depIds")); | ||
504 | } | ||
505 | map.put("departIds", departs);//去重 | ||
463 | return map; | 506 | return map; |
464 | } | 507 | } |
465 | 508 | ||
... | @@ -511,4 +554,22 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart | ... | @@ -511,4 +554,22 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart |
511 | return list; | 554 | return list; |
512 | } | 555 | } |
513 | 556 | ||
557 | @Override | ||
558 | public List<SysDepart> queryUserDepartList(String userId) { | ||
559 | List<SysDepart> departList = new ArrayList<>(); | ||
560 | String departs = ""; | ||
561 | List<SysUserDepart> list = sysUserDepartMapper.getUserDepartByUid(userId); | ||
562 | if(list.size() > 0){ | ||
563 | SysUserDepart userDepart = list.get(0); | ||
564 | if(ConvertUtils.isNotEmpty(userDepart.getDepId())){ | ||
565 | departs = userDepart.getDepId() + "," + departs; | ||
566 | } | ||
567 | if(ConvertUtils.isNotEmpty(userDepart.getDepIds())){ | ||
568 | departs = userDepart.getDepIds() + "," + departs; | ||
569 | } | ||
570 | departList = sysDepartMapper.getChildDepartList(departs); | ||
571 | } | ||
572 | return departList; | ||
573 | } | ||
574 | |||
514 | } | 575 | } | ... | ... |
... | @@ -18,6 +18,7 @@ import com.skua.modules.alarmtmp.service.AlarmParamStandardConfigService; | ... | @@ -18,6 +18,7 @@ import com.skua.modules.alarmtmp.service.AlarmParamStandardConfigService; |
18 | import com.skua.modules.alarmtmp.service.AlarmRuleConfigService; | 18 | import com.skua.modules.alarmtmp.service.AlarmRuleConfigService; |
19 | import com.skua.modules.alarmtmp.service.AlarmRuleLevelConfigService; | 19 | import com.skua.modules.alarmtmp.service.AlarmRuleLevelConfigService; |
20 | import com.skua.modules.alarmtmp.service.IAlarmRuleLevelConfigTemplateService; | 20 | import com.skua.modules.alarmtmp.service.IAlarmRuleLevelConfigTemplateService; |
21 | import com.skua.modules.common.mapper.CommonSqlMapper; | ||
21 | import com.skua.modules.system.datestandard.entity.SysMonitorMetricInfo; | 22 | import com.skua.modules.system.datestandard.entity.SysMonitorMetricInfo; |
22 | import com.skua.modules.system.datestandard.service.ISysMonitorMetricInfoService; | 23 | import com.skua.modules.system.datestandard.service.ISysMonitorMetricInfoService; |
23 | import com.skua.modules.system.entity.SysDepart; | 24 | import com.skua.modules.system.entity.SysDepart; |
... | @@ -39,6 +40,7 @@ import org.springframework.beans.factory.annotation.Autowired; | ... | @@ -39,6 +40,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
39 | import org.springframework.stereotype.Service; | 40 | import org.springframework.stereotype.Service; |
40 | import org.springframework.transaction.annotation.Transactional; | 41 | import org.springframework.transaction.annotation.Transactional; |
41 | 42 | ||
43 | import javax.annotation.Resource; | ||
42 | import java.util.*; | 44 | import java.util.*; |
43 | import java.util.stream.Collectors; | 45 | import java.util.stream.Collectors; |
44 | 46 | ||
... | @@ -48,10 +50,12 @@ import java.util.stream.Collectors; | ... | @@ -48,10 +50,12 @@ import java.util.stream.Collectors; |
48 | @Service | 50 | @Service |
49 | public class SysFactoryInfoServiceImpl extends ServiceImpl<SysFactoryInfoMapper, SysFactoryInfo> implements ISysFactoryInfoService { | 51 | public class SysFactoryInfoServiceImpl extends ServiceImpl<SysFactoryInfoMapper, SysFactoryInfo> implements ISysFactoryInfoService { |
50 | 52 | ||
51 | @Autowired | 53 | @Resource |
52 | private SysFactoryInfoMapper sysFactoryInfoMapper; | 54 | private SysFactoryInfoMapper sysFactoryInfoMapper; |
53 | @Autowired | 55 | @Resource |
54 | private SysUserMapper sysUserMapper; | 56 | private SysUserMapper sysUserMapper; |
57 | @Resource | ||
58 | private CommonSqlMapper commonSqlMapper; | ||
55 | @Autowired | 59 | @Autowired |
56 | private ISysDepartService sysDepartService; | 60 | private ISysDepartService sysDepartService; |
57 | @Autowired | 61 | @Autowired |
... | @@ -69,8 +73,14 @@ public class SysFactoryInfoServiceImpl extends ServiceImpl<SysFactoryInfoMapper, | ... | @@ -69,8 +73,14 @@ public class SysFactoryInfoServiceImpl extends ServiceImpl<SysFactoryInfoMapper, |
69 | @Override | 73 | @Override |
70 | public SysFactoryInfoVO getByDepartId(String departId) { | 74 | public SysFactoryInfoVO getByDepartId(String departId) { |
71 | SysFactoryInfoVO sysFactoryInfo = new SysFactoryInfoVO(); | 75 | SysFactoryInfoVO sysFactoryInfo = new SysFactoryInfoVO(); |
76 | String departs = commonSqlMapper.getChildFactorys(departId); | ||
77 | if(StringUtils.isNotEmpty(departs)){ | ||
78 | String[] departArray = departs.split(","); | ||
79 | if(departArray.length>1){ | ||
80 | departId = departs.split(",")[0]; | ||
81 | } | ||
82 | } | ||
72 | //获取厂站基本信息 | 83 | //获取厂站基本信息 |
73 | |||
74 | sysFactoryInfo = sysFactoryInfoMapper.getByDepartId(departId); | 84 | sysFactoryInfo = sysFactoryInfoMapper.getByDepartId(departId); |
75 | SysDepart sysDepart = sysDepartService.getById(departId); | 85 | SysDepart sysDepart = sysDepartService.getById(departId); |
76 | if (sysDepart != null && "-1".equals(sysDepart.getDepartType())) { | 86 | if (sysDepart != null && "-1".equals(sysDepart.getDepartType())) { | ... | ... |
... | @@ -209,13 +209,15 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl | ... | @@ -209,13 +209,15 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl |
209 | @Transactional | 209 | @Transactional |
210 | public void addUserWithDepart(SysUser user, String selectedParts, String selectedManageDeparts) { | 210 | public void addUserWithDepart(SysUser user, String selectedParts, String selectedManageDeparts) { |
211 | // this.save(user); //保存角色的时候已经添加过一次了 | 211 | // this.save(user); //保存角色的时候已经添加过一次了 |
212 | if (ConvertUtils.isNotEmpty(selectedParts)) { | 212 | // if (ConvertUtils.isNotEmpty(selectedParts)) { |
213 | String[] arr = selectedParts.split(","); | 213 | // String[] arr = selectedParts.split(","); |
214 | for (String deaprtId : arr) { | 214 | // for (String deaprtId : arr) { |
215 | SysUserDepart userDeaprt = new SysUserDepart(user.getId(), deaprtId, selectedManageDeparts); | 215 | // SysUserDepart userDeaprt = new SysUserDepart(user.getId(), deaprtId, selectedManageDeparts); |
216 | sysUserDepartMapper.insert(userDeaprt); | 216 | // sysUserDepartMapper.insert(userDeaprt); |
217 | } | 217 | // } |
218 | } | 218 | // } |
219 | SysUserDepart userDeaprt = new SysUserDepart(user.getId(), selectedParts, selectedManageDeparts); | ||
220 | sysUserDepartMapper.insert(userDeaprt); | ||
219 | } | 221 | } |
220 | 222 | ||
221 | @Override | 223 | @Override |
... | @@ -224,13 +226,15 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl | ... | @@ -224,13 +226,15 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl |
224 | this.updateById(user); //更新角色的时候已经更新了一次了,可以再跟新一次 | 226 | this.updateById(user); //更新角色的时候已经更新了一次了,可以再跟新一次 |
225 | //先删后加 | 227 | //先删后加 |
226 | sysUserDepartMapper.delete(new QueryWrapper<SysUserDepart>().lambda().eq(SysUserDepart::getUserId, user.getId())); | 228 | sysUserDepartMapper.delete(new QueryWrapper<SysUserDepart>().lambda().eq(SysUserDepart::getUserId, user.getId())); |
227 | if (ConvertUtils.isNotEmpty(departs)) { | 229 | // if (ConvertUtils.isNotEmpty(departs)) { |
228 | String[] arr = departs.split(","); | 230 | // String[] arr = departs.split(","); |
229 | for (String departId : arr) { | 231 | // for (String departId : arr) { |
230 | SysUserDepart userDepart = new SysUserDepart(user.getId(), departId, selectedManageDeparts); | 232 | // SysUserDepart userDepart = new SysUserDepart(user.getId(), departId, selectedManageDeparts); |
231 | sysUserDepartMapper.insert(userDepart); | 233 | // sysUserDepartMapper.insert(userDepart); |
232 | } | 234 | // } |
233 | } | 235 | // } |
236 | SysUserDepart userDepart = new SysUserDepart(user.getId(), departs, selectedManageDeparts); | ||
237 | sysUserDepartMapper.insert(userDepart); | ||
234 | } | 238 | } |
235 | 239 | ||
236 | /** | 240 | /** | ... | ... |
-
请 注册 或 登录 后发表评论