Commit 21e24603 authored by 技术部-任文超's avatar 技术部-任文超

针对用户配偶信息添加和联系人信息一致的准入校验和查询过滤规则

parent 8856f9ad
......@@ -524,7 +524,7 @@ public class MotanUserServiceImpl implements UserMotanService {
return returnErrorValue("用户不能为空");
}
UserSpouse userSpouse = userSpouseService.findByUserId(userId);
if (userSpouse == null) {
if (userSpouse == null || !userSpouse.valid()) {
userSpouse = new UserSpouse(userId);
userSpouse.setStatus(MaritalStatus.UNKNOWN);
}
......@@ -603,8 +603,8 @@ public class MotanUserServiceImpl implements UserMotanService {
if (!ValidationUtil.validatePhoneNo(spousePhone)) {
return returnErrorValue("手机号格式错误");
}
if (StringUtils.isBlank(spouseName)) {
return returnErrorValue("配偶姓名不能为空");
if (!ValidationUtil.validateChinese(spouseName)) {
return returnErrorValue("配偶姓名错误");
}
}
UserSpouse userSpouse = userSpouseService.findByUserId(xUserSpouse.getUserId());
......
......@@ -740,8 +740,8 @@ public class InnerController implements IBaseController {
if (!ValidationUtil.validatePhoneNo(spousePhone)) {
return JsonResult.buildErrorStateResult("手机号格式错误", null);
}
if (StringUtils.isBlank(spouseName)) {
return JsonResult.buildErrorStateResult("配偶姓名不能为空", null);
if (!ValidationUtil.validateChinese(spouseName)) {
return JsonResult.buildErrorStateResult("配偶姓名错误", null);
}
}
UserSpouse userSpouse = userSpouseService.findByUserId(userId);
......@@ -765,7 +765,7 @@ public class InnerController implements IBaseController {
return JsonResult.buildErrorStateResult("用户不能为空", null);
}
UserSpouse userSpouse = userSpouseService.findByUserId(userId);
if (userSpouse == null) {
if (userSpouse == null || !userSpouse.valid()) {
userSpouse = new UserSpouse(userId);
userSpouse.setStatus(cn.quantgroup.user.enums.MaritalStatus.UNKNOWN);
}
......
......@@ -2,6 +2,7 @@ package cn.quantgroup.xyqb.entity;
import cn.quantgroup.user.enums.MaritalStatus;
import cn.quantgroup.xyqb.util.ValidationUtil;
import lombok.*;
import javax.persistence.*;
......@@ -44,4 +45,12 @@ public class UserSpouse implements Serializable {
public UserSpouse(Long userId) {
this.userId = userId;
}
/**
* 数据合法性校验
* @return
*/
public boolean valid(){
return (ValidationUtil.validatePhoneNo(this.spousePhone) && ValidationUtil.validateChinese(this.spouseName));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment