Browse Source

进入小组时查询组-客户关系列表,保证唯一性

master
wangchao 6 years ago
parent
commit
9221264bb3
  1. 2
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupInfoRedisDTO.java
  2. 17
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java

2
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupInfoRedisDTO.java

@ -56,7 +56,7 @@ public class ResiGroupInfoRedisDTO implements Serializable{
private String latestTopicPublishDate;
/**
* 组统计嘻嘻你系
* 组统计信息
* */
private ResiGroupStatisticalInfoRedisDTO groupStatisticalInfo;

17
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java

@ -168,12 +168,16 @@ public class RegisterRelationServiceImpl extends BaseServiceImpl<RegisterRelatio
userCustomer.setCustomerId(enterGridFormDTO.getCustomerId());
userCustomer.setUserId(enterGridFormDTO.getUserId());
List<RegisterRelationEntity> registerRecords = baseDao.getListByUserId(enterGridFormDTO.getUserId());
QueryWrapper<UserCustomerEntity> wrapper = new QueryWrapper<>();
wrapper.eq(UserCustomerConstant.CUSTOMER_ID,enterGridFormDTO.getCustomerId());
wrapper.eq(UserCustomerConstant.USER_ID,enterGridFormDTO.getUserId());
//1.查找用户注册关系表,如果没有表示当前用户为陌生人(拉取用户微信表信息),如果有表示当前用户已经进行居民认证
if(null == registerRecords || registerRecords.size() <= 0){
//当前用户尚未注册过居民信息
QueryWrapper<UserCustomerEntity> wrapper = new QueryWrapper<>();
wrapper.eq(UserCustomerConstant.CUSTOMER_ID,enterGridFormDTO.getCustomerId());
wrapper.eq(UserCustomerConstant.USER_ID,enterGridFormDTO.getUserId());
List<UserCustomerEntity> userCustomerList = userCustomerDao.selectList(wrapper);
if(null == userCustomerList || userCustomerList.size() <= 0){
userCustomerDao.insert(userCustomer);
@ -192,7 +196,7 @@ public class RegisterRelationServiceImpl extends BaseServiceImpl<RegisterRelatio
Optional<RegisterRelationEntity> registerRecordWithSameCustAndGrid =
registerRecords.stream().filter(obj -> customerId.equals(obj.getCustomerId()) && gridId.equals(obj.getGridId())).findFirst();
//是否存在相同客户相同网格的注册记录
//存在相同客户相同网格的注册记录
if(!registerRecordWithSameCustAndGrid.isPresent()){
Optional<RegisterRelationEntity> registerRecordWithSameCustAndDiffGrid =
registerRecords.stream().filter(obj -> customerId.equals(obj.getCustomerId()) && !gridId.equals(obj.getGridId())).findAny();
@ -217,7 +221,10 @@ public class RegisterRelationServiceImpl extends BaseServiceImpl<RegisterRelatio
registerRelationToSave.setParticipation(NumConstant.ONE_STR);
baseDao.insert(registerRelationToSave);
userCustomerDao.insert(userCustomer);
List<UserCustomerEntity> userCustomerList = userCustomerDao.selectList(wrapper);
if(null == userCustomerList || userCustomerList.size() <= 0){
userCustomerDao.insert(userCustomer);
}
}else{
//如果不存在不同客户不同网格数据,说明在居民注册时没有成功记录register_relation信息

Loading…
Cancel
Save