个人信息完善

This commit is contained in:
2025-10-29 23:02:56 +08:00
parent 93a11067a4
commit 1b24bd092c
5 changed files with 267 additions and 8 deletions

View File

@@ -1,6 +1,11 @@
package com.vetti.web.controller.system; package com.vetti.web.controller.system;
import java.util.Map; import java.util.Map;
import cn.hutool.json.JSONUtil;
import com.vetti.common.enums.UserOperStepsEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@@ -31,6 +36,7 @@ import com.vetti.system.service.ISysUserService;
* *
* @author ruoyi * @author ruoyi
*/ */
@Api(tags ="个人信息完善")
@RestController @RestController
@RequestMapping("/system/user/profile") @RequestMapping("/system/user/profile")
public class SysProfileController extends BaseController public class SysProfileController extends BaseController
@@ -44,17 +50,56 @@ public class SysProfileController extends BaseController
/** /**
* 个人信息 * 个人信息
*/ */
@GetMapping @ApiOperation("个人信息")
public AjaxResult profile() @GetMapping("/personalInfo")
public AjaxResult<SysUser> profile()
{ {
LoginUser loginUser = getLoginUser(); LoginUser loginUser = getLoginUser();
SysUser user = loginUser.getUser(); SysUser user = userService.selectUserById(loginUser.getUserId());
AjaxResult ajax = AjaxResult.success(user); AjaxResult ajax = AjaxResult.success(user);
ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername())); // ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername())); // ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername()));
return ajax; return ajax;
} }
/**
* 修改用户
*/
@ApiOperation("个人信息完善")
@Log(title = "个人信息完善", businessType = BusinessType.UPDATE)
@PutMapping("/completeInfo")
public AjaxResult personalInfoProfile(@RequestBody SysUser user)
{
LoginUser loginUser = getLoginUser();
SysUser currentUser = userService.selectUserById(loginUser.getUserId());
if(UserOperStepsEnum.STEPS_1.getCode().equals(user.getSteps())){
currentUser.setNickName(user.getNickName());
currentUser.setEmail(user.getEmail());
currentUser.setPhonenumber(user.getPhonenumber());
currentUser.setSex(user.getSex());
}else if (UserOperStepsEnum.STEPS_2.getCode().equals(user.getSteps())){
currentUser.setJobPosition(user.getJobPosition());
currentUser.setExperience(user.getExperience());
currentUser.setCvUrl(user.getCvUrl());
}else if (UserOperStepsEnum.STEPS_3.getCode().equals(user.getSteps())){
currentUser.setLocation(user.getLocation());
currentUser.setJobType(user.getJobType());
currentUser.setRelocate(user.getRelocate());
}else if (UserOperStepsEnum.STEPS_4.getCode().equals(user.getSteps())){
//个人展示数据存储
currentUser.setBestSideJson(JSONUtil.toJsonStr(user.getBestSideDtoList()));
}
currentUser.setSteps(user.getSteps());
if (userService.updateUserProfile(currentUser) > 0)
{
// 更新缓存用户信息
tokenService.setLoginUser(loginUser);
}
return success();
}
/** /**
* 修改用户 * 修改用户
*/ */

View File

@@ -0,0 +1,20 @@
package com.vetti.common.core.domain.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 用户个人展示数据结构
*
* @author wangxiangshun
* @date 2025-10-29
*/
@Data
@Accessors(chain = true)
public class UserBestSideDto {
@ApiModelProperty("个人展示的链接地址")
private String linkAddress;
}

View File

