diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java index 6a0c43f14c..f3003fc047 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java @@ -6,6 +6,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.resi.group.dto.group.ResiGroupDTO; import com.epmet.resi.group.dto.group.form.*; import com.epmet.resi.group.dto.group.result.*; +import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; import com.epmet.resi.group.dto.topic.MyCreateTopicsFormDTO; import com.epmet.resi.group.dto.topic.ResiTopicDTO; import com.epmet.resi.group.dto.topic.form.*; @@ -333,4 +334,12 @@ public interface ResiGroupOpenFeignClient { */ @PostMapping("/resi/group/group/getBranchGroupList") Result>> getBranchGroupList(); + + /** + * @Author sun + * @Description 查询小组成员列表 + **/ + @PostMapping("/resi/group/member/getmemberlist") + Result> getMemberList(@RequestBody List groupIdList); + } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java index 98cddc7d9b..f42d54799f 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java @@ -6,6 +6,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.resi.group.dto.group.ResiGroupDTO; import com.epmet.resi.group.dto.group.form.*; import com.epmet.resi.group.dto.group.result.*; +import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; import com.epmet.resi.group.dto.topic.MyCreateTopicsFormDTO; import com.epmet.resi.group.dto.topic.ResiTopicDTO; import com.epmet.resi.group.dto.topic.form.*; @@ -241,4 +242,9 @@ public class ResiGroupOpenFeignClientFallback implements ResiGroupOpenFeignClien public Result>> getBranchGroupList() { return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "getBranchGroupList", null); } + + @Override + public Result> getMemberList(String groupId) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "getMemberList", groupId); + } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/ResiGroupMemberController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/ResiGroupMemberController.java index c3d7547d07..b931bab11c 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/ResiGroupMemberController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/ResiGroupMemberController.java @@ -24,16 +24,14 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.modules.member.service.GroupMemeberOperationService; import com.epmet.modules.member.service.ResiGroupMemberService; +import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; import com.epmet.resi.group.dto.member.form.*; import com.epmet.resi.group.dto.member.result.ApplyingMemberResultDTO; import com.epmet.resi.group.dto.member.result.GridVotableCountResultDTO; import com.epmet.resi.group.dto.member.result.GroupMemberListResultDTO; import com.epmet.resi.group.dto.member.result.JoinGroupApplyRealTimeResultDTO; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -206,4 +204,10 @@ public class ResiGroupMemberController { ValidatorUtils.validateEntity(param); return new Result().ok(operationService.applyEnterByLink(param)); } + + @PostMapping("getmemberlist") + public Result> groupMemberList(@RequestBody List groupIdList){ + return new Result>().ok(resiGroupMemberService.groupMemberList(groupIdList)); + } + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/ResiGroupMemberDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/ResiGroupMemberDao.java index daf4e23248..c6c5501de7 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/ResiGroupMemberDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/ResiGroupMemberDao.java @@ -181,4 +181,6 @@ public interface ResiGroupMemberDao extends BaseDao { int countAllMembers(@Param("customerId") String customerId, @Param("groupId") String groupId); int exitGroupById(@Param("id") String id, @Param("updatedBy") String updatedBy); + + List groupMemberList(@Param("groupIdList") List groupIdList); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/ResiGroupMemberService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/ResiGroupMemberService.java index 8027971cb6..2355fd5a2a 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/ResiGroupMemberService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/ResiGroupMemberService.java @@ -262,4 +262,6 @@ public interface ResiGroupMemberService extends BaseService groupMemberList(List groupIdList); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java index a933306cb2..773bf9ebf1 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java @@ -1036,4 +1036,9 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl groupMemberList(List groupIdList) { + return baseDao.groupMemberList(groupIdList); + } + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml index ff7060f839..af37ca8cc6 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml @@ -250,4 +250,19 @@ WHERE id = #{id} + + diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/ActAndScheduleListResultDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/ActAndScheduleListResultDTO.java index 20b1e69408..9b3248a0f3 100644 --- a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/ActAndScheduleListResultDTO.java +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/ActAndScheduleListResultDTO.java @@ -33,6 +33,7 @@ public class ActAndScheduleListResultDTO implements Serializable { private String activityId; private String staffId; + private String dateId; private String topic; private String address; private String holdTime; @@ -58,6 +59,7 @@ public class ActAndScheduleListResultDTO implements Serializable { private String remark; private Boolean isMe = false; private String staffId; + private String dateId; } @Data diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyActService.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyActService.java index d0f1d68d65..100c47fead 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyActService.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyActService.java @@ -1,6 +1,8 @@ package com.epmet.modules.partyOrg.service; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.rocketmq.messages.PartyMeetingMessageMQMsg; +import com.epmet.commons.tools.dto.form.mq.MqBaseFormDTO; import com.epmet.commons.tools.page.PageData; import com.epmet.modules.partyOrg.entity.IcPartyActEntity; import com.epmet.resi.partymember.dto.icpartyact.form.IcPartyActAddOrUpdateFormDTO; @@ -62,6 +64,8 @@ public interface IcPartyActService extends BaseService { */ IcPartyActDetailResDTO queryActDetail(String customerId, String userId, String icPartyActId); + void partyMeetingMessage(PartyMeetingMessageMQMsg dto); + /** * Desc: 【党建日历】活动、日程列表 * @param formDTO diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActServiceImpl.java index 643d525bd2..ce7530def5 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActServiceImpl.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActServiceImpl.java @@ -1,15 +1,19 @@ package com.epmet.modules.partyOrg.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.rocketmq.messages.PartyMeetingMessageMQMsg; import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.modules.partyOrg.dao.*; import com.epmet.modules.partyOrg.entity.IcPartyActEntity; @@ -19,6 +23,8 @@ import com.epmet.modules.partyOrg.service.IcPartyActOrgService; import com.epmet.modules.partyOrg.service.IcPartyActService; import com.epmet.modules.partyOrg.service.IcPartyOrgService; import com.epmet.modules.partyOrg.service.ResiPartymemberAttachmentService; +import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; +import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; import com.epmet.resi.partymember.dto.icpartyact.form.IcPartyActAddOrUpdateFormDTO; import com.epmet.resi.partymember.dto.icpartyact.form.IcPartyActPageFormDTO; import com.epmet.resi.partymember.dto.icpartyact.result.IcPartActTypeDTO; @@ -47,7 +53,8 @@ import java.util.stream.Collectors; */ @Service public class IcPartyActServiceImpl extends BaseServiceImpl implements IcPartyActService { - + @Autowired + private ResiGroupOpenFeignClient resiGroupOpenFeignClient; @Autowired private IcScheduleDao scheduleDao; @Autowired @@ -262,6 +269,102 @@ public class IcPartyActServiceImpl extends BaseServiceImpl homeSearch(ActAndScheduleListFormDTO formDTO) { - return null; + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); + if (null == staffInfo){ + throw new EpmetException("查询工作人员失败:"+formDTO.getStaffId()); + } + formDTO.setAgencyId(staffInfo.getAgencyId()); + IcPartyOrgDTO icPartyOrgDTO = partyOrgService.get(formDTO.getOrgId()); + if (null == icPartyOrgDTO){ + throw new EpmetException("未查询到党组织信息:"+formDTO.getOrgId()); + } + formDTO.setPath(icPartyOrgDTO.getOrgPids().equals("") || icPartyOrgDTO.getOrgPids().equals(NumConstant.ZERO_STR) ? icPartyOrgDTO.getId() : icPartyOrgDTO.getOrgPids().concat(":").concat(icPartyOrgDTO.getId())); + List result = constructHomeSearchData(formDTO.getStartDate(), formDTO.getEndDate()); + List activityList = baseDao.getActivityList(formDTO); + if (CollectionUtils.isNotEmpty(activityList)){ + activityList.forEach(a -> { + a.setIsMe(formDTO.getStaffId().equals(a.getStaffId())); + }); + Map> groupByDateId = activityList.stream().collect(Collectors.groupingBy(ActAndScheduleListResultDTO.ActivityListDTO::getDateId)); + result.forEach(r -> { + groupByDateId.forEach((dateId,list) -> { + if (r.getDateId().equals(dateId)){ + r.setActivityList(list); + r.setActivityTotal(list.size()); + } + }); + }); + } + List scheduleList = scheduleDao.getScheduleList(formDTO); + if (CollectionUtils.isNotEmpty(scheduleList)){ + scheduleList.forEach(s -> { + s.setIsMe(formDTO.getStaffId().equals(s.getStaffId())); + }); + Map> groupByDateId = scheduleList.stream().collect(Collectors.groupingBy(ActAndScheduleListResultDTO.ScheduleListDTO::getDateId)); + result.forEach(r -> { + groupByDateId.forEach((dateId,list) -> { + if (r.getDateId().equals(dateId)){ + r.setScheduleList(list); + r.setScheduleTotal(list.size()); + } + }); + }); + } + return result; + } + + public static List constructHomeSearchData(String startDate,String endDate){ + List result = new ArrayList<>(); + if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)){ + List days = DateUtils.getDaysBetween(startDate, endDate); + days.forEach(d -> { + ActAndScheduleListResultDTO dto = new ActAndScheduleListResultDTO(); + dto.setDateId(d); + result.add(dto); + }); + } + return result; + } + + + /** + * 党建小助手活动触发为用户推送消息 + */ + @Override + public void partyMeetingMessage(PartyMeetingMessageMQMsg formDTO) { + //1.校验活动数据是否存在 + IcPartyActEntity entity = baseDao.selectById(formDTO.getIcPartyActId()); + if(null==entity){ + String msg = "活动信息不存在,活动Id:" + formDTO.getIcPartyActId(); + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), msg, msg); + } + //2.根据不同类型消息触发不同处理逻辑 + //2-1.发布活动给居民端涉及党员已经工作端活动发布站推送党建活动消息 + if("publish".equals(formDTO.getType())){ + //查询活动对应的发布范围信息 + LambdaQueryWrapper orgWrapper = new LambdaQueryWrapper<>(); + orgWrapper.eq(IcPartyActOrgEntity::getDelFlag, NumConstant.ZERO_STR); + orgWrapper.eq(IcPartyActOrgEntity::getIcPartyActId, formDTO.getIcPartyActId()); + List list = icPartyActOrgDao.selectList(orgWrapper); + List groupIdList = list.stream().filter(ca -> ca.getOrgType().equals("6")).map(m -> m.getJoinOrgId()).collect(Collectors.toList()); + List partyOrgIdList = list.stream().filter(ca -> !ca.getOrgType().equals("6")).map(m -> m.getJoinOrgId()).collect(Collectors.toList()); + //分别查询党组织、党小组下的人 + List userIdList = new ArrayList<>(); + if(!CollectionUtils.isEmpty(groupIdList)){ + Result> result = resiGroupOpenFeignClient.getMemberList(groupIdList); + if (!result.success()) { + throw new RenException("调用common service查询secret失败"); + } + userIdList = result.getData().stream().map(ResiGroupMemberDTO::getCustomerUserId).collect(Collectors.toList()); + } + if(!CollectionUtils.isEmpty(groupIdList)){ + //TODO + } + + //组装消息 + + } + } + } \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcScheduleServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcScheduleServiceImpl.java index 3c7861a02d..2d38215d07 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcScheduleServiceImpl.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcScheduleServiceImpl.java @@ -3,6 +3,7 @@ package com.epmet.modules.partyOrg.service.impl; 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.rocketmq.messages.PartyMeetingMessageMQMsg; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.exception.EpmetException; @@ -11,11 +12,15 @@ import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.SpringContextUtils; +import com.epmet.constant.SystemMessageType; +import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.modules.partyOrg.dao.IcScheduleDao; import com.epmet.modules.partyOrg.entity.IcScheduleEntity; import com.epmet.modules.partyOrg.service.IcScheduleService; import com.epmet.resi.partymember.dto.IcScheduleDTO; import com.epmet.resi.partymember.dto.partyOrg.form.AddOrEditScheduleFormDTO; +import com.epmet.send.SendMqMsgUtil; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; @@ -112,6 +117,13 @@ public class IcScheduleServiceImpl extends BaseServiceImpl + @@ -39,6 +40,7 @@ pa.TOPIC, pa.ADDRESS, DATE_FORMAT(pa.HOLD_TIME,'%Y-%m-%d %H:%i:%s') AS holdTime, + DATE_FORMAT(pa.HOLD_TIME,'%Y%m%d') AS dateId, pa.ACT_TYPE AS type, (CASE WHEN pa.JOIN_USER_TYPE = '1' THEN '支部委员' WHEN pa.JOIN_USER_TYPE = '0' THEN '全体党员' @@ -54,10 +56,18 @@ LEFT JOIN ic_party_act_org ao ON (ao.IC_PARTY_ACT_ID = pa.ID AND ao.DEL_FLAG = 0) WHERE pa.DEL_FLAG = 0 AND pa.CUSTOMER_ID = #{customerId} - AND DATE_FORMAT(pa.HOLD_TIME,'%Y%m%d') = #{dateId} + + AND DATE_FORMAT(pa.HOLD_TIME,'%Y%m%d') = #{dateId} + AND pa.PUBLISH_STAFF_ID = #{staffId} + + AND DATE_FORMAT(pa.HOLD_TIME,'%Y%m%d') >= #{startDate} + + + AND DATE_FORMAT(pa.HOLD_TIME,'%Y%m%d') #{endDate} + AND pa.PUBLISH_ORG_PATH LIKE CONCAT(#{path},'%') \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcScheduleDao.xml b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcScheduleDao.xml index 990fa16220..a9c155a9e1 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcScheduleDao.xml +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcScheduleDao.xml @@ -25,10 +25,10 @@ FROM ic_schedule WHERE DEL_FLAG = 0 AND CUSTOMER_ID = #{customerId} - AND DATE_FORMAT(CREATED_TIME,'%Y') = #{yearId} + AND DATE_FORMAT(REMIND_TIME,'%Y') = #{yearId} AND ORG_ID_PATH LIKE CONCAT('%',#{agencyId},'%') AND IS_PUBLIC = '1' OR (STAFF_ID = #{staffId} AND IS_PUBLIC = '0') - GROUP BY DATE_FORMAT(CREATED_TIME,'%Y%m') + GROUP BY DATE_FORMAT(REMIND_TIME,'%Y%m') UNION ALL SELECT COUNT(id) as count, @@ -49,12 +49,21 @@ ID AS scheduleId, TITLE, DATE_FORMAT(REMIND_TIME,'%Y-%m-%d %H:%i:%s') AS remindTime, + DATE_FORMAT(REMIND_TIME,'%Y%m%d') AS dateId, REMARK, STAFF_ID FROM ic_schedule WHERE DEL_FLAG = 0 AND CUSTOMER_ID = #{customerId} - AND DATE_FORMAT(CREATED_TIME,'%Y%m%d') = #{dateId} + + AND DATE_FORMAT(REMIND_TIME,'%Y%m%d') = #{dateId} + + + AND DATE_FORMAT(REMIND_TIME,'%Y%m%d') >= #{startDate} + + + AND DATE_FORMAT(REMIND_TIME,'%Y%m%d') #{endDate} + AND ORG_ID_PATH LIKE CONCAT('%',#{agencyId},'%') AND IS_PUBLIC = '1' OR (STAFF_ID = #{staffId} AND IS_PUBLIC = '0')