|
|
@ -2,8 +2,15 @@ package com.epmet.modules.group.service.impl; |
|
|
|
|
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.security.dto.GovTokenDto; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.dto.form.LoginUserDetailsFormDTO; |
|
|
|
import com.epmet.dto.result.LoginUserDetailsResultDTO; |
|
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
|
import com.epmet.feign.GovIssueOpenFeignClient; |
|
|
|
import com.epmet.modules.group.dao.ResiGroupStatisticalDao; |
|
|
|
import com.epmet.modules.group.entity.ResiGroupStatisticalEntity; |
|
|
|
import com.epmet.modules.group.redis.ResiGroupRedis; |
|
|
|
import com.epmet.modules.group.service.ExitGroupService; |
|
|
|
import com.epmet.modules.member.dao.ExitGroupRecordDao; |
|
|
|
import com.epmet.modules.member.dao.GroupMemeberOperationDao; |
|
|
@ -11,7 +18,8 @@ import com.epmet.modules.member.dao.ResiGroupMemberDao; |
|
|
|
import com.epmet.modules.member.entity.ExitGroupRecordEntity; |
|
|
|
import com.epmet.modules.topic.dao.ResiTopicCommentDao; |
|
|
|
import com.epmet.modules.topic.dao.ResiTopicDao; |
|
|
|
import com.epmet.modules.topic.entity.ResiTopicEntity; |
|
|
|
import com.epmet.modules.topic.entity.ResiTopicOperationEntity; |
|
|
|
import com.epmet.modules.topic.service.ResiTopicOperationService; |
|
|
|
import com.epmet.resi.group.dto.group.form.ExitGroupFormDTO; |
|
|
|
import com.epmet.resi.group.dto.member.GroupMemeberOperationDTO; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
@ -44,6 +52,14 @@ public class ExitGroupServiceImpl implements ExitGroupService { |
|
|
|
private GovIssueOpenFeignClient govIssueOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private ResiTopicCommentDao resiTopicCommentDao; |
|
|
|
@Autowired |
|
|
|
private ResiTopicOperationService resiTopicOperationService; |
|
|
|
@Autowired |
|
|
|
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private ResiGroupStatisticalDao resiGroupStatisticalDao; |
|
|
|
@Autowired |
|
|
|
private ResiGroupRedis resiGroupRedis; |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
@ -76,6 +92,16 @@ public class ExitGroupServiceImpl implements ExitGroupService { |
|
|
|
//2-3.屏蔽这些单纯的话题
|
|
|
|
if (delIdList.size() > NumConstant.ZERO) { |
|
|
|
resiTopicDao.upTopicList(delIdList, formDTO.getOperateUserId()); |
|
|
|
//2-4.话题操作日志表批量新增记录
|
|
|
|
List<ResiTopicOperationEntity> list = new ArrayList<>(); |
|
|
|
ResiTopicOperationEntity entity = new ResiTopicOperationEntity(); |
|
|
|
entity.setOperationType("hidden"); |
|
|
|
entity.setOperationReason("组员删除,话题屏蔽"); |
|
|
|
delIdList.forEach(d->{ |
|
|
|
entity.setTopicId(d); |
|
|
|
list.add(entity); |
|
|
|
}); |
|
|
|
resiTopicOperationService.insertBatch(list); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -114,6 +140,36 @@ public class ExitGroupServiceImpl implements ExitGroupService { |
|
|
|
throw new RenException(String.format("新增退群记录表数据操作失败,小组Id【%s】被修改人Id【%s】", formDTO.getGroupId(), formDTO.getUserId())); |
|
|
|
} |
|
|
|
|
|
|
|
//5.群组统计表修改数据
|
|
|
|
//5-1.获取被删人员居民端角色信息
|
|
|
|
LoginUserDetailsFormDTO dto = new LoginUserDetailsFormDTO(); |
|
|
|
dto.setApp("resi"); |
|
|
|
dto.setClient("wxmp"); |
|
|
|
dto.setUserId(formDTO.getUserId()); |
|
|
|
Result<LoginUserDetailsResultDTO> resultUser = epmetUserOpenFeignClient.getLoginUserDetails(dto); |
|
|
|
if (!resultUser.success()) { |
|
|
|
throw new RenException(resultUser.getInternalMsg()); |
|
|
|
} |
|
|
|
List<GovTokenDto.Role> roleList = resultUser.getData().getRoleList(); |
|
|
|
//5-2.群组统计表数据修改,缓存数据修改
|
|
|
|
ResiGroupStatisticalEntity statisticalEntity = resiGroupStatisticalDao.selectByResiGroupId(formDTO.getGroupId()); |
|
|
|
if (null == statisticalEntity) { |
|
|
|
throw new RenException("未查询到群组统计数据,删除失败"); |
|
|
|
} |
|
|
|
statisticalEntity.setTotalMembers(statisticalEntity.getTotalMembers() - 1); |
|
|
|
statisticalEntity.setTotalNormalMemebers(statisticalEntity.getTotalNormalMemebers() - 1); |
|
|
|
roleList.forEach(r -> { |
|
|
|
if ("partymember".equals(r)) {//党员总数减一
|
|
|
|
statisticalEntity.setTotalPartyMembers(statisticalEntity.getTotalPartyMembers() - 1); |
|
|
|
} |
|
|
|
if ("warmhearted".equals(r)) {//热心居民总数减一
|
|
|
|
statisticalEntity.setTotalEarnestMemebers(statisticalEntity.getTotalEarnestMemebers() - 1); |
|
|
|
} |
|
|
|
}); |
|
|
|
resiGroupStatisticalDao.updateById(statisticalEntity); |
|
|
|
resiGroupRedis.delGroup(formDTO.getGroupId()); |
|
|
|
resiGroupRedis.get(formDTO.getGroupId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|