|
|
@@ -73,25 +73,34 @@ public class SecondUserCreditRecordServiceImpl extends ServiceImpl<SecondUserCre
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public R<SecondUserCreditRecordListVo> getByUserId(Integer userId, Integer timeRange) {
|
|
|
- log.info("SecondUserCreditRecordServiceImpl.getByUserId, userId={}, timeRange={}", userId, timeRange);
|
|
|
+ public R<SecondUserCreditRecordListVo> getByUserId(Integer userId, Integer timeRange, Integer pointsType) {
|
|
|
+ log.info("SecondUserCreditRecordServiceImpl.getByUserId, userId={}, timeRange={}, pointsType={}", userId, timeRange, pointsType);
|
|
|
LambdaQueryWrapper<SecondUserCreditRecord> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.eq(SecondUserCreditRecord::getUserId, userId);
|
|
|
|
|
|
// 根据时间范围过滤
|
|
|
Date startTime = null;
|
|
|
-
|
|
|
-
|
|
|
- queryWrapper.orderByDesc(SecondUserCreditRecord::getCreatedTime);
|
|
|
- // 下面全部 忽略时间范围 需求变动再去添加
|
|
|
- List<SecondUserCreditRecord> recordsChange = this.list(queryWrapper);
|
|
|
-
|
|
|
if (timeRange != null) {
|
|
|
startTime = calculateStartTime(timeRange);
|
|
|
if (startTime != null) {
|
|
|
queryWrapper.ge(SecondUserCreditRecord::getCreatedTime, startTime);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // 根据积分类型过滤:0-全部,1-正分,2-负分
|
|
|
+ if (pointsType != null) {
|
|
|
+ if (pointsType == 1) {
|
|
|
+ // 正分:points > 0
|
|
|
+ queryWrapper.gt(SecondUserCreditRecord::getPoints, 0);
|
|
|
+ } else if (pointsType == 2) {
|
|
|
+ // 负分:points < 0
|
|
|
+ queryWrapper.lt(SecondUserCreditRecord::getPoints, 0);
|
|
|
+ }
|
|
|
+ // pointsType == 0 或 null 表示全部,不需要过滤
|
|
|
+ }
|
|
|
+
|
|
|
+ queryWrapper.orderByDesc(SecondUserCreditRecord::getCreatedTime);
|
|
|
+ List<SecondUserCreditRecord> recordsChange = this.list(queryWrapper);
|
|
|
|
|
|
// 查询日期积分记录,按照相同的时间范围筛选
|
|
|
LambdaQueryWrapper<SecondUserCreditDateRecord> dateRecordQueryWrapper = new LambdaQueryWrapper<>();
|