| | |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.qxueyou.scc.admin.classes.model.ClsClassReSubject; |
| | | import com.qxueyou.scc.admin.classes.service.IClassLectureService; |
| | | import com.qxueyou.scc.teach.subject.model.Subject; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | |
| | | import com.qxueyou.scc.teach.subject.model.view.MyLectureV; |
| | | import com.qxueyou.scc.teach.subject.service.ILectureService; |
| | | import com.qxueyou.scc.teach.subject.service.ISubjectService; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | @Service |
| | | public class SubjectLectureService extends CommonAppService implements ILectureService { |
| | |
| | | lecture.setRemark(res.getRemark()); |
| | | lecture.setSubjectId(chapter.getSubjectId()); |
| | | lecture.setResItemId(res.getResId()); |
| | | |
| | | |
| | | save(lecture); |
| | | subjectService.addLectureCount(lecture.getSubjectId(), 1); |
| | | return new Result(true, "success"); |
| | | } |
| | | |
| | | subjectService.addLectureCount(chapter.getSubjectId(), 1); |
| | | |
| | | @Override |
| | | public Result addLectureLoad(String sectionId){ |
| | | SubjectChapter chapter = read(SubjectChapter.class, sectionId); |
| | | String hql = "from Subject where subjectId = ? and deleteFlag is false"; |
| | | String subjectId = chapter.getSubjectId(); |
| | | Subject subjectOne = findUnique(hql,CollectionUtils.newList(subjectId),Subject.class); |
| | | String hqlOne = "from Subject where name = ? and deleteFlag is false"; |
| | | List<Subject> subjectTwo = find(hqlOne,CollectionUtils.newList(subjectOne.getName()),Subject.class); |
| | | for (Subject s : subjectTwo){ |
| | | String hqlTwo = "from ClsClassReSubject where subjectId = ? and deleteFlag is false"; |
| | | ClsClassReSubject subject = findUnique(hqlTwo,CollectionUtils.newList(s.getSubjectId()),ClsClassReSubject.class); |
| | | if(subject != null){ |
| | | subjectService.updateClsSubject(subject.getClassId(),s.getSubjectId(),s.getOrigSubjectId(),s.getTeacherId(),s.getSchoolYear(),s.getTerm()); |
| | | } |
| | | } |
| | | return new Result(true, "success"); |
| | | } |
| | | |
| | |
| | | for (String lectureId : lectureIds) { |
| | | deleteLecture(lectureId); |
| | | } |
| | | |
| | | return new Result(true, "success"); |
| | | } |
| | | @Override |
| | | public Result deleteLectureLoad(String[] lectureIds){ |
| | | SubjectLecture lecture = read(SubjectLecture.class, lectureIds[0]); |
| | | String hql = "from Subject where subjectId = ? and deleteFlag is false"; |
| | | String subjectId = lecture.getSubjectId(); |
| | | Subject subjectOne = findUnique(hql,CollectionUtils.newList(subjectId),Subject.class); |
| | | String hqlOne = "from Subject where name = ? and deleteFlag is false"; |
| | | List<Subject> subjectTwo = find(hqlOne,CollectionUtils.newList(subjectOne.getName()),Subject.class); |
| | | for (Subject s : subjectTwo){ |
| | | String hqlTwo = "from ClsClassReSubject where subjectId = ? and deleteFlag is false"; |
| | | ClsClassReSubject subject = findUnique(hqlTwo,CollectionUtils.newList(s.getSubjectId()),ClsClassReSubject.class); |
| | | if(subject != null){ |
| | | subjectService.updateClsSubject(subject.getClassId(),s.getSubjectId(),s.getOrigSubjectId(),s.getTeacherId(),s.getSchoolYear(),s.getTerm()); |
| | | } |
| | | } |
| | | return new Result(true, "success"); |
| | | } |
| | | |
| | |
| | | |
| | | TraceUtils.setUpdateTrace(lecture); |
| | | lecture.setDeleteFlag(true); |
| | | |
| | | save(lecture); |
| | | |
| | | subjectService.addLectureCount(lecture.getSubjectId(), -1); |
| | |
| | | Integer pageNum, String type) { |
| | | StringBuffer hql = new StringBuffer("from MyLectureV where chapterId=? and id.userId=?"); |
| | | List<Object> args = CollectionUtils.newList(chapterId, learnerId); |
| | | |
| | | if (StringUtils.isNotEmpty(type)) { |
| | | hql.append(" and lectureType=?"); |
| | | args.add(type); |
| | | } |
| | | |
| | | List<MyLectureV> result = findList(hql.toString(), new Pager(pageSize, pageNum), args, MyLectureV.class); |
| | | |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<MyLectureV> listLectureVBySubjectId(String learnerId, String subjectId, String keyword, Integer pageSize, |
| | | Integer pageNum, String type) { |
| | | StringBuffer hql = new StringBuffer("from MyLectureV where subjectId=? and id.userId=? order by lectureUpdateTime desc"); |
| | | List<Object> args = CollectionUtils.newList(subjectId, learnerId); |
| | | |
| | | if (StringUtils.isNotEmpty(type)) { |
| | | hql.append(" and lectureType=?"); |
| | |
| | | @Override |
| | | public Result doStudy(String lectureId, Double from, Double to) { |
| | | String userId = null; |
| | | return progressService.addProgress(Progress.PROGRESS_TYPE_LECTURE, lectureId, from.doubleValue(), to.doubleValue(), |
| | | return progressService.addProgress(Progress.PROGRESS_TYPE_LECTURE, lectureId, from.intValue(), to.intValue(), |
| | | userId); |
| | | } |
| | | |