派生自 projectDept/qhighschool

Administrator
2022-12-06 92027c9960c8e4e8d84db11c2c422254a5b7d38c
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
56
57
58
59
60
61
62
63
64
65
66
package com.qxueyou.scc.admin.progress.service.impl.item;
 
import java.util.HashMap;
import java.util.Map;
 
import javax.annotation.PostConstruct;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
 
import com.qxueyou.scc.admin.classes.model.ClsSubjectLecture;
import com.qxueyou.scc.admin.classes.service.IClassLectureService;
import com.qxueyou.scc.admin.progress.model.Progress;
import com.qxueyou.scc.admin.progress.service.IDetailProgressService;
import com.qxueyou.scc.base.model.Result;
import com.qxueyou.scc.base.service.impl.CommonAppService;
import com.qxueyou.scc.teach.subject.model.SubjectLecture;
 
@Service("LectureProgressService")
public class LectureProgressService extends CommonAppService implements IDetailProgressService {
 
    @Autowired
    IClassLectureService lectureService;
 
    /**
     * 各类型课件进度服务实现
     */
    private Map<String, IDetailProgressService> resItemServiceMap = new HashMap<String, IDetailProgressService>(6);
 
    @Autowired
    private ApplicationContext appContext;
 
    @PostConstruct
    private void init() {
        addLectureProgressService(appContext.getBean("LectureVideoProgressService",IDetailProgressService.class));
        addLectureProgressService(appContext.getBean("LectureAudioProgressService",IDetailProgressService.class));
        addLectureProgressService(appContext.getBean("LectureDocProgressService",IDetailProgressService.class));
    }
 
    private void addLectureProgressService(IDetailProgressService service) {
        resItemServiceMap.put(service.getType(), service);
    }
 
 
    @Override
    public Result addProgress(String targetId,String learnerId, int start, int end) {
        ClsSubjectLecture lecture = lectureService.readClsLecture(targetId);
 
        String lectureType = null;
        if(lecture == null) {
            lectureType = this.read(SubjectLecture.class, targetId).getLectureType();
        }else {
            lectureType = lecture.getLectureType();
        }
 
        return resItemServiceMap.get(lectureType).addProgress(targetId, learnerId, start, end);
 
    }
 
    @Override
    public String getType() {
        return Progress.PROGRESS_TYPE_LECTURE;
    }
 
}