Browse Source

Merge branches 'dev' and 'dev_heart' of http://git.elinkit.com.cn:7070/r/epmet-cloud into dev_heart

dev_shibei_match
yinzuomei 5 years ago
parent
commit
bfd89299a7
  1. 12
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserResiInfoDTO.java
  2. 2
      epmet-user/epmet-user-server/deploy/docker-compose-dev.yml
  3. 2
      epmet-user/epmet-user-server/pom.xml
  4. 1
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java
  5. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserCustomerDao.java
  6. 18
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserResiInfoDao.java
  7. 31
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java
  8. 16
      epmet-user/epmet-user-server/src/main/resources/mapper/UserCustomerDao.xml
  9. 8
      epmet-user/epmet-user-server/src/main/resources/mapper/UserResiInfoDao.xml

12
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserResiInfoDTO.java

@ -17,9 +17,11 @@
package com.epmet.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
@ -48,9 +50,10 @@ public class UserResiInfoDTO implements Serializable {
*/
private String userId;
/**
* 手机号(注册手机号)
*/
/**
* 手机号(注册手机号)
*/
@NotBlank(message = "手机号不能为空")
private String regMobile;
/**
@ -121,6 +124,7 @@ public class UserResiInfoDTO implements Serializable {
/**
* 客户Id (customer.id)
*/
@NotBlank(message = "客户Id不能为空")
private String customerId;
/**

2
epmet-user/epmet-user-server/deploy/docker-compose-dev.yml

@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-user-server:
container_name: epmet-user-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.93
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.94
ports:
- "8087:8087"
network_mode: host # 不会创建新的网络

2
epmet-user/epmet-user-server/pom.xml

@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<version>0.3.93</version>
<version>0.3.94</version>
<parent>
<groupId>com.epmet</groupId>
<artifactId>epmet-user</artifactId>

1
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java

@ -149,6 +149,7 @@ public class UserResiInfoController {
**/
@PostMapping("saveResiInfo")
public Result saveResiInfo (@RequestBody UserResiInfoDTO userResiInfoDTO) {
ValidatorUtils.validateEntity(userResiInfoDTO);
return userResiInfoService.saveResiInfo(userResiInfoDTO);
}

11
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserCustomerDao.java

@ -3,6 +3,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.UserCustomerEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* @Description 客户用户关系表
@ -11,6 +12,14 @@ import org.apache.ibatis.annotations.Mapper;
* @date 2020.03.31 13:53
*/
@Mapper
public interface UserCustomerDao extends BaseDao<UserCustomerEntity>{
public interface UserCustomerDao extends BaseDao<UserCustomerEntity> {
/**
* desc:修改客户的用户的注册状态为已注册
*
* @param customerId
* @param userId
* @return
*/
int updateRegistered(@Param("customerId") String customerId, @Param("userId") String userId);
}

18
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserResiInfoDao.java

@ -39,8 +39,8 @@ import java.util.List;
public interface UserResiInfoDao extends BaseDao<UserResiInfoEntity> {
/**
* @return com.epmet.dto.UserResiInfoDTO
* @param userResiInfoFormDTO
* @return com.epmet.dto.UserResiInfoDTO
* @Author yinzuomei
* @Description 查询用户注册信息
* @Date 2020/3/30 11:10
@ -48,23 +48,23 @@ public interface UserResiInfoDao extends BaseDao<UserResiInfoEntity> {
UserResiInfoResultDTO selectUserResiInfoDTO(UserResiInfoFormDTO userResiInfoFormDTO);
/**
* @Description 查询用户注册信息 不按照客户Id查询
* @param userResiInfoFormDTO
* @return UserResiInfoResultDTO
* @return UserResiInfoResultDTO
* @Description 查询用户注册信息 不按照客户Id查询
* @author wangc
* @date 2020.05.21 13:18
**/
**/
UserResiInfoResultDTO selectUserResiInfoNotByCustId(UserResiInfoFormDTO userResiInfoFormDTO);
/**
* @Author sun
* @Description 根据手机号查询居民注册信息(user_resi_info)表数据
**/
List<UserResiInfoDTO> selectResiInfoByMobile(String regMobile);
List<UserResiInfoDTO> selectResiInfoByMobile(@Param("regMobile") String regMobile, @Param("customerId") String customerId);
/**
* @return java.util.List<com.epmet.dto.UserResiInfoDTO>
* @param userIdList
* @return java.util.List<com.epmet.dto.UserResiInfoDTO>
* @Author yinzuomei
* @Description 根据userId集合查询用户注册信息
* @Date 2020/4/7 18:26
@ -72,18 +72,18 @@ public interface UserResiInfoDao extends BaseDao<UserResiInfoEntity> {
List<UserResiInfoResultDTO> selectListUserResiInfoDTO(@Param("userIdList") List<String> userIdList);
/**
* @Description 根据userId查询议题发起人
* @param formDTO
* @Description 根据userId查询议题发起人
* @author zxc
* @date 2020/5/11 11:18
*/
IssueInitiatorResultDTO selectIssueInitiator(IssueInitiatorFormDTO formDTO);
/**
* @return com.epmet.dto.UserResiInfoDTO
* @param userId
* @return com.epmet.dto.UserResiInfoDTO
* @author yinzuomei
* @description 根据要用户id,查询用户注册的信息
* @description 根据要用户id, 查询用户注册的信息
* @Date 2020/7/22 10:58
**/
UserResiInfoDTO selectByUserId(String userId);

31
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.metadata.IPage;
import com.epmet.common.token.util.UserUtil;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.EpmetRoleKeyConstant;
import com.epmet.commons.tools.constant.FieldConstant;
@ -30,9 +31,11 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.SmsTemplateConstant;
import com.epmet.constant.UserConstant;
import com.epmet.constant.UserRoleConstant;
import com.epmet.dao.UserCustomerDao;
import com.epmet.dao.UserResiInfoDao;
import com.epmet.dao.UserWechatDao;
import com.epmet.dto.UserResiInfoDTO;
import com.epmet.dto.UserResiRegisterVisitDTO;
import com.epmet.dto.UserRoleDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.IssueInitiatorResultDTO;
@ -79,6 +82,8 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us
@Autowired
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@Autowired
private UserCustomerDao userCustomerDao;
@Autowired
private UserBaseInfoService userBaseInfoService;
@Autowired
private UserWechatDao userWechatService;
@ -165,8 +170,8 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us
userResiRegisterVisitService.updateResiRegisterVisit(false, userResiInfoDTO);
return new Result().error(EpmetErrorCode.MOBILE_CODE_ERROR.getCode());
}*/
//2:再次判断手机号是否可用
if (!getResiInfoByMobile(userResiInfoDTO.getRegMobile())) {
//2:再次判断手机号是否在客户下可用
if (!getResiInfoByMobile(userResiInfoDTO.getRegMobile(), userResiInfoDTO.getCustomerId())) {
//手机号验证失败则更新行为记录表数据 返回前台结果
userResiRegisterVisitService.updateResiRegisterVisit(false, userResiInfoDTO);
return new Result().error(EpmetErrorCode.MOBILE_HAS_BEEN_USED.getCode());
@ -222,15 +227,17 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us
//1:更新居民注册访问记录表数据
userResiRegisterVisitService.updateResiVisitOperate(verificationCodeFormDTO);
//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());
}
//3:调用短信服务 生成验证码发送短信
SendVerificationCodeFormDTO sendVerificationCodeFormDTO=new SendVerificationCodeFormDTO();
SendVerificationCodeFormDTO sendVerificationCodeFormDTO = new SendVerificationCodeFormDTO();
sendVerificationCodeFormDTO.setMobile(verificationCodeFormDTO.getMobile());
sendVerificationCodeFormDTO.setAliyunTemplateCode(SmsTemplateConstant.USER_REGISTER);
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());
}
//4:删除缓存中可能存在的旧验证码
@ -241,11 +248,12 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us
}
@Override
@Transactional(rollbackFor = Exception.class)
public Result saveResiInfo(UserResiInfoDTO userResiInfoDTO) {
Result result = new Result();
//判断手机号是否可用
if (getResiInfoByMobile(userResiInfoDTO.getRegMobile())) {
if (getResiInfoByMobile(userResiInfoDTO.getRegMobile(), userResiInfoDTO.getCustomerId())) {
//数据存入居民注册表
saveUserResiInfo(userResiInfoDTO);
//居民注册关系表新增数据 首次注册数加一 注册数加一 参与数加一
@ -256,6 +264,8 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us
userRole.setRoleKey(UserConstant.ROLE_RESI);
userRole.setApp(userResiInfoDTO.getApp());
userRoleService.saveUserRole(userRole);
//更新该用户在该客户下的注册状态
userCustomerDao.updateRegistered(userResiInfoDTO.getCustomerId(), userResiInfoDTO.getUserId());
}
return result;
@ -282,12 +292,17 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us
* 判断手机号是否可用-根据手机号查询居民注册信息(user_resi_info)表数据
*
* @param mobile
* @param customerId
* @return
* @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;
List<UserResiInfoDTO> list = userResiInfoDao.selectResiInfoByMobile(mobile);
List<UserResiInfoDTO> list = userResiInfoDao.selectResiInfoByMobile(mobile, customerId);
if (list.size() > 0) {
bl = false;
}

16
epmet-user/epmet-user-server/src/main/resources/mapper/UserCustomerDao.xml

@ -3,18 +3,8 @@
<mapper namespace="com.epmet.dao.UserCustomerDao">
<resultMap type="com.epmet.entity.UserCustomerEntity" id="userCustomerMap">
<result property="id" column="ID"/>
<result property="app" column="APP"/>
<result property="roleName" column="ROLE_NAME"/>
<result property="roleKey" column="ROLE_KEY"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<update id="updateRegistered">
update set IS_REGISTER = 1 where CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} and USER_ID = #{userId,jdbcType=VARCHAR}
</update>
</mapper>

8
epmet-user/epmet-user-server/src/main/resources/mapper/UserResiInfoDao.xml

@ -98,8 +98,12 @@
SELECT
<include refid="sql"></include>
FROM user_resi_info uri
WHERE uri.del_flag = '0'
AND uri.reg_mobile = #{regMobile}
LEFT JOIN user_customer uc ON uri.USER_ID = uc.USER_ID
WHERE
uri.DEL_FLAG = '0'
AND uri.REG_MOBILE = #{regMobile,jdbcType=VARCHAR}
AND uc.CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
AND uc.IS_REGISTER = 1
</select>
<!-- 根据userId集合查询用户注册信息 -->

Loading…
Cancel
Save