Преглед изворни кода

保存课节

tags/正式3.2.0
王宁 пре 2 година
родитељ
комит
21376c6311

+ 10
- 2
slive/src/main/java/com/xhkjedu/slive/controller/xz/XzController.java Прегледај датотеку

@@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5 5
 import com.xhkjedu.slive.model.xz.LXz;
6 6
 import com.xhkjedu.slive.service.xz.XzService;
7
+import com.xhkjedu.slive.vo.xz.XzDateVo;
7 8
 import com.xhkjedu.utils.N_Utils;
8 9
 import com.xhkjedu.utils.PageUtil;
9 10
 import com.xhkjedu.vo.PageResult;
@@ -38,9 +39,9 @@ public class XzController {
38 39
      **/
39 40
     @PostMapping("/list")
40 41
     public ResultVo list(@RequestBody LXz xz){
41
-        N_Utils.validation(new Object[]{xz.getSchoolid(),"学校id",1});
42
+        N_Utils.validation(new Object[]{xz.getSchoolid(),"学校id",1,xz.getGradeid(),"年级",1});
42 43
         PageHelper.startPage(xz.getPage(), xz.getPageSize());
43
-        List<Map> list = xzService.listXzs(xz.getSchoolid(),xz.getXzname());
44
+        List<Map> list = xzService.listXzs(xz);
44 45
         PageResult pageResult = PageUtil.getPageResult(new PageInfo(list));
45 46
         return new ResultVo(0,"获取行政直播列表成功",pageResult);
46 47
     }
@@ -106,4 +107,11 @@ public class XzController {
106 107
         return new ResultVo(0, "删除成功");
107 108
     }
108 109
 
110
+    @PostMapping("/sxzk")
111
+    public ResultVo saveXzCourse(@RequestBody LXz xz){
112
+        N_Utils.validation(new Object[]{xz.getXzid(),"行政直播id",1});
113
+        xzService.saveXzCourse(xz);
114
+        return new ResultVo(0, "成功保存行政直播课程表");
115
+    }
116
+
109 117
 }

+ 6
- 11
slive/src/main/java/com/xhkjedu/slive/controller/xz/XzKjController.java Прегледај датотеку

@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RestController;
11 11
 
12 12
 import javax.annotation.Resource;
13 13
 import java.util.List;
14
+import java.util.Map;
14 15
 
