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;
|
}
|
|
}
|