diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java
index e69de29bb2..e5507ab766 100644
--- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java
+++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java
@@ -0,0 +1,1358 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.modules.group.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
+import com.epmet.commons.tools.constant.AppClientConstant;
+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.scan.param.ImgScanParamDTO;
+import com.epmet.commons.tools.scan.param.ImgTaskDTO;
+import com.epmet.commons.tools.scan.param.TextScanParamDTO;
+import com.epmet.commons.tools.scan.param.TextTaskDTO;
+import com.epmet.commons.tools.scan.result.SyncScanResult;
+import com.epmet.commons.tools.security.user.LoginUserUtil;
+import com.epmet.commons.tools.utils.*;
+import com.epmet.constant.ReadFlagConstant;
+import com.epmet.dto.form.*;
+import com.epmet.dto.result.UserResiInfoResultDTO;
+import com.epmet.dto.result.UserRoleResultDTO;
+import com.epmet.feign.EpmetMessageOpenFeignClient;
+import com.epmet.modules.constant.UserMessageConstant;
+import com.epmet.modules.feign.EpmetMessageFeignClient;
+import com.epmet.modules.feign.EpmetUserFeignClient;
+import com.epmet.modules.feign.GovOrgFeignClient;
+import com.epmet.modules.group.dao.GroupEditSubmitRecordDao;
+import com.epmet.modules.group.dao.ResiGroupDao;
+import com.epmet.modules.group.dao.ResiGroupOperationDao;
+import com.epmet.modules.group.entity.GroupEditSubmitRecordEntity;
+import com.epmet.modules.group.entity.ResiGroupEntity;
+import com.epmet.modules.group.entity.ResiGroupOperationEntity;
+import com.epmet.modules.group.redis.ResiGroupRedis;
+import com.epmet.modules.group.service.ResiGroupOperationService;
+import com.epmet.modules.group.service.ResiGroupService;
+import com.epmet.modules.group.service.ResiGroupStatisticalService;
+import com.epmet.modules.member.dao.GroupMemeberOperationDao;
+import com.epmet.modules.member.dao.ResiGroupMemberDao;
+import com.epmet.modules.member.redis.ResiGroupMemberRedis;
+import com.epmet.modules.member.service.GroupMemeberOperationService;
+import com.epmet.modules.member.service.ResiGroupMemberService;
+import com.epmet.modules.utils.ModuleConstant;
+import com.epmet.resi.group.constant.*;
+import com.epmet.resi.group.dto.UserRoleDTO;
+import com.epmet.resi.group.dto.group.*;
+import com.epmet.resi.group.dto.group.form.GridIdFormDTO;
+import com.epmet.resi.group.dto.group.form.ShouldVoteCountFormDTO;
+import com.epmet.resi.group.dto.group.form.*;
+import com.epmet.resi.group.dto.group.result.*;
+import com.epmet.resi.group.dto.member.GroupMemeberOperationDTO;
+import com.epmet.resi.group.dto.member.ResiGroupMemberDTO;
+import com.epmet.resi.group.dto.member.ResiGroupMemberInfoRedisDTO;
+import com.github.pagehelper.PageHelper;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * 群组信息表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-28
+ */
+@Service
+public class ResiGroupServiceImpl extends BaseServiceImpl implements ResiGroupService {
+ private Logger logger = LoggerFactory.getLogger(getClass());
+
+ @Autowired
+ private ResiGroupMemberService resiGroupMemberService;
+
+ @Autowired
+ private ResiGroupOperationService resiGroupOperationService;
+
+ @Autowired
+ private EpmetUserFeignClient epmetUserFeignClient;
+
+ @Autowired
+ private GroupMemeberOperationService groupMemeberOperationService;
+
+ @Autowired
+ private ResiGroupStatisticalService resiGroupStatisticalService;
+
+ @Autowired
+ private ResiGroupOperationDao resiGroupOperationDao;
+
+ @Autowired
+ private ResiGroupMemberDao resiGroupMemberDao;
+
+ @Autowired
+ private GroupMemeberOperationDao groupMemeberOperationDao;
+
+ @Autowired
+ private ResiGroupRedis resiGroupRedis;
+
+ @Autowired
+ private ResiGroupMemberRedis resiGroupMemberRedis;
+
+ @Autowired
+ private GovOrgFeignClient govOrgFeignClient;
+
+ @Autowired
+ private EpmetMessageFeignClient epmetMessageFeignClient;
+
+ @Autowired
+ private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
+
+ @Autowired
+ private ResiGroupDao resiGroupDao;
+
+ @Autowired
+ private GroupEditSubmitRecordDao groupEditSubmitRecordDao;
+
+ @Autowired
+ private LoginUserUtil loginUserUtil;
+
+ @Autowired
+ private CpUserDetailRedis sysUserInfoRedis;
+
+ @Value("${openapi.scan.server.url}")
+ private String scanApiUrl;
+
+ @Value("${openapi.scan.method.textSyncScan}")
+ private String textSyncScanMethod;
+
+ @Value("${openapi.scan.method.imgSyncScan}")
+ private String imgSyncScanMethod;
+
+ @Override
+ public PageData page(Map params) {
+ IPage page = baseDao.selectPage(
+ getPage(params, FieldConstant.CREATED_TIME, false),
+ getWrapper(params)
+ );
+ return getPageData(page, ResiGroupDTO.class);
+ }
+
+ @Override
+ public List list(Map params) {
+ List entityList = baseDao.selectList(getWrapper(params));
+
+ return ConvertUtils.sourceToTarget(entityList, ResiGroupDTO.class);
+ }
+
+ private QueryWrapper getWrapper(Map params) {
+ String id = (String) params.get(FieldConstant.ID_HUMP);
+
+ QueryWrapper wrapper = new QueryWrapper<>();
+ wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
+
+ return wrapper;
+ }
+
+ @Override
+ public ResiGroupDTO get(String id) {
+ ResiGroupEntity entity = baseDao.selectById(id);
+ return ConvertUtils.sourceToTarget(entity, ResiGroupDTO.class);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void save(ResiGroupDTO dto) {
+ ResiGroupEntity entity = ConvertUtils.sourceToTarget(dto, ResiGroupEntity.class);
+ insert(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(ResiGroupDTO dto) {
+ ResiGroupEntity entity = ConvertUtils.sourceToTarget(dto, ResiGroupEntity.class);
+ updateById(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void delete(String[] ids) {
+ // 逻辑删除(@TableLogic 注解)
+ baseDao.deleteBatchIds(Arrays.asList(ids));
+ }
+
+ /**
+ * @param myGroupFormDTO
+ * @return com.epmet.commons.tools.utils.Result>
+ * @Author yinzuomei
+ * @Description 我的小组查询(包含我创建的小组+我加入的小组),以各组的最新话题时间有近到远排序)
+ * @Date 2020/3/28 20:37
+ **/
+ @Override
+ public List getMyGroup(MyGroupFormDTO myGroupFormDTO) {
+ int pageIndex = (myGroupFormDTO.getPageNo() - NumConstant.ONE) * myGroupFormDTO.getPageSize();
+ myGroupFormDTO.setPageNo(pageIndex);
+ List myGroupList = baseDao.selectListMyGroup(myGroupFormDTO);
+ if (null == myGroupList || myGroupList.size() < 1) {
+ logger.info(String.format("我的小组查询为空,selectListMyGroup入参%s", JSON.toJSONString(myGroupFormDTO)));
+ return new ArrayList<>();
+ }
+ return myGroupList;
+ }
+
+ /**
+ * @param recommendGroupFormDTO
+ * @return com.epmet.commons.tools.utils.Result>
+ * @Author yinzuomei
+ * @Description 推荐组列表查询
+ * @Date 2020/3/28 19:53
+ **/
+ @Override
+ public List getRecommendGroup(RecommendGroupFormDTO recommendGroupFormDTO) {
+ int pageIndex = (recommendGroupFormDTO.getPageNo() - NumConstant.ONE) * recommendGroupFormDTO.getPageSize();
+ recommendGroupFormDTO.setPageNo(pageIndex);
+ //显示当前网格内所有当前用户还未加入的组,以组的人数由高到低排序;如果人数相同,以最新话题的时间有近到远排序
+ List recommendGroupList = baseDao.selectListRecommendGroup(recommendGroupFormDTO);
+ if (null == recommendGroupList || recommendGroupList.size() == 0) {
+ logger.info(String.format("推荐小组查询为空,selectListRecommendGroup入参%s", JSON.toJSONString(recommendGroupFormDTO)));
+ return new ArrayList<>();
+ }
+ for (RecommendGroupResultDTO recommendGroupResultDTO : recommendGroupList) {
+ GroupMemeberOperationDTO groupMemeberOperationDTO = groupMemeberOperationService.selectLatestRecord(recommendGroupResultDTO.getGroupId(),
+ recommendGroupFormDTO.getUserId());
+ if (null != groupMemeberOperationDTO) {
+ recommendGroupResultDTO.setStatus(groupMemeberOperationDTO.getOperateStatus());
+ }
+ }
+ return recommendGroupList;
+ }
+
+ /**
+ * @param createdFormDTO
+ * @return com.epmet.commons.tools.utils.Result>
+ * @Author yinzuomei
+ * @Description 我创建的小组
+ * @Date 2020/3/28 22:01
+ **/
+ @Override
+ public List getCreated(CreatedFormDTO createdFormDTO) {
+ int pageIndex = (createdFormDTO.getPageNo() - NumConstant.ONE) * createdFormDTO.getPageSize();
+ createdFormDTO.setPageNo(pageIndex);
+ List createdResultDTOList = baseDao.selectListMyCreated(createdFormDTO);
+ if (null == createdResultDTOList || createdResultDTOList.size() == 0) {
+ logger.info(String.format("我创建的小组查询为空,selectListMyCreated入参%s", JSON.toJSONString(createdFormDTO)));
+ return new ArrayList<>();
+ }
+ return createdResultDTOList;
+ }
+
+ /**
+ * @param modifyGroupFormDTO
+ * @return com.epmet.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 修改组信息
+ * @Date 2020/3/28 22:27
+ **/
+ @Transactional(rollbackFor = Exception.class)
+ @Override
+ public void modifyGroup(ModifyGroupFormDTO modifyGroupFormDTO) {
+ //校验是否是群主
+ ResiGroupMemberDTO groupMemberDTO = resiGroupMemberService.getResiGroupMember(modifyGroupFormDTO.getGroupId(), modifyGroupFormDTO.getUserId());
+ if (null == groupMemberDTO || ModuleConstant.GROUP_MEMBER.equals(groupMemberDTO.getGroupLeaderFlag())) {
+ logger.info(String.format("修改小组信息异常:%s",EpmetErrorCode.GROUP_LEADER_CAN_EDIT_GROUP_INFO.getMsg()));
+ throw new RenException(EpmetErrorCode.GROUP_LEADER_CAN_EDIT_GROUP_INFO.getCode());
+ }
+ if (StringUtils.isBlank(modifyGroupFormDTO.getGroupHeadPhoto())
+ && StringUtils.isBlank(modifyGroupFormDTO.getGroupName())
+ && StringUtils.isBlank(modifyGroupFormDTO.getGroupIntroduction())) {
+ logger.info("小组信息未发生变更,无需更改");
+ return;
+ }
+ int updatedRows = baseDao.modifyGroupInfo(modifyGroupFormDTO);
+ if (1 == updatedRows) {
+ logger.info("修改小组信息成功");
+ }else{
+ logger.error(String.format("修改小组信息失败,updatedRows=%s",updatedRows));
+ }
+ }
+
+ /**
+ * @param groupSummarizeFormDTO
+ * @return com.epmet.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 查看小组管理界面信息
+ * @Date 2020/3/29 17:52
+ **/
+ @Override
+ public GroupSummarizeResultDTO getGroupSummarize(GroupSummarizeFormDTO groupSummarizeFormDTO) {
+ GroupSummarizeResultDTO groupSummarizeResultDTO = baseDao.selectGroupSummarize(groupSummarizeFormDTO);
+ if (null == groupSummarizeResultDTO) {
+ logger.warn(String.format("查看小组管理界面信息异常,userId=%s,groupId=%s",groupSummarizeFormDTO.getUserId(),groupSummarizeFormDTO.getGroupId()));
+ return new GroupSummarizeResultDTO();
+ }
+ //获取组长信息
+ Result groupLeaderUserInfo = this.getGroupLeaderUserInfo(groupSummarizeFormDTO.getGroupId());
+ if (groupLeaderUserInfo.success() && null != groupLeaderUserInfo.getData()) {
+ groupSummarizeResultDTO.setLeaderName(groupLeaderUserInfo.getData().getShowName());
+ } else {
+ logger.warn(String.format("查看小组管理界面信息错误,获取组长注册信息失败,接口返参%s",JSON.toJSONString(groupLeaderUserInfo)));
+ groupSummarizeResultDTO.setLeaderName("");
+ }
+ return groupSummarizeResultDTO;
+ }
+
+ /**
+ * @param groupId
+ * @return com.epmet.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 根据组id查询组长信息
+ * @Date 2020/3/30 15:07
+ **/
+ private Result getGroupLeaderUserInfo(String groupId) {
+ //群主名称需要调用feign查询
+ ResiGroupEntity resiGroupEntity = baseDao.selectById(groupId);
+ if (null == resiGroupEntity) {
+ return new Result<>();
+ }
+ ResiGroupMemberDTO groupMemberDTO = baseDao.selectGroupLeader(groupId);
+ if (null == groupMemberDTO) {
+ return new Result<>();
+ }
+ UserResiInfoFormDTO resiUserInfoFormDTO = new UserResiInfoFormDTO();
+ resiUserInfoFormDTO.setCustomerId(resiGroupEntity.getCustomerId());
+ resiUserInfoFormDTO.setUserId(groupMemberDTO.getCustomerUserId());
+ return epmetUserFeignClient.getUserResiInfoDTO(resiUserInfoFormDTO);
+ }
+
+ /**
+ * @param applyCreateGroupFormDTO
+ * @return com.epmet.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 创建小组
+ * @Date 2020/3/29 19:26
+ **/
+ @Transactional(rollbackFor = Exception.class)
+ @Override
+ public void applyCreateGroup(ApplyCreateGroupFormDTO applyCreateGroupFormDTO) {
+ //1、校验是否同名
+ List resiGroupEntityList = this.getResiGroupEntityList(applyCreateGroupFormDTO);
+ if (null != resiGroupEntityList && resiGroupEntityList.size() > 0) {
+ logger.info(String.format("创建小组异常:%s",EpmetErrorCode.GROUP_ALREADY_EXISTED.getMsg()));
+ throw new RenException(EpmetErrorCode.GROUP_ALREADY_EXISTED.getCode());
+ }
+
+ //2.内容检查
+ scanGroupEditContent(applyCreateGroupFormDTO.getGroupName(),
+ applyCreateGroupFormDTO.getGroupIntroduction(),
+ applyCreateGroupFormDTO.getGroupHeadPhoto());
+
+ //3.1、查询当前申请人的身份,生成对应格式的消息内容
+ UserRoleDTO userRoleDTO = this.checkPartyMemberOrWarmHeated(applyCreateGroupFormDTO.getApp(),
+ applyCreateGroupFormDTO.getUserId(),
+ applyCreateGroupFormDTO.getCustomerId(),
+ applyCreateGroupFormDTO.getGridId());
+ if (!NumConstant.ONE_STR.equals(userRoleDTO.getPartymemberFlag()) && !NumConstant.ONE_STR.equals(userRoleDTO.getWarmHeartedFlag())) {
+ logger.info(String.format("创建小组异常:%s",EpmetErrorCode.CANNOT_CREATE_GROUP.getMsg()));
+ throw new RenException(EpmetErrorCode.CANNOT_CREATE_GROUP.getCode());
+ }
+ String roleName = "";
+ if(NumConstant.ONE_STR.equals(userRoleDTO.getPartymemberFlag())){
+ roleName = ModuleConstant.PARTYMEMBER;
+ }else if(NumConstant.ONE_STR.equals(userRoleDTO.getWarmHeartedFlag())){
+ roleName = ModuleConstant.WAREMHEARTED_RESI;
+ }
+
+ //3.2、插入一条待审核的组信息
+ ResiGroupEntity resiGroupEntity = this.structureResiGroupEntity(applyCreateGroupFormDTO);
+ insert(resiGroupEntity);
+ //4.获取居民注册信息
+ UserResiInfoFormDTO resiParam = new UserResiInfoFormDTO();
+ resiParam.setCustomerId(applyCreateGroupFormDTO.getCustomerId());
+ resiParam.setUserId(applyCreateGroupFormDTO.getUserId());
+ Result resiResult =
+ epmetUserFeignClient.getUserResiInfoDTO(resiParam);
+ String userName = "";
+ if(resiResult.success() && null != resiResult.getData()){
+ userName = (StringUtils.isBlank(resiResult.getData().getSurname()) ? "" : resiResult.getData().getSurname())
+ + (StringUtils.isBlank(resiResult.getData().getName()) ? "" :resiResult.getData().getName());
+ }
+ userName = StringUtils.isBlank(userName) ? ModuleConstant.UNKNOWN : userName;
+ String msg = String.format(UserMessageConstant.CREATION_OF_GROUP_MESSAGE_TEMPLATE,roleName,userName,applyCreateGroupFormDTO.getGroupName());
+ //4.2、插入一条待审核的操作记录
+ ResiGroupOperationDTO resiGroupOperation = new ResiGroupOperationDTO();
+ resiGroupOperation.setResiGroupId(resiGroupEntity.getId());
+ resiGroupOperation.setState(GroupStateConstant.GROUP_UNDER_AUDITTING);
+ resiGroupOperation.setOperateUserId(applyCreateGroupFormDTO.getUserId());
+ resiGroupOperation.setMessageText(msg);
+ resiGroupOperation.setReadFlag(ModuleConstant.UNREAD);
+ resiGroupOperationService.save(resiGroupOperation);
+ //5、插入一群成员信息(群主)
+ ResiGroupMemberDTO resiGroupMemberDTO = new ResiGroupMemberDTO();
+ resiGroupMemberDTO.setCustomerUserId(applyCreateGroupFormDTO.getUserId());
+ resiGroupMemberDTO.setResiGroupId(resiGroupEntity.getId());
+ resiGroupMemberDTO.setGroupLeaderFlag(LeaderFlagConstant.GROUP_LEADER);
+ resiGroupMemberDTO.setStatus(MemberStateConstant.UNDER_AUDITTING);
+ resiGroupMemberDTO.setEnterGroupType(EnterGroupTypeConstant.CREATED);
+ resiGroupMemberService.save(resiGroupMemberDTO);
+ //6、插入一条入群记录(群主的)
+ GroupMemeberOperationDTO groupMemeberOperationDTO = new GroupMemeberOperationDTO();
+ groupMemeberOperationDTO.setCustomerUserId(applyCreateGroupFormDTO.getUserId());
+ groupMemeberOperationDTO.setGroupId(resiGroupEntity.getId());
+ groupMemeberOperationDTO.setOperateStatus(MemberStateConstant.UNDER_AUDITTING);
+ groupMemeberOperationDTO.setOperateUserId(applyCreateGroupFormDTO.getUserId());
+ groupMemeberOperationDTO.setEnterGroupType(EnterGroupTypeConstant.CREATED);
+ groupMemeberOperationService.save(groupMemeberOperationDTO);
+ //7、群初始统计记录
+ /*UserRoleDTO userRoleDTO = this.checkPartyMemberOrWarmHeated(applyCreateGroupFormDTO.getApp(),
+ applyCreateGroupFormDTO.getUserId(),
+ applyCreateGroupFormDTO.getCustomerId(),
+ applyCreateGroupFormDTO.getGridId());*/
+ ResiGroupStatisticalDTO resiGroupStatisticalDTO = new ResiGroupStatisticalDTO();
+ resiGroupStatisticalDTO.setResiGroupId(resiGroupEntity.getId());
+ resiGroupStatisticalDTO.setTotalMembers(NumConstant.ONE);
+ resiGroupStatisticalDTO.setTotalNormalMemebers(NumConstant.ONE);
+ resiGroupStatisticalDTO.setTotalTopics(NumConstant.ZERO);
+ resiGroupStatisticalDTO.setTotalIssues(NumConstant.ZERO);
+ if (NumConstant.ONE_STR.equals(userRoleDTO.getPartymemberFlag())) {
+ resiGroupStatisticalDTO.setTotalPartyMembers(NumConstant.ONE);
+ } else {
+ resiGroupStatisticalDTO.setTotalPartyMembers(NumConstant.ZERO);
+ }
+ if (NumConstant.ONE_STR.equals(userRoleDTO.getWarmHeartedFlag())) {
+ resiGroupStatisticalDTO.setTotalEarnestMemebers(NumConstant.ONE);
+ } else {
+ resiGroupStatisticalDTO.setTotalEarnestMemebers(NumConstant.ZERO);
+ }
+ resiGroupStatisticalService.save(resiGroupStatisticalDTO);
+ //发送消息:创建小组
+ sendMsgResi2Gov(UserMessageConstant.CREATE_GROUP_APPLYING_MSG_TITLE,msg,applyCreateGroupFormDTO.getGridId(),applyCreateGroupFormDTO.getUserId(),applyCreateGroupFormDTO.getCustomerId());
+ //更新政府端:工作-基层治理-群组管理reddot
+ resiGroupRedis.addWorkGrassrootsGroupRedDotValue(applyCreateGroupFormDTO.getGridId());
+ }
+
+
+ private void setWorkGrassrootsGroupRedDot(String gridId) {
+ try{
+
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @param applyCreateGroupFormDTO
+ * @return java.util.List
+ * @Author yinzuomei
+ * @Description 查询是否存在相同名字的群
+ * @Date 2020/3/30 16:01
+ **/
+ private List getResiGroupEntityList(ApplyCreateGroupFormDTO applyCreateGroupFormDTO) {
+ List list = baseDao.checkResiGroupName(applyCreateGroupFormDTO);
+ return list;
+ }
+
+ /**
+ * @param initApplyGroupFormDTO
+ * @return com.epmet.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 加入小组界面初始化
+ * @Date 2020/3/30 10:17
+ **/
+ @Override
+ public void initApplyGroup(InitApplyGroupFormDTO initApplyGroupFormDTO) {
+ UserResiInfoFormDTO resiUserInfoFormDTO = new UserResiInfoFormDTO();
+ resiUserInfoFormDTO.setUserId(initApplyGroupFormDTO.getUserId());
+ resiUserInfoFormDTO.setCustomerId(initApplyGroupFormDTO.getCustomerId());
+ Result result = epmetUserFeignClient.getUserResiInfoDTO(resiUserInfoFormDTO);
+ if (!result.success() || null == result.getData() || StringUtils.isBlank(result.getData().getRegMobile())) {
+ logger.info(String.format("加入小组界面初始化查询成功,当前用户非注册居民,epmet-user-server接口入参%s,返回%s",JSON.toJSONString(resiUserInfoFormDTO),JSON.toJSONString(result)));
+ throw new RenException(EpmetErrorCode.CANNOT_JOIN_GROUP.getCode());
+ }
+ }
+
+ private ResiGroupEntity structureResiGroupEntity(ApplyCreateGroupFormDTO applyCreateGroupFormDTO) {
+ ResiGroupEntity resiGroupEntity = new ResiGroupEntity();
+ resiGroupEntity.setCustomerId(applyCreateGroupFormDTO.getCustomerId());
+ resiGroupEntity.setGridId(applyCreateGroupFormDTO.getGridId());
+ resiGroupEntity.setGroupHeadPhoto(applyCreateGroupFormDTO.getGroupHeadPhoto());
+ resiGroupEntity.setGroupName(applyCreateGroupFormDTO.getGroupName());
+ resiGroupEntity.setGroupIntroduction(applyCreateGroupFormDTO.getGroupIntroduction());
+ resiGroupEntity.setCreatedBy(applyCreateGroupFormDTO.getUserId());
+ resiGroupEntity.setState(GroupStateConstant.GROUP_UNDER_AUDITTING);
+ return resiGroupEntity;
+ }
+
+ /**
+ * @param initApplyCreatedGroupFormDTO
+ * @return com.epmet.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 校验用户是否是热心居民或者党员
+ * @Date 2020/3/30 15:50
+ **/
+ @Override
+ public void initApplyCreatedGroup(InitApplyCreatedGroupFormDTO initApplyCreatedGroupFormDTO) {
+ UserRoleDTO userRoleDTO = this.checkPartyMemberOrWarmHeated(initApplyCreatedGroupFormDTO.getApp(),
+ initApplyCreatedGroupFormDTO.getUserId(),
+ initApplyCreatedGroupFormDTO.getCustomerId(),
+ initApplyCreatedGroupFormDTO.getGridId());
+ if (!NumConstant.ONE_STR.equals(userRoleDTO.getPartymemberFlag()) && !NumConstant.ONE_STR.equals(userRoleDTO.getWarmHeartedFlag())) {
+ logger.info(String.format("创建小组界面初始化查询成功,用户角色列表%s",JSON.toJSONString(userRoleDTO)));
+ throw new RenException(EpmetErrorCode.CANNOT_CREATE_GROUP.getCode());
+ }
+ }
+
+
+ /**
+ * @param agreeApplyGroupFormDTO
+ * @return com.epmet.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 审核群申请-测试用后面会放到政府端
+ * @Date 2020/3/31 12:44
+ **/
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Result agreeApplyGroup(AgreeApplyGroupFormDTO agreeApplyGroupFormDTO) {
+ //1、更新组的状态
+ ResiGroupDTO resiGroupDTO = this.get(agreeApplyGroupFormDTO.getGroupId());
+ resiGroupDTO.setState(GroupStateConstant.GROUP_APPROVED);
+ this.update(resiGroupDTO);
+ //2、更新组的申请记录改为已通过
+ ResiGroupOperationDTO resiGroupOperation = resiGroupOperationDao.selectGroupApplyRecord(agreeApplyGroupFormDTO.getGroupId());
+ resiGroupOperation.setState(GroupStateConstant.GROUP_APPROVED);
+ resiGroupOperation.setOperateUserId(agreeApplyGroupFormDTO.getUserId());
+ resiGroupOperationService.update(resiGroupOperation);
+ //3、将群主在群成员的状态改为已通过
+ ResiGroupMemberDTO resiGroupMemberDTO = resiGroupMemberDao.selectLeaderMember(agreeApplyGroupFormDTO.getGroupId());
+ resiGroupMemberDTO.setStatus(MemberStateConstant.APPROVED);
+ resiGroupMemberService.update(resiGroupMemberDTO);
+ //4、更新群主的出入群记录改为已通过
+ GroupMemeberOperationDTO groupMemeberOperationDTO = groupMemeberOperationDao.selectLeaderRecord(agreeApplyGroupFormDTO.getGroupId());
+ groupMemeberOperationDTO.setOperateStatus(MemberStateConstant.APPROVED);
+ groupMemeberOperationDTO.setOperateUserId(agreeApplyGroupFormDTO.getUserId());
+ groupMemeberOperationService.update(groupMemeberOperationDTO);
+ //5、给用户发送消息???待定
+ //6、新增小组缓存信息、组员缓存信息
+ Map param = new HashMap<>();
+ param.put(ModuleConstant.RESI_GROUP_ID, resiGroupDTO.getId());
+ param.put(FieldConstant.DEL_FLAG,NumConstant.ZERO_STR);
+ List statisticalList = resiGroupStatisticalService.list(param);
+ if (null != statisticalList && statisticalList.size() > 0) {
+ ResiGroupInfoRedisDTO groupRedis = transferToGroupInfoRedis(resiGroupDTO, statisticalList.get(0));
+ resiGroupRedis.set(groupRedis);
+
+ ResiGroupMemberInfoRedisDTO memberRedis = new ResiGroupMemberInfoRedisDTO();
+ memberRedis.setUserId(resiGroupMemberDTO.getCustomerUserId());
+ memberRedis.setGroupLeaderFlag(ModuleConstant.GROUP_LEADER);
+ memberRedis.setEnterGroupType(resiGroupMemberDTO.getEnterGroupType());
+ memberRedis.setMemberStatus(resiGroupMemberDTO.getStatus());
+ memberRedis.setGroupId(resiGroupMemberDTO.getResiGroupId());
+
+ UserResiInfoFormDTO userParam = new UserResiInfoFormDTO();
+ userParam.setUserId(resiGroupMemberDTO.getCustomerUserId());
+ userParam.setCustomerId(resiGroupDTO.getCustomerId());
+ Result userInfo =
+ epmetUserFeignClient.getUserResiInfoDTO(userParam);
+ if(userInfo.success() && null != userInfo.getData()){
+ memberRedis.setUserShowName(userInfo.getData().getShowName());
+ memberRedis.setUserHeadPhoto(userInfo.getData().getHeadPhoto());
+ memberRedis.setMemberMobile(userInfo.getData().getRegMobile());
+ }else{
+ logger.warn(ModuleConstant.USER_INFO_LIST_NOT_FOUND);
+ }
+ resiGroupMemberRedis.set(memberRedis);
+ } else {
+ /*
+ 当没有查询到组统计信息时,需要自己封装统计信息
+ @param UserRoleFormDTO::getApp
+ @param UserRoleFormDTO::getCustomerId
+ @param UserRoleFormDTO::getUserId
+ @param UserRoleFormDTO::getGridId
+ 查询用户身份信息[热心居民/党员]
+ epmetUserFeignClient.getUserRoleInfo(userRoleFormDTO);
+ */
+ logger.warn(ModuleConstant.NO_SUCH_GROUP_STASTICAL_INFO);
+ }
+ //发送消息
+ UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO();
+ userMessageFormDTO.setUserId(resiGroupDTO.getCreatedBy());
+ userMessageFormDTO.setTitle(UserMessageConstant.AUDITED_GROUP_APPLYING_TITLE);
+ userMessageFormDTO.setReadFlag(ModuleConstant.UNREAD);
+ userMessageFormDTO.setApp(ModuleConstant.APP_RESI);
+ userMessageFormDTO.setGridId(resiGroupDTO.getGridId());
+ userMessageFormDTO.setCustomerId(resiGroupDTO.getCustomerId());
+ userMessageFormDTO.setMessageContent(String.format(UserMessageConstant.AGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName()));
+ if(!epmetMessageFeignClient.saveUserMessage(userMessageFormDTO).success()){
+ logger.warn(String.format(ModuleConstant.FAILED_SEND_MESSAGE,String.format(UserMessageConstant.AGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName())));
+ }
+ //发送微信订阅消息
+ WxSubscribeMessageFormDTO wxSubscribeMessageFormDTO = new WxSubscribeMessageFormDTO();
+ wxSubscribeMessageFormDTO.setCustomerId(resiGroupDTO.getCustomerId());
+ wxSubscribeMessageFormDTO.setUserId(resiGroupDTO.getCreatedBy());
+ wxSubscribeMessageFormDTO.setClientType(AppClientConstant.APP_RESI);
+ wxSubscribeMessageFormDTO.setGridId(resiGroupDTO.getGridId());
+ wxSubscribeMessageFormDTO.setBehaviorType(UserMessageConstant.WX_APPLY_CREATE_GROUP_BEHAVIOR);
+ wxSubscribeMessageFormDTO.setMessageContent(String.format(UserMessageConstant.AGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName()));
+ wxSubscribeMessageFormDTO.setMessageTime(new Date());
+ List msgList = new ArrayList<>();
+ msgList.add(wxSubscribeMessageFormDTO);
+ epmetMessageOpenFeignClient.sendWxSubscribeMessage(msgList);
+ //更新政府端:工作-基层治理-党员认证reddot
+ resiGroupRedis.subtractWorkGrassrootsPartyAuthRedDotValue(resiGroupDTO.getGridId());
+ return new Result();
+ }
+
+ /**
+ * @param disAgreeApplyGroupFormDTO
+ * @return com.epmet.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 审核(拒绝)群申请-测试用后面会放到政府端
+ * @Date 2020/3/31 13:22
+ **/
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Result disagreeApplyGroup(DisAgreeApplyGroupFormDTO disAgreeApplyGroupFormDTO) {
+ //1、更新组的状态
+ ResiGroupDTO resiGroupDTO = this.get(disAgreeApplyGroupFormDTO.getGroupId());
+ resiGroupDTO.setState(GroupStateConstant.GROUP_REJECTED);
+ this.update(resiGroupDTO);
+ //2、更新组的申请记录改为已通过
+ ResiGroupOperationDTO resiGroupOperation = resiGroupOperationDao.selectGroupApplyRecord(disAgreeApplyGroupFormDTO.getGroupId());
+ resiGroupOperation.setState(GroupStateConstant.GROUP_REJECTED);
+ resiGroupOperation.setOperateUserId(disAgreeApplyGroupFormDTO.getUserId());
+ resiGroupOperation.setOperateReason(disAgreeApplyGroupFormDTO.getRejectReason());
+ resiGroupOperationService.update(resiGroupOperation);
+ //3、将群主在群成员的状态改为已通过
+ ResiGroupMemberDTO resiGroupMemberDTO = resiGroupMemberDao.selectLeaderMember(disAgreeApplyGroupFormDTO.getGroupId());
+ resiGroupMemberDTO.setStatus(MemberStateConstant.REJECTED);
+ resiGroupMemberService.update(resiGroupMemberDTO);
+ //4、更新群主的出入群记录改为已通过
+ GroupMemeberOperationDTO groupMemeberOperationDTO = groupMemeberOperationDao.selectLeaderRecord(disAgreeApplyGroupFormDTO.getGroupId());
+ groupMemeberOperationDTO.setOperateStatus(MemberStateConstant.REJECTED);
+ groupMemeberOperationDTO.setOperateUserId(disAgreeApplyGroupFormDTO.getUserId());
+ groupMemeberOperationService.update(groupMemeberOperationDTO);
+ //5、给用户发送消息???待定
+ UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO();
+ userMessageFormDTO.setUserId(resiGroupDTO.getCreatedBy());
+ userMessageFormDTO.setTitle(UserMessageConstant.AUDITED_GROUP_APPLYING_TITLE);
+ userMessageFormDTO.setReadFlag(ModuleConstant.UNREAD);
+ userMessageFormDTO.setApp(ModuleConstant.APP_RESI);
+ userMessageFormDTO.setGridId(resiGroupDTO.getGridId());
+ userMessageFormDTO.setCustomerId(resiGroupDTO.getCustomerId());
+ userMessageFormDTO.setMessageContent(String.format(UserMessageConstant.DISAGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName(),disAgreeApplyGroupFormDTO.getRejectReason()));
+ if(!epmetMessageFeignClient.saveUserMessage(userMessageFormDTO).success()){
+ logger.warn(String.format(ModuleConstant.FAILED_SEND_MESSAGE,String.format(UserMessageConstant.DISAGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName(),disAgreeApplyGroupFormDTO.getRejectReason())));
+ }
+
+ //发送微信订阅消息
+ WxSubscribeMessageFormDTO wxSubscribeMessageFormDTO = new WxSubscribeMessageFormDTO();
+ wxSubscribeMessageFormDTO.setCustomerId(resiGroupDTO.getCustomerId());
+ wxSubscribeMessageFormDTO.setUserId(resiGroupDTO.getCreatedBy());
+ wxSubscribeMessageFormDTO.setClientType(AppClientConstant.APP_RESI);
+ wxSubscribeMessageFormDTO.setGridId(resiGroupDTO.getGridId());
+ wxSubscribeMessageFormDTO.setBehaviorType(UserMessageConstant.WX_APPLY_CREATE_GROUP_BEHAVIOR);
+ wxSubscribeMessageFormDTO.setMessageContent(String.format(UserMessageConstant.DISAGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName(),disAgreeApplyGroupFormDTO.getRejectReason()));
+ wxSubscribeMessageFormDTO.setMessageTime(new Date());
+ List msgList = new ArrayList<>();
+ msgList.add(wxSubscribeMessageFormDTO);
+ epmetMessageOpenFeignClient.sendWxSubscribeMessage(msgList);
+
+ //更新政府端:工作-基层治理-党员认证reddot
+ resiGroupRedis.subtractWorkGrassrootsPartyAuthRedDotValue(resiGroupDTO.getGridId());
+ return new Result();
+ }
+
+ /**
+ * @param app
+ * @param userId
+ * @param customerId
+ * @param gridId
+ * @return boolean
+ * @Author yinzuomei
+ * @Description 用户拥有党员或者热心居民标签返回true, 没有权限返回false
+ * @Date 2020/3/30 16:33
+ **/
+ @Override
+ public UserRoleDTO checkPartyMemberOrWarmHeated(String app, String userId, String customerId, String gridId) {
+ UserRoleDTO userRoleDTO = new UserRoleDTO();
+ UserRoleFormDTO userRoleFormDTO = new UserRoleFormDTO();
+ userRoleFormDTO.setApp(app);
+ userRoleFormDTO.setCustomerId(customerId);
+ userRoleFormDTO.setUserId(userId);
+ userRoleFormDTO.setGridId(gridId);
+ logger.info(String.format("用户同意邀请进组,获取当前用户所有角色入参:%s", JSON.toJSONString(userRoleFormDTO)));
+ Result> userRoleListResult = epmetUserFeignClient.getUserRoleInfo(userRoleFormDTO);
+ if (!userRoleListResult.success()) {
+ logger.error("获取用户角色feign调用失败" + userRoleListResult.getMsg());
+ return userRoleDTO;
+ }
+ List userRoleList = userRoleListResult.getData();
+ if (null == userRoleList || userRoleList.size() == 0) {
+ return userRoleDTO;
+ }
+ for (UserRoleResultDTO userRoleResultDTO : userRoleList) {
+ if (EpmetRoleKeyConstant.PARTYMEMBER.equals(userRoleResultDTO.getRoleKey())) {
+ userRoleDTO.setPartymemberFlag(NumConstant.ONE_STR);
+ }
+ if (EpmetRoleKeyConstant.WARMHEARTED.equals(userRoleResultDTO.getRoleKey())) {
+ userRoleDTO.setWarmHeartedFlag(NumConstant.ONE_STR);
+ }
+ if (EpmetRoleKeyConstant.REGISTERED_RESI.equals(userRoleResultDTO.getRoleKey())) {
+ userRoleDTO.setRegisteredResiFlag(NumConstant.ONE_STR);
+ }
+ }
+ logger.info(String.format("用户同意邀请进组,获取当前用户所有角色返参:%s",JSON.toJSONString(userRoleDTO)));
+ return userRoleDTO;
+ }
+
+ @Override
+ public Result> audited(GroupAuditedFromDTO formDTO) {
+ Result> result = new Result<>();
+ //查询条件
+ int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize();
+ formDTO.setPageNo(pageIndex);
+ //获取审核列表
+ List resultList = baseDao.selectAuditedGroupList(formDTO);
+
+ return result.ok(resultList);
+ }
+
+ @Override
+ public Result> getGroupsInGrid(GroupAuditedFromDTO formDTO) {
+ List resultList = new ArrayList<>();
+ //查询条件
+ int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize();
+ formDTO.setPageNo(pageIndex);
+ List list = baseDao.selectGroupsByGridId(formDTO);
+ list.forEach(group -> {
+ GroupsInGridResultDTO groupsInGridResultDTO = new GroupsInGridResultDTO();
+ if (MemberStateConstant.REJECTED.equals(group.getState())) {
+ groupsInGridResultDTO.setGroupId(group.getId());
+ groupsInGridResultDTO.setGroupName(group.getGroupName());
+ groupsInGridResultDTO.setGroupHeadPhoto(group.getGroupHeadPhoto());
+ groupsInGridResultDTO.setStatus(group.getState());
+ groupsInGridResultDTO.setTotalMember(NumConstant.ZERO);
+ groupsInGridResultDTO.setTotalPartyMember(NumConstant.ZERO);
+ resultList.add(groupsInGridResultDTO);
+ } else if(MemberStateConstant.APPROVED.equals(group.getState())) {
+ //缓存中获取组信息
+ ResiGroupInfoRedisDTO resiGroupInfoRedisDTO = resiGroupRedis.get(group.getId());
+ groupsInGridResultDTO.setGroupId(resiGroupInfoRedisDTO.getGroupId());
+ groupsInGridResultDTO.setGroupName(resiGroupInfoRedisDTO.getGroupName());
+ groupsInGridResultDTO.setGroupHeadPhoto(resiGroupInfoRedisDTO.getGroupHeadPhoto());
+ groupsInGridResultDTO.setStatus(resiGroupInfoRedisDTO.getGroupState());
+ groupsInGridResultDTO.setTotalMember(resiGroupInfoRedisDTO.getGroupStatisticalInfo().getTotalMembers());
+ groupsInGridResultDTO.setTotalPartyMember(resiGroupInfoRedisDTO.getGroupStatisticalInfo().getTotalPartyMembers());
+ resultList.add(groupsInGridResultDTO);
+ }
+
+
+ });
+
+ return new Result>().ok(resultList);
+ }
+
+ @Override
+ public Result getGovGroupSummarize(GovGroupSummarizeFromDTO formDTO) {
+ GovGroupSummarizeResultDTO resultDTO = new GovGroupSummarizeResultDTO();
+ //从缓存中获取组相关信息
+ ResiGroupInfoRedisDTO resiGroupInfoRedisDTO = resiGroupRedis.get(formDTO.getGroupId());
+ resultDTO.setGroupId(resiGroupInfoRedisDTO.getGroupId());
+ resultDTO.setGroupHeadPhoto(resiGroupInfoRedisDTO.getGroupHeadPhoto());
+ resultDTO.setGroupIntroduction(resiGroupInfoRedisDTO.getGroupIntroduction());
+ resultDTO.setGroupName(resiGroupInfoRedisDTO.getGroupName());
+ resultDTO.setTotalMember(resiGroupInfoRedisDTO.getGroupStatisticalInfo().getTotalMembers());
+ resultDTO.setTotalTopics(resiGroupInfoRedisDTO.getGroupStatisticalInfo().getTotalTopics());
+
+ //获取组长信息
+ Result groupLeaderUserInfo = this.getGroupLeaderUserInfo(formDTO.getGroupId());
+ if (groupLeaderUserInfo.success() && null != groupLeaderUserInfo.getData()) {
+ resultDTO.setLeaderName(groupLeaderUserInfo.getData().getShowName());
+ } else {
+ logger.info("组长注册信息查询失败" + groupLeaderUserInfo.getMsg());
+ }
+
+ return new Result().ok(resultDTO);
+ }
+
+ /**
+ * @return ResiGroupInfoRedisDTO
+ * @Description 将ResiGroupDTO与ResiGroupStatisticalDTO转换成ResiGroupInfoRedisDTO
+ * @Param ResiGroupDTO
+ * @Param ResiGroupStatisticalDTO
+ * @Author wangc
+ * @Date 2020.04.13 16:36
+ **/
+ private ResiGroupInfoRedisDTO transferToGroupInfoRedis(ResiGroupDTO groupDTO, ResiGroupStatisticalDTO statisticalDTO) {
+
+ ResiGroupStatisticalInfoRedisDTO statisticalObjct =
+ ConvertUtils.sourceToTarget(statisticalDTO, ResiGroupStatisticalInfoRedisDTO.class);
+ statisticalObjct.setTotalEarnestMembers(statisticalDTO.getTotalEarnestMemebers());
+ statisticalObjct.setTotalNormalMembers(statisticalDTO.getTotalNormalMemebers());
+ ResiGroupInfoRedisDTO targetObject =
+ ConvertUtils.sourceToTarget(groupDTO, ResiGroupInfoRedisDTO.class);
+ targetObject.setGroupId(groupDTO.getId());
+ targetObject.setGroupState(groupDTO.getState());
+ SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN);
+ if (null != groupDTO.getLatestTopicPublishDate()) {
+ targetObject.setLatestTopicPublishDate(format.format(groupDTO.getLatestTopicPublishDate()));
+ }
+ targetObject.setGroupStatisticalInfo(statisticalObjct);
+ return targetObject;
+ }
+
+ /**
+ * @Description 查询待审核的小组 (不从缓存中取,这时还没有成功建组,缓存中没有组数据)
+ * @Param ApplyingGroupsFormDTO
+ * @return Result>
+ * @Author wangc
+ * @Date 2020.04.18 10:18
+ **/
+ @Override
+ public Result> getApplyingGroups(ApplyingGroupsFormDTO params){
+ if(null == params.getPageNo()){
+ throw new RenException(ModuleConstant.PAGE_INDEX_NOT_NULL);
+ }
+ params.setPageNo((params.getPageNo() - NumConstant.ONE) * params.getPageSize());
+ return new Result>().ok(baseDao.getApplyingGroupsByCustIdAndGridId(params));
+ }
+
+ /**
+ * @Description 建组申请详情 已审核(更新已读未读标识)/未审核
+ * @Param AgreeApplyGroupFormDTO
+ * @return Result
+ * @Author wangc
+ * @Date 2020.04.19 23:32
+ **/
+ @Override
+ public Result getApplyingGroupDetail(CommonGroupIdFromDTO groupId){
+ //1.查询小组信息
+ //注意,这里查询出的组申请详情中,无论是已审核还是未审核,都是将该组信息关联到初始化组时状态为[待审核、审核通过、拒绝]其中之一的组操作记录上,并读取审核的已读未读信息,上述三种状态在一个组的所有操作记录当中只可能存在一种,与之后的屏蔽、取消屏蔽、关闭无关,如果查出多条说明建组的逻辑有问题
+ ApplyingGroupDetailResultDTO detail = baseDao.getApplyingGroupDetailByGroupId(groupId.getGroupId());
+ //2.查询用户信息(TODO 先走数据库,之后改成走缓存)
+ List userId = new ArrayList<>();
+ userId.add(detail.getLeaderId());
+ Result> userInfoResult =
+ epmetUserFeignClient.getUserResiInfoList(new UserResiInfoListFormDTO(userId));
+ if(userInfoResult.success() && null != userInfoResult.getData() && userInfoResult.getData().size() >= 1){
+ //姓氏+先生/女士 注:在数据库中拼接成[街道+显示名称]默认格式,故要进行截取
+ //detail.setGroupLeaderName(userInfoResult.getData().get(0).getShowName().split("-")[NumConstant.ONE]);
+ //姓氏+名称
+ detail.setGroupLeaderName(userInfoResult.getData().get(0).getSurname() + userInfoResult.getData().get(0).getName());
+ detail.setStreet(userInfoResult.getData().get(0).getStreet());
+ StringBuffer buffer = new StringBuffer(detail.getStreet());
+ buffer.append(StringUtils.isBlank(buffer) ? "" : "-");
+ detail.setGroupLeaderName(buffer.append(detail.getGroupLeaderName()).toString());
+ }else{
+ logger.warn(ModuleConstant.USER_INFO_LIST_NOT_FOUND);
+ }
+ //3.未读改成已读
+ if(StringUtils.equals(detail.getReadFlag(),ModuleConstant.UNREAD)){
+ ResiGroupOperationEntity operationEntity = new ResiGroupOperationEntity();
+ operationEntity.setId(detail.getOperationId());
+ operationEntity.setReadFlag(ModuleConstant.READ);
+ operationEntity.setUpdatedBy(groupId.getUserId());
+ resiGroupOperationDao.updateById(operationEntity);
+ }
+ //4.将组长用户Id隐藏
+ detail.setLeaderId(null);
+ detail.setOperationId(null);
+
+ return new Result().ok(ConvertUtils.sourceToTarget(detail, ApplyingGroupDetailResult2DTO.class));
+ }
+
+ @Override
+ public List queryGroupProcessingCount(List gridIdList) {
+ List list=new ArrayList<>();
+ for(String gridId:gridIdList){
+ GroupProcessingCountResultDTO resultDTO=new GroupProcessingCountResultDTO();
+ resultDTO.setGridId(gridId);
+ Integer auditingCreateGroupCount=resiGroupRedis.getWorkGrassrootsGroupRedDotValue(gridId);
+ Integer auditingGroupEditRecordCount=groupEditSubmitRecordDao.selectCountAuditingRec(gridId);
+ Integer auditingCount=auditingCreateGroupCount+auditingGroupEditRecordCount;
+ if (null == auditingCount) {
+ resultDTO.setCount(0);
+ } else {
+ resultDTO.setCount(auditingCount);
+ }
+ list.add(resultDTO);
+ }
+ return list;
+ }
+
+
+ /**
+ * @Description 查询一个网格下面所有组Id
+ * @param gridId
+ * @return List
+ * @author wangc
+ * @date 2020.05.14 10:54
+ **/
+ @Override
+ public List getGroupIdByGridId(String gridId) {
+ if(StringUtils.isBlank(gridId)) return null;
+ return baseDao.getGroupIdByGridId(gridId);
+ }
+
+ /**
+ * @Description 返回 Map>
+ * @param gridIdList
+ * @return Map>
+ * @author wangc
+ * @date 2020.05.22 09:27
+ **/
+ @Override
+ public Map> getGroupIdsByGridIdList(List gridIdList) {
+ if(null == gridIdList || gridIdList.size() < NumConstant.ONE)
+ return null;
+ Map> result = new HashMap<>();
+ List groups = new ArrayList<>();
+ Map> groupMap
+ = groups.stream().collect(Collectors.groupingBy(ResiGroupDTO::getGridId));
+ groupMap.forEach((k,v)->{
+ Set groupIds =
+ v.stream().map(ResiGroupDTO::getId).collect(Collectors.toSet());
+ result.put(k,groupIds);
+ });
+
+ return result;
+ }
+
+ /**
+ * @Description 校验用户是否加入小组
+ * @param gridId
+ * @author zxc
+ */
+ @Override
+ public CheckJoinTeamResultDTO checkjointeam(GridIdFormDTO gridId) {
+ CheckJoinTeamResultDTO checkJoinTeamResultDTO = new CheckJoinTeamResultDTO();
+ Integer joinTeamCounts = baseDao.checkjointeam(gridId);
+ if (joinTeamCounts==NumConstant.ZERO){//未加入任何小组(当前网格下)
+ checkJoinTeamResultDTO.setVoteAuthorization(false);
+ }else {
+ checkJoinTeamResultDTO.setVoteAuthorization(true);
+ }
+ return checkJoinTeamResultDTO;
+ }
+
+ /**
+ * @Description 获取应表决数
+ * @param formDTO
+ * @author zxc
+ */
+ @Override
+ public ShouldVoteCountResultDTO shouldVoteCount(ShouldVoteCountFormDTO formDTO) {
+ //网格下所有加过组的人数
+ Integer shouldVoteCount = baseDao.shouldVoteCount(formDTO).getShouldVoteCount();
+ Integer outGroupCount = baseDao.getOutGroupCount(formDTO);
+ ShouldVoteCountResultDTO result = new ShouldVoteCountResultDTO();
+ result.setShouldVoteCount(shouldVoteCount-outGroupCount);
+ return result;
+ }
+
+ @Override
+ public List recommendedList(RecommendedListFormDTO formDTO) {
+
+ //显示当前网格内所有当前用户还未加入的组,以组的人数由高到低排序;如果人数相同,以话题数由多到少排序
+ List recommendGroupList = baseDao.selectListRecommendList(formDTO);
+ recommendGroupList.forEach(dto -> {
+ Result groupLeaderUserInfo = this.getGroupLeaderUserInfo(dto.getGroupId());
+ if (groupLeaderUserInfo.success() && null != groupLeaderUserInfo.getData()) {
+ dto.setLeaderName(groupLeaderUserInfo.getData().getShowName());
+ } else {
+ logger.warn("组长注册信息查询失败" + groupLeaderUserInfo.getMsg());
+ }
+ });
+ return recommendGroupList;
+ }
+
+ /**
+ * @Description 给加入此网格的网格长发送消息
+ * @param msg
+ * @param gridId
+ * @param userId
+ * @author wangc
+ * @date 2020.04.29 22:49
+ **/
+ private void sendMsgResi2Gov(String title,String msg,String gridId,String userId,String customerId){
+ //1.查询加入当前网格下的人员 customer_staff_grid
+ CommonGridIdFormDTO commonGridIdFormDTO = new CommonGridIdFormDTO();
+ commonGridIdFormDTO.setGridId(gridId);
+ commonGridIdFormDTO.setUserId(userId);
+ Result> gridstaffs =
+ govOrgFeignClient.getGridStaffs(commonGridIdFormDTO);
+ //2.查询这些人是否有管理员身份且未被禁用 staff_role customer_staff
+ if(gridstaffs.success() && null != gridstaffs.getData() && gridstaffs.getData().size() > 0){
+ RolesUsersListFormDTO rolesUsersListFormDTO = new RolesUsersListFormDTO();
+ rolesUsersListFormDTO.setCustomerId(customerId);
+ List roleKeys = new ArrayList();
+ roleKeys.add(ModuleConstant.STAFF_ROLE_GRID_MANAGER);
+ rolesUsersListFormDTO.setRoleKeys(roleKeys);
+ rolesUsersListFormDTO.setUserIds(gridstaffs.getData());
+ Result> staffRoles =
+ epmetUserFeignClient.specificRolesStaffs(rolesUsersListFormDTO);
+ //3.发送消息
+ if(staffRoles.success() && null != staffRoles.getData() && staffRoles.getData().size() > 0){
+ List msgList = new ArrayList<>();
+ List subscribeList = new ArrayList<>();
+ for(String to : staffRoles.getData()){
+ //站内信
+ UserMessageFormDTO msgObj = new UserMessageFormDTO();
+ msgObj.setApp(ModuleConstant.APP_GOV);
+ msgObj.setCustomerId(customerId);
+ msgObj.setGridId(gridId);
+ msgObj.setMessageContent(msg);
+ msgObj.setReadFlag(ReadFlagConstant.UN_READ);
+ msgObj.setTitle(title);
+ msgObj.setUserId(to);
+ msgList.add(msgObj);
+ //微信订阅
+ WxSubscribeMessageFormDTO subscribeDTO = new WxSubscribeMessageFormDTO();
+ subscribeDTO.setClientType(ModuleConstant.APP_GOV);
+ subscribeDTO.setGridId(gridId);
+ subscribeDTO.setCustomerId(customerId);
+ subscribeDTO.setUserId(to);
+ subscribeDTO.setBehaviorType(UserMessageConstant.WX_CREATE_GROUP_BEHAVIOR);
+ subscribeDTO.setMessageContent(msg);
+ subscribeDTO.setMessageTime(new Date());
+ subscribeList.add(subscribeDTO);
+ }
+ if (subscribeList.size() > NumConstant.ZERO){
+ epmetMessageOpenFeignClient.sendWxSubscribeMessage(subscribeList);
+ }
+ Result result = epmetMessageFeignClient.saveUserMessageList(msgList);
+ if(result.success()){
+ return;
+ }
+ }
+ }
+ logger.warn(String.format(ModuleConstant.FAILED_SEND_MESSAGE,msg));
+
+ }
+
+ @Override
+ public GroupDetailResultDTO getGroupDetail(String groupId) {
+ GroupDetailResultDTO groupDetail = new GroupDetailResultDTO();
+
+ // 1.拼装组基本信息
+ GroupEditSubmitRecordEntity ler = groupEditSubmitRecordDao.getLatestEditSubmitRecord(groupId);
+
+ if (ler != null) {
+ groupDetail.setAuditStatus(ler.getAuditStatus());
+ groupDetail.setRemark(ler.getRemark());
+ }
+
+ if (ler != null && GroupAuditStatusConstant.UNDER_AUDITING.equals(ler.getAuditStatus())) {
+ // 审核中,显示待审核内容
+ groupDetail.setGroupHeadPhoto(ler.getGroupHeadPhoto());
+ groupDetail.setGroupName(ler.getGroupName());
+ groupDetail.setGroupIntroduction(ler.getGroupIntroduction());
+ } else {
+ // 不在审核中,直接显示组信息
+ ResiGroupEntity resiGroupEntity = resiGroupDao.selectById(groupId);
+ if (resiGroupEntity == null) {
+ return null;
+ }
+
+ groupDetail.setGroupHeadPhoto(resiGroupEntity.getGroupHeadPhoto());
+ groupDetail.setGroupName(resiGroupEntity.getGroupName());
+ groupDetail.setGroupIntroduction(resiGroupEntity.getGroupIntroduction());
+ }
+
+ // 2.编辑次数及其限制
+ groupDetail.setEditNumLimit(GroupLimitConstant.EDIT_NUM_LIMIT_MONTH);
+ Date now = new Date();
+ int usedEditNum = groupEditSubmitRecordDao.countEditNum(groupId, DateUtils.getMonthStart(now), DateUtils.getMonthEnd(now));
+ groupDetail.setAvaliableEditNum(GroupLimitConstant.EDIT_NUM_LIMIT_MONTH - usedEditNum);
+
+ // 审核状态
+ // 是否可编辑
+ boolean editable = true;
+
+ if (GroupLimitConstant.EDIT_NUM_LIMIT_MONTH <= usedEditNum) {
+ // 达到最大编辑次数了
+ editable = false;
+ }
+
+ if (ler != null && GroupAuditStatusConstant.UNDER_AUDITING.equals(ler.getAuditStatus())) {
+ // 提交了,还没审核完
+ editable = false;
+ }
+
+ groupDetail.setEditable(editable);
+ return groupDetail;
+ }
+
+ @Override
+ public void submitGroupEdit(String groupId, String groupName, String groupHeadPhoto, String groupIntroduction, String editUserId) {
+ // 1.判断小组是否存在,判断是否已经在"待审核"状态
+ ResiGroupEntity group = resiGroupDao.selectById(groupId);
+ if (group == null) {
+ throw new RenException(EpmetErrorCode.GROUP_NOT_EXISTS.getCode(), EpmetErrorCode.GROUP_NOT_EXISTS.getMsg());
+ }
+
+ // 判断是否是组长
+ ResiGroupMemberDTO groupLeader = resiGroupMemberDao.selectLeaderMember(groupId);
+ if (groupLeader == null || !groupLeader.getCustomerUserId().equals(editUserId)) {
+ String msg = "只有该组的组长才可以编辑组信息";
+ throw new RenException(EpmetErrorCode.GROUP_EDIT_ERROR.getCode(), msg, msg, RenException.MessageMode.CODE_INTERNAL_EXTERNAL);
+ }
+
+ // 2.判断是否可以提交编辑
+ GroupEditSubmitRecordEntity lre = groupEditSubmitRecordDao.getLatestEditSubmitRecord(groupId);
+ if (lre != null && GroupAuditStatusConstant.UNDER_AUDITING.equals(lre.getAuditStatus())) {
+ // 在待审核状态,不允许再次提交编辑
+ throw new RenException(EpmetErrorCode.GROUP_IN_AUDITING.getCode(), EpmetErrorCode.GROUP_IN_AUDITING.getMsg());
+ }
+
+ if (resiGroupDao.countExistsGroupNameBeforeEdit(groupId, group.getGridId(), groupName) > 0) {
+ // 已存在组名,拒绝提交
+ throw new RenException(EpmetErrorCode.GROUP_ALREADY_EXISTED.getCode(), EpmetErrorCode.GROUP_ALREADY_EXISTED.getMsg());
+ }
+
+ Date now = new Date();
+ int usedEditNum = groupEditSubmitRecordDao.countEditNum(groupId, DateUtils.getMonthStart(now), DateUtils.getMonthEnd(now));
+ if (GroupLimitConstant.EDIT_NUM_LIMIT_MONTH <= usedEditNum) {
+ // 达到最大编辑次数了
+ throw new RenException(EpmetErrorCode.GROUP_EDIT_NUM_LIMITED.getCode(), EpmetErrorCode.GROUP_EDIT_NUM_LIMITED.getMsg());
+ }
+
+ // 3.内容检查
+ scanGroupEditContent(groupName, groupIntroduction, groupHeadPhoto);
+
+ String app = loginUserUtil.getLoginUserApp();
+ String userId = loginUserUtil.getLoginUserId();
+ String messageText = generateGroupEditMessageText(app, userId, group.getCustomerId(), group.getGridId(), groupName);
+
+ // 4.创建编辑提交记录
+ GroupEditSubmitRecordEntity editRecord = new GroupEditSubmitRecordEntity();
+ editRecord.setAuditStatus(GroupAuditStatusConstant.UNDER_AUDITING);
+ editRecord.setCustomerId(group.getCustomerId());
+ editRecord.setGridId(group.getGridId());
+ editRecord.setGroupHeadPhoto(groupHeadPhoto);
+ editRecord.setGroupIntroduction(groupIntroduction);
+ editRecord.setGroupId(groupId);
+ editRecord.setGroupName(groupName);
+ editRecord.setReadFlag(ReadFlagConstant.UN_READ);
+ editRecord.setMessageText(messageText);
+
+ if (groupEditSubmitRecordDao.insert(editRecord) == 0) {
+ throw new RenException(EpmetErrorCode.GROUP_EDIT_ERROR.getCode(), EpmetErrorCode.GROUP_EDIT_ERROR.getMsg());
+ }
+
+ resiGroupRedis.addWorkGrassrootsGroupRedDotValue(group.getGridId());
+
+ }
+
+ /**
+ * 生成组信息编辑简介文本:xxx申请编辑组信息,请审核
+ * @param app
+ * @param userId
+ * @param customerId
+ * @param gridId
+ * @param groupName
+ * @return
+ */
+ private String generateGroupEditMessageText(String app, String userId, String customerId, String gridId, String groupName) {
+ List resiRoles = getResiRoles(app, customerId, userId, gridId);
+ boolean isPartymember = false;
+ boolean isWarmhearted = false;
+ for (UserRoleResultDTO role : resiRoles) {
+ if (EpmetRoleKeyConstant.WARMHEARTED.equals(role.getRoleKey())) {
+ isWarmhearted = true;
+ }
+ if (EpmetRoleKeyConstant.PARTYMEMBER.equals(role.getRoleKey())) {
+ isPartymember = true;
+ }
+ }
+ if (!isWarmhearted && isPartymember) {
+ throw new RenException(EpmetErrorCode.CANNOT_CREATE_GROUP.getCode(), "只有党员和热心居民才能创建和编辑小组");
+ }
+ String roleName = "";
+ if (isPartymember) {
+ roleName = ModuleConstant.PARTYMEMBER;
+ } else if (isWarmhearted) {
+ roleName = ModuleConstant.WAREMHEARTED_RESI;
+ }
+
+ //3.获取居民注册信息
+ UserResiInfoFormDTO resiParam = new UserResiInfoFormDTO();
+ resiParam.setCustomerId(customerId);
+ resiParam.setUserId(userId);
+ Result resiResult =
+ epmetUserFeignClient.getUserResiInfoDTO(resiParam);
+ String userName = "";
+ if (resiResult.success() && null != resiResult.getData()) {
+ userName = (StringUtils.isBlank(resiResult.getData().getSurname()) ? "" : resiResult.getData().getSurname())
+ + (StringUtils.isBlank(resiResult.getData().getName()) ? "" : resiResult.getData().getName());
+ }
+ userName = StringUtils.isBlank(userName) ? ModuleConstant.UNKNOWN : userName;
+ return String.format(UserMessageConstant.EDIT_OF_GROUP_MESSAGE_TEMPLATE, roleName, userName, groupName);
+ }
+
+ /**
+ * 查询居民的角色列表
+ * @param app
+ * @param customerId
+ * @param userId
+ * @param gridId
+ * @return
+ */
+ private List getResiRoles(String app, String customerId, String userId, String gridId) {
+ UserRoleFormDTO userRoleFormDTO = new UserRoleFormDTO();
+ userRoleFormDTO.setApp(app);
+ userRoleFormDTO.setCustomerId(customerId);
+ userRoleFormDTO.setUserId(userId);
+ userRoleFormDTO.setGridId(gridId);
+ Result> rolesResult = epmetUserFeignClient.getUserRoleInfo(userRoleFormDTO);
+
+ if (! rolesResult.success()) {
+ logger.error("修改组信息:查询居民角色失败,详情:{}", rolesResult.getInternalMsg());
+ throw new RenException(EpmetErrorCode.GROUP_EDIT_ERROR.getCode(), "查询居民角色失败");
+ } else {
+ List roles = rolesResult.getData();
+ if (CollectionUtils.isEmpty(roles)) {
+ roles = new ArrayList<>();
+ }
+ return roles;
+ }
+ }
+
+ /**
+ * 内容检查
+ * @param groupName
+ * @param groupIntroduction
+ * @param groupHeadPhoto
+ */
+ private void scanGroupEditContent(String groupName, String groupIntroduction, String groupHeadPhoto) {
+ // 文本内容审核
+ TextScanParamDTO textScanParamDTO = new TextScanParamDTO();
+ TextTaskDTO taskDTO = new TextTaskDTO();
+ String content = groupName.concat("-").concat(groupIntroduction);
+ taskDTO.setContent(content);
+ taskDTO.setDataId(UUID.randomUUID().toString().replace("-", ""));
+ textScanParamDTO.getTasks().add(taskDTO);
+ Result textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO);
+ if (!textSyncScanResult.success()) {
+ logger.error("调用内容审核服务审核文本发生错误:{}", textSyncScanResult.getInternalMsg());
+ throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
+ } else {
+ if (!textSyncScanResult.getData().isAllPass()) {
+ throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode(), EpmetErrorCode.TEXT_SCAN_FAILED.getMsg());
+ }
+ }
+
+ // 图片内容审核
+ ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO();
+ ImgTaskDTO task = new ImgTaskDTO();
+ task.setDataId(UUID.randomUUID().toString().replace("-", ""));
+ task.setUrl(groupHeadPhoto);
+ imgScanParamDTO.getTasks().add(task);
+
+ Result imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO);
+ if (!imgScanResult.success()){
+ logger.error("调用内容审核服务审核图片发生错误:{}", textSyncScanResult.getInternalMsg());
+ throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
+ } else {
+ if (!textSyncScanResult.getData().isAllPass()) {
+ throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode(), EpmetErrorCode.IMG_SCAN_FAILED.getMsg());
+ }
+ }
+ }
+
+ /**
+ * @Description 工作端 查询组变更待审核列表
+ * @param param
+ * @return
+ * @author wangc
+ * @date 2020.11.03 10:19
+ */
+ @Override
+ public List getEditAuditingList(CommonGridAndPageFormDTO param) {
+ return Optional.ofNullable(PageHelper.startPage(null == param.getPageNo() ? NumConstant.ONE : param.getPageNo() , null == param.getPageSize() ? NumConstant.TWELVE : param.getPageSize())
+ .doSelectPage(() -> {
+ groupEditSubmitRecordDao.selectGroupEditApplyList(param.getGridId());}).getResult()).orElse(new LinkedList<>())
+ .stream().map(o -> { return (ApplyingGroupResultDTO)o; }).collect(Collectors.toList());
+ }
+
+ /**
+ * @Description 查询小组修改信息的详情内容 不加事务!
+ * @param param
+ * @return com.epmet.resi.group.dto.group.result.GroupEditionDetailResultDTO
+ * @author wangc
+ * @date 2020.11.03 14:10
+ */
+ @Override
+ public GroupEditionDetailResultDTO getEditAuditingDetail(GovGroupSummarizeFromDTO param) {
+ GroupEditSubmitRecordEntity edit = groupEditSubmitRecordDao.selectEditDetail(param.getGroupId(),null);
+ if(null == edit) {
+ logger.error("com.epmet.modules.group.service.impl.ResiGroupServiceImpl.getEditAuditingDetail,未找到小组变更信息记录,传参:{}",JSON.toJSONString(param));
+ return null;}
+ //取消未读状态
+ GroupEditSubmitRecordEntity _update = new GroupEditSubmitRecordEntity();
+ _update.setId(edit.getId());_update.setReadFlag(ModuleConstant.READ);
+ groupEditSubmitRecordDao.updateById(_update);
+ GroupEditionDetailResultDTO result = ConvertUtils.sourceToTarget(edit, GroupEditionDetailResultDTO.class);
+ result.setGroupLeaderName(resiGroupRedis.getFullName(edit.getCreatedBy()));
+ return result;
+ }
+
+ /**
+ * @Description 工作人员提交审核
+ * @param param
+ * @return void
+ * @author wangc
+ * @date 2020.11.03 16:02
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void auditEdit(GroupEditionAuditFormDTO param) {
+ if(StringUtils.equals(param.getAuditResult(),ModuleConstant.AUDITING_OPERATION_REJECT) && StringUtils.isBlank(param.getRemark())){
+ throw new RenException("拒绝理由不能为空");
+ }
+ GroupEditSubmitRecordEntity edit = groupEditSubmitRecordDao.selectEditDetail(param.getGroupId(),null);
+ if(null == edit){
+ logger.error("com.epmet.modules.group.service.impl.ResiGroupServiceImpl.auditEdit,找不到待审核的组更新记录,传参:{}",JSON.toJSONString(param));
+ throw new RenException("找不到待审核的组更新记录");
+ }
+
+ int affectedRows = groupEditSubmitRecordDao.updateAuditResult(param.getGroupId(),param.getStaffId(),param.getAuditResult(),param.getRemark());
+ if(affectedRows <= NumConstant.ZERO){
+ logger.error("com.epmet.modules.group.service.impl.ResiGroupServiceImpl.auditEdit,更新组编辑记录时受影响行数小于1,传参:{}",JSON.toJSONString(param));
+ throw new RenException("更新组编辑记录时受影响行数小于1");
+ }
+ if(!StringUtils.equals(param.getAuditResult(),ModuleConstant.AUDITING_OPERATION_REJECT)){
+ //同意
+ ResiGroupEntity _update = ConvertUtils.sourceToTarget(edit,ResiGroupEntity.class);
+ _update.setId(param.getGroupId());
+ baseDao.updateById(_update);
+ }
+ resiGroupRedis.subtractWorkGrassrootsPartyAuthRedDotValue(edit.getGridId());
+ resiGroupRedis.delGroup(param.getGroupId());
+ }
+
+}