|
|
@ -5,11 +5,7 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
|
import cn.hutool.extra.pinyin.PinyinUtil;
|
|
|
|
import cn.hutool.extra.pinyin.PinyinUtil;
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
|
|
|
|
|
|
|
import com.ruoyi.system.domain.UserCheckDTO;
|
|
|
|
|
|
|
|
import com.ruoyi.system.service.*;
|
|
|
|
|
|
|
|
import com.ruoyi.web.controller.manager.UserRecordManager;
|
|
|
|
import com.ruoyi.web.controller.manager.UserRecordManager;
|
|
|
|
import lombok.val;
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.Logger;
|
|
|
@ -35,6 +31,10 @@ import com.ruoyi.common.utils.StringUtils;
|
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
|
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
|
|
|
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
|
|
|
import com.ruoyi.framework.shiro.util.AuthorizationUtils;
|
|
|
|
import com.ruoyi.framework.shiro.util.AuthorizationUtils;
|
|
|
|
|
|
|
|
import com.ruoyi.system.service.ISysDeptService;
|
|
|
|
|
|
|
|
import com.ruoyi.system.service.ISysPostService;
|
|
|
|
|
|
|
|
import com.ruoyi.system.service.ISysRoleService;
|
|
|
|
|
|
|
|
import com.ruoyi.system.service.ISysUserService;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 用户信息
|
|
|
|
* 用户信息
|
|
|
@ -65,9 +65,6 @@ public class SysUserController extends BaseController {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private UserRecordManager userRecordManager;
|
|
|
|
private UserRecordManager userRecordManager;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private ISysDictDataService dictDataService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequiresPermissions("system:user:view")
|
|
|
|
@RequiresPermissions("system:user:view")
|
|
|
|
@GetMapping()
|
|
|
|
@GetMapping()
|
|
|
|
public String user() {
|
|
|
|
public String user() {
|
|
|
@ -137,15 +134,6 @@ public class SysUserController extends BaseController {
|
|
|
|
} else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
|
|
|
|
} else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
|
|
|
|
return error("新增用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
|
|
|
|
return error("新增用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
List<SysDictData> smType = dictDataService.selectDictDataByType("sys_role_key");
|
|
|
|
|
|
|
|
UserCheckDTO userCheckDTO = new UserCheckDTO();
|
|
|
|
|
|
|
|
userCheckDTO.setDeptId(user.getDeptId());
|
|
|
|
|
|
|
|
userCheckDTO.setRoleId(user.getRoleIds()[0]);
|
|
|
|
|
|
|
|
userCheckDTO.setRoleKey(smType.get(0).getDictValue());
|
|
|
|
|
|
|
|
int total = userService.checkUser(userCheckDTO);
|
|
|
|
|
|
|
|
if(total>=1){
|
|
|
|
|
|
|
|
return error("新增用户'" + user.getLoginName() + "'在当前部门该角色下账号已存在,不能重复新增");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
user.setSalt(ShiroUtils.randomSalt());
|
|
|
|
user.setSalt(ShiroUtils.randomSalt());
|
|
|
|
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
|
|
|
|
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
|
|
|
|
user.setCreateBy(getLoginName());
|
|
|
|
user.setCreateBy(getLoginName());
|
|
|
@ -215,6 +203,38 @@ public class SysUserController extends BaseController {
|
|
|
|
return error();
|
|
|
|
return error();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* resetUeky绑定
|
|
|
|
|
|
|
|
* @param userId
|
|
|
|
|
|
|
|
* @param mmap
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
//@RequiresPermissions("system:user:resetUeky")
|
|
|
|
|
|
|
|
@GetMapping("/resetUeky/{userId}")
|
|
|
|
|
|
|
|
public String resetUeky(@PathVariable("userId") Long userId, ModelMap mmap) {
|
|
|
|
|
|
|
|
mmap.put("user", userService.selectUserById(userId));
|
|
|
|
|
|
|
|
return prefix + "/resetUeky";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* resetUeky绑定
|
|
|
|
|
|
|
|
* @param user
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
//@RequiresPermissions("system:user:resetUeky")
|
|
|
|
|
|
|
|
@Log(title = "UKey绑定", businessType = BusinessType.RESET)
|
|
|
|
|
|
|
|
@PostMapping("/resetUekySave")
|
|
|
|
|
|
|
|
@ResponseBody
|
|
|
|
|
|
|
|
public AjaxResult resetUekySave(SysUser user) {
|
|
|
|
|
|
|
|
boolean update = userService.lambdaUpdate()
|
|
|
|
|
|
|
|
.eq(SysUser::getUserId, user.getUserId())
|
|
|
|
|
|
|
|
.set(SysUser::getUkeyId, user.getUkeyId())
|
|
|
|
|
|
|
|
.update();
|
|
|
|
|
|
|
|
if (update) {
|
|
|
|
|
|
|
|
return success();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return error();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 进入授权角色页
|
|
|
|
* 进入授权角色页
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -372,11 +392,4 @@ public class SysUserController extends BaseController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/checkUser")
|
|
|
|
|
|
|
|
@ResponseBody
|
|
|
|
|
|
|
|
public AjaxResult checkUser(UserCheckDTO userCheckDTO) {
|
|
|
|
|
|
|
|
return success(userService.checkUser(userCheckDTO));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|