Browse Source

Merge remote-tracking branch 'remotes/origin/dev_more_appid' into dev

# Conflicts:
#	epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java
master
jianjun 5 years ago
parent
commit
6662004736
  1. 29
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java

29
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java

@ -19,6 +19,7 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.common.token.util.UserUtil;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.EpmetRoleKeyConstant; import com.epmet.commons.tools.constant.EpmetRoleKeyConstant;
import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.FieldConstant;
@ -79,6 +80,8 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us
@Autowired @Autowired
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@Autowired @Autowired
private UserCustomerDao userCustomerDao;
@Autowired
private UserBaseInfoService userBaseInfoService; private UserBaseInfoService userBaseInfoService;
@Autowired @Autowired
private UserWechatDao userWechatService; private UserWechatDao userWechatService;
@ -165,8 +168,8 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us
userResiRegisterVisitService.updateResiRegisterVisit(false, userResiInfoDTO); userResiRegisterVisitService.updateResiRegisterVisit(false, userResiInfoDTO);
return new Result().error(EpmetErrorCode.MOBILE_CODE_ERROR.getCode()); return new Result().error(EpmetErrorCode.MOBILE_CODE_ERROR.getCode());
}*/ }*/
//2:再次判断手机号是否可用 //2:再次判断手机号是否在客户下可用
if (!getResiInfoByMobile(userResiInfoDTO.getRegMobile())) { if (!getResiInfoByMobile(userResiInfoDTO.getRegMobile(), userResiInfoDTO.getCustomerId())) {
//手机号验证失败则更新行为记录表数据 返回前台结果 //手机号验证失败则更新行为记录表数据 返回前台结果
userResiRegisterVisitService.updateResiRegisterVisit(false, userResiInfoDTO); userResiRegisterVisitService.updateResiRegisterVisit(false, userResiInfoDTO);
return new Result().error(EpmetErrorCode.MOBILE_HAS_BEEN_USED.getCode()); return new Result().error(EpmetErrorCode.MOBILE_HAS_BEEN_USED.getCode());
@ -222,15 +225,17 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us
//1:更新居民注册访问记录表数据 //1:更新居民注册访问记录表数据
userResiRegisterVisitService.updateResiVisitOperate(verificationCodeFormDTO); userResiRegisterVisitService.updateResiVisitOperate(verificationCodeFormDTO);
//2:判断手机号是否可用 //2:判断手机号是否可用
if (!getResiInfoByMobile(verificationCodeFormDTO.getMobile())) { //2020-07-29 根据要注册的网格获取客户Id
UserResiRegisterVisitDTO registerVisitDTO = userResiRegisterVisitService.get(verificationCodeFormDTO.getResiVisitId());
if (!getResiInfoByMobile(verificationCodeFormDTO.getMobile(), registerVisitDTO.getCustomerId())) {
return new Result().error(EpmetErrorCode.MOBILE_HAS_BEEN_USED.getCode()); return new Result().error(EpmetErrorCode.MOBILE_HAS_BEEN_USED.getCode());
} }
//3:调用短信服务 生成验证码发送短信 //3:调用短信服务 生成验证码发送短信
SendVerificationCodeFormDTO sendVerificationCodeFormDTO=new SendVerificationCodeFormDTO(); SendVerificationCodeFormDTO sendVerificationCodeFormDTO = new SendVerificationCodeFormDTO();
sendVerificationCodeFormDTO.setMobile(verificationCodeFormDTO.getMobile()); sendVerificationCodeFormDTO.setMobile(verificationCodeFormDTO.getMobile());
sendVerificationCodeFormDTO.setAliyunTemplateCode(SmsTemplateConstant.USER_REGISTER); sendVerificationCodeFormDTO.setAliyunTemplateCode(SmsTemplateConstant.USER_REGISTER);
Result<SendVerificationCodeResultDTO> result = epmetMessageOpenFeignClient.sendVerificationCode(sendVerificationCodeFormDTO); Result<SendVerificationCodeResultDTO> result = epmetMessageOpenFeignClient.sendVerificationCode(sendVerificationCodeFormDTO);
if(!result.success()||null==result.getData()||StringUtils.isBlank(result.getData().getCode())){ if (!result.success() || null == result.getData() || StringUtils.isBlank(result.getData().getCode())) {
return new Result().error(EpmetErrorCode.MOBILE_GET_CODE_ERROR.getCode()); return new Result().error(EpmetErrorCode.MOBILE_GET_CODE_ERROR.getCode());
} }
//4:删除缓存中可能存在的旧验证码 //4:删除缓存中可能存在的旧验证码
@ -241,11 +246,12 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public Result saveResiInfo(UserResiInfoDTO userResiInfoDTO) { public Result saveResiInfo(UserResiInfoDTO userResiInfoDTO) {
Result result = new Result(); Result result = new Result();
//判断手机号是否可用 //判断手机号是否可用
if (getResiInfoByMobile(userResiInfoDTO.getRegMobile())) { if (getResiInfoByMobile(userResiInfoDTO.getRegMobile(), userResiInfoDTO.getCustomerId())) {
//数据存入居民注册表 //数据存入居民注册表
saveUserResiInfo(userResiInfoDTO); saveUserResiInfo(userResiInfoDTO);
//居民注册关系表新增数据 首次注册数加一 注册数加一 参与数加一 //居民注册关系表新增数据 首次注册数加一 注册数加一 参与数加一
@ -256,6 +262,8 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us
userRole.setRoleKey(UserConstant.ROLE_RESI); userRole.setRoleKey(UserConstant.ROLE_RESI);
userRole.setApp(userResiInfoDTO.getApp()); userRole.setApp(userResiInfoDTO.getApp());
userRoleService.saveUserRole(userRole); userRoleService.saveUserRole(userRole);
//更新该用户在该客户下的注册状态
userCustomerDao.updateRegistered(userResiInfoDTO.getCustomerId(), userResiInfoDTO.getUserId());
} }
return result; return result;
@ -282,12 +290,17 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us
* 判断手机号是否可用-根据手机号查询居民注册信息(user_resi_info)表数据 * 判断手机号是否可用-根据手机号查询居民注册信息(user_resi_info)表数据
* *
* @param mobile * @param mobile
* @param customerId
* @return * @return
* @Author sun * @Author sun
*/ */
private Boolean getResiInfoByMobile(String mobile) { private Boolean getResiInfoByMobile(String mobile, String customerId) {
if (StringUtils.isBlank(customerId)) {
log.info("getResiInfoByMobile UserUtil.getCustomerId:{}", customerId);
customerId = UserUtil.getCurrentUser().getCustomerId();
}
Boolean bl = true; Boolean bl = true;
List<UserResiInfoDTO> list = userResiInfoDao.selectResiInfoByMobile(mobile); List<UserResiInfoDTO> list = userResiInfoDao.selectResiInfoByMobile(mobile, customerId);
if (list.size() > 0) { if (list.size() > 0) {
bl = false; bl = false;
} }

Loading…
Cancel
Save