|
@@ -1,12 +1,26 @@
|
|
|
package com.chelvc.cloud.maintain.controller;
|
|
|
|
|
|
+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.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 com.chelvc.framework.common.util.ErrorUtils;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
+import org.springframework.web.bind.annotation.PutMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import javax.validation.Valid;
|
|
|
+import javax.validation.constraints.Min;
|
|
|
+
|
|
|
/**
|
|
|
* 用户接口
|
|
|
*
|
|
@@ -27,4 +41,26 @@ public class UserController {
|
|
|
public void unregister() {
|
|
|
this.userService.unregister();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取用户信息
|
|
|
+ *
|
|
|
+ * @return 用户信息
|
|
|
+ */
|
|
|
+ @GetMapping("/user/info")
|
|
|
+ public UserVO getUserInfo() {
|
|
|
+ UserDTO user = this.userService.getUser();
|
|
|
+ ResourceUtils.required(user, "用户不存在");
|
|
|
+ return UserCopier.INSTANCE.copying(user);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改用户信息
|
|
|
+ *
|
|
|
+ * @param param 修改参数
|
|
|
+ */
|
|
|
+ @PutMapping("/user/info")
|
|
|
+ public void updateUser(@RequestBody @Valid UserModifyParam param) {
|
|
|
+ this.userService.updateUser(param);
|
|
|
+ }
|
|
|
}
|