| | |
| | | |
| | | import java.lang.reflect.InvocationTargetException; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import com.qxueyou.scc.base.model.UserInfoWrapper; |
| | |
| | | |
| | | |
| | | @Override |
| | | public Result add(String subjectName, String coverPageFileId, String contentFileId, int type) { |
| | | public Result add(String subjectName, String coverPageFileId, String contentFileId, int type, Date startTime, Date endTime) { |
| | | |
| | | Subject subject = new Subject(); |
| | | if (StringUtils.isNotEmpty(coverPageFileId)) { |
| | |
| | | subject.setStatus(Subject.STATUS_DRAFT); |
| | | subject.setLectureCount(0); |
| | | subject.setType(type); |
| | | //签到时间 |
| | | subject.setStartTime(startTime); |
| | | subject.setEndTime(endTime); |
| | | subject.setOrgId(ClientUtils.getOrgId()); |
| | | |
| | | save(subject); |
| | |
| | | |
| | | @Override |
| | | public List<Subject> list(String text, String teacherId, String status, Integer type, Integer pageSize, Integer pageNum) { |
| | | |
| | | StringBuffer hql = new StringBuffer("from Subject where name like ? and orgId=? and deleteFlag is false and origSubjectId is null "); |
| | | //and origSubjectId is null |
| | | StringBuffer hql = new StringBuffer("from Subject where name like ? and orgId=? and deleteFlag is false "); |
| | | |
| | | List<Object> args = CollectionUtils.newList(text + "%", ClientUtils.getOrgId()); |
| | | |
| | |
| | | args.add(status); |
| | | } |
| | | |
| | | // if (!StringUtils.isEmpty(teacherId)) { |
| | | // hql.append(" and createId=?"); |
| | | // args.add(teacherId); |
| | | // } |
| | | if (!StringUtils.isEmpty(teacherId)) { |
| | | hql.append(" and createId=?"); |
| | | hql.append(" and teacherId=?"); |
| | | args.add(teacherId); |
| | | } |
| | | hql.append(" order by createTime desc"); |
| | |
| | | @Override |
| | | public Result addClsSubject(String classId, String origSubjectId, String teacherId, Integer schoolYear, Integer term) throws IllegalAccessException, InvocationTargetException { |
| | | //新增老师课程 |
| | | Subject newSubject = new Subject(); |
| | | Subject origSubject = this.read(origSubjectId); |
| | | // Subject newSubject = new Subject(); |
| | | Subject newSubject = this.read(origSubjectId); |
| | | UserTeacher teacher = this.read(UserTeacher.class, teacherId); |
| | | BeanUtils.copyProperties(newSubject, origSubject); |
| | | // BeanUtils.copyProperties(newSubject, origSubject); |
| | | |
| | | TraceUtils.setCreateTrace(newSubject); |
| | | newSubject.setSubjectId(null); |
| | | // newSubject.setSubjectId(null); |
| | | newSubject.setTeacherId(teacherId); |
| | | newSubject.setSchoolYear(schoolYear); |
| | | newSubject.setTerm(term); |
| | | newSubject.setStatus(origSubject.getStatus()); |
| | | // newSubject.setStatus(origSubject.getStatus()); |
| | | newSubject.setOrigSubjectId(origSubjectId); |
| | | newSubject.setOrigCopySubjectId(origSubjectId); |
| | | newSubject.setType(Subject.TYPE_CLS_SUBJECT); |
| | | // newSubject.setType(Subject.TYPE_CLS_SUBJECT); |
| | | newSubject.setType(Subject.TYPE_ORG_SUBJECT); |
| | | newSubject.setTeacherName(teacher.getName()); |
| | | newSubject.setOrgId(ClientUtils.getOrgId()); |
| | | save(newSubject); |
| | |
| | | String className = "公开课"; |
| | | subjectMap.put("subjectName",subject.getSubjectName()); |
| | | subjectMap.put("subjectId",subject.getSubjectId()); |
| | | |
| | | subjectMap.put("coverPageUrl",subject.getCoverPageUrl()); |
| | | subjectMap.put("percent", new BigDecimal(percentAvg)); |
| | | subjectMap.put("progressValue", new BigDecimal(progressValue)); |
| | | subjectMap.put("className",className); |
| | |
| | | } else { |
| | | if (StringUtils.isNotEmpty(teacherId)) { |
| | | result = this.findListWithMapByHql( |
| | | "select distinct origSubjectId as subjectId ,name as subjectName from Subject where deleteFlag is false and type=" + Subject.TYPE_CLS_SUBJECT + " and teacherId='" + teacherId + "'", null); |
| | | // "select distinct origSubjectId as subjectId ,name as subjectName from Subject where deleteFlag is false and type=" + Subject.TYPE_CLS_SUBJECT + " and teacherId='" + teacherId + "'", null); |
| | | "select distinct origSubjectId as subjectId ,name as subjectName from Subject where deleteFlag is false and type=" + Subject.TYPE_ORG_SUBJECT + " and teacherId='" + teacherId + "'", null); |
| | | |
| | | } else { |
| | | result = this.findListWithMapByHql( |
| | | "select subjectId as subjectId ,name as subjectName from Subject where deleteFlag is false and type=" + Subject.TYPE_ORG_SUBJECT + " and orgId='" + ClientUtils.getOrgId() + "'", null); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String findSubjectName(String subjectId) { |
| | | Subject subject = findUnique("from Subject where subjectId = ? ",CollectionUtils.newList(subjectId),Subject.class); |
| | | return subject.getName(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 我的公开课列表 |