@@ -3,6 +3,9 @@ package com.vetti.common.core.domain.entity;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import com.vetti.common.core.domain.dto.UserBestSideDto;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.vetti.common.annotation.Excel; import com.vetti.common.annotation.Excel;
@@ -17,49 +20,61 @@ import com.vetti.common.xss.Xss;
* *
* @author ruoyi * @author ruoyi
*/ */
public class SysUser extends BaseEntity public class SysUser extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 用户ID */ /** 用户ID */
@ApiModelProperty("用户ID")
@Excel(name = "用户序号", type = Type.EXPORT, cellType = ColumnType.NUMERIC, prompt = "用户编号") @Excel(name = "用户序号", type = Type.EXPORT, cellType = ColumnType.NUMERIC, prompt = "用户编号")
private Long userId; private Long userId;
/** 部门ID */ /** 部门ID */
@ApiModelProperty("用户ID")
@Excel(name = "部门编号", type = Type.IMPORT) @Excel(name = "部门编号", type = Type.IMPORT)
private Long deptId; private Long deptId;
/** 用户账号 */ /** 用户账号 */
@ApiModelProperty("用户账号(注册邮箱或者手机号)")
@Excel(name = "登录名称") @Excel(name = "登录名称")
private String userName; private String userName;
/** 用户昵称 */ /** 用户昵称 */
@ApiModelProperty("用户名称(姓名)")
@Excel(name = "用户名称") @Excel(name = "用户名称")
private String nickName; private String nickName;
/** 用户邮箱 */ /** 用户邮箱 */
@ApiModelProperty("用户邮箱")
@Excel(name = "用户邮箱") @Excel(name = "用户邮箱")
private String email; private String email;
/** 手机号码 */ /** 手机号码 */
@ApiModelProperty("手机号码")
@Excel(name = "手机号码", cellType = ColumnType.TEXT) @Excel(name = "手机号码", cellType = ColumnType.TEXT)
private String phonenumber; private String phonenumber;
/** 用户性别 */ /** 用户性别 */
@ApiModelProperty("用户性别(0=男,1=女,2=未知)")
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知") @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
private String sex; private String sex;
/** 用户头像 */ /** 用户头像 */
@ApiModelProperty("用户头像")
private String avatar; private String avatar;
/** 密码 */ /** 密码 */
@ApiModelProperty("密码")
private String password; private String password;
/** 账号状态0正常 1停用 */ /** 账号状态0正常 1停用 */
@ApiModelProperty("账号状态0正常 1停用")
@Excel(name = "账号状态", readConverterExp = "0=正常,1=停用") @Excel(name = "账号状态", readConverterExp = "0=正常,1=停用")
private String status; private String status;
/** 删除标志0代表存在 2代表删除 */ /** 删除标志0代表存在 2代表删除 */
@ApiModelProperty("删除标志0代表存在 2代表删除")
private String delFlag; private String delFlag;
/** 最后登录IP */ /** 最后登录IP */
@@ -76,8 +91,36 @@ public class SysUser extends BaseEntity
/** /**
* 用户类型(manager:管理员,interviewer:面试官 ,candidate:候选者) * 用户类型(manager:管理员,interviewer:面试官 ,candidate:候选者)
*/ */
@ApiModelProperty("用户类型(manager:管理员,interviewer:面试官 ,candidate:候选者)")
private String sysUserType; private String sysUserType;
@ApiModelProperty("个人信息完善步骤(1、2、3、4)")
private String steps;
@ApiModelProperty("当前职位")
private String jobPosition;
@ApiModelProperty("工作年限")
private String experience;
@ApiModelProperty("简历地址")
private String cvUrl;
@ApiModelProperty("工作地点")
private String location;
@ApiModelProperty("工作类型")
private String jobType;
@ApiModelProperty("是否搬家")
private String relocate;
@ApiModelProperty("")
private String bestSideJson;
@ApiModelProperty("个人展示的链接地址")
private List<UserBestSideDto> bestSideDtoList;
/** 部门对象 */ /** 部门对象 */
@Excels({ @Excels({
@Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT), @Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
@@ -324,6 +367,79 @@ public class SysUser extends BaseEntity
this.sysUserType = sysUserType; this.sysUserType = sysUserType;
} }
public String getSteps() {
return steps;
}
public void setSteps(String steps) {
this.steps = steps;
}
public String getJobPosition() {
return jobPosition;
}
public void setJobPosition(String jobPosition) {
this.jobPosition = jobPosition;
}
public String getExperience() {
return experience;
}
public void setExperience(String experience) {
this.experience = experience;
}
public String getCvUrl() {
return cvUrl;
}
public void setCvUrl(String cvUrl) {
this.cvUrl = cvUrl;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public String getJobType() {
return jobType;
}
public void setJobType(String jobType) {
this.jobType = jobType;
}
public String getRelocate() {
return relocate;
}
public void setRelocate(String relocate) {
this.relocate = relocate;
}
public String getBestSideJson() {
return bestSideJson;
}
public void setBestSideJson(String bestSideJson) {
this.bestSideJson = bestSideJson;
}
public List<UserBestSideDto> getBestSideDtoList() {
return bestSideDtoList;
}
public void setBestSideDtoList(List<UserBestSideDto> bestSideDtoList) {
this.bestSideDtoList = bestSideDtoList;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@@ -0,0 +1,34 @@
package com.vetti.common.enums;
/**
* 用户操作步骤
*/
public enum UserOperStepsEnum {
STEPS_1("1", "基础信息"),
STEPS_2("2", "工作经验"),
STEPS_3("3", "工作地点"),
STEPS_4("4", "个人展示"),
;
private final String code;
private final String info;
UserOperStepsEnum(String code, String info)
{
this.code = code;
this.info = info;
}
public String getCode()
{
return code;
}
public String getInfo()
{
return info;
}
}

View File

@@ -25,6 +25,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<result property="sysUserType" column="sys_user_type" /> <result property="sysUserType" column="sys_user_type" />
<result property="steps" column="steps" />
<result property="jobPosition" column="job_position" />
<result property="experience" column="experience" />
<result property="cvUrl" column="cv_url" />
<result property="location" column="location" />
<result property="jobType" column="job_type" />
<result property="relocate" column="relocate" />
<result property="bestSideJson" column="best_side_json" />
<association property="dept" javaType="SysDept" resultMap="deptResult" /> <association property="dept" javaType="SysDept" resultMap="deptResult" />
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" /> <collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
</resultMap> </resultMap>
@@ -52,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.pwd_update_date, u.create_by, u.create_time, u.remark, select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.pwd_update_date, u.create_by, u.create_time, u.remark,
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status, d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status,u.sys_user_type r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status,u.sys_user_type
,u.steps,u.job_position,u.experience,u.cv_url,u.location,u.job_type,u.relocate,u.best_side_json
from sys_user u from sys_user u
left join sys_dept d on u.dept_id = d.dept_id left join sys_dept d on u.dept_id = d.dept_id
left join sys_user_role ur on u.user_id = ur.user_id left join sys_user_role ur on u.user_id = ur.user_id
@@ -59,7 +70,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql> </sql>
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult"> <select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader,u.sys_user_type from sys_user u select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
d.dept_name, d.leader,u.sys_user_type,u.steps,u.job_position,u.experience,u.cv_url,u.location,u.job_type,u.relocate,u.best_side_json from sys_user u
left join sys_dept d on u.dept_id = d.dept_id left join sys_dept d on u.dept_id = d.dept_id
where u.del_flag = '0' where u.del_flag = '0'
<if test="userId != null and userId != 0"> <if test="userId != null and userId != 0">
@@ -91,7 +103,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult"> <select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time,u.sys_user_type select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status,
u.create_time,u.sys_user_type,u.steps,u.job_position,u.experience,u.cv_url,u.location,u.job_type,u.relocate,u.best_side_json
from sys_user u from sys_user u
left join sys_dept d on u.dept_id = d.dept_id left join sys_dept d on u.dept_id = d.dept_id
left join sys_user_role ur on u.user_id = ur.user_id left join sys_user_role ur on u.user_id = ur.user_id
@@ -108,7 +121,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult"> <select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult">
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time,u.sys_user_type select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time,u.sys_user_type,
u.steps,u.job_position,u.experience,u.cv_url,u.location,u.job_type,u.relocate,u.best_side_json
from sys_user u from sys_user u
left join sys_dept d on u.dept_id = d.dept_id left join sys_dept d on u.dept_id = d.dept_id
left join sys_user_role ur on u.user_id = ur.user_id left join sys_user_role ur on u.user_id = ur.user_id
@@ -163,6 +177,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null and createBy != ''">create_by,</if> <if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if> <if test="remark != null and remark != ''">remark,</if>
<if test="sysUserType != null and sysUserType != ''">sys_user_type,</if> <if test="sysUserType != null and sysUserType != ''">sys_user_type,</if>
<if test="steps != null and steps != ''">steps,</if>
<if test="jobPosition != null and jobPosition != ''">job_position,</if>
<if test="experience != null and experience != ''">experience,</if>
<if test="cvUrl != null and cvUrl != ''">cv_url,</if>
<if test="location != null and location != ''">location,</if>
<if test="jobType != null and jobType != ''">job_type,</if>
<if test="relocate != null and relocate != ''">relocate,</if>
<if test="bestSideJson != null and bestSideJson != ''">best_side_json,</if>
create_time create_time
)values( )values(
<if test="userId != null and userId != ''">#{userId},</if> <if test="userId != null and userId != ''">#{userId},</if>
@@ -179,6 +203,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null and createBy != ''">#{createBy},</if> <if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if> <if test="remark != null and remark != ''">#{remark},</if>
<if test="sysUserType != null and sysUserType != ''">#{sysUserType},</if> <if test="sysUserType != null and sysUserType != ''">#{sysUserType},</if>
<if test="steps != null and steps != ''">#{steps},</if>
<if test="jobPosition != null and jobPosition != ''">#{jobPosition},</if>
<if test="experience != null and experience != ''">#{experience},</if>
<if test="cvUrl != null and cvUrl != ''">#{cvUrl},</if>
<if test="location != null and location != ''">#{location},</if>
<if test="jobType != null and jobType != ''">#{jobType},</if>
<if test="relocate != null and relocate != ''">#{relocate},</if>
<if test="bestSideJson != null and bestSideJson != ''">#{bestSideJson},</if>
sysdate() sysdate()
) )
</insert> </insert>
@@ -199,6 +233,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="sysUserType != null">sys_user_type = #{sysUserType},</if> <if test="sysUserType != null">sys_user_type = #{sysUserType},</if>
<if test="steps != null and steps != ''">steps = #{steps},</if>
<if test="jobPosition != null and jobPosition != ''">job_position = #{jobPosition},</if>
<if test="experience != null and experience != ''">experience = #{experience},</if>
<if test="cvUrl != null and cvUrl != ''">cv_url = #{cvUrl},</if>
<if test="location != null and location != ''">location = #{location},</if>
<if test="jobType != null and jobType != ''">job_type = #{jobType},</if>
<if test="relocate != null and relocate != ''">relocate = #{relocate},</if>
<if test="bestSideJson != null and bestSideJson != ''">best_side_json = #{bestSideJson},</if>
update_time = sysdate() update_time = sysdate()
</set> </set>
where user_id = #{userId} where user_id = #{userId}