|
@ -19,7 +19,6 @@ 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; |
|
@ -31,11 +30,9 @@ import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.constant.SmsTemplateConstant; |
|
|
import com.epmet.constant.SmsTemplateConstant; |
|
|
import com.epmet.constant.UserConstant; |
|
|
import com.epmet.constant.UserConstant; |
|
|
import com.epmet.constant.UserRoleConstant; |
|
|
import com.epmet.constant.UserRoleConstant; |
|
|
import com.epmet.dao.UserCustomerDao; |
|
|
|
|
|
import com.epmet.dao.UserResiInfoDao; |
|
|
import com.epmet.dao.UserResiInfoDao; |
|
|
import com.epmet.dao.UserWechatDao; |
|
|
import com.epmet.dao.UserWechatDao; |
|
|
import com.epmet.dto.UserResiInfoDTO; |
|
|
import com.epmet.dto.UserResiInfoDTO; |
|
|
import com.epmet.dto.UserResiRegisterVisitDTO; |
|
|
|
|
|
import com.epmet.dto.UserRoleDTO; |
|
|
import com.epmet.dto.UserRoleDTO; |
|
|
import com.epmet.dto.form.*; |
|
|
import com.epmet.dto.form.*; |
|
|
import com.epmet.dto.result.IssueInitiatorResultDTO; |
|
|
import com.epmet.dto.result.IssueInitiatorResultDTO; |
|
@ -85,8 +82,6 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us |
|
|
private UserBaseInfoService userBaseInfoService; |
|
|
private UserBaseInfoService userBaseInfoService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private UserWechatDao userWechatService; |
|
|
private UserWechatDao userWechatService; |
|
|
@Autowired |
|
|
|
|
|
private UserCustomerDao userCustomerDao; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PageData<UserResiInfoDTO> page(Map<String, Object> params) { |
|
|
public PageData<UserResiInfoDTO> page(Map<String, Object> params) { |
|
@ -169,8 +164,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(), userResiInfoDTO.getCustomerId())) { |
|
|
if (!getResiInfoByMobile(userResiInfoDTO.getRegMobile())) { |
|
|
//手机号验证失败则更新行为记录表数据 返回前台结果
|
|
|
//手机号验证失败则更新行为记录表数据 返回前台结果
|
|
|
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()); |
|
@ -226,17 +221,15 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us |
|
|
//1:更新居民注册访问记录表数据
|
|
|
//1:更新居民注册访问记录表数据
|
|
|
userResiRegisterVisitService.updateResiVisitOperate(verificationCodeFormDTO); |
|
|
userResiRegisterVisitService.updateResiVisitOperate(verificationCodeFormDTO); |
|
|
//2:判断手机号是否可用
|
|
|
//2:判断手机号是否可用
|
|
|
//2020-07-29 根据要注册的网格获取客户Id
|
|
|
if (!getResiInfoByMobile(verificationCodeFormDTO.getMobile())) { |
|
|
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:删除缓存中可能存在的旧验证码
|
|
@ -247,12 +240,11 @@ 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(), userResiInfoDTO.getCustomerId())) { |
|
|
if (getResiInfoByMobile(userResiInfoDTO.getRegMobile())) { |
|
|
//数据存入居民注册表
|
|
|
//数据存入居民注册表
|
|
|
saveUserResiInfo(userResiInfoDTO); |
|
|
saveUserResiInfo(userResiInfoDTO); |
|
|
//居民注册关系表新增数据 首次注册数加一 注册数加一 参与数加一
|
|
|
//居民注册关系表新增数据 首次注册数加一 注册数加一 参与数加一
|
|
@ -262,8 +254,6 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us |
|
|
userRole.setUserId(userResiInfoDTO.getUserId()); |
|
|
userRole.setUserId(userResiInfoDTO.getUserId()); |
|
|
userRole.setRoleKey(UserConstant.ROLE_RESI); |
|
|
userRole.setRoleKey(UserConstant.ROLE_RESI); |
|
|
userRoleService.saveUserRole(userRole); |
|
|
userRoleService.saveUserRole(userRole); |
|
|
//更新该用户在该客户下的注册状态
|
|
|
|
|
|
userCustomerDao.updateRegistered(userResiInfoDTO.getCustomerId(), userResiInfoDTO.getUserId()); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return result; |
|
|
return result; |
|
@ -290,17 +280,12 @@ 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, String customerId) { |
|
|
private Boolean getResiInfoByMobile(String mobile) { |
|
|
if (StringUtils.isBlank(customerId)) { |
|
|
|
|
|
customerId = UserUtil.getCurrentUser().getCustomerId(); |
|
|
|
|
|
log.info("getResiInfoByMobile UserUtil.getCustomerId:{}", customerId); |
|
|
|
|
|
} |
|
|
|
|
|
Boolean bl = true; |
|
|
Boolean bl = true; |
|
|
List<UserResiInfoDTO> list = userResiInfoDao.selectResiInfoByMobile(mobile, customerId); |
|
|
List<UserResiInfoDTO> list = userResiInfoDao.selectResiInfoByMobile(mobile); |
|
|
if (list.size() > 0) { |
|
|
if (list.size() > 0) { |
|
|
bl = false; |
|
|
bl = false; |
|
|
} |
|
|
} |
|
|