处理个人信息大部分允许为null
This commit is contained in:
-2
@@ -3,7 +3,6 @@ package org.jiayunet.pojo.param.userProfile;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.jiayunet.pojo.vo.DescriptionParagraph;
|
import org.jiayunet.pojo.vo.DescriptionParagraph;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -15,7 +14,6 @@ import java.util.List;
|
|||||||
public class UserProfileCompetitionParam {
|
public class UserProfileCompetitionParam {
|
||||||
|
|
||||||
/** 竞赛名称 */
|
/** 竞赛名称 */
|
||||||
@NotBlank(message = "竞赛名称不能为空")
|
|
||||||
private String competitionName;
|
private String competitionName;
|
||||||
|
|
||||||
/** 获奖情况,如全国二等奖 */
|
/** 获奖情况,如全国二等奖 */
|
||||||
|
|||||||
-4
@@ -3,8 +3,6 @@ package org.jiayunet.pojo.param.userProfile;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.jiayunet.pojo.vo.DescriptionParagraph;
|
import org.jiayunet.pojo.vo.DescriptionParagraph;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -16,14 +14,12 @@ import java.util.List;
|
|||||||
public class UserProfileEducationParam {
|
public class UserProfileEducationParam {
|
||||||
|
|
||||||
/** 学校名称 */
|
/** 学校名称 */
|
||||||
@NotBlank(message = "学校名称不能为空")
|
|
||||||
private String school;
|
private String school;
|
||||||
|
|
||||||
/** 专业 */
|
/** 专业 */
|
||||||
private String major;
|
private String major;
|
||||||
|
|
||||||
/** 学历 1=大专 2=本科 3=硕士 4=博士 */
|
/** 学历 1=大专 2=本科 3=硕士 4=博士 */
|
||||||
@NotNull(message = "学历不能为空")
|
|
||||||
private Integer degree;
|
private Integer degree;
|
||||||
|
|
||||||
/** 学习形式 0=全日制 1=非全日制 */
|
/** 学习形式 0=全日制 1=非全日制 */
|
||||||
|
|||||||
-4
@@ -3,7 +3,6 @@ package org.jiayunet.pojo.param.userProfile;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.jiayunet.pojo.vo.DescriptionParagraph;
|
import org.jiayunet.pojo.vo.DescriptionParagraph;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -15,15 +14,12 @@ import java.util.List;
|
|||||||
public class UserProfileInternshipParam {
|
public class UserProfileInternshipParam {
|
||||||
|
|
||||||
/** 公司名称 */
|
/** 公司名称 */
|
||||||
@NotBlank(message = "公司名称不能为空")
|
|
||||||
private String companyName;
|
private String companyName;
|
||||||
|
|
||||||
/** 职位 */
|
/** 职位 */
|
||||||
@NotBlank(message = "职位不能为空")
|
|
||||||
private String position;
|
private String position;
|
||||||
|
|
||||||
/** 开始时间,格式:2023.06 */
|
/** 开始时间,格式:2023.06 */
|
||||||
@NotBlank(message = "开始时间不能为空")
|
|
||||||
private String startDate;
|
private String startDate;
|
||||||
|
|
||||||
/** 结束时间,格式:2023.09,至今则为空 */
|
/** 结束时间,格式:2023.09,至今则为空 */
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package org.jiayunet.pojo.param.userProfile;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -26,7 +25,6 @@ public class UserProfileParam {
|
|||||||
private String idCard;
|
private String idCard;
|
||||||
|
|
||||||
/** 所在城市编码 */
|
/** 所在城市编码 */
|
||||||
@NotBlank(message = "所在城市不能为空")
|
|
||||||
private String regionCode;
|
private String regionCode;
|
||||||
|
|
||||||
/** 微信号 */
|
/** 微信号 */
|
||||||
|
|||||||
-3
@@ -3,7 +3,6 @@ package org.jiayunet.pojo.param.userProfile;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.jiayunet.pojo.vo.DescriptionParagraph;
|
import org.jiayunet.pojo.vo.DescriptionParagraph;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -18,14 +17,12 @@ public class UserProfileProjectParam {
|
|||||||
private String companyName;
|
private String companyName;
|
||||||
|
|
||||||
/** 项目名称 */
|
/** 项目名称 */
|
||||||
@NotBlank(message = "项目名称不能为空")
|
|
||||||
private String projectName;
|
private String projectName;
|
||||||
|
|
||||||
/** 担任角色 */
|
/** 担任角色 */
|
||||||
private String role;
|
private String role;
|
||||||
|
|
||||||
/** 开始时间,格式:2023.06 */
|
/** 开始时间,格式:2023.06 */
|
||||||
@NotBlank(message = "开始时间不能为空")
|
|
||||||
private String startDate;
|
private String startDate;
|
||||||
|
|
||||||
/** 结束时间,格式:2023.09,至今则为空 */
|
/** 结束时间,格式:2023.09,至今则为空 */
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package org.jiayunet.pojo.param.userProfile;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.jiayunet.pojo.vo.DescriptionParagraph;
|
import org.jiayunet.pojo.vo.DescriptionParagraph;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -15,15 +14,12 @@ import java.util.List;
|
|||||||
public class UserProfileWorkParam {
|
public class UserProfileWorkParam {
|
||||||
|
|
||||||
/** 公司名称 */
|
/** 公司名称 */
|
||||||
@NotBlank(message = "公司名称不能为空")
|
|
||||||
private String companyName;
|
private String companyName;
|
||||||
|
|
||||||
/** 职位 */
|
/** 职位 */
|
||||||
@NotBlank(message = "职位不能为空")
|
|
||||||
private String position;
|
private String position;
|
||||||
|
|
||||||
/** 开始时间,格式:2023.06 */
|
/** 开始时间,格式:2023.06 */
|
||||||
@NotBlank(message = "开始时间不能为空")
|
|
||||||
private String startDate;
|
private String startDate;
|
||||||
|
|
||||||
/** 结束时间,格式:2023.09,至今则为空 */
|
/** 结束时间,格式:2023.09,至今则为空 */
|
||||||
|
|||||||
@@ -89,9 +89,14 @@ public class UserProfileService {
|
|||||||
new LambdaQueryWrapper<UserProfile>().eq(UserProfile::getUserId, userId));
|
new LambdaQueryWrapper<UserProfile>().eq(UserProfile::getUserId, userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** JSON字段的TypeHandler,UpdateWrapper显式set时需指定,否则JSON字段不会正确序列化 */
|
||||||
|
private static final String JSON_TYPE_HANDLER = "typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存个人资料主表(upsert)
|
* 保存个人资料主表(upsert)
|
||||||
* <p>1. 按userId查询是否存在 2. 存在则更新,不存在则插入</p>
|
* <p>1. 按userId查询是否存在 2. 存在则更新,不存在则插入</p>
|
||||||
|
* <p>更新时用LambdaUpdateWrapper显式set用户可编辑字段(允许清空为null,绕过全局update-strategy=not_null),
|
||||||
|
* AI派生字段(schoolRank/companyPrestige/majorIds/honors等)不在更新范围内,保留原值</p>
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void saveProfile(UserProfile profile) {
|
public void saveProfile(UserProfile profile) {
|
||||||
@@ -100,11 +105,18 @@ public class UserProfileService {
|
|||||||
new LambdaQueryWrapper<UserProfile>().eq(UserProfile::getUserId, userId));
|
new LambdaQueryWrapper<UserProfile>().eq(UserProfile::getUserId, userId));
|
||||||
Instant now = Instant.now();
|
Instant now = Instant.now();
|
||||||
if (existing != null) {
|
if (existing != null) {
|
||||||
profile.setId(existing.getId());
|
userProfileMapper.update(null, new com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper<UserProfile>()
|
||||||
profile.setUserId(userId);
|
.eq(UserProfile::getId, existing.getId())
|
||||||
profile.setCreateTime(existing.getCreateTime());
|
.set(UserProfile::getName, profile.getName())
|
||||||
profile.setUpdateTime(now);
|
.set(UserProfile::getEmail, profile.getEmail())
|
||||||
userProfileMapper.updateById(profile);
|
.set(UserProfile::getMobileNumber, profile.getMobileNumber())
|
||||||
|
.set(UserProfile::getIdCard, profile.getIdCard())
|
||||||
|
.set(UserProfile::getRegionCode, profile.getRegionCode())
|
||||||
|
.set(UserProfile::getWechatNumber, profile.getWechatNumber())
|
||||||
|
.set(UserProfile::getPortfolioUrl, profile.getPortfolioUrl())
|
||||||
|
.set(UserProfile::getSkills, profile.getSkills(), JSON_TYPE_HANDLER)
|
||||||
|
.set(UserProfile::getCertificates, profile.getCertificates(), JSON_TYPE_HANDLER)
|
||||||
|
.set(UserProfile::getUpdateTime, now));
|
||||||
} else {
|
} else {
|
||||||
profile.setUserId(userId);
|
profile.setUserId(userId);
|
||||||
profile.setCreateTime(now);
|
profile.setCreateTime(now);
|
||||||
|
|||||||
Reference in New Issue
Block a user