hjl
2024-06-17 e11362ca4849da567a77d8b5e5be510df9fb0741
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package com.ruoyi.study.service.impl;
 
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.study.domain.TSubjectRecord;
import com.ruoyi.study.mapper.TSubjectRecordMapper;
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>
 * 自主游戏 服务实现类
 * </p>
 *
 * @author 无关风月
 * @since 2024-04-26
 */
@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;
    }
}