|
|
@ -19,10 +19,12 @@ package com.epmet.modules.group.service.impl; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.extension.api.R; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.EpmetRoleKeyConstant; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
@ -35,11 +37,15 @@ import com.epmet.modules.feign.EpmetUserFeignClient; |
|
|
|
import com.epmet.modules.group.dao.ResiGroupStatisticalDao; |
|
|
|
import com.epmet.modules.group.entity.ResiGroupEntity; |
|
|
|
import com.epmet.modules.group.entity.ResiGroupStatisticalEntity; |
|
|
|
import com.epmet.modules.group.redis.ResiGroupRedis; |
|
|
|
import com.epmet.modules.group.service.ResiGroupStatisticalService; |
|
|
|
import com.epmet.modules.member.dao.ResiGroupMemberDao; |
|
|
|
import com.epmet.modules.member.entity.ResiGroupMemberEntity; |
|
|
|
import com.epmet.modules.utils.ModuleConstant; |
|
|
|
import com.epmet.resi.group.dto.group.ResiGroupStatisticalDTO; |
|
|
|
import com.epmet.resi.group.dto.group.form.ResiRolesOfGroupMemberFormDTO; |
|
|
|
import com.epmet.resi.group.dto.member.form.RemoveMemberFormDTO; |
|
|
|
import com.epmet.resi.group.dto.member.form.ResiIdentityFormDTO; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
@ -50,6 +56,7 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* 群组统计信息表 |
|
|
@ -64,6 +71,10 @@ public class ResiGroupStatisticalServiceImpl extends BaseServiceImpl<ResiGroupSt |
|
|
|
private ResiGroupServiceImpl resiGroupServiceImpl; |
|
|
|
@Autowired |
|
|
|
private EpmetUserFeignClient epmetUserFeignClient; |
|
|
|
@Autowired |
|
|
|
private ResiGroupMemberDao resiGroupMemberDao; |
|
|
|
@Autowired |
|
|
|
private ResiGroupRedis resiGroupRedis; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<ResiGroupStatisticalDTO> page(Map<String, Object> params) { |
|
|
@ -168,4 +179,50 @@ public class ResiGroupStatisticalServiceImpl extends BaseServiceImpl<ResiGroupSt |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description partymember服务审核通过热心居民、党员申请之后,需要遍历这个人所在的组进行组的缓存与数据库的更新 |
|
|
|
* @param resiIdentityFormDTO |
|
|
|
* @return |
|
|
|
* @author wangc |
|
|
|
* @date 2020.05.26 14:12 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void updateWhenAuditedResiRole(ResiIdentityFormDTO resiIdentityFormDTO) { |
|
|
|
//用户Id不能为空
|
|
|
|
//warmFlag为"1"时,网格Id不能为空
|
|
|
|
//warmFlag与partyFlag不能同时不为0
|
|
|
|
if(StringUtils.isBlank(resiIdentityFormDTO.getUserId()) |
|
|
|
|| (StringUtils.isBlank(resiIdentityFormDTO.getGridId()) && StringUtils.equals(NumConstant.ONE_STR,resiIdentityFormDTO.getWarmFlag())) |
|
|
|
|| (StringUtils.equals(NumConstant.ONE_STR,resiIdentityFormDTO.getPartyFlag()) && StringUtils.equals(NumConstant.ONE_STR,resiIdentityFormDTO.getWarmFlag()))){ |
|
|
|
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); |
|
|
|
} |
|
|
|
|
|
|
|
//查出这个人所在这个网格下的所有的组Id
|
|
|
|
List<String> groupIds = |
|
|
|
resiGroupMemberDao.getGroupIdByUserIdAndGridId(resiIdentityFormDTO.getGridId(), |
|
|
|
resiIdentityFormDTO.getUserId(), |
|
|
|
StringUtils.equals(NumConstant.ONE_STR,resiIdentityFormDTO.getWarmFlag()) ? NumConstant.ONE_STR : NumConstant.THREE_STR |
|
|
|
); |
|
|
|
if(null != groupIds && groupIds.size() > NumConstant.ZERO){ |
|
|
|
List<ResiRolesOfGroupMemberFormDTO> params = groupIds.stream().map(groupId -> { |
|
|
|
ResiRolesOfGroupMemberFormDTO param = new ResiRolesOfGroupMemberFormDTO(); |
|
|
|
param.setGroupId(groupId); |
|
|
|
if(StringUtils.equals(NumConstant.ONE_STR,resiIdentityFormDTO.getWarmFlag())){ |
|
|
|
param.setWarmFlag(NumConstant.ONE_STR); |
|
|
|
}else{ |
|
|
|
param.setPartyFlag(NumConstant.ONE_STR); |
|
|
|
} |
|
|
|
param.setUpdatedBy(resiIdentityFormDTO.getOperatorId()); |
|
|
|
return param; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
baseDao.incryResiRoleMembersBatch(params); |
|
|
|
resiGroupRedis.increaseRolesCount(params); |
|
|
|
} |
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|