| | |
| | | package com.ruoyi.study.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.study.domain.TGameRecord; |
| | | import com.ruoyi.study.domain.TSubjectRecord; |
| | | import com.ruoyi.study.mapper.TGameRecordMapper; |
| | | import com.ruoyi.study.mapper.TSubjectRecordMapper; |
| | | import com.ruoyi.study.service.ITGameRecordService; |
| | | import com.ruoyi.study.service.ITSubjectRecordService; |
| | | import com.ruoyi.study.vo.ExitLearnVO; |
| | | import com.ruoyi.study.vo.SubjectRecordResultVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TSubjectRecordServiceImpl extends ServiceImpl<TSubjectRecordMapper, TSubjectRecord> implements ITSubjectRecordService { |
| | | |
| | | @Override |
| | | public Boolean exitLearning(ExitLearnVO exitLearn, Integer userid) { |
| | | Integer week = exitLearn.getWeek(); |
| | | Integer day = exitLearn.getDay(); |
| | | Integer type = exitLearn.getType(); |
| | | String topicIds = exitLearn.getTopicIds(); |
| | | String teamIds = exitLearn.getTeamIds(); |
| | | // 封装信息 |
| | | TSubjectRecord subjectRecord = new TSubjectRecord(); |
| | | subjectRecord.setUserId(userid); |
| | | subjectRecord.setWeek(week); |
| | | subjectRecord.setDay(day); |
| | | subjectRecord.setType(type); |
| | | // 答题次数与答题正确次数 |
| | | subjectRecord.setAnswerNumber(exitLearn.getAnswerNumber()); |
| | | subjectRecord.setCorrectNumber(exitLearn.getCorrectNumber()); |
| | | subjectRecord.setType(type); |
| | | // 题目与题组需处理 |
| | | List<String> teamIdList = Arrays.stream(teamIds.split(",")).collect(Collectors.toList()); |
| | | List<String> topicIdList = Arrays.stream(topicIds.split(",")).collect(Collectors.toList()); |
| | | subjectRecord.setBeforeSubject(teamIdList.stream().map(String::valueOf).collect(Collectors.joining(","))); |
| | | subjectRecord.setCompleteSubject(topicIdList.stream().map(String::valueOf).collect(Collectors.joining(","))); |
| | | return this.save(subjectRecord); |
| | | } |
| | | |
| | | @Override |
| | | public SubjectRecordResultVO recordResult(TSubjectRecord subjectRecord, Integer userid) { |
| | | return null; |
| | | } |
| | | } |