任务 抽奖 签到
This commit is contained in:
@@ -4,8 +4,14 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sqx.modules.userSign.entity.UserSignRecord;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface UserSignRecordDao extends BaseMapper<UserSignRecord> {
|
||||
//周 抽奖次数
|
||||
Map<Integer,Integer> getTaskWCount(long userId, int wCount,String time);
|
||||
//周 签到 次数 连续签到
|
||||
Integer getWSignCount(long userId,String time);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,19 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sqx.modules.userSign.dto.UserSignDTO;
|
||||
import com.sqx.modules.userSign.entity.UserSignRecord;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface UserSignRecordService extends IService<UserSignRecord> {
|
||||
|
||||
UserSignDTO getUserSignData(long userId);
|
||||
|
||||
//获取当月签到次数
|
||||
int getUserSignCount(long userId);
|
||||
//周 剩余抽奖次数
|
||||
Map<Integer,Integer> getTaskWCount(long userId, int wCount);
|
||||
//周 签到 次数
|
||||
Integer getWSignCount(long userId);
|
||||
|
||||
String[] getUserSignAwardConfig();
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sqx.common.exception.SqxException;
|
||||
@@ -120,6 +121,27 @@ public class UserSignRecordServiceImpl extends ServiceImpl<UserSignRecordDao, Us
|
||||
return dto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUserSignCount(long userId) {
|
||||
QueryWrapper<UserSignRecord> signWrapper = new QueryWrapper<>();
|
||||
signWrapper.eq("user_id", userId);
|
||||
signWrapper.gt("sign_day", DateUtil.format(new Date(), "yyyy-MM") + "-00");
|
||||
signWrapper.orderByAsc("create_time");
|
||||
int signCount = baseMapper.selectCount(signWrapper);
|
||||
return signCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Integer,Integer> getTaskWCount(long userId,int wCount) {
|
||||
Date thirtyDaysAgo = DateUtil.offsetDay(new Date(), -30);
|
||||
return baseMapper.getTaskWCount(userId,wCount,DateUtil.format(thirtyDaysAgo, "yyyy-MM-dd")+" 00:00:00");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getWSignCount(long userId) {
|
||||
return baseMapper.getWSignCount(userId, DateUtil.format(DateUtil.yesterday(), "yyyy-MM-dd") + " 00:00:00");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getUserSignAwardConfig() {
|
||||
CommonInfo config = commonInfoDao.findOne(918);
|
||||
|
||||
Reference in New Issue
Block a user