|
|
@ -2,13 +2,14 @@ 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.dto.form.UserRoleFormDTO; |
|
|
|
import com.epmet.dto.result.UserRoleResultDTO; |
|
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
|
import com.epmet.feign.GovIssueOpenFeignClient; |
|
|
|
import com.epmet.modules.group.dao.ResiGroupDao; |
|
|
|
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.ExitGroupService; |
|
|
@ -60,6 +61,8 @@ public class ExitGroupServiceImpl implements ExitGroupService { |
|
|
|
private ResiGroupStatisticalDao resiGroupStatisticalDao; |
|
|
|
@Autowired |
|
|
|
private ResiGroupRedis resiGroupRedis; |
|
|
|
@Autowired |
|
|
|
private ResiGroupDao resiGroupDao; |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
@ -69,6 +72,11 @@ public class ExitGroupServiceImpl implements ExitGroupService { |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void removeMember(ExitGroupFormDTO formDTO) { |
|
|
|
//0.组长自己不能删除自己
|
|
|
|
if(formDTO.getUserId().equals(formDTO.getOperateUserId())){ |
|
|
|
throw new RenException("群组长不能删除自己"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.校验被删除人员是否是当前小组内成员
|
|
|
|
int num = resiGroupMemberDao.checkUserInGroup(formDTO.getUserId(), formDTO.getGroupId()); |
|
|
|
if (num < NumConstant.ONE) { |
|
|
@ -141,16 +149,18 @@ public class ExitGroupServiceImpl implements ExitGroupService { |
|
|
|
} |
|
|
|
|
|
|
|
//5.群组统计表修改数据
|
|
|
|
//5-1.获取被删人员居民端角色信息
|
|
|
|
LoginUserDetailsFormDTO dto = new LoginUserDetailsFormDTO(); |
|
|
|
//5-1.获取被删人员当前网格居民端角色信息
|
|
|
|
ResiGroupEntity groupEntity = resiGroupDao.selectById(formDTO.getGroupId()); |
|
|
|
UserRoleFormDTO dto = new UserRoleFormDTO(); |
|
|
|
dto.setApp("resi"); |
|
|
|
dto.setClient("wxmp"); |
|
|
|
dto.setUserId(formDTO.getUserId()); |
|
|
|
Result<LoginUserDetailsResultDTO> resultUser = epmetUserOpenFeignClient.getLoginUserDetails(dto); |
|
|
|
dto.setCustomerId(formDTO.getCustomerId()); |
|
|
|
dto.setGridId(groupEntity.getGridId()); |
|
|
|
Result<List<UserRoleResultDTO>> resultUser = epmetUserOpenFeignClient.getUserRoleInfo(dto); |
|
|
|
if (!resultUser.success()) { |
|
|
|
throw new RenException(resultUser.getInternalMsg()); |
|
|
|
} |
|
|
|
List<GovTokenDto.Role> roleList = resultUser.getData().getRoleList(); |
|
|
|
List<UserRoleResultDTO> roleList = resultUser.getData(); |
|
|
|
//5-2.群组统计表数据修改,缓存数据修改
|
|
|
|
ResiGroupStatisticalEntity statisticalEntity = resiGroupStatisticalDao.selectByResiGroupId(formDTO.getGroupId()); |
|
|
|
if (null == statisticalEntity) { |
|
|
@ -159,10 +169,10 @@ public class ExitGroupServiceImpl implements ExitGroupService { |
|
|
|
statisticalEntity.setTotalMembers(statisticalEntity.getTotalMembers() - 1); |
|
|
|
statisticalEntity.setTotalNormalMemebers(statisticalEntity.getTotalNormalMemebers() - 1); |
|
|
|
roleList.forEach(r -> { |
|
|
|
if ("partymember".equals(r)) {//党员总数减一
|
|
|
|
if ("partymember".equals(r.getRoleKey())) {//党员总数减一
|
|
|
|
statisticalEntity.setTotalPartyMembers(statisticalEntity.getTotalPartyMembers() - 1); |
|
|
|
} |
|
|
|
if ("warmhearted".equals(r)) {//热心居民总数减一
|
|
|
|
if ("warmhearted".equals(r.getRoleKey())) {//热心居民总数减一
|
|
|
|
statisticalEntity.setTotalEarnestMemebers(statisticalEntity.getTotalEarnestMemebers() - 1); |
|
|
|
} |
|
|
|
}); |
|
|
|