|
@@ -10,6 +10,7 @@ import java.util.Date;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.MediaType;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
@@ -48,12 +49,14 @@ public class UserController extends BaseController {
|
|
|
@ApiImplicitParam(name = "createStartDate", value = "开始注册时间", required = true, dataType = "String"),
|
|
|
@ApiImplicitParam(name = "createEndDate", value = "结束注册时间", required = true, dataType = "String") })
|
|
|
@GetMapping(value = "/queryPage")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('user/queryPage')")
|
|
|
public Object queryPage(SysUserQueryInfo queryInfo) {
|
|
|
return succeed(sysUserService.queryPage(queryInfo));
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "查询用户信息接口")
|
|
|
@GetMapping("/query")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('user/query')")
|
|
|
public Object query() {
|
|
|
AuthUser user = SecurityUtils.getUser();
|
|
|
if (user != null) {
|
|
@@ -64,6 +67,7 @@ public class UserController extends BaseController {
|
|
|
|
|
|
@ApiOperation(value = "根据用户编号获取用户基本信息")
|
|
|
@GetMapping("/getBasic")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('user/getBasic')")
|
|
|
public Object getBasic(Integer userId) {
|
|
|
if (userId == null) {
|
|
|
return failed("参数校验异常");
|
|
@@ -82,12 +86,14 @@ public class UserController extends BaseController {
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "新增用户")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('user/add')")
|
|
|
@PostMapping(value = "/add", consumes = MediaType.APPLICATION_JSON_VALUE)
|
|
|
public Object add(@RequestBody SysUser sysUser) {
|
|
|
return succeed(sysUserService.add(sysUser));
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "设置密码")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('user/setPassword')")
|
|
|
@PostMapping(value = "/setPassword", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
@ApiImplicitParams({ @ApiImplicitParam(name = "mobile", value = "手机号", required = true, dataType = "String"),
|
|
|
@ApiImplicitParam(name = "password", value = "密码", required = true, dataType = "String") })
|
|
@@ -105,6 +111,7 @@ public class UserController extends BaseController {
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "修改密码")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('user/updatePassword')")
|
|
|
@PostMapping(value = "/updatePassword", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
@ApiImplicitParams({ @ApiImplicitParam(name = "mobile", value = "手机号", required = true, dataType = "String"),
|
|
|
@ApiImplicitParam(name = "authCode", value = "验证码", required = true, dataType = "String"),
|
|
@@ -126,6 +133,7 @@ public class UserController extends BaseController {
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "修改用户")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('user/update')")
|
|
|
@PostMapping(value = "/update", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
|
|
public Object update(SysUser sysUser) {
|
|
|
AuthUser user = SecurityUtils.getUser();
|
|
@@ -141,6 +149,7 @@ public class UserController extends BaseController {
|
|
|
|
|
|
@ApiOperation(value = "获取用户角色列表")
|
|
|
@GetMapping("/getRole")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('user/getRole')")
|
|
|
public Object getRole() {
|
|
|
AuthUser user = SecurityUtils.getUser();
|
|
|
if (user != null) {
|
|
@@ -153,6 +162,7 @@ public class UserController extends BaseController {
|
|
|
@ApiImplicitParams({ @ApiImplicitParam(name = "userId", value = "用户编号", required = true, dataType = "Integer"),
|
|
|
@ApiImplicitParam(name = "roleIds", value = "角色id,逗号分隔", required = true, dataType = "String") })
|
|
|
@PostMapping(value = "/addRole", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('user/addRole')")
|
|
|
public Object getRole(String userId, String roleIds) {
|
|
|
if (StringUtils.isEmpty(userId) || StringUtils.isEmpty(roleIds)) {
|
|
|
return failed(SecurityConstants.PARAM_VERIFY_EXCEPTION);
|
|
@@ -165,6 +175,7 @@ public class UserController extends BaseController {
|
|
|
@ApiImplicitParams({ @ApiImplicitParam(name = "userId", value = "用户编号", required = true, dataType = "Integer"),
|
|
|
@ApiImplicitParam(name = "roleIds", value = "角色id,逗号分隔", required = true, dataType = "String") })
|
|
|
@PostMapping(value = "/delRole", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('user/delRole')")
|
|
|
public Object delRole(String userId, String roleIds) {
|
|
|
if (StringUtils.isEmpty(userId) || StringUtils.isEmpty(roleIds)) {
|
|
|
return failed(SecurityConstants.PARAM_VERIFY_EXCEPTION);
|