Browse Source

Merge remote-tracking branch 'origin/dev'

dev_shibei_match
wangchao 5 years ago
parent
commit
5a3b0857ed
  1. 1
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointTotalServiceImpl.java
  2. 7
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointStatisticalDailyDao.xml
  3. 5
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointTotalDao.xml

1
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointTotalServiceImpl.java

@ -199,7 +199,6 @@ public class UserPointTotalServiceImpl extends BaseServiceImpl<UserPointTotalDao
}
//将假分页结果替换到rankList
rankList = rankList.subList(fromIndex,toIndex);
}
List<String> userIds = rankList.stream().map(ResiPointRankResultDTO::getUserId).collect(Collectors.toList());

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

@ -25,6 +25,8 @@
<!-- 查询客户下周/月度用户积分排行榜 传参:客户Id | 维度 | 维度值 -->
<!-- user_point_statistical_daily中的action_flag有三种key值,plus(获取),exchange(积分兑换),minus(调整、惩罚),当action_flag为minus时,point_change为负值,其余均为正数 -->
<select id="selectPointRankWithinTimeZone" resultType="com.epmet.dto.result.ResiPointRankResultDTO">
select * from (
SELECT IF ( @point > point.TOTAL_POINT,
@rank := @rank + 1,
@rank := @rank + 0
@ -38,7 +40,8 @@
total.USER_ID,
IF
( IFNULL( SUM( daily.POINT_CHANGE ), 0 ) <![CDATA[ < ]]> 0, 0, IFNULL( SUM( daily.POINT_CHANGE ), 0 ) ) AS TOTAL_POINT
( IFNULL( SUM( daily.POINT_CHANGE ), 0 ) <![CDATA[ < ]]> 0, 0, IFNULL( SUM( daily.POINT_CHANGE ), 0 ) ) AS
TOTAL_POINT
FROM
user_point_total total
LEFT JOIN user_point_statistical_daily daily ON daily.USER_ID = total.USER_ID
@ -61,6 +64,8 @@
TOTAL_POINT DESC
) point,
( SELECT @point := NULL, @rank := 1 ) a
) temp
</select>
<!-- 查询有无指定日期的积分日统计 userId dateId actionFlag-->

5
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointTotalDao.xml

@ -48,6 +48,9 @@
<!-- 查询客户下的用户积分排行,分页 传参:customerId -->
<select id="selectUserPointRank" resultType="com.epmet.dto.result.ResiPointRankResultDTO">
select * from (
SELECT
IF ( @point > point.total_point, @rank := @rank + 1, @rank := @rank + 0 ) AS rank,
point.user_id,
@ -57,6 +60,8 @@
FROM
( SELECT * FROM user_point_total WHERE CUSTOMER_ID = #{customerId} ORDER BY total_point DESC ) point,
( SELECT @point := NULL, @rank := 1 ) a
) temp
</select>
<!-- 根据userId查找是否存在数据 -->

Loading…
Cancel
Save