| | |
| | | import cn.hutool.core.date.DateUnit; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | if (signScoreDic == null) { |
| | | throw new FebsException("签到活动未开启"); |
| | | } |
| | | Integer signScore = Integer.parseInt(signScoreDic.getValue()); |
| | | |
| | | MallScoreSignRecord mallScoreSignRecord = mallScoreSignRecordMapper.selectRecentSignRecord(member.getId()); |
| | | if (mallScoreSignRecord == null) { |
| | |
| | | if (mallScoreSignRecord.getSignTime() != null && DateUtil.betweenDay(mallScoreSignRecord.getSignTime(), new Date(), true) == 0) { |
| | | throw new FebsException("今日已签到"); |
| | | } |
| | | |
| | | Integer signScore = Integer.parseInt(signScoreDic.getValue()); |
| | | /** |
| | | * 获取签到次数 |
| | | * 判断签到次数是否大于规定的时长signScoreDays,超出则获得的积分数为signScoreCnt |
| | | */ |
| | | Integer count = mallScoreSignRecordMapper.selectCountByMemberId(member.getId()); |
| | | DataDictionaryCustom signScoreDaysDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.SIGN_SCORE_DAYS.getType(), |
| | | DataDictionaryEnum.SIGN_SCORE_DAYS.getCode()); |
| | | Integer signScoreDays = Integer.parseInt(signScoreDaysDic.getValue()); |
| | | if(count >= signScoreDays){ |
| | | DataDictionaryCustom signScoreCntDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.SIGN_SCORE_CNT.getType(), |
| | | DataDictionaryEnum.SIGN_SCORE_CNT.getCode()); |
| | | Integer signScoreCnt = Integer.parseInt(signScoreCntDic.getValue()); |
| | | signScore = signScoreCnt; |
| | | } |
| | | mallScoreSignRecord.setMemberId(member.getId()); |
| | | mallScoreSignRecord.setTotalCnt(signScore); |
| | | mallScoreSignRecord.setSignTime(new Date()); |