| | |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.core.domain.entity.*; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.DtoConversionUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.bean.BeanValidators; |
| | |
| | | /** |
| | | * 通过用户名查询用户 |
| | | * |
| | | * @param userName 用户名 |
| | | * @param phone 用户名 |
| | | * @return 用户对象信息 |
| | | */ |
| | | @Override |
| | |
| | | sysUserDept.setDeptType("2"); |
| | | sysUserDeptBQs = sysUserDeptMapper.selectSysUserDeptList(sysUserDept); |
| | | } |
| | | if (StringUtils.isNotEmpty(userName) && userName.equals("admin")) { |
| | | //如果是admin,只能去sys_dept去取数据 |
| | | SysDept dept = new SysDept(); |
| | | dept.setDeptType("1"); |
| | | sysDepts = sysDeptMapper.selectDeptList(dept); |
| | | sysUserDeptKSs = DtoConversionUtils.sourceToTarget(sysDepts, SysUserDept.class); |
| | | |
| | | dept.setDeptType("2"); |
| | | sysDepts = sysDeptMapper.selectDeptList(dept); |
| | | sysUserDeptBQs = DtoConversionUtils.sourceToTarget(sysDepts, SysUserDept.class); |
| | | |
| | | List<SysUserDept> distinctUserDepts = new ArrayList<>(); |
| | | Set<String> uniqueDeptCodes = new HashSet<>(); |
| | | for (SysUserDept userDept : sysUserDeptKSs) { |
| | | String deptCode = userDept.getDeptCode(); |
| | | if (StringUtils.isNotEmpty(deptCode) && !uniqueDeptCodes.contains(deptCode)) { |
| | | distinctUserDepts.add(userDept); |
| | | uniqueDeptCodes.add(deptCode); |
| | | } |
| | | } |
| | | |
| | | List<SysUserDept> distinctUserBQs = new ArrayList<>(); |
| | | Set<String> uniqueBQCodes = new HashSet<>(); |
| | | for (SysUserDept userDept : sysUserDeptBQs) { |
| | | String deptCode = userDept.getDeptCode(); |
| | | if (StringUtils.isNotEmpty(deptCode) && !uniqueBQCodes.contains(deptCode)) { |
| | | distinctUserBQs.add(userDept); |
| | | uniqueBQCodes.add(deptCode); |
| | | } |
| | | } |
| | | sysUserDeptKSs = distinctUserDepts; |
| | | sysUserDeptBQs = distinctUserBQs; |
| | | } |
| | | |
| | | sysUser.setDepts(deptIds); |
| | | if (!CollectionUtils.isEmpty(sysUserDeptBQs)) { |