diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiGroupController.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiGroupController.java index 0dec7e9d03..1d2f9d7162 100644 --- a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiGroupController.java +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiGroupController.java @@ -1,8 +1,12 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.resi.group.dto.group.form.GovGroupSummarizeFromDTO; import com.epmet.resi.group.dto.group.form.GroupAuditedFromDTO; +import com.epmet.resi.group.dto.group.result.GovGroupSummarizeResultDTO; import com.epmet.resi.group.dto.group.result.GroupAuditedResultDTO; +import com.epmet.resi.group.dto.group.result.GroupsInGridResultDTO; import com.epmet.service.ResiGroupService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -33,4 +37,28 @@ public class ResiGroupController { public Result> audited(@RequestBody GroupAuditedFromDTO formDTO) { return resiGroupService.audited(formDTO); } + + /** + * 本网格小组列表 + * + * @param formDTO 参数 + * @return Result> + */ + @PostMapping("groupsingrid") + public Result> getGroupsInGrid(GroupAuditedFromDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return resiGroupService.getGroupsInGrid(formDTO); + } + + /** + * 小组管理界面信息 + * + * @param formDTO 参数 + * @return Result + */ + @PostMapping("getgroupsummarize") + public Result getGroupSummarize(GovGroupSummarizeFromDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return resiGroupService.getGroupSummarize(formDTO); + } } diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/ResiGroupFeignClient.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/ResiGroupFeignClient.java index 9bc9428a86..c615a1f101 100644 --- a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/ResiGroupFeignClient.java +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/ResiGroupFeignClient.java @@ -3,8 +3,11 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.feign.fallback.ResiGroupFeignClientFallBack; +import com.epmet.resi.group.dto.group.form.GovGroupSummarizeFromDTO; import com.epmet.resi.group.dto.group.form.GroupAuditedFromDTO; +import com.epmet.resi.group.dto.group.result.GovGroupSummarizeResultDTO; import com.epmet.resi.group.dto.group.result.GroupAuditedResultDTO; +import com.epmet.resi.group.dto.group.result.GroupsInGridResultDTO; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; @@ -25,4 +28,22 @@ public interface ResiGroupFeignClient { */ @PostMapping("/resi/group/group/audited") Result> audited(GroupAuditedFromDTO formDTO); + + /** + * 本网格小组列表 + * + * @param formDTO 参数 + * @return Result> + */ + @PostMapping("/resi/group/group/groupsingrid") + Result> getGroupsInGrid(GroupAuditedFromDTO formDTO); + + /** + * 小组管理界面信息 + * + * @param formDTO 参数 + * @return Result + */ + @PostMapping("/resi/group/group/getgovgroupsummarize") + Result getGovGroupSummarize(GovGroupSummarizeFromDTO formDTO); } diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/fallback/ResiGroupFeignClientFallBack.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/fallback/ResiGroupFeignClientFallBack.java index b95ccce2c7..3f8e59cc07 100644 --- a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/fallback/ResiGroupFeignClientFallBack.java +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/fallback/ResiGroupFeignClientFallBack.java @@ -4,8 +4,11 @@ import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.feign.ResiGroupFeignClient; +import com.epmet.resi.group.dto.group.form.GovGroupSummarizeFromDTO; import com.epmet.resi.group.dto.group.form.GroupAuditedFromDTO; +import com.epmet.resi.group.dto.group.result.GovGroupSummarizeResultDTO; import com.epmet.resi.group.dto.group.result.GroupAuditedResultDTO; +import com.epmet.resi.group.dto.group.result.GroupsInGridResultDTO; import org.springframework.stereotype.Component; import java.util.List; @@ -21,4 +24,14 @@ public class ResiGroupFeignClientFallBack implements ResiGroupFeignClient { public Result> audited(GroupAuditedFromDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "audited", formDTO); } + + @Override + public Result> getGroupsInGrid(GroupAuditedFromDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "getGroupsInGrid", formDTO); + } + + @Override + public Result getGovGroupSummarize(GovGroupSummarizeFromDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "getGovGroupSummarize", formDTO); + } } diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/ResiGroupService.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/ResiGroupService.java index 425f0f5bd2..5ed8694aa9 100644 --- a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/ResiGroupService.java +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/ResiGroupService.java @@ -1,8 +1,11 @@ package com.epmet.service; import com.epmet.commons.tools.utils.Result; +import com.epmet.resi.group.dto.group.form.GovGroupSummarizeFromDTO; import com.epmet.resi.group.dto.group.form.GroupAuditedFromDTO; +import com.epmet.resi.group.dto.group.result.GovGroupSummarizeResultDTO; import com.epmet.resi.group.dto.group.result.GroupAuditedResultDTO; +import com.epmet.resi.group.dto.group.result.GroupsInGridResultDTO; import java.util.List; @@ -19,4 +22,20 @@ public interface ResiGroupService { * @return Result> */ Result> audited(GroupAuditedFromDTO formDTO); + + /** + * 本网格小组列表 + * + * @param formDTO 参数 + * @return Result> + */ + Result> getGroupsInGrid(GroupAuditedFromDTO formDTO); + + /** + * 小组管理界面信息 + * + * @param formDTO 参数 + * @return Result + */ + Result getGroupSummarize(GovGroupSummarizeFromDTO formDTO); } diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiGroupServiceImpl.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiGroupServiceImpl.java index f20b368b9f..0512260341 100644 --- a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiGroupServiceImpl.java +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiGroupServiceImpl.java @@ -2,8 +2,11 @@ package com.epmet.service.impl; import com.epmet.commons.tools.utils.Result; import com.epmet.feign.ResiGroupFeignClient; +import com.epmet.resi.group.dto.group.form.GovGroupSummarizeFromDTO; import com.epmet.resi.group.dto.group.form.GroupAuditedFromDTO; +import com.epmet.resi.group.dto.group.result.GovGroupSummarizeResultDTO; import com.epmet.resi.group.dto.group.result.GroupAuditedResultDTO; +import com.epmet.resi.group.dto.group.result.GroupsInGridResultDTO; import com.epmet.service.ResiGroupService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -24,4 +27,14 @@ public class ResiGroupServiceImpl implements ResiGroupService{ public Result> audited(GroupAuditedFromDTO formDTO) { return resiGroupFeignClient.audited(formDTO); } + + @Override + public Result> getGroupsInGrid(GroupAuditedFromDTO formDTO) { + return resiGroupFeignClient.getGroupsInGrid(formDTO); + } + + @Override + public Result getGroupSummarize(GovGroupSummarizeFromDTO formDTO) { + return resiGroupFeignClient.getGovGroupSummarize(formDTO); + } } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GovGroupSummarizeFromDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GovGroupSummarizeFromDTO.java new file mode 100644 index 0000000000..7757d54e37 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GovGroupSummarizeFromDTO.java @@ -0,0 +1,19 @@ +package com.epmet.resi.group.dto.group.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/4/20 9:30 + */ +@Data +public class GovGroupSummarizeFromDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 小组id + */ + private String groupId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GovGroupSummarizeResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GovGroupSummarizeResultDTO.java new file mode 100644 index 0000000000..e0b0c2fd4c --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GovGroupSummarizeResultDTO.java @@ -0,0 +1,43 @@ +package com.epmet.resi.group.dto.group.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/4/20 9:24 + */ +@Data +public class GovGroupSummarizeResultDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 组id + */ + private String groupId; + /** + * 组头像 + */ + private String groupHeadPhoto; + /** + * 组名 + */ + private String groupName; + /** + * 成员总数 + */ + private Integer totalMember; + /** + * 组长名称 + */ + private String leaderName; + /** + * 组介绍 + */ + private String groupIntroduction; + /** + * 话题总数 + */ + private Integer totalTopics; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupsInGridResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupsInGridResultDTO.java new file mode 100644 index 0000000000..fa4d22740a --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupsInGridResultDTO.java @@ -0,0 +1,41 @@ +package com.epmet.resi.group.dto.group.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/4/17 15:53 + */ +@NoArgsConstructor +@Data +public class GroupsInGridResultDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 小组id + */ + private String groupId; + /** + * 小组名称 + */ + private String groupName; + /** + * 小组头像 + */ + private String groupHeadPhoto; + /** + * 成员总数 + */ + private Integer totalMember; + /** + * 党员总数 + */ + private Integer totalPartyMember; + /** + * 当前状态审核通过 - approved 、 审核中 - under_auditting、 审核未通过 - rejected 、 已屏蔽 - hidden、 已关闭 - closed + */ + private String status; +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java index 7dbe4179ba..0f08cfa4eb 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java @@ -230,4 +230,27 @@ public class ResiGroupController { ValidatorUtils.validateEntity(formDTO); return resiGroupService.audited(formDTO); } + + /** + * 本网格小组列表 + * + * @param formDTO 参数 + * @return Result> + */ + @PostMapping("groupsingrid") + public Result> getGroupsInGrid(GroupAuditedFromDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return resiGroupService.getGroupsInGrid(formDTO); + } + + /** + * 小组管理界面信息 + * + * @param formDTO 参数 + * @return Result + */ + @PostMapping("getgovgroupsummarize") + public Result getGovGroupSummarize(GovGroupSummarizeFromDTO formDTO) { + return resiGroupService.getGovGroupSummarize(formDTO); + } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java index 6c6d0aaf26..ecebc5049d 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java @@ -113,4 +113,11 @@ public interface ResiGroupDao extends BaseDao { * @return */ List selectAuditedGroupList(GroupAuditedFromDTO formDTO); + + /** + * 查询网格小组列表 + * @param formDTO + * @return + */ + List selectGroupsByGridId(GroupAuditedFromDTO formDTO); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java index 787b160f6c..f58c9b2208 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java @@ -173,8 +173,8 @@ public interface ResiGroupService extends BaseService { Result initApplyCreatedGroup(InitApplyCreatedGroupFormDTO initApplyCreatedGroupFormDTO); /** - * @return com.epmet.commons.tools.utils.Result * @param agreeApplyGroupFormDTO + * @return com.epmet.commons.tools.utils.Result * @Author yinzuomei * @Description 审核(同意)群申请-测试用后面会放到政府端 * @Date 2020/3/31 12:44 @@ -182,8 +182,8 @@ public interface ResiGroupService extends BaseService { Result agreeApplyGroup(AgreeApplyGroupFormDTO agreeApplyGroupFormDTO); /** - * @return com.epmet.commons.tools.utils.Result * @param disAgreeApplyGroupFormDTO + * @return com.epmet.commons.tools.utils.Result * @Author yinzuomei * @Description 审核(拒绝)群申请-测试用后面会放到政府端 * @Date 2020/3/31 13:22 @@ -191,11 +191,11 @@ public interface ResiGroupService extends BaseService { Result disagreeApplyGroup(DisAgreeApplyGroupFormDTO disAgreeApplyGroupFormDTO); /** - * @return com.epmet.resi.group.dto.UserRoleDTO * @param app * @param userId * @param customerId * @param gridId + * @return com.epmet.resi.group.dto.UserRoleDTO * @Author yinzuomei * @Description 判断用户当前角色 * @Date 2020/4/1 0:00 @@ -204,8 +204,25 @@ public interface ResiGroupService extends BaseService { /** * 小组审核历史列表 + * * @param formDTO 参数 - * @return Result> + * @return Result> */ Result> audited(GroupAuditedFromDTO formDTO); + + /** + * 本网格小组列表 + * + * @param formDTO 参数 + * @return Result> + */ + Result> getGroupsInGrid(GroupAuditedFromDTO formDTO); + + /** + * 小组管理界面信息 + * + * @param formDTO 参数 + * @return Result + */ + Result getGovGroupSummarize(GovGroupSummarizeFromDTO formDTO); } 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 75f07cc192..dafcf7bdea 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 @@ -17,6 +17,7 @@ package com.epmet.modules.group.service.impl; +import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; @@ -563,6 +564,52 @@ public class ResiGroupServiceImpl extends BaseServiceImpl> 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(i -> { + //缓存中获取组信息 + ResiGroupInfoRedisDTO resiGroupInfoRedisDTO = resiGroupRedis.get(i.getId()); + GroupsInGridResultDTO groupsInGridResultDTO = new GroupsInGridResultDTO(); + 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 diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml index 05bf42e0d8..418dbf8a1e 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml @@ -215,4 +215,16 @@ rgo.UPDATED_TIME DESC LIMIT #{pageNo}, #{pageSize} +