|
@ -21,21 +21,24 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.constant.UserResiRegisterConstant; |
|
|
import com.epmet.constant.UserResiRegisterConstant; |
|
|
import com.epmet.dao.UserResiInfoDao; |
|
|
import com.epmet.dao.UserResiInfoDao; |
|
|
import com.epmet.dto.UserResiInfoDTO; |
|
|
import com.epmet.dto.UserResiInfoDTO; |
|
|
import com.epmet.dto.form.UserResiInfoFormDTO; |
|
|
import com.epmet.dto.form.UserResiInfoFormDTO; |
|
|
|
|
|
import com.epmet.dto.form.VerificationCodeFormDTO; |
|
|
import com.epmet.entity.UserResiInfoEntity; |
|
|
import com.epmet.entity.UserResiInfoEntity; |
|
|
import com.epmet.redis.UserResiInfoRedis; |
|
|
import com.epmet.redis.UserResiInfoRedis; |
|
|
import com.epmet.service.RegisterRelationService; |
|
|
import com.epmet.service.RegisterRelationService; |
|
|
import com.epmet.service.UserResiInfoService; |
|
|
import com.epmet.service.UserResiInfoService; |
|
|
import com.epmet.service.UserResiRegisterVisitService; |
|
|
import com.epmet.service.UserResiRegisterVisitService; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
|
import org.slf4j.Logger; |
|
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
@ -54,6 +57,7 @@ import java.util.Map; |
|
|
@Service |
|
|
@Service |
|
|
public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, UserResiInfoEntity> implements UserResiInfoService { |
|
|
public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, UserResiInfoEntity> implements UserResiInfoService { |
|
|
|
|
|
|
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(UserResiInfoServiceImpl.class); |
|
|
@Autowired |
|
|
@Autowired |
|
|
private UserResiInfoRedis userResiInfoRedis; |
|
|
private UserResiInfoRedis userResiInfoRedis; |
|
|
@Autowired |
|
|
@Autowired |
|
@ -140,14 +144,15 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us |
|
|
//2:验证码校验失败则更新行为记录表数据 返回前台结果
|
|
|
//2:验证码校验失败则更新行为记录表数据 返回前台结果
|
|
|
if (false) { |
|
|
if (false) { |
|
|
userResiRegisterVisitService.updateResiRegisterVisit(false, userResiInfoDTO); |
|
|
userResiRegisterVisitService.updateResiRegisterVisit(false, userResiInfoDTO); |
|
|
|
|
|
result.error(UserResiRegisterConstant.PARAMETER_ERROR); |
|
|
result.setMsg(UserResiRegisterConstant.MOBILECODE_EXCEPTION); |
|
|
result.setMsg(UserResiRegisterConstant.MOBILECODE_EXCEPTION); |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
//3:校验成功 数据存入居民注册表 更新行为记录表数据
|
|
|
//3:校验成功 数据存入居民注册表 更新行为记录表数据
|
|
|
saveUserResiInfo(userResiInfoDTO); |
|
|
saveUserResiInfo(userResiInfoDTO); |
|
|
result = userResiRegisterVisitService.updateResiRegisterVisit(true, userResiInfoDTO); |
|
|
userResiRegisterVisitService.updateResiRegisterVisit(true, userResiInfoDTO); |
|
|
//4:居民注册关系表新增数据 首次注册数加一 注册数加一 参与数加一
|
|
|
//4:居民注册关系表新增数据 首次注册数加一 注册数加一 参与数加一
|
|
|
result = registerRelationService.saveRegisterRelation(userResiInfoDTO); |
|
|
registerRelationService.saveRegisterRelation(userResiInfoDTO); |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -170,4 +175,47 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us |
|
|
userResiInfoDao.saveUserResiInfo(userResiInfoDTO); |
|
|
userResiInfoDao.saveUserResiInfo(userResiInfoDTO); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @param verificationCodeFormDTO |
|
|
|
|
|
* @Author sun |
|
|
|
|
|
* @Description 居民端-居民注册根据手机号获取验证码 |
|
|
|
|
|
**/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public Result getVerificationCode(VerificationCodeFormDTO verificationCodeFormDTO) { |
|
|
|
|
|
Result result = new Result(); |
|
|
|
|
|
//1:更新居民注册访问记录表数据
|
|
|
|
|
|
userResiRegisterVisitService.updateResiVisitOperate(verificationCodeFormDTO); |
|
|
|
|
|
//2:判断手机号是否可用
|
|
|
|
|
|
if (!getResiInfoByMobile(verificationCodeFormDTO.getMobile())) { |
|
|
|
|
|
result.error(UserResiRegisterConstant.PARAMETER_ERROR); |
|
|
|
|
|
result.setMsg(UserResiRegisterConstant.MOBILE_EXIST); |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
//3:调用短信服务 生成验证码发送短信 TODO
|
|
|
|
|
|
|
|
|
|
|
|
//4:将验证码存入redis TODO
|
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 判断手机号是否可用-根据手机号查询居民注册信息(user_resi_info)表数据 |
|
|
|
|
|
* |
|
|
|
|
|
* @param mobile |
|
|
|
|
|
* @return |
|
|
|
|
|
* @Author sun |
|
|
|
|
|
*/ |
|
|
|
|
|
private Boolean getResiInfoByMobile(String mobile) { |
|
|
|
|
|
Boolean bl = true; |
|
|
|
|
|
if (StringUtils.isBlank(mobile)) { |
|
|
|
|
|
log.error(UserResiRegisterConstant.PARAMETER_ERROR); |
|
|
|
|
|
return bl; |
|
|
|
|
|
} |
|
|
|
|
|
List<UserResiInfoDTO> list = userResiInfoDao.selectResiInfoByMobile(mobile); |
|
|
|
|
|
if (list.size() > 0) { |
|
|
|
|
|
bl = false; |
|
|
|
|
|
} |
|
|
|
|
|
return bl; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|