修改手机号,登录手机号和线索手机号一直

This commit is contained in:
shuo.wang
2024-11-18 15:48:31 +08:00
parent 7f2fd018e4
commit 1fc63b7936
2 changed files with 19 additions and 1 deletions

View File

@@ -23,6 +23,7 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.entity.Example;
import javax.annotation.Resource;
import java.util.List;
@@ -51,6 +52,15 @@ public class LineInfoDAO {
}
return null;
}
public Boolean getLineInfoByMobile(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;
}
public Integer updateLineInfo(LineInfoDO param){
if(Objects.isNull(param.getId())){

View File

@@ -20,9 +20,11 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.text.MessageFormat;
import java.util.Date;
import java.util.Objects;
/**
@@ -179,6 +181,7 @@ public class WechatMiniAppServiceImpl implements WechatMiniAppService {
}
@Override
@Transactional(rollbackFor = Exception.class)
public String updateUserPhoneNumber(MobileUpdateRequest request, PartnerUserInfoVO userInfoVO) {
String newMobile = "";
HyPartnerUserInfoDO oldUserInfo = hyPartnerUserInfoDAO.selectByMobile(userInfoVO.getMobile());
@@ -195,11 +198,16 @@ public class WechatMiniAppServiceImpl implements WechatMiniAppService {
return newMobile;
}
HyPartnerUserInfoDO newUserInfo = hyPartnerUserInfoDAO.selectByMobile(newMobile);
if (newUserInfo != null) {
Boolean lineInfoByMobile = lineInfoDAO.getLineInfoByMobile(newMobile);
if (newUserInfo != null&& lineInfoByMobile) {
throw new ServiceException(ErrorCodeEnum.NEW_MOBILE_HAS_EXIST);
}
LineInfoDO lineInfoDO = lineInfoDAO.getByPartnerId(userInfoVO.getPartnerId());
lineInfoDO.setMobile(newMobile);
lineInfoDO.setUpdateTime(new Date());
oldUserInfo.setMobile(newMobile);
hyPartnerUserInfoDAO.updateByPrimaryKeySelective(oldUserInfo);
lineInfoDAO.updateLineInfo(lineInfoDO);
//修改意向申请信息中的手机号
// hyPartnerBaseInfoDAO.updateByPartnerId(null, newMobile, oldUserInfo.getPartnerId());
}