Browse Source

排序修改

dev
zxc 4 years ago
parent
commit
bc1c0b292e
  1. 3
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointStatisticalDailyDao.java
  2. 10
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointStatisticalDailyServiceImpl.java
  3. 41
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointStatisticalDailyDao.xml

3
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointStatisticalDailyDao.java

@ -19,6 +19,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.ResiAroundPartyPointRankFormDTO;
import com.epmet.dto.result.AllPartyResultDTO;
import com.epmet.dto.result.ResiAroundPartyPointRankResultDTO;
import com.epmet.dto.result.ResiPointRankResultDTO;
import com.epmet.entity.UserPointStatisticalDailyEntity;
@ -73,6 +74,7 @@ public interface UserPointStatisticalDailyDao extends BaseDao<UserPointStatistic
* @Date 09:24 2020-12-29
**/
List<ResiAroundPartyPointRankResultDTO> selectListGridPartyRankByUsablePoint(ResiAroundPartyPointRankFormDTO formDTO);
List<AllPartyResultDTO> selectListGridPartyNewRankByUsablePoint(ResiAroundPartyPointRankFormDTO formDTO);
/**
* 身边党员-积分排行 按网格统计对本月党员增加的积分 进行排序
@ -82,4 +84,5 @@ public interface UserPointStatisticalDailyDao extends BaseDao<UserPointStatistic
* @Date 09:24 2020-12-29
**/
List<ResiAroundPartyPointRankResultDTO> selectListGridPartyRankByMonth(ResiAroundPartyPointRankFormDTO formDTO);
List<AllPartyResultDTO> selectListGridPartyNewRankByMonth(ResiAroundPartyPointRankFormDTO formDTO);
}

10
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointStatisticalDailyServiceImpl.java

@ -315,14 +315,14 @@ public class UserPointStatisticalDailyServiceImpl extends BaseServiceImpl<UserPo
List<String> userIds = partyMemberInfos.stream().map(m -> m.getUserId()).collect(Collectors.toList());
ResiAroundPartyPointRankFormDTO selDto = ConvertUtils.sourceToTarget(formDTO, ResiAroundPartyPointRankFormDTO.class);
selDto.setUserIds(userIds);
List<ResiAroundPartyPointRankResultDTO> resultDTOS = new ArrayList<>();
List<AllPartyResultDTO> resultDTOS = new ArrayList<>();
if (AroundPartyConstant.ALL.equals(formDTO.getType())){
resultDTOS = baseDao.selectListGridPartyRankByUsablePoint(selDto);
resultDTOS = baseDao.selectListGridPartyNewRankByUsablePoint(selDto);
}else if (AroundPartyConstant.MONTHLY.equals(formDTO.getType())){
resultDTOS = baseDao.selectListGridPartyRankByMonth(selDto);
resultDTOS = baseDao.selectListGridPartyNewRankByMonth(selDto);
}
resultDTOS = getPartyBaseInfo(resultDTOS);
List<AllPartyResultDTO> result = ConvertUtils.sourceToTarget(resultDTOS, AllPartyResultDTO.class);
List<ResiAroundPartyPointRankResultDTO> partyBaseInfo = getPartyBaseInfo(ConvertUtils.sourceToTarget(resultDTOS, ResiAroundPartyPointRankResultDTO.class));
List<AllPartyResultDTO> result = ConvertUtils.sourceToTarget(partyBaseInfo, AllPartyResultDTO.class);
return result;
}

41
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointStatisticalDailyDao.xml

@ -184,4 +184,45 @@
ORDER BY P.point DESC
LIMIT #{pageNo}, #{pageSize}
</select>
<select id="selectListGridPartyNewRankByUsablePoint" resultType="com.epmet.dto.result.AllPartyResultDTO">
SELECT
@curRank := @curRank + 1 AS ranking,
@point := IFNULL(p.USABLE_POINT, 0),
IFNULL(p.USABLE_POINT, 0) point,
p.USER_ID userId
FROM user_point_total p
<if test="null != userIds and userIds.size() > 0">
WHERE p.USER_ID IN
<foreach collection="userIds" item="userId" open="(" separator="," close=" )">
#{userId}
</foreach>
</if>
ORDER BY IFNULL(p.USABLE_POINT, 0) DESC
LIMIT #{pageNo}, #{pageSize}
</select>
<select id="selectListGridPartyNewRankByMonth" resultType="com.epmet.dto.result.AllPartyResultDTO">
SELECT
@curRank := @curRank + 1 AS ranking,
@point := p.point,
P.userId,
P.point
FROM(
SELECT
pl.USER_ID userId,
SUM(PL.POINT) point
FROM user_point_action_log pl
WHERE pl.DEL_FLAG = '0' AND DATE_FORMAT(pl.CREATED_TIME, '%Y%m')= DATE_FORMAT( CURDATE( ) , '%Y%m' ) AND pl.action_flag = 'plus'
GROUP BY pl.USER_ID
) P
<if test="null != userIds and userIds.size() > 0">
WHERE userId IN
<foreach collection="userIds" item="userId" open="(" separator="," close=" )">
#{userId}
</foreach>
</if>
ORDER BY P.point DESC
LIMIT #{pageNo}, #{pageSize}
</select>
</mapper>

Loading…
Cancel
Save