|
@@ -7,6 +7,7 @@ import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
|
|
@@ -170,9 +171,12 @@ public class UserController extends BaseController {
|
|
|
|
|
|
@ApiOperation(value = "设置用户名密码")
|
|
|
@PostMapping(value = "/setUsernameAndPassword", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
- @ApiImplicitParams({@ApiImplicitParam(name = "password", value = "密码", required = true, dataType = "String"),
|
|
|
- @ApiImplicitParam(name = "username", value = "用户名", dataType = "String")})
|
|
|
- public Object setPassword(String password, String username) {
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "password", value = "密码", required = true, dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "username", value = "用户名", dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "gender", value = "性别0女1男", dataType = "Integer")
|
|
|
+ })
|
|
|
+ public Object setPassword(String password, String username, Integer gender) {
|
|
|
if (StringUtils.isEmpty(password)) {
|
|
|
return failed("参数校验失败");
|
|
|
}
|
|
@@ -184,6 +188,13 @@ public class UserController extends BaseController {
|
|
|
if (sysUser == null) {
|
|
|
return failed("用户不存在");
|
|
|
}
|
|
|
+
|
|
|
+ // 设置用户性别
|
|
|
+ if (Objects.nonNull(gender)) {
|
|
|
+ sysUser.setGender(gender);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置用户名称、昵称
|
|
|
if (!StringUtil.isEmpty(username)) {
|
|
|
if (sysUser.getUserType().contains("SYSTEM")) {
|
|
|
sysUser.setRealName(username);
|