| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.study.domain.TGame; |
| | | import com.ruoyi.study.domain.TGameRecord; |
| | | import com.ruoyi.study.domain.TStudy; |
| | | import com.ruoyi.study.domain.TUserStudy; |
| | | import com.ruoyi.study.dto.CompleteGameDTO; |
| | | import com.ruoyi.study.dto.CompleteStudyDTO; |
| | | import com.ruoyi.study.mapper.TUserStudyMapper; |
| | | import com.ruoyi.study.service.ITGameRecordService; |
| | | import com.ruoyi.study.service.ITUserStudyService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | */ |
| | | @Service |
| | | public class TUserStudyServiceImpl extends ServiceImpl<TUserStudyMapper, TUserStudy> implements ITUserStudyService { |
| | | |
| | | @Resource |
| | | private ITGameRecordService gameRecordService; |
| | | |
| | | /** |
| | | * 所属day map |
| | |
| | | TUserStudy userStudy = this.lambdaQuery().eq(TUserStudy::getUserId, userid).one(); |
| | | // 更新游戏难度学习记录 |
| | | if (!Constants.TWO.equals(userStudy.getGameDifficulty())) { |
| | | userStudy.setGameDifficulty(GAME_DIFFICULTY_MAP.get(completeStudy.getDifficulty())); |
| | | // 获取用户游戏进度 |
| | | List<TGameRecord> list = gameRecordService.lambdaQuery().eq(TGameRecord::getUserId, userid) |
| | | .eq(TGameRecord::getGameId, game.getId()) |
| | | .ge(TGameRecord::getAccuracy, answerRate) |
| | | .eq(TGameRecord::getGameDifficulty, completeStudy.getDifficulty()).list(); |
| | | if (!list.isEmpty()) { |
| | | userStudy.setGameDifficulty(GAME_DIFFICULTY_MAP.get(completeStudy.getDifficulty())); |
| | | } |
| | | } |
| | | this.updateById(userStudy); |
| | | } |