|
|
@@ -0,0 +1,171 @@
|
|
|
+package com.usoftchina.smartschool.school.wxschool.basic.service.impl;
|
|
|
+
|
|
|
+import com.usoftchina.smartschool.school.po.TeacherClazzDO;
|
|
|
+import com.usoftchina.smartschool.school.po.TeacherDO;
|
|
|
+import com.usoftchina.smartschool.school.wxschool.mapper.*;
|
|
|
+import com.usoftchina.smartschool.school.po.ClazzCurriculumDO;
|
|
|
+import com.usoftchina.smartschool.school.po.StudentDO;
|
|
|
+import com.usoftchina.smartschool.school.wxschool.basic.service.WxClazzCurriculumService;
|
|
|
+import com.usoftchina.smartschool.school.wxschool.utils.ObjectUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+
|
|
|
+@Service
|
|
|
+public class WxClazzCurriculumServiceImpl implements WxClazzCurriculumService {
|
|
|
+ @Autowired
|
|
|
+ private WxClazzCurriculumMapper clazzCurriculumMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private WxSubjectMapper subjectMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private WxTeacherMapper wxTeacherMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private WxTeacherClazzMapper wxTeacherClazzMapper;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> selectCurriculumByStuId(Long stuId, Integer curStatus) throws Exception {
|
|
|
+ List<ClazzCurriculumDO> curricula = clazzCurriculumMapper.selectCurriculumByStuId(stuId, curStatus);
|
|
|
+ if (ObjectUtils.isNotEmpty(curricula)){
|
|
|
+ //Map<String, Object> maps = new HashMap<>();
|
|
|
+ //StudentDO studentDO = studentMapper.get(stuId);
|
|
|
+ //if (ObjectUtils.isNotEmpty(studentDO)){
|
|
|
+ //maps.put("stuName",studentDO.getStuName());
|
|
|
+ //maps.put("clazzName",clazzMapper.get(studentDO.getClazzId()).getClazzName());
|
|
|
+ //maps.put("curricula",curricula);
|
|
|
+ //}else {
|
|
|
+ //throw new Exception("该学生不存在,请联系管理员");
|
|
|
+ //}
|
|
|
+ return getCurr(curricula);
|
|
|
+ }else {
|
|
|
+ throw new Exception("暂时没有课程表,请联系管理员");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> selectCurriculumByTeacherId(Long teacherId, Integer curStatus) throws Exception {
|
|
|
+ List<ClazzCurriculumDO> curricula = clazzCurriculumMapper.selectCurriculumByteacherId(teacherId, curStatus);
|
|
|
+ if (ObjectUtils.isNotEmpty(curricula)){
|
|
|
+ return getCurr(curricula);
|
|
|
+ }else {
|
|
|
+ throw new Exception("暂无数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 写入科目信息
|
|
|
+ * @param curricula
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private Map<String, Object> getCurr(List<ClazzCurriculumDO> curricula) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ List<Map<String,Object>> curFris = new ArrayList<>();
|
|
|
+ List<Map<String,Object>> curMons = new ArrayList<>(); List<Map<String,Object>> curSats = new ArrayList<>();
|
|
|
+ List<Map<String,Object>> curThurs = new ArrayList<>();
|
|
|
+ List<Map<String,Object>> curTuess = new ArrayList<>();
|
|
|
+ List<Map<String,Object>> curWeds = new ArrayList<>();
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm");
|
|
|
+ dateFormat.setTimeZone(TimeZone.getTimeZone("GMT-6"));
|
|
|
+ for (ClazzCurriculumDO cc:curricula) {
|
|
|
+ Long curFri = cc.getCurFri();
|
|
|
+ //System.err.println(cc.getCurStartTime());
|
|
|
+ //System.err.println(dateFormat.format(cc.getCurStartTime()));
|
|
|
+ if (ObjectUtils.isNotEmpty(curFri)){
|
|
|
+ Map<String, Object> curFriMap = new HashMap<>();
|
|
|
+ curFriMap.put("startTime",dateFormat.format(cc.getCurStartTime()));
|
|
|
+ curFriMap.put("endTime",dateFormat.format(cc.getCurEndTime()));
|
|
|
+ curFriMap.put("subjectName",subjectMapper.get(curFri).getSubjectName());
|
|
|
+ TeacherClazzDO teacher1 = wxTeacherClazzMapper.getTeacher(cc.getClazzId(), curFri);
|
|
|
+ TeacherDO teacherDO1 = wxTeacherMapper.get(teacher1.getTeacherId());
|
|
|
+ curFriMap.put("teacherName",teacherDO1.getTeacherName());
|
|
|
+ curFriMap.put("teacherPhoto",teacherDO1.getTeacherPhoto());
|
|
|
+ curFris.add(curFriMap);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ Long curMon = cc.getCurMon();
|
|
|
+ if (ObjectUtils.isNotEmpty(curMon)){
|
|
|
+ Map<String, Object> curMonMap = new HashMap<>();
|
|
|
+ curMonMap.put("startTime",dateFormat.format(cc.getCurStartTime()));
|
|
|
+ curMonMap.put("endTime",dateFormat.format(cc.getCurEndTime()));
|
|
|
+ curMonMap.put("subjectName",subjectMapper.get(curMon).getSubjectName());
|
|
|
+ TeacherClazzDO teacher2 = wxTeacherClazzMapper.getTeacher(cc.getClazzId(), curMon);
|
|
|
+ TeacherDO teacherDO2 = wxTeacherMapper.get(teacher2.getTeacherId());
|
|
|
+ curMonMap.put("teacherName",teacherDO2.getTeacherName());
|
|
|
+ curMonMap.put("teacherPhoto",teacherDO2.getTeacherPhoto());
|
|
|
+ curMons.add(curMonMap);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ Long curSat = cc.getCurSat();
|
|
|
+ if (ObjectUtils.isNotEmpty(curSat)){
|
|
|
+ Map<String, Object> curSatMap = new HashMap<>();
|
|
|
+ curSatMap.put("startTime",dateFormat.format(cc.getCurStartTime()));
|
|
|
+ curSatMap.put("endTime",dateFormat.format(cc.getCurEndTime()));
|
|
|
+ curSatMap.put("subjectName",subjectMapper.get(curSat).getSubjectName());
|
|
|
+ TeacherClazzDO teacher3 = wxTeacherClazzMapper.getTeacher(cc.getClazzId(), curSat);
|
|
|
+ TeacherDO teacherDO3 = wxTeacherMapper.get(teacher3.getTeacherId());
|
|
|
+ curSatMap.put("teacherName",teacherDO3.getTeacherName());
|
|
|
+ curSatMap.put("teacherPhoto",teacherDO3.getTeacherPhoto());
|
|
|
+ curSats.add(curSatMap);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ Long curThur = cc.getCurThur();
|
|
|
+ if (ObjectUtils.isNotEmpty(curThur)){
|
|
|
+ Map<String, Object> curThurMap = new HashMap<>();
|
|
|
+ curThurMap.put("startTime",dateFormat.format(cc.getCurStartTime()));
|
|
|
+ curThurMap.put("endTime",dateFormat.format(cc.getCurEndTime()));
|
|
|
+ curThurMap.put("subjectName",subjectMapper.get(curThur).getSubjectName());
|
|
|
+ TeacherClazzDO teacher4 = wxTeacherClazzMapper.getTeacher(cc.getClazzId(), curThur);
|
|
|
+ TeacherDO teacherDO4 = wxTeacherMapper.get(teacher4.getTeacherId());
|
|
|
+ curThurMap.put("teacherName",teacherDO4.getTeacherName());
|
|
|
+ curThurMap.put("teacherPhoto",teacherDO4.getTeacherPhoto());
|
|
|
+ curThurs.add(curThurMap);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ Long curTues = cc.getCurTues();
|
|
|
+ if (ObjectUtils.isNotEmpty(curTues)){
|
|
|
+ Map<String, Object> curTuesMap = new HashMap<>();
|
|
|
+ curTuesMap.put("startTime",dateFormat.format(cc.getCurStartTime()));
|
|
|
+ curTuesMap.put("endTime",dateFormat.format(cc.getCurEndTime()));
|
|
|
+ curTuesMap.put("subjectName",subjectMapper.get(curTues).getSubjectName());
|
|
|
+ TeacherClazzDO teacher5 = wxTeacherClazzMapper.getTeacher(cc.getClazzId(), curTues);
|
|
|
+ TeacherDO teacherDO5 = wxTeacherMapper.get(teacher5.getTeacherId());
|
|
|
+ curTuesMap.put("teacherName",teacherDO5.getTeacherName());
|
|
|
+ curTuesMap.put("teacherPhoto",teacherDO5.getTeacherPhoto());
|
|
|
+ curTuess.add(curTuesMap);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ Long curWed = cc.getCurWed();
|
|
|
+ if (ObjectUtils.isNotEmpty(curWed)){
|
|
|
+ Map<String, Object> curWedMap = new HashMap<>();
|
|
|
+ curWedMap.put("startTime",dateFormat.format(cc.getCurStartTime()));
|
|
|
+ curWedMap.put("endTime",dateFormat.format(cc.getCurEndTime()));
|
|
|
+ curWedMap.put("subjectName",subjectMapper.get(curWed).getSubjectName());
|
|
|
+ TeacherClazzDO teacher6 = wxTeacherClazzMapper.getTeacher(cc.getClazzId(), curWed);
|
|
|
+ TeacherDO teacherDO6 = wxTeacherMapper.get(teacher6.getTeacherId());
|
|
|
+ curWedMap.put("teacherName",teacherDO6.getTeacherName());
|
|
|
+ curWedMap.put("teacherPhoto",teacherDO6.getTeacherPhoto());
|
|
|
+ curWeds.add(curWedMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ map.put("curMons",curMons);
|
|
|
+ map.put("curFris",curFris);
|
|
|
+ map.put("curSats",curSats);
|
|
|
+ map.put("curThurs",curThurs);
|
|
|
+ map.put("curTuess",curTuess);
|
|
|
+ map.put("curWeds",curWeds);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+}
|