|
@@ -10,14 +10,20 @@ import com.ym.mec.common.controller.BaseController;
|
|
|
import com.ym.mec.common.security.AuthUser;
|
|
|
import com.ym.mec.common.security.SecurityUtils;
|
|
|
import com.ym.mec.common.validcode.SmsCodeService;
|
|
|
-import io.swagger.annotations.*;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.http.MediaType;
|
|
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
|
|
|
@RestController()
|
|
|
@RequestMapping("user")
|
|
@@ -33,18 +39,11 @@ public class UserController extends BaseController {
|
|
|
@Autowired
|
|
|
private SmsCodeService smsCodeService;
|
|
|
|
|
|
- /*@ApiOperation("根据用户名查询用户信息接口")
|
|
|
- @ApiImplicitParam(name = "username", value = "用户名", required = true, dataType = "String", paramType = "path")
|
|
|
- @GetMapping("/{username}")
|
|
|
- public Object getUser(@PathVariable("username") String username) {
|
|
|
- return succeed(sysUserService.queryUserInfoByUsername(username));
|
|
|
- }*/
|
|
|
-
|
|
|
@ApiOperation(value = "分页查询用户信息")
|
|
|
@ApiImplicitParams({ @ApiImplicitParam(name = "userType", value = "用户类型", required = false, dataType = "String"),
|
|
|
@ApiImplicitParam(name = "createStartDate", value = "开始注册时间", required = true, dataType = "String"),
|
|
|
@ApiImplicitParam(name = "createEndDate", value = "结束注册时间", required = true, dataType = "String") })
|
|
|
- @GetMapping("/queryPage")
|
|
|
+ @GetMapping(value = "/queryPage",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
|
|
public Object queryPage(SysUserQueryInfo queryInfo) {
|
|
|
return succeed(sysUserService.queryPage(queryInfo));
|
|
|
}
|
|
@@ -59,13 +58,13 @@ public class UserController extends BaseController {
|
|
|
return failed();
|
|
|
}
|
|
|
|
|
|
- @GetMapping("/queryUserByPhone")
|
|
|
+ @GetMapping(value = "/queryUserByPhone",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
|
|
public SysUser queryUserByPhone(String mobile) {
|
|
|
return sysUserService.queryByPhone(mobile);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "新增用户")
|
|
|
- @PostMapping("/add")
|
|
|
+ @PostMapping(value = "/add",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
|
|
public Object add(SysUser sysUser) {
|
|
|
// sysUser.setPassword(new BCryptPasswordEncoder().encode(sysUser.getPassword()));
|
|
|
sysUserService.insert(sysUser);
|
|
@@ -73,7 +72,7 @@ public class UserController extends BaseController {
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "设置密码")
|
|
|
- @PostMapping("/setPassword")
|
|
|
+ @PostMapping(value = "/setPassword",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
|
|
@ApiImplicitParams({ @ApiImplicitParam(name = "mobile", value = "手机号", required = true, dataType = "String"),
|
|
|
@ApiImplicitParam(name = "authCode", value = "验证码", required = true, dataType = "String"),
|
|
|
@ApiImplicitParam(name = "password", value = "密码", required = true, dataType = "String") })
|
|
@@ -95,7 +94,7 @@ public class UserController extends BaseController {
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "修改密码")
|
|
|
- @PostMapping("/updatePassword")
|
|
|
+ @PostMapping(value = "/updatePassword",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
|
|
@ApiImplicitParams({ @ApiImplicitParam(name = "mobile", value = "手机号", required = true, dataType = "String"),
|
|
|
@ApiImplicitParam(name = "authCode", value = "验证码", required = true, dataType = "String"),
|
|
|
@ApiImplicitParam(name = "newPassword", value = "新密码", required = true, dataType = "String"),
|
|
@@ -132,7 +131,7 @@ public class UserController extends BaseController {
|
|
|
}*/
|
|
|
|
|
|
@ApiOperation(value = "修改用户")
|
|
|
- @PostMapping("/update")
|
|
|
+ @PostMapping(value = "/update",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
|
|
public Object update(SysUser sysUser) {
|
|
|
AuthUser user = SecurityUtils.getUser();
|
|
|
if(user != null){
|
|
@@ -158,7 +157,7 @@ public class UserController extends BaseController {
|
|
|
@ApiOperation(value = "用户角色新增")
|
|
|
@ApiImplicitParams({ @ApiImplicitParam(name = "userId", value = "用户编号", required = true, dataType = "Integer"),
|
|
|
@ApiImplicitParam(name = "roleIds", value = "角色id,逗号分隔", required = true, dataType = "String") })
|
|
|
- @PostMapping("/addRole")
|
|
|
+ @PostMapping(value = "/addRole",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
|
|
public Object getRole(String userId,String roleIds) {
|
|
|
if(StringUtils.isEmpty(userId) || StringUtils.isEmpty(roleIds)){
|
|
|
return failed(SecurityConstants.PARAM_VERIFY_EXCEPTION);
|
|
@@ -170,7 +169,7 @@ public class UserController extends BaseController {
|
|
|
@ApiOperation(value = "用户角色删除")
|
|
|
@ApiImplicitParams({ @ApiImplicitParam(name = "userId", value = "用户编号", required = true, dataType = "Integer"),
|
|
|
@ApiImplicitParam(name = "roleIds", value = "角色id,逗号分隔", required = true, dataType = "String") })
|
|
|
- @PostMapping("/delRole")
|
|
|
+ @PostMapping(value = "/delRole",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
|
|
public Object delRole(String userId,String roleIds) {
|
|
|
if(StringUtils.isEmpty(userId) || StringUtils.isEmpty(roleIds)){
|
|
|
return failed(SecurityConstants.PARAM_VERIFY_EXCEPTION);
|