|
@@ -3,13 +3,10 @@ package com.chelvc.cloud.maintain.controller;
|
|
|
import javax.validation.Valid;
|
|
|
|
|
|
import com.chelvc.cloud.maintain.copier.UserCopier;
|
|
|
-import com.chelvc.cloud.maintain.vo.UserVO;
|
|
|
-import com.chelvc.cloud.uc.api.dto.UserDTO;
|
|
|
-import com.chelvc.cloud.uc.api.param.UserModifyParam;
|
|
|
+import com.chelvc.cloud.maintain.vo.PersonalVO;
|
|
|
+import com.chelvc.cloud.uc.api.param.PersonalModifyParam;
|
|
|
import com.chelvc.cloud.uc.api.service.UserService;
|
|
|
import com.chelvc.framework.base.annotation.ResponseWrapping;
|
|
|
-import com.chelvc.framework.base.context.SessionContextHolder;
|
|
|
-import com.chelvc.framework.base.util.ResourceUtils;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
@@ -32,32 +29,30 @@ public class UserController {
|
|
|
private UserService userService;
|
|
|
|
|
|
/**
|
|
|
- * 注销当前用户
|
|
|
+ * 获取用户个人信息
|
|
|
+ *
|
|
|
+ * @return 用户个人信息
|
|
|
*/
|
|
|
- @DeleteMapping("/user/mine/unregister")
|
|
|
- public void unregister() {
|
|
|
- this.userService.unregister();
|
|
|
+ @GetMapping("/user/mine")
|
|
|
+ public PersonalVO getPersonal() {
|
|
|
+ return UserCopier.INSTANCE.copying(this.userService.getPersonal());
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 获取用户信息
|
|
|
+ * 修改用户个人信息
|
|
|
*
|
|
|
- * @return 用户信息
|
|
|
+ * @param param 修改参数
|
|
|
*/
|
|
|
- @GetMapping("/user/info")
|
|
|
- public UserVO getUserInfo() {
|
|
|
- UserDTO user = this.userService.getUser(SessionContextHolder.getId());
|
|
|
- ResourceUtils.required(user, "用户不存在");
|
|
|
- return UserCopier.INSTANCE.copying(user);
|
|
|
+ @PutMapping("/user/mine")
|
|
|
+ public void updatePersonal(@RequestBody @Valid PersonalModifyParam param) {
|
|
|
+ this.userService.updatePersonal(param);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 修改用户信息
|
|
|
- *
|
|
|
- * @param param 修改参数
|
|
|
+ * 用户注销
|
|
|
*/
|
|
|
- @PutMapping("/user/info")
|
|
|
- public void updateUser(@RequestBody @Valid UserModifyParam param) {
|
|
|
- this.userService.updateUser(param);
|
|
|
+ @DeleteMapping("/user/unregister")
|
|
|
+ public void unregister() {
|
|
|
+ this.userService.unregister();
|
|
|
}
|
|
|
}
|