From be965e67230bf964d451d555f0be0f3b3d13dfdb Mon Sep 17 00:00:00 2001
From: liyj <1003249715@qq.com>
Date: Tue, 10 Sep 2024 17:36:10 +0800
Subject: [PATCH] 1、组织架构调整
---
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUserService.java | 39 +++++++++++++++------------------------
1 files changed, 15 insertions(+), 24 deletions(-)
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUserService.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUserService.java
index 5411841..08bd4a3 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUserService.java
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUserService.java
@@ -10,7 +10,6 @@
import cn.huge.module.client.api.impl.UtilsClientImpl;
import cn.huge.module.constant.BaseConsts;
import cn.huge.module.ctrole.domain.po.CtRole;
-import cn.huge.module.ctrole.service.CtRoleService;
import cn.huge.module.ctuser.dao.mapper.CtUserMapper;
import cn.huge.module.ctuser.domain.po.*;
import cn.huge.module.ctuser.dto.CtUserSaveDTO;
@@ -18,6 +17,8 @@
import cn.huge.module.cust.constant.UserBaseConsts;
import cn.huge.module.cust.dto.CtUserDTO;
import cn.huge.module.redis.constant.RedisKeyConsts;
+import cn.huge.module.rsoper.domain.po.RsRole;
+import cn.huge.module.rsoper.service.RsRoleService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -65,11 +66,11 @@
@Autowired
private CtUseroleService ctUseroleService;
@Autowired
- private CtRoleService ctRoleService;
- @Autowired
private CtUsepostService ctUsepostService;
@Autowired
private CtDeptService ctDeptService;
+ @Autowired
+ private RsRoleService rsRoleService;
@Autowired
private UtilsClientImpl utilsClient;
@@ -253,23 +254,13 @@
}
result.put("units", SelectTermUtils.createTreeByFirst(unitSelectTerms, loginUser.getUnitId()));
- // 角色条件
- QueryWrapper<CtRole> ctRoleQueryWrapper = new QueryWrapper<>();
- ctRoleQueryWrapper.eq("unit_id", loginUser.getUnitId());
- //判断是否为村居(村居不应该有调委会管理员角色)
- QueryWrapper<CtUnit> ctUnitQueryWrapper1 = new QueryWrapper<>();
- ctUnitQueryWrapper1.eq("id", loginUser.getUnitId()).eq("cust_id", loginUser.getCustId())
- .select("unit_type");
- CtUnit ctUnit = ctUnitService.getOne(ctUnitQueryWrapper1);
- if (ctUnit.getUnitType() == UserBaseConsts.UNIT_TYPE_4) {
- ctRoleQueryWrapper.ne("role_code", RoleBaseEnum.ROLE_1.getIndex());
- }
- List<CtRole> ctRoleList = ctRoleService.list(ctRoleQueryWrapper);
+ // 查询可选角色
List<SelectTermDTO> roleSelectTerms = new ArrayList<>();
- for (CtRole ctRole : ctRoleList) {
+ List<RsRole> rsRoleList = rsRoleService.list();
+ for (RsRole rsRole : rsRoleList) {
SelectTermDTO selectTerm = new SelectTermDTO();
- selectTerm.setValue(ctRole.getRoleCode());
- selectTerm.setLabel(ctRole.getName());
+ selectTerm.setValue(rsRole.getId());
+ selectTerm.setLabel(rsRole.getName());
roleSelectTerms.add(selectTerm);
}
result.put("roles", roleSelectTerms);
@@ -391,9 +382,9 @@
for (CtUserole ctUserole : ctUseroleList) {
ctUserole.setId(utilsClient.getNewTimeId());
ctUserole.setUserId(ctUser.getId());
- CtRole ctRole = ctRoleService.getByUnitIdAndRoleId(ctUser.getUnitId(), ctUserole.getRoleId());
- ctUserole.setRoleId(ctRole.getId());
- ctUserole.setRoleCode(ctRole.getRoleCode());
+ RsRole rsRole = rsRoleService.getById(ctUserole.getRoleId());
+ ctUserole.setRoleId(rsRole.getId());
+ ctUserole.setRoleCode(rsRole.getId());
ctUserole.setCustId(ctUser.getCustId());
ctUserole.setCreateTime(nowDate);
ctUserole.setUpdateTime(nowDate);
@@ -442,9 +433,9 @@
ctUserole.setId(utilsClient.getNewTimeId());
ctUserole.setUserId(ctUser.getId());
ctUserole.setCustId(ctUser.getCustId());
- CtRole ctRole = ctRoleService.getByUnitIdAndRoleId(ctUser.getUnitId(), ctUserole.getRoleId());
- ctUserole.setRoleId(ctRole.getId());
- ctUserole.setRoleCode(ctRole.getRoleCode());
+ RsRole rsRole = rsRoleService.getById(ctUserole.getRoleId());
+ ctUserole.setRoleId(rsRole.getId());
+ ctUserole.setRoleCode(rsRole.getId());
ctUserole.setCreateTime(nowDate);
ctUserole.setUpdateTime(nowDate);
ctUseroleService.save(ctUserole);
--
Gitblit v1.8.0