| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.exception.GlobalException; |
| | | import com.ruoyi.study.domain.TGame; |
| | | import com.ruoyi.study.domain.TIntegralRecord; |
| | | import com.ruoyi.study.domain.TSubject; |
| | | import com.ruoyi.study.dto.CompleteGameDTO; |
| | | import com.ruoyi.study.mapper.TGameMapper; |
| | | import com.ruoyi.study.service.ITGameService; |
| | | import com.ruoyi.study.vo.StudyGameMemoryVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Random; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | return gameAvailableIntegral; |
| | | } else { |
| | | // 积分明细不为空,根据正确率及已获取积分数量计算本次答题可获取的积分数量 |
| | | List<Integer> integralList = integralRecordList.stream().map(TIntegralRecord::getIntegral).collect(Collectors.toList()) |
| | | List<Integer> integralList = integralRecordList.stream() |
| | | .map(TIntegralRecord::getIntegral).collect(Collectors.toList()) |
| | | .stream().map(Integer::parseInt).collect(Collectors.toList()); |
| | | int sumIntegral = integralList.stream().mapToInt(Integer::intValue).sum(); |
| | | if (gameAvailableIntegral > sumIntegral) { |
| | | return gameAvailableIntegral - sumIntegral; |
| | | } else { |
| | | return null; |
| | | return Constants.ZERO; |
| | | } |
| | | } |
| | | } |