diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/ResiAroundPartyPointRankFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/ResiAroundPartyPointRankFormDTO.java new file mode 100644 index 0000000000..8387992756 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/ResiAroundPartyPointRankFormDTO.java @@ -0,0 +1,53 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 身边党员 积分排行接口 入参 + * @Auth zy + */ +@Data +public class ResiAroundPartyPointRankFormDTO implements Serializable { + private static final long serialVersionUID = 1534061512200591149L; + + public interface ResiAroundPartyPointRankGroup extends CustomerClientShowGroup{} + + /** + * 页码 + * */ + @Min(value = 1,groups = ResiAroundPartyPointRankGroup.class) + private Integer pageNo = 1; + + /** + * 每页数据条数 + * */ + private Integer pageSize = 10; + + /** + * 身边党员 grid 社区党员community + * */ + @NotBlank(message = "查询的部门维度scope不能为空",groups = ResiAroundPartyPointRankFormDTO.ResiAroundPartyPointRankGroup.class) + private String scope; + + /** + * 本月 monthly 总排行 all; + * */ + @NotBlank(message = "查询的时间维度type不能为空",groups = ResiAroundPartyPointRankFormDTO.ResiAroundPartyPointRankGroup.class) + private String type; + + /** + * 当前网格id + * */ + @NotBlank(message = "网格id不能为空",groups = ResiAroundPartyPointRankFormDTO.ResiAroundPartyPointRankGroup.class) + private String gridId; + + /** + * 客户Id,不做校验,如果前端不传则使用userId查询相应的客户Id + * */ + private String customerId; +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/ResiAroundPartyPointRankResultDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/ResiAroundPartyPointRankResultDTO.java new file mode 100644 index 0000000000..33c9ba5ffb --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/ResiAroundPartyPointRankResultDTO.java @@ -0,0 +1,39 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 身边党员 积分排行接口返参DTO + * @Auth zy + */ +@Data +public class ResiAroundPartyPointRankResultDTO implements Serializable { + private static final long serialVersionUID = 685408245193506541L; + + /** + * 排序 + * */ + private Integer ranking; + + /** + * 积分 + * */ + private Integer point; + + /** + * 头像 + * */ + private String userHeadPhoto; + + /** + * 名称 + * */ + private String realName; + + /** + * 用户id + * */ + private String userId; +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java index f4e5ce6bb4..6e7336d188 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java @@ -6,11 +6,9 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.CommonPageUserFormDTO; import com.epmet.dto.form.CommonUserFormDTO; +import com.epmet.dto.form.ResiAroundPartyPointRankFormDTO; import com.epmet.dto.form.ResiPointRankFormDTO; -import com.epmet.dto.result.PointExchangeResponseResultDTO; -import com.epmet.dto.result.ResiPointDetailResultDTO; -import com.epmet.dto.result.ResiPointLogListResultDTO; -import com.epmet.dto.result.ResiPointRankListResultDTO; +import com.epmet.dto.result.*; import com.epmet.service.PointVerificationLogService; import com.epmet.service.UserPointActionLogService; import com.epmet.service.UserPointStatisticalDailyService; @@ -141,4 +139,24 @@ public class ResiPointController { public Result exchangeCallback(@LoginUser TokenDto tokenDto){ return new Result().ok(pointVerificationLogService.resiExchangeCallback(tokenDto.getUserId())); } + + /** + * 身边党员-积分排行 + * 查询规则: scope : grid && type :monthly 表示:按网格统计,对本月党员增加的积分 进行排序 + * scope : grid && type :all 表示:按网格统计,对党员累计可用积分 排序 + * scope : community && type :monthly 表示:按社区统计,对本月党员增加的积分 进行排序 + * scope : community && type :all 表示:按社区统计,对党员累计可用积分 排序 + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 16:17 2020-12-28 + **/ + @PostMapping("aroundparty") + public Result> aroundPartyPointRank(@LoginUser TokenDto tokenDto, @RequestBody ResiAroundPartyPointRankFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(formDTO,ResiAroundPartyPointRankFormDTO.ResiAroundPartyPointRankGroup.class); + List resultDTOS = userPointStatisticalDailyService.listAroundPartyPointRank(formDTO); + return new Result>().ok(resultDTOS); + } } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointStatisticalDailyDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointStatisticalDailyDao.java index 9f9783797d..b536a8b5e9 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointStatisticalDailyDao.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointStatisticalDailyDao.java @@ -18,6 +18,8 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.ResiAroundPartyPointRankFormDTO; +import com.epmet.dto.result.ResiAroundPartyPointRankResultDTO; import com.epmet.dto.result.ResiPointRankResultDTO; import com.epmet.entity.UserPointStatisticalDailyEntity; import org.apache.ibatis.annotations.Mapper; @@ -62,4 +64,43 @@ public interface UserPointStatisticalDailyDao extends BaseDao + * @Author zhangyong + * @Date 09:24 2020-12-29 + **/ + List selectListGridPartyRankByUsablePoint(ResiAroundPartyPointRankFormDTO formDTO); + + /** + * 身边党员-积分排行 :按网格统计,对本月党员增加的积分 进行排序 + * @param formDTO + * @return java.util.List + * @Author zhangyong + * @Date 09:24 2020-12-29 + **/ + List selectListGridPartyRankPointByMonth(ResiAroundPartyPointRankFormDTO formDTO); + + /** + * 身边党员-积分排行 :按社区(社区下的所有网格)统计,对党员累计可用积分 排序 + * @param formDTO + * @param grids 社区下的所有网格id + * @return java.util.List + * @Author zhangyong + * @Date 09:24 2020-12-29 + **/ + List selectListCommunityPartyRankByUsablePoint(ResiAroundPartyPointRankFormDTO formDTO, + @Param("grids")List grids); + + /** + * 身边党员-积分排行 :按社区(社区下的所有网格)统计,对本月党员增加的积分 进行排序 + * @param formDTO + * @return java.util.List + * @Author zhangyong + * @Date 09:24 2020-12-29 + **/ + List selectListCommunityPartyRankPointByMonth(ResiAroundPartyPointRankFormDTO formDTO, + @Param("grids")List grids); +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointStatisticalDailyService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointStatisticalDailyService.java index 9d3f2d3ecf..6630a87891 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointStatisticalDailyService.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointStatisticalDailyService.java @@ -20,7 +20,9 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.UserPointStatisticalDailyDTO; +import com.epmet.dto.form.ResiAroundPartyPointRankFormDTO; import com.epmet.dto.form.ResiPointRankFormDTO; +import com.epmet.dto.result.ResiAroundPartyPointRankResultDTO; import com.epmet.dto.result.ResiPointRankListResultDTO; import com.epmet.entity.UserPointStatisticalDailyEntity; @@ -114,4 +116,13 @@ public interface UserPointStatisticalDailyService extends BaseService> + * @Author zhangyong + * @Date 16:17 2020-12-28 + **/ + List listAroundPartyPointRank(ResiAroundPartyPointRankFormDTO formDTO); +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointStatisticalDailyServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointStatisticalDailyServiceImpl.java index a36a0c39d9..0242064ae9 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointStatisticalDailyServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointStatisticalDailyServiceImpl.java @@ -27,13 +27,12 @@ import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.UserPointStatisticalDailyDao; import com.epmet.dto.UserPointStatisticalDailyDTO; +import com.epmet.dto.form.ResiAroundPartyPointRankFormDTO; import com.epmet.dto.form.ResiPointRankFormDTO; -import com.epmet.dto.result.ResiPointRankListResultDTO; -import com.epmet.dto.result.ResiPointRankResultDTO; -import com.epmet.dto.result.ResiPointRankingResultDTO; -import com.epmet.dto.result.UserBaseInfoResultDTO; +import com.epmet.dto.result.*; import com.epmet.entity.UserPointStatisticalDailyEntity; import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.service.UserPointStatisticalDailyService; import com.epmet.utils.DimIdGenerator; import com.epmet.utils.ModuleConstant; @@ -59,6 +58,8 @@ public class UserPointStatisticalDailyServiceImpl extends BaseServiceImpl page(Map params) { @@ -230,5 +231,75 @@ public class UserPointStatisticalDailyServiceImpl extends BaseServiceImpl listAroundPartyPointRank(ResiAroundPartyPointRankFormDTO formDTO) { + //查询条件 + int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); + formDTO.setPageNo(pageIndex); + List resultDTOS = new ArrayList<>(); + + // 获取党员信息 + + // 按网格统计 + if ("grid".equals(formDTO.getScope())){ + if ("monthly".equals(formDTO.getType())){ + // scope : grid && type :monthly 表示:按网格统计,对本月党员增加的积分 进行排序 + resultDTOS = baseDao.selectListGridPartyRankPointByMonth(formDTO); + } else if ("all".equals(formDTO.getType())){ + // scope : grid && type :all 表示:按网格统计,对党员累计可用积分 排序 + resultDTOS = baseDao.selectListGridPartyRankByUsablePoint(formDTO); + } + } -} \ No newline at end of file + // 按社区统计 + if ("community".equals(formDTO.getScope())){ + // 根据网格id,获取社区下的所有网格id + Result> gridInCommunity = govOrgOpenFeignClient.getGridInCommunity(formDTO.getGridId()); + if (gridInCommunity.getData().size() <= NumConstant.ZERO){ + log.error("根据" + formDTO.getGridId() + "网格id, 查询不到同属于一个社区下的所有网格id"); + return resultDTOS; + } + if ("monthly".equals(formDTO.getType())){ + // scope : community && type :monthly 表示:按社区统计,对本月党员增加的积分 进行排序 + resultDTOS = baseDao.selectListCommunityPartyRankPointByMonth(formDTO, gridInCommunity.getData()); + } else if ("all".equals(formDTO.getType())){ + // scope : community && type :all 表示:按社区统计,对党员累计可用积分 排序 + resultDTOS = baseDao.selectListCommunityPartyRankByUsablePoint(formDTO, gridInCommunity.getData()); + } + } + + // 给排好序的 身边党员-积分排行, 赋值 【头像】 + resultDTOS = getPartyBaseInfo(resultDTOS); + return resultDTOS; + } + + /* + * 给排好序的 身边党员-积分排行, 赋值 【头像】 + * @param rankResultDTOS + * @return java.util.List + * @Author zhangyong + * @Date 10:14 2020-12-29 + **/ + private List getPartyBaseInfo(List rankResultDTOS){ + // 1.获取当前党员Id + List userIdParam = new LinkedList<>(); + for (ResiAroundPartyPointRankResultDTO formDTO : rankResultDTOS){ + userIdParam.add(formDTO.getUserId()); + } + if (userIdParam.size() == NumConstant.ZERO){ + return rankResultDTOS; + } + // 2.获取用户基本信息 + Result> myResiInfoResult = epmetUserOpenFeignClient.queryUserBaseInfo(userIdParam); + if(myResiInfoResult.success() && null != myResiInfoResult.getData() && !myResiInfoResult.getData().isEmpty()){ + for (UserBaseInfoResultDTO resiInfo : myResiInfoResult.getData()){ + for (ResiAroundPartyPointRankResultDTO formDTO : rankResultDTOS){ + if (formDTO.getUserId().equals(resiInfo.getUserId())){ + formDTO.setUserHeadPhoto(resiInfo.getHeadImgUrl()); + } + } + } + } + return rankResultDTOS; + } +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointStatisticalDailyDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointStatisticalDailyDao.xml index 9bb759ed72..37325951aa 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointStatisticalDailyDao.xml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointStatisticalDailyDao.xml @@ -130,4 +130,157 @@ - \ No newline at end of file + + + + + + + + + + + + diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridInCommunityDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridInCommunityDTO.java new file mode 100644 index 0000000000..52cfa389da --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridInCommunityDTO.java @@ -0,0 +1,32 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 根据网格id查询,它的父级 社区id + 最后返回 社区id 下的所有网格信息 + * @Author zy + * @Date 2020/12/28 23:16 + */ +@Data +public class GridInCommunityDTO implements Serializable { + private static final long serialVersionUID = 4360690752084258055L; + + /** + * 网格ID + */ + private String gridId; + + /** + * 网格名称 + */ + private String gridName; + + /** + * 客户ID + */ + private String customerId; +} + diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java index 2dab8452b3..50bb5e6205 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java @@ -314,4 +314,14 @@ public interface GovOrgOpenFeignClient { **/ @PostMapping("/gov/org/customergrid/griddatafilter") Result gridDataFilter(CommonGridIdFormDTO gridForm); + + /** + * 根据 网格id,查询同属于一个社区下的所有网格id + * @param gridId + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 17:44 2020-12-28 + **/ + @GetMapping("/gov/org/customergrid/getGridInCommunity/{gridId}") + Result> getGridInCommunity(@PathVariable("gridId") String gridId); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java index 4776dec9b6..ad3eeeb81c 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java @@ -181,6 +181,10 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient { @Override public Result gridDataFilter(CommonGridIdFormDTO gridForm) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "gridDataFilter", gridForm); + } + @Override + public Result> getGridInCommunity(String gridId) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridInCommunity", gridId); } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java index b86bb7df20..26ccea082b 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java @@ -228,4 +228,16 @@ public class CustomerGridController { return new Result().ok(customerGridService.selectGridCount(customerIdFormDTO)); } + /** + * @param gridId + * @return com.epmet.commons.tools.utils.Result> + * @Author zy + * @Description 根据 网格id,查询同属于一个社区下的所有网格id、网格name + * @Date 2020/12/28 23:16 + **/ + @GetMapping("getGridInCommunity/{gridId}") + public Result> getGridInCommunity(@PathVariable("gridId") String gridId) { + List resultDTOS = customerGridService.listGridInCommunity(gridId); + return new Result>().ok(resultDTOS); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java index 64274d1b69..45afaf2874 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java @@ -246,4 +246,13 @@ public interface CustomerGridDao extends BaseDao { List selectOrgInfoByAgency(@Param("orgIds")List orgIds); List selectOrgInfoByGrid(@Param("orgIds")List orgIds); List selectOrgInfoByDept(@Param("orgIds")List orgIds); -} \ No newline at end of file + + /** + * @param gridId + * @return com.epmet.commons.tools.utils.Result> + * @Author zy + * @Description 根据 网格id,查询同属于一个社区下的所有网格id、网格name + * @Date 2020/12/28 23:16 + **/ + List selectListGridInCommunity(@Param("gridId") String gridId); +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java index f9e8610778..df10430dbf 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java @@ -39,7 +39,7 @@ import java.util.List; import java.util.Map; /** - * 客户网格表 + * 客户网格表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-03-16 @@ -277,4 +277,13 @@ public interface CustomerGridService extends BaseService { * @date 2020/11/10 2:55 下午 */ List selectOrgInfo(OrgInfoFormDTO orgInfoFormDTO); -} \ No newline at end of file + + /** + * @param gridId + * @return com.epmet.commons.tools.utils.Result> + * @Author zy + * @Description 根据 网格id,查询同属于一个社区下的所有网格id、网格name + * @Date 2020/12/28 23:16 + **/ + List listGridInCommunity(String gridId); +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java index df895b4f11..da31fd338a 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java @@ -692,4 +692,8 @@ public class CustomerGridServiceImpl extends BaseServiceImpl listGridInCommunity(String gridId) { + return baseDao.selectListGridInCommunity(gridId); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml index b3e93a2fc3..ecb4a27199 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml @@ -545,4 +545,20 @@ ID = #{orgId} + + +