| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | @Autowired |
| | | private CtUseroleService ctUseroleService; |
| | | @Autowired |
| | | private CtRoleService ctRoleService; |
| | | @Autowired |
| | | private CtUsepostService ctUsepostService; |
| | | @Autowired |
| | | private CtDeptService ctDeptService; |
| | | @Autowired |
| | | private RsRoleService rsRoleService; |
| | | |
| | | @Autowired |
| | | private UtilsClientImpl utilsClient; |
| | |
| | | } |
| | | 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); |
| | |
| | | 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); |
| | |
| | | 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); |