抽奖次数

This commit is contained in:
2024-12-24 10:39:11 +08:00
parent 6ffa4d5bf8
commit 8ffb5bb329
7 changed files with 41 additions and 17 deletions

View File

@@ -10,8 +10,9 @@ import java.util.Map;
@Mapper
public interface UserSignRecordDao extends BaseMapper<UserSignRecord> {
//周 抽奖次数
Map<Integer,Integer> getTaskWCount(long userId, int wCount,String time,List<Integer> ids);
List getNoRecordTask(long userId, String time);
List<UserSignRecord> getTaskWCount(long userId, int wCount,String time,List<Long> ids);
List<Long> getNoRecordTask(long userId, String time);
//周 签到 次数 连续签到
Integer getWSignCount(long userId,String time);

View File

@@ -13,7 +13,7 @@ public interface UserSignRecordService extends IService<UserSignRecord> {
//获取当月签到次数
int getUserSignCount(long userId);
//周 剩余抽奖次数
Map<Integer,Integer> getTaskWCount(long userId, int wCount);
Map<Long,Integer> getTaskWCount(long userId, int wCount);
//周 签到 次数
Integer getWSignCount(long userId);

View File

@@ -12,6 +12,7 @@ import com.sqx.modules.app.dao.UserDao;
import com.sqx.modules.app.entity.UserEntity;
import com.sqx.modules.common.dao.CommonInfoDao;
import com.sqx.modules.common.entity.CommonInfo;
import com.sqx.modules.taskCenter.entity.TaskCenterReward;
import com.sqx.modules.userSign.dao.UserSignRecordDao;
import com.sqx.modules.userSign.dto.UserSignDTO;
import com.sqx.modules.userSign.dto.UserSignRecordDTO;
@@ -132,10 +133,16 @@ public class UserSignRecordServiceImpl extends ServiceImpl<UserSignRecordDao, Us
}
@Override
public Map<Integer,Integer> getTaskWCount(long userId,int wCount) {
public Map<Long,Integer> getTaskWCount(long userId,int wCount) {
Date thirtyDaysAgo = DateUtil.offsetDay(new Date(), -30);
List<Integer> noRecordTasks = baseMapper.getNoRecordTask(userId, DateUtil.format(thirtyDaysAgo, "yyyy-MM-dd") + " 00:00:00");
return baseMapper.getTaskWCount(userId, wCount, DateUtil.format(thirtyDaysAgo, "yyyy-MM-dd") + " 00:00:00", noRecordTasks);
List<Long> noRecordTasks = baseMapper.getNoRecordTask(userId, DateUtil.format(thirtyDaysAgo, "yyyy-MM-dd") + " 00:00:00");
List<UserSignRecord> taskWCount = baseMapper.getTaskWCount(userId, wCount, DateUtil.format(thirtyDaysAgo, "yyyy-MM-dd") + " 00:00:00", noRecordTasks);
Map<Long, Integer> map = taskWCount.stream()
.collect(Collectors.groupingBy(
UserSignRecord::getId,
Collectors.summingInt(UserSignRecord::getDay)
));
return map;
}
@Override