瀏覽代碼

朗通个人中心修改

zhoutg 6 年之前
父節點
當前提交
725ddc1a96

+ 4 - 0
user-service/src/main/java/com/diagbot/dto/UserLoginDTO.java

@@ -50,6 +50,10 @@ public class UserLoginDTO {
      */
     private String position;
 
+    /**
+     * 手机号码
+     */
+    private String phone;
 
     public String getTypeCn() {
         return ConstantEnum.getName(this.type);

+ 14 - 0
user-service/src/main/java/com/diagbot/entity/User.java

@@ -82,6 +82,11 @@ public class User implements Serializable {
      */
     private String position;
 
+    /**
+     * 手机号码
+     */
+    private String phone;
+
     /**
      * 用户类型
      */
@@ -184,6 +189,14 @@ public class User implements Serializable {
         this.position = position;
     }
 
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
     public Integer getType() {
         return type;
     }
@@ -208,6 +221,7 @@ public class User implements Serializable {
                 ", email='" + email + '\'' +
                 ", dept='" + dept + '\'' +
                 ", position='" + position + '\'' +
+                ", phone='" + phone + '\'' +
                 ", type=" + type +
                 '}';
     }

+ 42 - 0
user-service/src/main/java/com/diagbot/facade/UserFacade.java

@@ -46,6 +46,7 @@ import com.diagbot.util.UserUtils;
 import com.diagbot.vo.BaseIdVO;
 import com.diagbot.vo.ImgVerVerVO;
 import com.diagbot.vo.OrganizationVO;
+import com.diagbot.vo.PersonVO;
 import com.diagbot.vo.UserAndOrganizationVO;
 import com.diagbot.vo.UserExportVO;
 import com.diagbot.vo.UserInfoAuditVO;
@@ -258,6 +259,47 @@ public class UserFacade extends UserServiceImpl {
     }
 
 
+    /**
+     * 获取朗通后台个人信息
+     *
+     * @return 获取个人信息
+     */
+    public UserLoginDTO getPersonInfo() {
+        Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
+        User user = this.getById(userId);
+        if (user == null) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "用户不存在【" + userId + "】");
+        }
+        UserLoginDTO userLoginDTO = new UserLoginDTO();
+        BeanUtil.copyProperties(user, userLoginDTO);
+        return userLoginDTO;
+    }
+
+
+    /**
+     * 修改朗通后台个人信息
+     */
+    public void updatePersonInfo(PersonVO personVO) {
+        if(!RegexValidateUtil.checkMobileNumber(personVO.getPhone())) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "请输入正确的手机号");
+        }
+        Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
+        User user = this.getById(userId);
+        if (user == null) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "用户不存在【" + userId + "】");
+        }
+        user.setGmtModified(DateUtil.now());
+        user.setPhone(personVO.getPhone());
+        user.setLinkman(personVO.getLinkman());
+        user.setDept(personVO.getDept());
+        user.setPosition(personVO.getPosition());
+        user.setEmail(personVO.getEmail());
+        this.updateById(user);
+    }
+
     /**
      * 获取jwt
      *

+ 40 - 0
user-service/src/main/java/com/diagbot/vo/PersonVO.java

@@ -0,0 +1,40 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description: 个人中心修改参数
+ * @Author: ztg
+ * @Date: 2018/10/10 13:17
+ */
+@Getter
+@Setter
+public class PersonVO {
+
+
+    /**
+     * 联系人
+     */
+    private String linkman;
+
+    /**
+     * 邮箱
+     */
+    private String email;
+
+    /**
+     * 所属部门
+     */
+    private String dept;
+
+    /**
+     * 所属岗位
+     */
+    private String position;
+
+    /**
+     * 所属岗位
+     */
+    private String phone;
+}

+ 21 - 0
user-service/src/main/java/com/diagbot/web/UserController.java

@@ -6,6 +6,7 @@ import com.diagbot.dto.GetConsoleUserInfoDTO;
 import com.diagbot.dto.JwtDTO;
 import com.diagbot.dto.LoginDTO;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.UserLoginDTO;
 import com.diagbot.dto.UserOrgDTO;
 import com.diagbot.entity.Permission;
 import com.diagbot.entity.User;
@@ -14,6 +15,7 @@ import com.diagbot.facade.UserFacade;
 import com.diagbot.vo.AppkeySecretVO;
 import com.diagbot.vo.BaseIdVO;
 import com.diagbot.vo.JwtVO;
+import com.diagbot.vo.PersonVO;
 import com.diagbot.vo.ResetPasswordVO;
 import com.diagbot.vo.UserInfoByIdPageVO;
 import com.diagbot.vo.UserLoginVO;
@@ -108,6 +110,25 @@ public class UserController {
     }
 
 
+    @ApiOperation(value = "获取朗通后台个人信息[by:zhoutg]",
+            notes = "")
+    @PostMapping("/getPersonInfo")
+    @SysLogger("getPersonInfo")
+    public RespDTO<UserLoginDTO> getPersonInfo() {
+
+        UserLoginDTO data = userFacade.getPersonInfo();
+        return RespDTO.onSuc(data);
+    }
+
+
+    @ApiOperation(value = "修改朗通后台个人信息[by:zhoutg]", notes = "")
+    @PostMapping("/updatePersonInfo")
+    @SysLogger("updatePersonInfo")
+    public RespDTO<String> updatePersonInfo(@RequestBody PersonVO personVO) {
+        userFacade.updatePersonInfo(personVO);
+        return RespDTO.onSuc(null);
+    }
+
     @ApiOperation(value = "重置密码[by:zhoutg]",
             notes = "username:用户名,必填<br>" +
                     "password:密码, 必填<br> ")