feat:校验
This commit is contained in:
@@ -79,7 +79,7 @@ public enum ErrorCodeEnum {
|
||||
NO_TRANSFER_REQUIRED(500013, "招商经理现有私海线索无需转让,请检查后重试!", null),
|
||||
NO_BATCH_TRANSFER_REQUIRED(500014, "已选线索包含此招商经理现有私海线索,无需转让,请检查后重试!", null),
|
||||
PARTNER_MOBILE_EXIST(500010, "手机号码已存在,请核实!", null),
|
||||
MOBILE_EXIST(500015, "此手机号码已存在,请修改后重试", null),
|
||||
MOBILE_EXIST(500015, "此手机号码已存在,\n 线索状态:{0}\n 督导:{1}", null),
|
||||
INVESTMENT_MANAGER_NOT_EXIST(500016, "当前招商经理不存在", null),
|
||||
PARTNER_MOBILE_EXIST_0(500017, "手机号码已存在", null),
|
||||
TIME_OCCUPIED(500018, "预约时间被占用", null),
|
||||
|
||||
@@ -55,14 +55,15 @@ public class LineInfoDAO {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public Boolean getLineInfoByMobile(String mobile) {
|
||||
|
||||
public LineInfoDO getLineByMobile(String mobile) {
|
||||
Example example = new Example(LineInfoDO.class);
|
||||
example.createCriteria().andEqualTo("mobile", mobile);
|
||||
List<LineInfoDO> lineInfoDOS = lineInfoMapper.selectByExample(example);
|
||||
if(CollectionUtils.isNotEmpty(lineInfoDOS)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return lineInfoMapper.selectOneByExample(example);
|
||||
}
|
||||
|
||||
public Boolean getLineInfoByMobile(String mobile) {
|
||||
return Objects.nonNull(getLineByMobile(mobile));
|
||||
}
|
||||
|
||||
public Integer updateLineInfo(LineInfoDO param){
|
||||
|
||||
@@ -435,8 +435,10 @@ public class LineServiceImpl implements LineService {
|
||||
}
|
||||
HyPartnerUserInfoDO hyPartnerUserInfoDO = hyPartnerUserInfoDAO.selectByMobile(addLineRequest.getMobile());
|
||||
if (hyPartnerUserInfoDO!=null){
|
||||
throw new ServiceException(ErrorCodeEnum.MOBILE_EXIST);
|
||||
//校验
|
||||
validateAndProcessLineInfo(addLineRequest.getMobile());
|
||||
}
|
||||
|
||||
hyPartnerUserInfoDO = new HyPartnerUserInfoDO();
|
||||
hyPartnerUserInfoDO.setMobile(addLineRequest.getMobile());
|
||||
hyPartnerUserInfoDO.setUserChannelId(Integer.valueOf(UserChannelEnum.ADD.getCode()));
|
||||
@@ -465,6 +467,55 @@ public class LineServiceImpl implements LineService {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验线索
|
||||
* @param mobile
|
||||
*/
|
||||
public void validateAndProcessLineInfo(String mobile) {
|
||||
LineInfoDO lineInfo = lineInfoDAO.getLineByMobile(mobile);
|
||||
String investmentManager = getInvestmentManagerName(lineInfo);
|
||||
String listName = determineListName(lineInfo);
|
||||
|
||||
throw new ServiceException(ErrorCodeEnum.MOBILE_EXIST, listName, investmentManager);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提取获取招商经理姓名的方法
|
||||
* @param lineInfo
|
||||
* @return
|
||||
*/
|
||||
private String getInvestmentManagerName(LineInfoDO lineInfo) {
|
||||
if (lineInfo == null || StringUtils.isEmpty(lineInfo.getInvestmentManager())) {
|
||||
return "-";
|
||||
}
|
||||
return enterpriseUserDAO.getUserName(lineInfo.getInvestmentManager());
|
||||
}
|
||||
|
||||
/**
|
||||
* 提取判断列表名称的逻辑
|
||||
* @param lineInfo
|
||||
* @return
|
||||
*/
|
||||
private String determineListName(LineInfoDO lineInfo) {
|
||||
if (lineInfo == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
Integer lineStatus = lineInfo.getLineStatus();
|
||||
if (LineStatusEnum.PUBLIC_SEAS.getCode().equals(lineStatus)) {
|
||||
return StringUtils.isNotEmpty(lineInfo.getInvestmentManager()) ? "'公海列表'" : "'未分配列表'";
|
||||
}
|
||||
|
||||
if (LineStatusEnum.PRIVATE_SEAS.getCode().equals(lineStatus)) {
|
||||
return lineInfo.getJoinStatus() == 0 ? "'线索列表'" : "'加盟商列表'";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取招商经理id
|
||||
* @param addLineRequest
|
||||
|
||||
Reference in New Issue
Block a user