|
@ -19,6 +19,7 @@ package com.epmet.service.impl; |
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
|
import com.epmet.common.enu.AroundPartyConstant; |
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
@ -33,6 +34,8 @@ import com.epmet.dto.result.*; |
|
|
import com.epmet.entity.UserPointStatisticalDailyEntity; |
|
|
import com.epmet.entity.UserPointStatisticalDailyEntity; |
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
|
|
|
import com.epmet.resi.partymember.dto.partymember.PartymemberInfoDTO; |
|
|
|
|
|
import com.epmet.resi.partymember.feign.ResiPartyMemberOpenFeignClient; |
|
|
import com.epmet.service.UserPointStatisticalDailyService; |
|
|
import com.epmet.service.UserPointStatisticalDailyService; |
|
|
import com.epmet.utils.DimIdGenerator; |
|
|
import com.epmet.utils.DimIdGenerator; |
|
|
import com.epmet.utils.ModuleConstant; |
|
|
import com.epmet.utils.ModuleConstant; |
|
@ -60,6 +63,8 @@ public class UserPointStatisticalDailyServiceImpl extends BaseServiceImpl<UserPo |
|
|
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|
|
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|
|
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private ResiPartyMemberOpenFeignClient resiPartyMemberOpenFeignClient; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PageData<UserPointStatisticalDailyDTO> page(Map<String, Object> params) { |
|
|
public PageData<UserPointStatisticalDailyDTO> page(Map<String, Object> params) { |
|
@ -234,47 +239,70 @@ public class UserPointStatisticalDailyServiceImpl extends BaseServiceImpl<UserPo |
|
|
@Override |
|
|
@Override |
|
|
public List<ResiAroundPartyPointRankResultDTO> listAroundPartyPointRank(ResiAroundPartyPointRankFormDTO formDTO) { |
|
|
public List<ResiAroundPartyPointRankResultDTO> listAroundPartyPointRank(ResiAroundPartyPointRankFormDTO formDTO) { |
|
|
//查询条件
|
|
|
//查询条件
|
|
|
int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); |
|
|
formDTO.setPageNo((formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize()); |
|
|
formDTO.setPageNo(pageIndex); |
|
|
|
|
|
List<ResiAroundPartyPointRankResultDTO> resultDTOS = new ArrayList<>(); |
|
|
List<ResiAroundPartyPointRankResultDTO> resultDTOS = new ArrayList<>(); |
|
|
|
|
|
|
|
|
// 获取党员信息
|
|
|
List<String> gridList = new ArrayList<>(); |
|
|
|
|
|
// 1-1、获取网格id
|
|
|
// 按网格统计
|
|
|
if (AroundPartyConstant.GRID.equals(formDTO.getScope())){ |
|
|
if ("grid".equals(formDTO.getScope())){ |
|
|
gridList.add(formDTO.getGridId()); |
|
|
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); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 按社区统计
|
|
|
// 1-2、获取社区(下的所有的网格) id
|
|
|
if ("community".equals(formDTO.getScope())){ |
|
|
if (AroundPartyConstant.COMMUNITY.equals(formDTO.getScope())){ |
|
|
// 根据网格id,获取社区下的所有网格id
|
|
|
// 1、根据网格id,获取社区下的所有网格id
|
|
|
Result<List<String>> gridInCommunity = govOrgOpenFeignClient.getGridIdsInCommunity(formDTO.getGridId()); |
|
|
Result<List<String>> gridInCommunity = govOrgOpenFeignClient.getGridIdsInCommunity(formDTO.getGridId()); |
|
|
if (gridInCommunity.getData().size() <= NumConstant.ZERO){ |
|
|
if (gridInCommunity.success() && gridInCommunity.getData().isEmpty()){ |
|
|
log.error("根据" + formDTO.getGridId() + "网格id, 查询不到同属于一个社区下的所有网格id"); |
|
|
log.warn("根据" + formDTO.getGridId() + "网格id, 查询不到同属于一个社区下的所有网格id"); |
|
|
return resultDTOS; |
|
|
return resultDTOS; |
|
|
} |
|
|
} |
|
|
if ("monthly".equals(formDTO.getType())){ |
|
|
gridList = gridInCommunity.getData(); |
|
|
// 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()); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 2.获取网格下的所有党员
|
|
|
|
|
|
Result<List<PartymemberInfoDTO>> partymemberInfo = resiPartyMemberOpenFeignClient.getPartymemberInfoByGridId(gridList); |
|
|
|
|
|
if (partymemberInfo.success() && partymemberInfo.getData().isEmpty()){ |
|
|
|
|
|
log.warn("根据" + formDTO.getGridId() + "网格id, 查询不到党员信息"); |
|
|
|
|
|
return resultDTOS; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 2.1.获取认证通过的党员的 用户id
|
|
|
|
|
|
List<String> userIds = getUserIds(partymemberInfo.getData()); |
|
|
|
|
|
formDTO.setUserIds(userIds); |
|
|
|
|
|
|
|
|
|
|
|
// 3.根据用户id(所有),查询积分信息,进行排名
|
|
|
|
|
|
if (AroundPartyConstant.ALL.equals(formDTO.getType())){ |
|
|
|
|
|
// scope : community && type :all 表示:按网格(一个网格 或 社区下的所有网格)统计,对党员累计可用积分 排序
|
|
|
|
|
|
resultDTOS = baseDao.selectListGridPartyRankByUsablePoint(formDTO); |
|
|
|
|
|
|
|
|
|
|
|
} else if (AroundPartyConstant.MONTHLY.equals(formDTO.getType())){ |
|
|
|
|
|
// scope : community && type :monthly 表示:按网格(一个网格 或 社区下的所有网格)统计,对本月党员增加的积分 进行排序
|
|
|
|
|
|
resultDTOS = baseDao.selectListGridPartyRankPointByMonth(formDTO); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 给排好序的 身边党员-积分排行, 赋值 【头像】
|
|
|
// 给排好序的 身边党员-积分排行, 赋值 【头像、真实姓名】
|
|
|
resultDTOS = getPartyBaseInfo(resultDTOS); |
|
|
resultDTOS = getPartyBaseInfo(resultDTOS); |
|
|
return resultDTOS; |
|
|
return resultDTOS; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 获取认证通过的党员的 用户id |
|
|
|
|
|
* |
|
|
|
|
|
* @param partymemberInfo |
|
|
|
|
|
* @return java.util.List<java.lang.String> |
|
|
|
|
|
* @Author zhangyong |
|
|
|
|
|
* @Date 14:11 2020-12-29 |
|
|
|
|
|
**/ |
|
|
|
|
|
private List<String> getUserIds(List<PartymemberInfoDTO> partymemberInfo){ |
|
|
|
|
|
List<String> userIds = new ArrayList<>(); |
|
|
|
|
|
for (PartymemberInfoDTO dto : partymemberInfo){ |
|
|
|
|
|
userIds.add(dto.getUserId()); |
|
|
|
|
|
} |
|
|
|
|
|
return userIds; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
* 给排好序的 身边党员-积分排行, 赋值 【头像】 |
|
|
* 给排好序的 身边党员-积分排行, 赋值 【头像、真实姓名】 |
|
|
* @param rankResultDTOS |
|
|
* @param rankResultDTOS |
|
|
* @return java.util.List<com.epmet.dto.result.ResiAroundPartyPointRankResultDTO> |
|
|
* @return java.util.List<com.epmet.dto.result.ResiAroundPartyPointRankResultDTO> |
|
|
* @Author zhangyong |
|
|
* @Author zhangyong |
|
@ -296,6 +324,7 @@ public class UserPointStatisticalDailyServiceImpl extends BaseServiceImpl<UserPo |
|
|
for (ResiAroundPartyPointRankResultDTO formDTO : rankResultDTOS){ |
|
|
for (ResiAroundPartyPointRankResultDTO formDTO : rankResultDTOS){ |
|
|
if (formDTO.getUserId().equals(resiInfo.getUserId())){ |
|
|
if (formDTO.getUserId().equals(resiInfo.getUserId())){ |
|
|
formDTO.setUserHeadPhoto(resiInfo.getHeadImgUrl()); |
|
|
formDTO.setUserHeadPhoto(resiInfo.getHeadImgUrl()); |
|
|
|
|
|
formDTO.setRealName(resiInfo.getRealName()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|