|
|
@ -19,21 +19,23 @@ package com.epmet.service.impl; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
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.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
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.resi.partymember.dto.partymember.PartymemberInfoDTO; |
|
|
|
import com.epmet.resi.partymember.feign.ResiPartyMemberOpenFeignClient; |
|
|
|
import com.epmet.service.UserPointStatisticalDailyService; |
|
|
|
import com.epmet.utils.DimIdGenerator; |
|
|
|
import com.epmet.utils.ModuleConstant; |
|
|
@ -59,6 +61,10 @@ public class UserPointStatisticalDailyServiceImpl extends BaseServiceImpl<UserPo |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private ResiPartyMemberOpenFeignClient resiPartyMemberOpenFeignClient; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<UserPointStatisticalDailyDTO> page(Map<String, Object> params) { |
|
|
@ -230,5 +236,98 @@ public class UserPointStatisticalDailyServiceImpl extends BaseServiceImpl<UserPo |
|
|
|
baseDao.insertOrUpdate(entity); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<ResiAroundPartyPointRankResultDTO> listAroundPartyPointRank(ResiAroundPartyPointRankFormDTO formDTO) { |
|
|
|
// 0、查询条件
|
|
|
|
formDTO.setPageNo((formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize()); |
|
|
|
List<ResiAroundPartyPointRankResultDTO> resultDTOS = new ArrayList<>(); |
|
|
|
|
|
|
|
} |
|
|
|
List<String> gridList = new ArrayList<>(); |
|
|
|
// 1-1、获取参数中的网格id
|
|
|
|
if (AroundPartyConstant.GRID.equals(formDTO.getScope())){ |
|
|
|
gridList.add(formDTO.getGridId()); |
|
|
|
} |
|
|
|
|
|
|
|
// 1-2、获取社区(下的所有网格) 的网格id
|
|
|
|
if (AroundPartyConstant.COMMUNITY.equals(formDTO.getScope())){ |
|
|
|
Result<List<String>> gridInCommunity = govOrgOpenFeignClient.getGridIdsInCommunity(formDTO.getGridId()); |
|
|
|
if (gridInCommunity.success() && null != gridInCommunity.getData() && gridInCommunity.getData().isEmpty()){ |
|
|
|
log.warn("根据" + formDTO.getGridId() + "网格id, 查询不到同属于一个社区下的所有网格id"); |
|
|
|
return resultDTOS; |
|
|
|
} |
|
|
|
gridList = gridInCommunity.getData(); |
|
|
|
} |
|
|
|
|
|
|
|
// 2.根据网格id,获取网格下的所有党员(认证通过)
|
|
|
|
Result<List<PartymemberInfoDTO>> partymemberInfo = resiPartyMemberOpenFeignClient.getPartymemberInfoByGridId(gridList); |
|
|
|
if (partymemberInfo.success() && null != partymemberInfo.getData() && 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())){ |
|
|
|
// type :all 表示:按网格(一个网格 或 社区下的所有网格)统计,对党员累计可用积分 排序
|
|
|
|
resultDTOS = baseDao.selectListGridPartyRankByUsablePoint(formDTO); |
|
|
|
|
|
|
|
} else if (AroundPartyConstant.MONTHLY.equals(formDTO.getType())){ |
|
|
|
// type :monthly 表示:按网格(一个网格 或 社区下的所有网格)统计,对本月党员增加的积分 进行排序
|
|
|
|
resultDTOS = baseDao.selectListGridPartyRankByMonth(formDTO); |
|
|
|
} |
|
|
|
|
|
|
|
// 4.给排好序的 身边党员-积分排行, 赋值 【头像、真实姓名】
|
|
|
|
resultDTOS = getPartyBaseInfo(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 |
|
|
|
* @return java.util.List<com.epmet.dto.result.ResiAroundPartyPointRankResultDTO> |
|
|
|
* @Author zhangyong |
|
|
|
* @Date 10:14 2020-12-29 |
|
|
|
**/ |
|
|
|
private List<ResiAroundPartyPointRankResultDTO> getPartyBaseInfo(List<ResiAroundPartyPointRankResultDTO> rankResultDTOS){ |
|
|
|
// 1.获取当前党员Id
|
|
|
|
List<String> userIdParam = new LinkedList<>(); |
|
|
|
for (ResiAroundPartyPointRankResultDTO formDTO : rankResultDTOS){ |
|
|
|
userIdParam.add(formDTO.getUserId()); |
|
|
|
} |
|
|
|
if (userIdParam.size() == NumConstant.ZERO){ |
|
|
|
return rankResultDTOS; |
|
|
|
} |
|
|
|
// 2.获取用户基本信息
|
|
|
|
Result<List<UserBaseInfoResultDTO>> 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()); |
|
|
|
formDTO.setRealName(resiInfo.getRealName()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return rankResultDTOS; |
|
|
|
} |
|
|
|
} |
|
|
|