15 16
 /**
16 17
  * @Description 行政直播课节详情
@@ -23,17 +24,11 @@ public class XzKjController {
23 24
     @Resource
24 25
     private XzKjService xzKjService;
25 26
 
26
-    /**
27
-     * @Description 保存直播课课节信息
28
-     * @Param [kj]
29
-     * @Return com.xhkjedu.vo.ResultVo
30
-     * @Author wn
31
-     * @Date 2022/3/30 16:22
32
-     **/
33
-    @PostMapping("/save")
34
-    public ResultVo save(@RequestBody LXzKj kj){
35
-        N_Utils.validation(new Object[]{kj.getXzid(),"行政直播id",1,kj.getCreateid(),"创建人",1});
36
-        return xzKjService.save(kj);
27
+    @PostMapping("/kjs")
28
+    public ResultVo listKjsByXzid(@RequestBody LXzKj kj){
29
+        N_Utils.validation(new Object[]{kj.getXzid(),"行政直播id",1});
30
+        List<Map> map = xzKjService.listXzKjsByXzid(kj.getXzid());
31
+        return new ResultVo(0,"成功获取行政直播课节详情",map);
37 32
     }
38 33
 
39 34
     /**

+ 4
- 1
slive/src/main/java/com/xhkjedu/slive/mapper/xz/XzMapper.java Прегледај датотеку

@@ -17,7 +17,7 @@ import java.util.Map;
17 17
 public interface XzMapper extends TkMapper<LXz> {
18 18
 
19 19
     //行政直播列表
20
-    List<Map> listXzs(@Param("schoolid") Integer schoolid,@Param("xzname") String xzname);
20
+    List<Map> listXzs(@Param("xz") LXz xz);
21 21
 
22 22
     //行政直播下进行中或已结束的课节数量
23 23
     Integer getXzSectionKsNum(@Param("xzid") Integer xzid);
@@ -34,4 +34,7 @@ public interface XzMapper extends TkMapper<LXz> {
34 34
     //修改行政直播删除状态
35 35
     void updateXzDeleted(@Param("deleted") Integer deleted,@Param("xzid") Integer xzid);
36 36
 
37
+    //保存完行政直播后生成的课节基本信息
38
+    List<Map> listXzKjsAfterSaveXz(@Param("xzid") Integer xzid);
39
+
37 40
 }

+ 6
- 0
slive/src/main/java/com/xhkjedu/slive/model/liveplay/LCourse.java Прегледај датотеку

@@ -75,6 +75,12 @@ public class LCourse extends BaseBean {
75 75
     //所属课程分类
76 76
     private Integer ctypeid;
77 77
 
78
+    //课程类别0专题直播1行政直播
79
+    private Integer courseclass;
80
+
81
+    //直播课节详情id
82
+    private Integer kjid;
83
+
78 84
     //创建人id
79 85
     private Integer createid;
80 86
 

+ 7
- 0
slive/src/main/java/com/xhkjedu/slive/model/xz/LXz.java Прегледај датотеку

@@ -1,9 +1,12 @@
1 1
 package com.xhkjedu.slive.model.xz;
2 2
 import com.xhkjedu.slive.model.BaseBean;
3
+import com.xhkjedu.slive.vo.xz.XzDateVo;
3 4
 import lombok.Data;
4 5
 
5 6
 import javax.persistence.Id;
6 7
 import javax.persistence.Table;
8
+import javax.persistence.Transient;
9
+import java.util.List;
7 10
 
8 11
 /**
9 12
  *@Description 行政直播概要表
@@ -46,4 +49,8 @@ public class LXz extends BaseBean {
46 49
 
47 50
     //学校id
48 51
     private Integer schoolid;
52
+
53
+    //行政直播日期集合
54
+    @Transient
55
+    private List<XzDateVo> xzdatas;
49 56
 }

+ 7
- 23
slive/src/main/java/com/xhkjedu/slive/service/xz/XzKjService.java Прегледај датотеку

@@ -11,7 +11,7 @@ import java.util.List;
11 11
 import java.util.Map;
12 12
 
13 13
 /**
14
- * @Description
14
+ * @Description 行政直播课节
15 15
  * @Author WN
16 16
  * Date 2022/3/30 15:26
17 17
  **/
@@ -21,31 +21,14 @@ public class XzKjService {
21 21
     private XzKjMapper xzKjMapper;
22 22
 
23 23
     /**
24
-     * @Description 保存课节信息
25
-     * @Param [xzKj]
24
+     * @Description  获取行政直播课节基本信息
25
+     * @Param [xzid]
26 26
      * @Return com.xhkjedu.vo.ResultVo
27 27
      * @Author wn
28
-     * @Date 2022/3/30 16:19
28
+     * @Date 2022/3/31 14:07
29 29
      **/
30
-    public ResultVo save(LXzKj xzKj) {
31
-        Integer timestamp = N_Utils.getSecondTimestamp();
32
-        List<LXzKj> kjlst = xzKj.getXzkjs();
33
-        if (kjlst == null || kjlst.size() == 0) {
34
-            return new ResultVo(1, "未设置课节信息");
35
-        } else {
36
-            for (int i = 0; i < kjlst.size(); i++) {
37
-                LXzKj kj = kjlst.get(i);
38
-                kj.setXzid(xzKj.getXzid());
39
-                kj.setCreateid(xzKj.getCreateid());
40
-                kj.setCreatetime(timestamp);
41
-                kj.setKjorder(i + 1);
42
-            }
43
-
44
-            xzKjMapper.insertList(kjlst);
45
-            //获取保存课节信息集合
46
-            List<Map> rtnlst = xzKjMapper.listXzKjsByXzid(xzKj.getXzid());
47
-            return new ResultVo(0, "保存成功", rtnlst);
48
-        }
30
+    public List<Map> listXzKjsByXzid(Integer xzid) {
31
+        return xzKjMapper.listXzKjsByXzid(xzid);
49 32
     }
50 33
 
51 34
     /**
@@ -73,4 +56,5 @@ public class XzKjService {
73 56
         xzKjMapper.updateBatchXzKj(xzKjs);
74 57
         return new ResultVo(0,"修改课节信息成功");
75 58
     }
59
+
76 60
 }

+ 241
- 18
slive/src/main/java/com/xhkjedu/slive/service/xz/XzService.java Прегледај датотеку

@@ -1,14 +1,38 @@
1 1
 package com.xhkjedu.slive.service.xz;
2 2
 
3
+import com.xhkjedu.slive.mapper.gradeclass.ClassTeacherMapper;
4
+import com.xhkjedu.slive.mapper.gradeclass.SchoolMapper;
5
+import com.xhkjedu.slive.mapper.liveplay.CourseClassMapper;
6
+import com.xhkjedu.slive.mapper.liveplay.CourseMapper;
7
+import com.xhkjedu.slive.mapper.liveplay.CourseSectionMapper;
8
+import com.xhkjedu.slive.mapper.xz.XzKjMapper;
3 9
 import com.xhkjedu.slive.mapper.xz.XzMapper;
10
+import com.xhkjedu.slive.model.gradeclass.TClass;
11
+import com.xhkjedu.slive.model.gradeclass.TClassTeacher;
12
+import com.xhkjedu.slive.model.liveplay.LCourse;
13
+import com.xhkjedu.slive.model.liveplay.LCourseClass;
14
+import com.xhkjedu.slive.model.liveplay.LCourseSection;
4 15
 import com.xhkjedu.slive.model.xz.LXz;
16
+import com.xhkjedu.slive.model.xz.LXzKj;
17
+import com.xhkjedu.slive.service.gradeclass.ClassService;
18
+import com.xhkjedu.slive.utils.LiveUtil;
19
+import com.xhkjedu.slive.vo.gradeclass.ClassVo;
20
+import com.xhkjedu.slive.vo.xz.XzDateVo;
21
+import com.xhkjedu.slive.vo.xz.XzDateXjTeaVo;
22
+import com.xhkjedu.slive.vo.xz.XzDateXjVo;
5 23
 import com.xhkjedu.utils.N_Utils;
24
+import com.xhkjedu.vo.ResultVo;
25
+import lombok.extern.slf4j.Slf4j;
6 26
 import org.springframework.stereotype.Service;
7 27
 import org.springframework.transaction.annotation.Transactional;
28
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
8 29
 
9 30
 import javax.annotation.Resource;
31
+import java.util.ArrayList;
32
+import java.util.HashMap;
10 33
 import java.util.List;
11 34
 import java.util.Map;
35
+import java.util.stream.Collectors;
12 36
 
13 37
 /**
14 38
  * @Description 行政直播概要
@@ -16,9 +40,24 @@ import java.util.Map;
16 40
  * Date 2022/3/30 13:42
17 41
  **/
18 42
 @Service
43
+@Slf4j
19 44
 public class XzService {
20 45
     @Resource
21 46
     private XzMapper xzMapper;
47
+    @Resource
48
+    private XzKjMapper xzKjMapper;
49
+    @Resource
50
+    private CourseMapper courseMapper;
51
+    @Resource
52
+    private CourseSectionMapper courseSectionMapper;
53
+    @Resource
54
+    private CourseClassMapper courseClassMapper;
55
+    @Resource
56
+    private SchoolMapper schoolMapper;
57
+    @Resource
58
+    private ClassService classService;
59
+    @Resource
60
+    private ClassTeacherMapper classTeacherMapper;
22 61
 
23 62
     /**
24 63
      * @Description 行政直播列表
@@ -27,8 +66,8 @@ public class XzService {
27 66
      * @Author wn
28 67
      * @Date 2022/3/30 14:03
29 68
      **/
30
-    public List<Map> listXzs(Integer schoolid, String xzname) {
31
-        return xzMapper.listXzs(schoolid, xzname);
69
+    public List<Map> listXzs(LXz xz) {
70
+        return xzMapper.listXzs(xz);
32 71
     }
33 72
 
34 73
     /**
@@ -38,11 +77,29 @@ public class XzService {
38 77
      * @Author wn
39 78
      * @Date 2022/3/30 14:07
40 79
      **/
80
+    @Transactional
41 81
     public Integer saveXz(LXz xz) {
42
-        xz.setCreatetime(N_Utils.getSecondTimestamp());
82
+        Integer timestamp = N_Utils.getSecondTimestamp();
83
+        xz.setCreatetime(timestamp);
43 84
         xz.setDeleted(1);
44
-        xzMapper.insertUseGeneratedKeys(xz);
45
-        return xz.getId();
85
+        xzMapper.insertUseGeneratedKeys(xz);//保存行政直播信息
86
+        Integer xzid = xz.getId();
87
+        //保存对应的课节信息
88
+        List<LXzKj> kjlst = new ArrayList<>();
89
+        for (int i = 0; i < xz.getDaynum(); i++) {
90
+            LXzKj kj = new LXzKj();
91
+            kj.setXzid(xzid);
92
+            String kjname = LiveUtil.getChineStrByNum(i);
93
+            kj.setKjname("第" + kjname + "节");
94
+            kj.setKjorder(i+1);
95
+            kj.setCreateid(xz.getCreateid());
96
+            kj.setCreatetime(timestamp);
97
+
98
+            kjlst.add(kj);
99
+        }
100
+        //批量保存行政直播对应的课节
101
+        xzKjMapper.insertList(kjlst);
102
+        return xzid;
46 103
     }
47 104
 
48 105
     /**
@@ -72,20 +129,186 @@ public class XzService {
72 129
      * @Author wn
73 130
      * @Date 2022/3/30 15:24
74 131
      **/
75
-    @Transactional
132
+    @Transactional(rollbackFor = Exception.class)
76 133
     public void deleteXz(Integer xzid) {
77
-        //如果行政直播下所有的课都未开始,则可以直接删除,
78
-        //如果有直播课已经开始则进行逻辑删除,并删除所有未开始上的直播课
79
-        Integer sectionnum = xzMapper.getXzSectionKsNum(xzid);
80
-        if (sectionnum != null && sectionnum > 0) {
81
-            //说明直播下有开始或结束的课节,只能删除未开始的直播和直播班级信息
82
-            xzMapper.deleteCourseClassKjByXzid(xzid);
83
-            //修改行政直播的状态未已删除
84
-            xzMapper.updateXzDeleted(10, xzid);
85
-        } else {
86
-            //说明该行政直播课程可以直接删除
87
-            xzMapper.deleteCourseClassByXzid(xzid);
88
-            xzMapper.deleteXzAndKjByXzid(xzid);
134
+        try {
135
+            //如果行政直播下所有的课都未开始,则可以直接删除,
136
+            //如果有直播课已经开始则进行逻辑删除,并删除所有未开始上的直播课
137
+            Integer sectionnum = xzMapper.getXzSectionKsNum(xzid);
138
+            if (sectionnum != null && sectionnum > 0) {
139
+                //说明直播下有开始或结束的课节,只能删除未开始的直播和直播班级信息
140
+                xzMapper.deleteCourseClassKjByXzid(xzid);
141
+                //修改行政直播的状态未已删除
142
+                xzMapper.updateXzDeleted(10, xzid);
143
+            } else {
144
+                //说明该行政直播课程可以直接删除
145
+                xzMapper.deleteCourseClassByXzid(xzid);
146
+                xzMapper.deleteXzAndKjByXzid(xzid);
147
+            }
148
+        }catch (Exception e){
149
+            log.error("删除行政直播出错:"+e.getMessage());
150
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
89 151
         }
152
+
153
+
90 154
     }
155
+    /**
156
+     * @Description 保存行政直播课程表
157
+     * @Param [xzDatelst]
158
+     * @Return com.xhkjedu.vo.ResultVo
159
+     * @Author wn
160
+     * @Date 2022/3/31 21:46
161
+     **/
162
+    public ResultVo saveXzCourse(LXz xz) {
163
+        //保存行政直播课程表,参数层级为日期--课节--班级和教师
164
+        //根据同一个课节下根据班级和教师确认是否是同一个直播课,保存进course,section(单课节课程)
165
+        LXz x = xzMapper.selectByPrimaryKey(xz.getXzid());
166
+        List<XzDateVo> xzDatelst = xz.getXzdatas();
167
+        for (int i = 0; i < xzDatelst.size(); i++) {
168
+            //日期下的课节情况
169
+            XzDateVo xzDateVo = xzDatelst.get(i);
170
+            String datazhou = LiveUtil.getDateZhou(xzDateVo.getCurrentdate());//要保存日期对应的周
171
+            List<XzDateXjVo> dateKjlst = xzDateVo.getKjs();//指定日期下课节情况
172
+
173
+            for (int j = 0; j < dateKjlst.size(); j++) {
174
+                //单课节情况
175
+                XzDateXjVo dateKjVo = dateKjlst.get(j);
176
+                List<XzDateXjTeaVo> xjTealst = dateKjVo.getKjteas();//单课节下各班级情况
177
+                //处理成教师下班级形式,生成课程
178
+                Map<Integer, List<XzDateXjTeaVo>> map = listChangeTeacherClass(xjTealst);
179
+                LCourse course = new LCourse();
180
+                course.setGradeid(x.getGradeid());
181
+                course.setBegindate(x.getBegindate());
182
+                course.setEnddate(x.getEnddate());
183
+                course.setCoursenum(1);
184
+                course.setCoursetype(1);
185
+                course.setCourseclass(1);
186
+                course.setCoursestate(0);
187
+                course.setDeleted(1);
188
+                course.setCreateid(xz.getCreateid());
189
+                course.setCreatetime(N_Utils.getSecondTimestamp());
190
+                course.setSchoolid(x.getSchoolid());
191
+
192
+                for(Map.Entry<Integer, List<XzDateXjTeaVo>> entry : map.entrySet()){
193
+                    List<XzDateXjTeaVo> xjTeas = entry.getValue();
194
+                    String teachername = xjTeas.get(0).getTeachername();
195
+                    //单个教师课程信息
196
+                    String coursename = datazhou + dateKjVo.getKjname() +xjTeas.get(0).getSubjectname()+ "("+ teachername +")";
197
+
198
+                    course.setCoursename(coursename);
199
+                    course.setSubjectid(xjTeas.get(0).getSubjectid());
200
+                    course.setTeacherid(entry.getKey());
201
+                    course.setBegintime(dateKjVo.getBegintime());
202
+                    course.setEndtime(dateKjVo.getEndtime());
203
+                    course.setKjid(dateKjVo.getKjid());
204
+                    //保存行政直播课程表
205
+                    saveCourseAll(xjTeas,course,xzDateVo.getCurrentdate());
206
+                }
207
+            }
208
+        }
209
+        return new ResultVo(0, "");
210
+    }
211
+
212
+    //指定天某天某节课下的教师班级层级关系
213
+    private Map<Integer, List<XzDateXjTeaVo>> listChangeTeacherClass(List<XzDateXjTeaVo> xjTealst) {
214
+        Map<Integer, List<XzDateXjTeaVo>> map = new HashMap<>();
215
+
216
+        for (int i = 0; i < xjTealst.size(); i++) {
217
+            XzDateXjTeaVo xzDateXjTeaVo = xjTealst.get(i);
218
+            if (map.containsKey(xzDateXjTeaVo.getTeacherid())) {
219
+                map.get(xzDateXjTeaVo.getTeacherid()).add(xzDateXjTeaVo);
220
+            } else {
221
+                List<XzDateXjTeaVo> classlst = new ArrayList<>();
222
+                classlst.add(xzDateXjTeaVo);
223
+                map.put(xzDateXjTeaVo.getTeacherid(), classlst);
224
+            }
225
+        }
226
+        return map;
227
+    }
228
+
229
+    //保存行政直播课程表
230
+    @Transactional(rollbackFor = Exception.class)
231
+    public void saveCourseAll(List<XzDateXjTeaVo> xjTeas,LCourse course,String currentdate){
232
+        try {
233
+            //获取集合中所有的班级id
234
+            List classidlst = xjTeas.stream().map(XzDateXjTeaVo::getClassid).collect(Collectors.toList());
235
+            List<Map> users = courseMapper.listUid(classidlst);//获取课班级下学生
236
+
237
+            //新生成直播班班级信息
238
+            TClass c = new TClass();
239
+            c.setClassname(course.getCoursename() + "班");
240
+            c.setCreateid(course.getCreateid());
241
+            c.setSchoolid(course.getSchoolid());
242
+            Integer year = schoolMapper.getYearById(course.getSchoolid());
243
+            c.setSchoolyear(year);
244
+            c.setYear(year);
245
+            c.setClassorder(999);
246
+            c.setGradeid(course.getGradeid());
247
+            c.setClasstype(99);//已直播班级
248
+
249
+            Integer classid = classService.save(c);//新生成直播班id
250
+            course.setClassid(classid);
251
+
252
+            //设置班级对应教师
253
+            //班级教师
254
+            TClassTeacher teacher = new TClassTeacher();
255
+            teacher.setClassid(classid);
256
+            teacher.setTeacherid(course.getTeacherid());
257
+            teacher.setCreateid(course.getCreateid());
258
+            teacher.setCreatetime(N_Utils.getSecondTimestamp());
259
+            teacher.setSchoolid(course.getSchoolid());
260
+            classTeacherMapper.insertSelective(teacher);
261
+
262
+            //保存课程信息
263
+            courseMapper.insertUseGeneratedKeys(course);
264
+            Integer courseid = course.getId();//课程id
265
+
266
+            List<Integer> studentids = new ArrayList<>();
267
+            users.forEach(userVo -> {
268
+                studentids.add((Integer) userVo.get("userid"));
269
+            });
270
+
271
+            classService.batchSaveStu(course.getCreateid(), course.getSchoolid(), classid, studentids);//批量添加报名学生
272
+            courseMapper.updateStuNum(courseid);//更新已报学生数量
273
+
274
+            //保存直播关联班级
275
+            List<LCourseClass> cclist = new ArrayList<>();
276
+            for(int i=0;i<classidlst.size();i++){
277
+                Integer cid = Integer.parseInt(classidlst.get(i).toString());
278
+                LCourseClass cc = new LCourseClass();
279
+                cc.setCourseid(courseid);
280
+                cc.setClassid(cid);
281
+                cc.setCreateid(course.getCreateid());
282
+                cc.setCreatetime(course.getCreatetime());
283
+                cclist.add(cc);
284
+                //通知班级
285
+                ClassVo classVo = new ClassVo();
286
+                classVo.setClassid(cid);
287
+            }
288
+            courseClassMapper.insertList(cclist);//保存原班级和直播的关联关系
289
+
290
+            //获取班级人数
291
+            ClassVo classVo = classService.getById(classid);
292
+
293
+            //保存课程课节关联关系
294
+            LCourseSection cs = new LCourseSection();
295
+            cs.setCourseid(courseid);
296
+            cs.setTeacherid(course.getTeacherid());
297
+            cs.setSectionname(course.getCoursename());
298
+            cs.setSectionorder(1);
299
+            cs.setSectiondate(currentdate);
300
+            cs.setPlanbegintime(course.getBegintime());
301
+            cs.setPlanendtime(course.getEndtime());
302
+            cs.setStunum(classVo.getClassnum());
303
+            cs.setSectionstate(0);
304
+            cs.setCreateid(course.getCreateid());
305
+            cs.setCreatetime(course.getCreatetime());
306
+            courseSectionMapper.insertUseGeneratedKeys(cs);//保存课程课节信息
307
+
308
+        }catch (Exception e){
309
+            log.info("保存行政直播课程表出错:"+e.getMessage());
310
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
311
+        }
312
+    }
313
+
91 314
 }

+ 61
- 0
slive/src/main/java/com/xhkjedu/slive/utils/LiveUtil.java Прегледај датотеку

@@ -0,0 +1,61 @@
1
+package com.xhkjedu.slive.utils;
2
+
3
+import com.ctc.wstx.util.StringUtil;
4
+import lombok.extern.slf4j.Slf4j;
5
+
6
+import java.time.LocalDate;
7
+import java.time.format.DateTimeFormatter;
8
+import java.util.HashMap;
9
+import java.util.Map;
10
+
11
+/**
12
+ * @Description
13
+ * @Author WN
14
+ * Date 2022/3/31 10:53
15
+ **/
16
+@Slf4j
17
+public class LiveUtil {
18
+
19
+    /**
20
+     * @Description  获取指定日期星期
21
+     * @Param [datestr]
22
+     * @Return java.lang.String
23
+     * @Author wn
24
+     * @Date 2022/3/31 11:06
25
+     **/
26
+    public static String getDateZhou(String datestr){
27
+        LocalDate localDate=LocalDate.parse(datestr, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
28
+        String k = String.valueOf(localDate.getDayOfWeek());
29
+        Map<String,String> map = saveZhou();
30
+        String zhoustr = map.get(k);
31
+        return "星期"+zhoustr;
32
+    }
33
+
34
+    //存放周
35
+    private static Map<String,String> saveZhou(){
36
+        Map<String,String> map = new HashMap<>();
37
+        map.put("MONDAY", "一");
38
+        map.put("TUESDAY", "二");
39
+        map.put("WEDNESDAY", "三");
40
+        map.put("THURSDAY", "四");
41
+        map.put("FRIDAY", "五");
42
+        map.put("SATURDAY", "六");
43
+        map.put("SUNDAY", "日");
44
+        return map;
45
+    }
46
+
47
+    /**
48
+     * @Description 获取索引对应的数字
49
+     * @Param [indexnum]
50
+     * @Return java.lang.String
51
+     * @Author wn
52
+     * @Date 2022/3/31 12:45
53
+     **/
54
+    public static String getChineStrByNum(int indexnum){
55
+        String[] strnum = {"一","二","三","四","五","六","七","八","九","十","十一",
56
+                "十二","十三","十四","十五","十六","十七","十八","十九","二十"};
57
+
58
+        return strnum[indexnum];
59
+    }
60
+
61
+}

+ 19
- 0
slive/src/main/java/com/xhkjedu/slive/vo/xz/XzDateVo.java Прегледај датотеку

@@ -0,0 +1,19 @@
1
+package com.xhkjedu.slive.vo.xz;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.ArrayList;
6
+import java.util.List;
7
+
8
+/**
9
+ * @Description 行政直播日期
10
+ * @Author WN
11
+ * Date 2022/3/31 10:02
12
+ **/
13
+@Data
14
+public class XzDateVo {
15
+    private String currentdate;//当前保存时间
16
+    private List<XzDateXjVo> kjs;//行政直播课节集合
17
+
18
+
19
+}

+ 24
- 0
slive/src/main/java/com/xhkjedu/slive/vo/xz/XzDateXjTeaVo.java Прегледај датотеку

@@ -0,0 +1,24 @@
1
+package com.xhkjedu.slive.vo.xz;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.List;
6
+
7
+/**
8
+ * @Description 行政直播课课节下班级和教师
9
+ * @Author WN
10
+ * Date 2022/3/31 10:04
11
+ **/
12
+@Data
13
+public class XzDateXjTeaVo {
14
+
15
+    private Integer classid;//班级id
16
+    private String classname;//班级名称
17
+    private Integer teacherid;//教师id
18
+    private String teachername;//教师姓名
19
+    private Integer courseid;//课程id
20
+    private String subjectid;//科目id
21
+    private String subjectname;//科目名称
22
+
23
+    private List<XzDateXjTeaVo> xjclass;//存放层级用于保存时使用
24
+}

+ 21
- 0
slive/src/main/java/com/xhkjedu/slive/vo/xz/XzDateXjVo.java Прегледај датотеку

@@ -0,0 +1,21 @@
1
+package com.xhkjedu.slive.vo.xz;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.List;
6
+
7
+/**
8
+ * @Description 行政直播课节
9
+ * @Author WN
10
+ * Date 2022/3/31 10:04
11
+ **/
12
+@Data
13
+public class XzDateXjVo {
14
+    private Integer kjid;//行政课节id
15
+    private String kjname;//课节名称
16
+    private Integer kjorder;//课节排序
17
+    private String begintime;//开始时间
18
+    private String endtime;//结束时间
19
+    private List<XzDateXjTeaVo> kjteas;//指定日期下课节下所有的直播课
20
+
21
+}

+ 4
- 1
slive/src/main/resources/application.properties Прегледај датотеку

@@ -3,7 +3,10 @@ server.port=8085
3 3
 
4 4
 spring.application.name=slive
5 5
 #注册到我们本地的eureka注册中心,端口8081
6
-eureka.client.service-url.defaultZone=http://127.0.0.1:8081/eureka/
6
+#eureka.client.service-url.defaultZone=http://127.0.0.1:8081/eureka/
7
+eureka.client.register-with-eureka=false
8
+eureka.client.fetch-registry=false
9
+
7 10
 #设置eureka输出日志级别
8 11
 logging.level.com.netflix=error
9 12
 

+ 1
- 1
slive/src/main/resources/mapper/xz/XzKjMapper.xml Прегледај датотеку

@@ -4,7 +4,7 @@
4 4
 
5 5
     <!--获取行政直播课节详情-->
6 6
     <select id="listXzKjsByXzid" resultType="java.util.Map">
7
-        select * from l_xz_kj where xzid=1 order by kjorder asc
7
+        select * from l_xz_kj where xzid=#{xzid} order by kjorder asc
8 8
     </select>
9 9
 
10 10
     <!--批量修改行政直播课节详情-->

+ 35
- 23
slive/src/main/resources/mapper/xz/XzMapper.xml Прегледај датотеку

@@ -5,28 +5,24 @@
5 5
     <!--行政直播列表-->
6 6
     <select id="listXzs" resultType="java.util.Map">
7 7
         select x.xzid,x.xzname,x.xzcomm,x.gradeid,x.daynum,x.begindate,x.enddate,x.createid,
8
-        x.createtime, u.username from l_xz x left join t_user u on x.createid=u.userid
9
-        where x.schoolid=#{schoolid} and x.deleted=1
10
-        <if test="xzname!='' and xzname!=null">
11
-            and x.xzname like '%${xzname}%'
8
+        x.createtime, u.username,u.headpic from l_xz x left join t_user u on x.createid=u.userid
9
+        where x.schoolid=#{xz.schoolid} and x.gradeid=#{xz.gradeid} and x.deleted=1
10
+        <if test="xz.xzname!='' and xz.xzname!=null">
11
+            and x.xzname like '%${xz.xzname}%'
12 12
         </if>
13 13
         order by x.begindate desc
14 14
     </select>
15 15
 
16 16
     <!--行政直播课对应的课节进行中或已结束数量-->
17 17
     <select id="getXzSectionKsNum" resultType="java.lang.Integer">
18
-        select count(*)
19
-        from l_course_section s
20
-                 left join l_course c on c.courseid = s.courseid
21
-                 left join l_xz_kj k on c.kjid = k.kjid
22
-        where k.xzid = #{xzid}
23
-          and s.sectionstate BETWEEN 2 and 3
18
+        select count(*) from l_course_section s left join l_course c on c.courseid = s.courseid
19
+        left join l_xz_kj k on c.kjid = k.kjid
20
+        where k.xzid = #{xzid} and s.sectionstate BETWEEN 2 and 3
24 21
     </select>
25 22
 
26 23
     <!--删除行政直播下所有的直播课程和直播班级-->
27 24
     <delete id="deleteCourseClassByXzid" parameterType="java.lang.Integer">
28
-        delete
29
-        c,lc from t_class as c left join l_course as lc on c.classid=lc.classid
25
+        delete c,lc from t_class as c left join l_course as lc on c.classid=lc.classid
30 26
         left join l_xz_kj k on k.kjid=lc.kjid where k.xzid=
31 27
         #{xzid}
32 28
     </delete>
@@ -41,20 +37,36 @@
41 37
         delete
42 38
         c,lc,k from t_class as c left join l_course as lc on c.classid=lc.classid
43 39
         left join l_course_section ls on ls.courseid=lc.courseid
44
-        left join l_xz_kj k on k.kjid=lc.kjid where k.xzid=
45
-        #{xzid}
46
-        and
47
-        ls
48
-        .
49
-        sectionstate
50
-        =
51
-        0
40
+        left join l_xz_kj k on k.kjid=lc.kjid where k.xzid=#{xzid}
41
+        and ls.sectionstate = 0
52 42
     </delete>
53 43
     <!--修改行政直播删除状态-->
54 44
     <update id="updateXzDeleted">
55
-        update l_xz
56
-        set deleted=#{deleted}
57
-        where xzid = #{xzid}
45
+        update l_xz set deleted=#{deleted} where xzid = #{xzid}
58 46
     </update>
59 47
 
48
+    <resultMap id="listXzKjsAfterSave" type="java.util.Map">
49
+        <result property="xzid" column="xzid"></result>
50
+        <result property="xzname" column="xzname"></result>
51
+        <result property="xzcomm" column="xzcomm"></result>
52
+        <result property="gradeid" column="gradeid"></result>
53
+        <result property="daynum" column="gradeid"></result>
54
+        <result property="begindate" column="begindate"></result>
55
+        <result property="enddate" column="enddate"></result>
56
+        <collection property="kjlist" ofType="java.util.Map" javaType="java.util.List">
57
+            <result property="kjid" column="kjid"></result>
58
+            <result property="kjname" column="kjname"></result>
59
+            <result property="kjorder" column="kjorder"></result>
60
+            <result property="begintime" column="begintime"></result>
61
+            <result property="endtime" column="endtime"></result>
62
+        </collection>
63
+    </resultMap>
64
+    <!--保存完行政直播后生成的课节基本信息-->
65
+    <select id="listXzKjsAfterSaveXz" resultMap="listXzKjsAfterSave">
66
+        select x.xzid,x.xzname,x.xzcomm,x.gradeid,x.daynum,x.begindate,x.enddate,
67
+        k.kjid,k.kjname,k.kjorder,k.begintime,k.endtime from l_xz x
68
+        left join l_xz_kj k on x.xzid=k.xzid where x.xzid=#{xzid} order by k.kjorder
69
+
70
+    </select>
71
+
60 72
 </mapper>

+ 2
- 0
suser/src/main/java/com/xhkjedu/suser/vo/gradeclass/ClassTeacherParams.java Прегледај датотеку

@@ -18,4 +18,6 @@ public class ClassTeacherParams {
18 18
     private Integer gradeid;//年级id
19 19
 
20 20
     private Integer year;//当前年费
21
+
22
+    private String username;//用户姓名
21 23
 }

+ 3
- 0
suser/src/main/resources/mapper/gradeclass/ClassTeacherMapper.xml Прегледај датотеку

@@ -172,6 +172,9 @@
172 172
     LEFT JOIN t_subject_book sb on tp.lsbid=sb.lsbid
173 173
     where c.schoolid=#{ctp.schoolid} and c.gradeid=#{ctp.gradeid} and c.year=#{ctp.year} and c.classstate=1
174 174
     and sb.subjectid=#{ctp.subjectid} and u.usertype=1 and u.userstate=1
175
+    <if test="ctp.username!=null and ctp.username!=''">
176
+        and u.username like '%${ctp.username}%'
177
+    </if>
175 178
     group by ct.teacherid
176 179
     </select>
177 180
 

Loading…
Откажи
Сачувај