From f1886ce21a494a1d6bf728dcd9ce757481e3dd55 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 31 Mar 2021 09:36:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=BB=84=E5=91=98=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=9C=A8=E7=BE=A4=E7=BB=84=E7=BB=9F=E8=AE=A1=E8=A1=A8?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E3=80=81=E8=AF=9D=E9=A2=98=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E8=A1=A8=E6=95=B0=E6=8D=AE=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ExitGroupServiceImpl.java | 58 ++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ExitGroupServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ExitGroupServiceImpl.java index 4116d6907c..e5a7d71a1e 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ExitGroupServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ExitGroupServiceImpl.java @@ -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 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 resultUser = epmetUserOpenFeignClient.getLoginUserDetails(dto); + if (!resultUser.success()) { + throw new RenException(resultUser.getInternalMsg()); + } + List 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()); + }