Browse Source

保存课程单个课节信息,修改课节时修改对应课程时间

tags/正式3.2.0
王宁 2 years ago
parent
commit
f8a8bcdd42

+ 7
- 7
slive/src/main/java/com/xhkjedu/slive/controller/xz/XzController.java View File

137
 
137
 
138
 
138
 
139
     /**
139
     /**
140
-     * @Description  保存行政直播课程表
140
+     * @Description  保存行政直播课程表(整个)
141
      * @Param [xz]
141
      * @Param [xz]
142
      * @Return com.xhkjedu.vo.ResultVo
142
      * @Return com.xhkjedu.vo.ResultVo
143
      * @Author wn
143
      * @Author wn
163
     }
163
     }
164
 
164
 
165
     /**
165
     /**
166
-     * @Description 修改课程表单个单元格数据
166
+     * @Description 保存课程表单个单元格数据(单元格)
167
      * @Param [kjTeaVo]
167
      * @Param [kjTeaVo]
168
      * @Return com.xhkjedu.vo.ResultVo
168
      * @Return com.xhkjedu.vo.ResultVo
169
      * @Author wn
169
      * @Author wn
170
      * @Date 2022/4/2 17:11
170
      * @Date 2022/4/2 17:11
171
      **/
171
      **/
172
-    @PostMapping("/kcbup")
173
-    public ResultVo updateXzkjDyg(@RequestBody XzDateKjTeaVo kjTeaVo){
174
-        N_Utils.validation(new Object[]{kjTeaVo.getCourseid(),"课程id",1,kjTeaVo.getClassid(),"班级id",1,kjTeaVo.getCreateid(),"操作人id",1});
175
-        xzService.updateXzKjDyg(kjTeaVo);
176
-        return new ResultVo(0, "成功修改单个课程信息");
172
+    @PostMapping("/kcbsone")
173
+    public ResultVo saveOneXzkjDyg(@RequestBody XzDateKjTeaVo kjTeaVo){
174
+        N_Utils.validation(new Object[]{kjTeaVo.getKjid(),"课节id",1,kjTeaVo.getClassid(),"班级id",1,kjTeaVo.getCreateid(),"操作人id",1,
175
+        kjTeaVo.getTeacherid(),"教师id",1,kjTeaVo.getSeldate(),"时间",2});
176
+        return xzService.saveOneXzKjDyg(kjTeaVo);
177
     }
177
     }
178
 
178
 
179
 }
179
 }

+ 5
- 3
slive/src/main/java/com/xhkjedu/slive/mapper/liveplay/CourseMapper.java View File

2
 
2
 
3
 import com.xhkjedu.slive.base.TkMapper;
3
 import com.xhkjedu.slive.base.TkMapper;
4
 import com.xhkjedu.slive.model.liveplay.LCourse;
4
 import com.xhkjedu.slive.model.liveplay.LCourse;
5
+import com.xhkjedu.slive.model.xz.LXzKj;
5
 import com.xhkjedu.slive.vo.liveplay.CTypeVo;
6
 import com.xhkjedu.slive.vo.liveplay.CTypeVo;
6
 import com.xhkjedu.slive.vo.liveplay.CourseParams;
7
 import com.xhkjedu.slive.vo.liveplay.CourseParams;
7
 import com.xhkjedu.slive.vo.liveplay.CourseSectionVo;
8
 import com.xhkjedu.slive.vo.liveplay.CourseSectionVo;
8
 import com.xhkjedu.slive.vo.liveplay.CourseStudentVo;
9
 import com.xhkjedu.slive.vo.liveplay.CourseStudentVo;
9
 import com.xhkjedu.slive.vo.liveplay.CourseVo;
10
 import com.xhkjedu.slive.vo.liveplay.CourseVo;
10
 import com.xhkjedu.slive.vo.liveplay.SectionDateVo;
11
 import com.xhkjedu.slive.vo.liveplay.SectionDateVo;
12
+import com.xhkjedu.slive.vo.xz.XzDateKjTeaVo;
11
 import org.apache.ibatis.annotations.Param;
13
 import org.apache.ibatis.annotations.Param;
12
 
14
 
13
 import java.util.List;
15
 import java.util.List;
107
     //获取指定课节班级日期下的课程信息
109
     //获取指定课节班级日期下的课程信息
108
     CourseVo getCourseByKjidAndClassid(@Param("kjid") Integer kjid,@Param("classid") Integer classid,@Param("seldate") String seldate);
110
     CourseVo getCourseByKjidAndClassid(@Param("kjid") Integer kjid,@Param("classid") Integer classid,@Param("seldate") String seldate);
109
     //获取指定指定日期教师课节下教师的直播课
111
     //获取指定指定日期教师课节下教师的直播课
110
-    CourseVo getCourseByDateKjTeacher(@Param("kjid") Integer kjid,@Param("teacherid") Integer teacherid,@Param("seldate") String seldate);
111
-    //更改课程相关任课教师
112
-    void updateCourseSectionClassTeacher(@Param("courseid") Integer courseid,@Param("teacherid") Integer teacherid,@Param("subjectid") String subjectid);
112
+    CourseVo getCourseByDateKjTeacher(@Param("kjTeaVo") XzDateKjTeaVo kjTeaVo);
113
+    //修改未开课课程课节时间-
114
+    void updateCourseSectionTime(@Param("kj") LXzKj kj);
113
 }
115
 }

+ 3
- 0
slive/src/main/java/com/xhkjedu/slive/mapper/xz/XzKjMapper.java View File

20
     //获取行政直播课节详情
20
     //获取行政直播课节详情
21
     List<XzDateKjVo> listXzKjsByXzid(@Param("xzid") Integer xzid);
21
     List<XzDateKjVo> listXzKjsByXzid(@Param("xzid") Integer xzid);
22
 
22
 
23
+    //修改行政直播课节详情
24
+    void updateXzkj(@Param("kj") LXzKj kj);
25
+
23
     //批量修改行政直播课节详情
26
     //批量修改行政直播课节详情
24
     void updateBatchXzKj(@Param("list") List<LXzKj> list);
27
     void updateBatchXzKj(@Param("list") List<LXzKj> list);
25
 }
28
 }

+ 3
- 2
slive/src/main/java/com/xhkjedu/slive/mapper/xz/XzMapper.java View File

2
 
2
 
3
 import com.xhkjedu.slive.base.TkMapper;
3
 import com.xhkjedu.slive.base.TkMapper;
4
 import com.xhkjedu.slive.model.xz.LXz;
4
 import com.xhkjedu.slive.model.xz.LXz;
5
-import com.xhkjedu.slive.vo.xz.XzDateKjVo;
6
-import com.xhkjedu.slive.vo.xz.XzDateVo;
7
 import org.apache.ibatis.annotations.Param;
5
 import org.apache.ibatis.annotations.Param;
8
 import org.springframework.stereotype.Repository;
6
 import org.springframework.stereotype.Repository;
9
 
7
 
47
 
45
 
48
     //获取指定课节班级对应的课程的日期
46
     //获取指定课节班级对应的课程的日期
49
     List<String> getAllDatesForKj(@Param("kjid") Integer kjid,@Param("classid") Integer classid,@Param("seldate") String seldate);
47
     List<String> getAllDatesForKj(@Param("kjid") Integer kjid,@Param("classid") Integer classid,@Param("seldate") String seldate);
48
+
49
+    //根据课节id获取行政直播详情
50
+    LXz getXzByXzkjid(@Param("kjid") Integer kjid);
50
 }
51
 }

+ 31
- 13
slive/src/main/java/com/xhkjedu/slive/service/xz/XzKjService.java View File

1
 package com.xhkjedu.slive.service.xz;
1
 package com.xhkjedu.slive.service.xz;
2
 
2
 
3
+import com.xhkjedu.slive.mapper.liveplay.CourseMapper;
3
 import com.xhkjedu.slive.mapper.xz.XzKjMapper;
4
 import com.xhkjedu.slive.mapper.xz.XzKjMapper;
4
 import com.xhkjedu.slive.model.xz.LXzKj;
5
 import com.xhkjedu.slive.model.xz.LXzKj;
5
 import com.xhkjedu.slive.vo.xz.XzDateKjVo;
6
 import com.xhkjedu.slive.vo.xz.XzDateKjVo;
6
 import com.xhkjedu.utils.N_Utils;
7
 import com.xhkjedu.utils.N_Utils;
7
 import com.xhkjedu.vo.ResultVo;
8
 import com.xhkjedu.vo.ResultVo;
9
+import lombok.extern.slf4j.Slf4j;
8
 import org.springframework.stereotype.Service;
10
 import org.springframework.stereotype.Service;
11
+import org.springframework.transaction.annotation.Transactional;
12
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
9
 
13
 
10
 import javax.annotation.Resource;
14
 import javax.annotation.Resource;
11
 import java.util.List;
15
 import java.util.List;
16
  * Date 2022/3/30 15:26
20
  * Date 2022/3/30 15:26
17
  **/
21
  **/
18
 @Service
22
 @Service
23
+@Slf4j
19
 public class XzKjService {
24
 public class XzKjService {
20
     @Resource
25
     @Resource
21
     private XzKjMapper xzKjMapper;
26
     private XzKjMapper xzKjMapper;
27
+    @Resource
28
+    private CourseMapper courseMapper;
22
 
29
 
23
     /**
30
     /**
24
      * @Description  获取行政直播课节基本信息
31
      * @Description  获取行政直播课节基本信息
37
      * @Author wn
44
      * @Author wn
38
      * @Date 2022/3/30 21:51
45
      * @Date 2022/3/30 21:51
39
      **/
46
      **/
47
+    @Transactional(rollbackFor = Exception.class)
40
     public ResultVo updateBatch(List<LXzKj> xzKjs) {
48
     public ResultVo updateBatch(List<LXzKj> xzKjs) {
41
-        for (int i = 0; i < xzKjs.size(); i++) {
42
-            boolean rtn = false;
43
-            LXzKj kj = xzKjs.get(i);
44
-            if (kj.getKjid() == null || kj.getKjid() == 0) {
45
-                rtn = true;
46
-            }
47
-            if (N_Utils.isEmpty(kj.getKjname()) || N_Utils.isEmpty(kj.getBegintime()) || N_Utils.isEmpty(kj.getEndtime())) {
48
-                rtn = true;
49
-            }
50
-            if(rtn){
51
-                return new ResultVo(1,"课节信息不完善");
49
+        try {
50
+            for (int i = 0; i < xzKjs.size(); i++) {
51
+                boolean rtn = false;
52
+                LXzKj kj = xzKjs.get(i);
53
+                if (kj.getKjid() == null || kj.getKjid() == 0) {
54
+                    rtn = true;
55
+                }
56
+                if (N_Utils.isEmpty(kj.getKjname()) || N_Utils.isEmpty(kj.getBegintime()) || N_Utils.isEmpty(kj.getEndtime())) {
57
+                    rtn = true;
58
+                }
59
+                if(rtn){
60
+                    return new ResultVo(1,"课节信息不完善");
61
+                }
62
+                //修改课节信息
63
+                xzKjMapper.updateXzkj(kj);
64
+                //修改所有未开始课程关联课节的时间
65
+                courseMapper.updateCourseSectionTime(kj);
52
             }
66
             }
67
+            return new ResultVo(0,"修改课节信息成功");
68
+        }catch (Exception e){
69
+            log.error("修改课节信息出错:"+e.getMessage());
70
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
71
+            return new ResultVo(1,"修改课节信息失败");
72
+
53
         }
73
         }
54
 
74
 
55
-        xzKjMapper.updateBatchXzKj(xzKjs);
56
-        return new ResultVo(0,"修改课节信息成功");
57
     }
75
     }
58
 
76
 
59
 }
77
 }

+ 65
- 57
slive/src/main/java/com/xhkjedu/slive/service/xz/XzService.java View File

33
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
33
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
34
 
34
 
35
 import javax.annotation.Resource;
35
 import javax.annotation.Resource;
36
+import javax.annotation.security.DenyAll;
36
 import java.util.ArrayList;
37
 import java.util.ArrayList;
37
 import java.util.HashMap;
38
 import java.util.HashMap;
38
 import java.util.List;
39
 import java.util.List;
321
                 cc.setCreateid(course.getCreateid());
322
                 cc.setCreateid(course.getCreateid());
322
                 cc.setCreatetime(course.getCreatetime());
323
                 cc.setCreatetime(course.getCreatetime());
323
                 cclist.add(cc);
324
                 cclist.add(cc);
324
-                //通知班级
325
-                ClassVo classVo = new ClassVo();
326
-                classVo.setClassid(cid);
327
             }
325
             }
328
             courseClassMapper.insertList(cclist);//保存原班级和直播的关联关系
326
             courseClassMapper.insertList(cclist);//保存原班级和直播的关联关系
329
 
327
 
341
             cs.setCreateid(course.getCreateid());
339
             cs.setCreateid(course.getCreateid());
342
             cs.setCreatetime(course.getCreatetime());
340
             cs.setCreatetime(course.getCreatetime());
343
             courseSectionMapper.insertUseGeneratedKeys(cs);//保存课程课节信息
341
             courseSectionMapper.insertUseGeneratedKeys(cs);//保存课程课节信息
344
-
345
         } catch (Exception e) {
342
         } catch (Exception e) {
346
             log.info("保存行政直播课程表出错:" + e.getMessage());
343
             log.info("保存行政直播课程表出错:" + e.getMessage());
347
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
344
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
457
     }
454
     }
458
 
455
 
459
     /**
456
     /**
460
-     * @Description 修改单个单元格
457
+     * @Description 保存单个单元格(单元格)
461
      * @Param [kjTeaVo]
458
      * @Param [kjTeaVo]
462
      * @Return com.xhkjedu.vo.ResultVo
459
      * @Return com.xhkjedu.vo.ResultVo
463
      * @Author wn
460
      * @Author wn
464
      * @Date 2022/4/2 15:19
461
      * @Date 2022/4/2 15:19
465
      **/
462
      **/
466
-    public ResultVo updateXzKjDyg(XzDateKjTeaVo kjTeaVo) {
463
+    public ResultVo saveOneXzKjDyg(XzDateKjTeaVo kjTeaVo) {
467
         try {
464
         try {
468
-            //判断课程的状态,如果已经开始上课则不能修改
469
-            LCourse course = courseMapper.selectByPrimaryKey(kjTeaVo.getCourseid());
470
-            Integer kjid = course.getKjid();
471
-            Integer classid = kjTeaVo.getClassid();//行政班id
472
-            if (course.getCoursestate() > 0) {
473
-                throw new Exception("选择的课程已经开始上课,不允许修改");
465
+            LXz xz = xzMapper.getXzByXzkjid(kjTeaVo.getKjid());
466
+            kjTeaVo.setGradeid(xz.getGradeid());
467
+            kjTeaVo.setSchoolid(xz.getSchoolid());
468
+
469
+            //先判断是保存当前课程还是后续日期的课
470
+            if (N_Utils.isEmptyInteger(kjTeaVo.getKfollow())) {
471
+                //kfollow为0或者空,则只需要保存当前选中的课程
472
+                ((XzService)applicationContext.getBean("xzService")).saveOneXzkjDygForDetail(kjTeaVo);
474
             } else {
473
             } else {
475
-                //先判断是修改当前课程还是后续日期的课
476
-                if (N_Utils.isEmptyInteger(kjTeaVo.getKfollow())) {
477
-                    //kfollow为0或者空,则只需要修改当前选中的课程
478
-                    ((XzService)applicationContext.getBean("xzService")).updateXzkjDygForDetail(kjTeaVo, course);
479
-                } else {
480
-                    //需要修改后续和当前日期相同的星期相同课节的课程
481
-                    //获取已生成课程的最后日期
482
-                    List<String> alldates = xzMapper.getAllDatesForKj(kjid, classid, course.getBegindate());
483
-                    if (alldates != null && alldates.size() > 0) {
484
-                        //已经成课程中符合周的需要修改的日期
485
-                        List<String> deldates = LiveUtil.getMeetDayOfDates(alldates, course.getBegindate());
486
-                        if (deldates != null && deldates.size() > 0) {
487
-                            for (int i = 0; i < deldates.size(); i++) {
488
-                                //先获取指定日期对应的课程
489
-                                course.setBegintime(deldates.get(i));
490
-                                ((XzService)applicationContext.getBean("xzService")).updateXzkjDygForDetail(kjTeaVo, course);
491
-                            }
474
+                //需要保存后续和当前日期相同的星期相同课节的课程,判断后续日期是否有课程,如果有则提示先删除后再添加
475
+                //获取已生成课程的往后日期
476
+                List<String> alldates = xzMapper.getAllDatesForKj(kjTeaVo.getKjid(), kjTeaVo.getClassid(), kjTeaVo.getSeldate());
477
+                if(alldates != null && alldates.size() > 0){
478
+                    //去匹配是否包含在当前选中日期后续周对应的日期
479
+                    List<String> afterlst = LiveUtil.getMeetDayOfDates(alldates,kjTeaVo.getSeldate());
480
+                    if(afterlst != null && afterlst.size() > 0){
481
+                        return new ResultVo(1,"同日期同班级同课节有数据,不能保存");
482
+                    }else{
483
+
484
+                        //获取seldate至结束日期时端内符合条件的日期
485
+                        List<String> savedates = LiveUtil.getDaysForMeetDates(kjTeaVo.getSeldate(),xz.getEnddate());
486
+                        for (int i = 0; i < savedates.size(); i++) {
487
+                            kjTeaVo.setSeldate(savedates.get(i));
488
+//                            ((XzService)applicationContext.getBean("xzService")).saveOneXzkjDygForDetail(kjTeaVo);
492
                         }
489
                         }
493
                     }
490
                     }
494
                 }
491
                 }
495
-                return new ResultVo(0, "成功修改课程表单个课程");
496
             }
492
             }
493
+            return new ResultVo(0, "成功保存课程表单个课程");
497
         } catch (Exception e) {
494
         } catch (Exception e) {
498
-            log.error("修改课程表单个课程出错:" + e.getMessage());
499
-            return new ResultVo(1, "修改课程表单个课程失败");
495
+            log.error("保存课程表单个课程出错:" + e.getMessage());
496
+            return new ResultVo(1, "保存课程表单个课程失败");
500
         }
497
         }
501
     }
498
     }
502
 
499
 
503
-    //修改单个课程
500
+    //保存单个课程
504
     @Transactional(rollbackFor = Exception.class)
501
     @Transactional(rollbackFor = Exception.class)
505
-    public void updateXzkjDygForDetail(XzDateKjTeaVo kjTeaVo, LCourse course) {
502
+    public void saveOneXzkjDygForDetail(XzDateKjTeaVo kjTeaVo) {
506
         try {
503
         try {
507
             //先看新选择的教师情况,先判断选中的同一日期课节教师是否还有其他直播课
504
             //先看新选择的教师情况,先判断选中的同一日期课节教师是否还有其他直播课
508
-            CourseVo courseVo = courseMapper.getCourseByDateKjTeacher(course.getKjid(), kjTeaVo.getTeacherid(),
509
-                                                                      course.getBegindate());
505
+            CourseVo courseVo = courseMapper.getCourseByDateKjTeacher(kjTeaVo);
510
             if (courseVo == null) {
506
             if (courseVo == null) {
511
-                //说明该老师之前没有直播课,则直接修改课程任课教师,直播班关联教师以及科目
512
-                courseMapper.updateCourseSectionClassTeacher(course.getCourseid(), kjTeaVo.getTeacherid(),
513
-                                                             kjTeaVo.getSubjectid());
507
+                //说明该老师之前没有直播课,则直接保存为新的课程
508
+                LCourse course = new LCourse();
509
+                course.setGradeid(kjTeaVo.getGradeid());
510
+                course.setBegindate(kjTeaVo.getSeldate());
511
+                course.setEnddate(kjTeaVo.getSeldate());
512
+                course.setCoursenum(1);
513
+                course.setCoursetype(1);
514
+                course.setCourseclass(1);
515
+                course.setCoursestate(0);
516
+                course.setDeleted(1);
517
+                course.setCourseselected(0);
518
+                course.setCreateid(kjTeaVo.getCreateid());
519
+                course.setCreatetime(N_Utils.getSecondTimestamp());
520
+                course.setSchoolid(kjTeaVo.getSchoolid());
521
+
522
+                String datezhou = LiveUtil.getDateZhou(kjTeaVo.getSeldate());
523
+                LXzKj kj = xzKjMapper.selectByPrimaryKey(kjTeaVo.getKjid());//课节详情
524
+
525
+                //单个教师课程信息
526
+                String coursename = datezhou + kj.getKjname() + kjTeaVo.getSubjectname() + "(" + kjTeaVo.getTeachername() + ")";
527
+
528
+                course.setCoursename(coursename);
529
+                course.setSubjectid(kjTeaVo.getSubjectid());
530
+                course.setTeacherid(kjTeaVo.getTeacherid());
531
+                course.setBegintime(kj.getBegintime());
532
+                course.setEndtime(kj.getEndtime());
533
+                course.setKjid(kjTeaVo.getKjid());
534
+                //保存行政直播课程表,调用保存整个课表时的方法
535
+                List<XzDateKjTeaVo> lst = new ArrayList<>();
536
+                lst.add(kjTeaVo);
537
+                ((XzService)applicationContext.getBean("xzService")).saveCourseAll(lst, course);
514
             } else {
538
             } else {
515
                 //说明该教师当前有其他直播课,则把班级加入课程,完成直播课学生数量
539
                 //说明该教师当前有其他直播课,则把班级加入课程,完成直播课学生数量
516
                 TClassStudent cs = new TClassStudent();
540
                 TClassStudent cs = new TClassStudent();
517
-                cs.setSchoolid(course.getSchoolid());
541
+                cs.setSchoolid(kjTeaVo.getSchoolid());
518
                 cs.setClassid(kjTeaVo.getClassid());
542
                 cs.setClassid(kjTeaVo.getClassid());
519
                 cs.setCreateid(kjTeaVo.getCreateid());
543
                 cs.setCreateid(kjTeaVo.getCreateid());
520
                 classStudentMapper.saveAllClassStu(cs, courseVo.getClassid());
544
                 classStudentMapper.saveAllClassStu(cs, courseVo.getClassid());
523
                 groupMapper.saveAllClassGroupStu(cs, courseVo.getClassid(), groupid);
547
                 groupMapper.saveAllClassGroupStu(cs, courseVo.getClassid(), groupid);
524
                 classMapper.updateNum2(courseVo.getClassid());//更改直播班级以及班级分组人数
548
                 classMapper.updateNum2(courseVo.getClassid());//更改直播班级以及班级分组人数
525
                 courseMapper.updateStuNum(courseVo.getCourseid());//更新直播课学生数量
549
                 courseMapper.updateStuNum(courseVo.getCourseid());//更新直播课学生数量
526
-
527
-                //把指定的班级从原直播班中移除
528
-                //修改原单元格中设置的教师信息,先判断该单元格对应的课程是否有其他班级
529
-                Integer coursenum = courseClassMapper.getOtherClassnumByCourseid(kjTeaVo.getCourseid(),
530
-                                                                                 kjTeaVo.getClassid());
531
-                if (coursenum == 0) {
532
-                    //说明该课程仅关联一个班级,直接修改该课程以及该课程对应的直播班
533
-                    courseMapper.deleteCourseClassByCourseid(kjTeaVo.getCourseid());
534
-                } else {
535
-                    //说明关联的还有其他班级,修改该班级在直播班级中的学生,
536
-                    courseClassMapper.deleteByCourseidAndClassid(kjTeaVo.getCourseid(), kjTeaVo.getClassid());
537
-                    //处理对应直播班级中学生
538
-                    classMapper.deleteClassstu(course.getClassid(), kjTeaVo.getClassid());
539
-                    classMapper.updateNum2(course.getClassid());//更改班级以及班级分组人数
540
-                    courseMapper.updateStuNum(kjTeaVo.getCourseid());//更新直播课学生数量
541
-                }
542
             }
550
             }
543
         } catch (Exception e) {
551
         } catch (Exception e) {
544
-            log.error("修改单个课程出错:" + e.getMessage());
552
+            log.error("保存单个课程出错:" + e.getMessage());
545
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
553
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
546
         }
554
         }
547
     }
555
     }

+ 25
- 1
slive/src/main/java/com/xhkjedu/slive/utils/LiveUtil.java View File

75
         DateTimeFormatter fomatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
75
         DateTimeFormatter fomatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
76
         LocalDate datas = LocalDate.parse(beginstr, fomatter);
76
         LocalDate datas = LocalDate.parse(beginstr, fomatter);
77
         LocalDate enddate = LocalDate.parse(endstr,fomatter);
77
         LocalDate enddate = LocalDate.parse(endstr,fomatter);
78
-
78
+        //days是的往后一周
79
         int i=0;
79
         int i=0;
80
         while (i<days){
80
         while (i<days){
81
             int td = i ;
81
             int td = i ;
102
         LocalDate startDate = LocalDate.parse(startDateStr, fomatter);
102
         LocalDate startDate = LocalDate.parse(startDateStr, fomatter);
103
         LocalDate endDate = LocalDate.parse(endDateStr, fomatter);
103
         LocalDate endDate = LocalDate.parse(endDateStr, fomatter);
104
 
104
 
105
+        //指定的周几
105
         DayOfWeek dayOfWeek = DayOfWeek.of(weekDate);
106
         DayOfWeek dayOfWeek = DayOfWeek.of(weekDate);
106
         long distance = ChronoUnit.DAYS.between(startDate, endDate);
107
         long distance = ChronoUnit.DAYS.between(startDate, endDate);
107
 
108
 
136
         return rtn;
137
         return rtn;
137
     }
138
     }
138
 
139
 
140
+    /**
141
+     * @Description 指定时间段内符合开始时间的周几的所有日期集合
142
+     * @Param [startDateStr, endDateStr]
143
+     * @Return java.util.List<java.lang.String>
144
+     * @Author wn
145
+     * @Date 2022/4/6 16:16
146
+     **/
147
+    public static List<String> getDaysForMeetDates(String startDateStr, String endDateStr) {
148
+        DateTimeFormatter fomatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
149
+        LocalDate startDate = LocalDate.parse(startDateStr, fomatter);
150
+        LocalDate endDate = LocalDate.parse(endDateStr, fomatter);
151
+
152
+        DayOfWeek dayOfWeek = startDate.getDayOfWeek();
153
+        long distance = ChronoUnit.DAYS.between(startDate, endDate);
154
+
155
+        List<String> rtnlst = new ArrayList<>();
156
+        Stream.iterate(startDate, d -> d.plusDays(1))
157
+              .limit(distance + 1)
158
+              .filter(localDate -> dayOfWeek.toString().equals(localDate.getDayOfWeek().toString()))
159
+              .forEach(f -> rtnlst.add(f.toString()));
160
+        return rtnlst;
161
+    }
162
+
139
 }
163
 }

+ 5
- 0
slive/src/main/java/com/xhkjedu/slive/vo/xz/XzDateKjTeaVo.java View File

21
     private String subjectid;//科目id
21
     private String subjectid;//科目id
22
     private String subjectname;//科目名称
22
     private String subjectname;//科目名称
23
 
23
 
24
+    private Integer kjid;//行政直播课节id
25
+    private String seldate;//选择设置的日期
26
+
24
     private Integer kfollow;//区分是否处理指定日期后的课0不处理1处理
27
     private Integer kfollow;//区分是否处理指定日期后的课0不处理1处理
28
+    private Integer gradeid;//年级id
25
     private Integer createid;//操作人id
29
     private Integer createid;//操作人id
30
+    private Integer schoolid;//学校id
26
 
31
 
27
     private List<XzDateKjTeaVo> xjclass;//存放层级用于保存时使用
32
     private List<XzDateKjTeaVo> xjclass;//存放层级用于保存时使用
28
 }
33
 }

+ 7
- 6
slive/src/main/resources/mapper/liveplay/CourseMapper.xml View File

517
     <!--获取指定指定日期教师课节下教师的直播课-->
517
     <!--获取指定指定日期教师课节下教师的直播课-->
518
     <select id="getCourseByDateKjTeacher" resultType="com.xhkjedu.slive.vo.liveplay.CourseVo">
518
     <select id="getCourseByDateKjTeacher" resultType="com.xhkjedu.slive.vo.liveplay.CourseVo">
519
         select courseid,subjectid,classid,teacherid,kjid from l_course
519
         select courseid,subjectid,classid,teacherid,kjid from l_course
520
-        where kjid=#{xkjid} and teacherid=#{teacherid} and begindate=#{seldate}
520
+        where kjid=#{kjTeaVo.kjid} and teacherid=#{kjTeaVo.teacherid} and begindate=#{kjTeaVo.seldate}
521
     </select>
521
     </select>
522
-    <!--更改课程相关任课教师-->
523
-    <update id="updateCourseSectionClassTeacher">
524
-        update l_course c ,l_course_section s,t_class_teacher ct
525
-        set c.teacherid=#{teacherid},s.teacherid=#{teacherid},ct.teacherid=#{teacherid},c.subjectid=#{subjectid}
526
-        where c.courseid=s.courseid and ct.classid=c.classid and c.courseid=#{courseid}
522
+
523
+    <!--修改未开课课程课节时间-->
524
+    <update id="updateCourseSectionTime">
525
+        update l_course c,l_course_section s set c.begintime=#{kj.begintime},c.endtime=#{kj.endtime},
526
+        s.planbegintime=#{kj.begintime},s.planendtime=#{kj.endtime} where c.courseid=s.courseid
527
+        and c.kjid=#{kj.kjid} and c.coursestate=0 and s.sectionstate=0
527
     </update>
528
     </update>
528
 </mapper>
529
 </mapper>

+ 6
- 0
slive/src/main/resources/mapper/xz/XzKjMapper.xml View File

7
         select * from l_xz_kj where xzid=#{xzid} order by kjorder asc
7
         select * from l_xz_kj where xzid=#{xzid} order by kjorder asc
8
     </select>
8
     </select>
9
 
9
 
10
+    <!--修改课节信息-->
11
+    <update id="updateXzkj">
12
+        update l_xz_kj set kjname=#{kj.kjname},begintime=#{kj.begintime},endtime=#{kj.endtime}
13
+        where kjid=#{kj.kjid}
14
+    </update>
15
+
10
     <!--批量修改行政直播课节详情-->
16
     <!--批量修改行政直播课节详情-->
11
     <update id="updateBatchXzKj" parameterType="java.util.List">
17
     <update id="updateBatchXzKj" parameterType="java.util.List">
12
         <foreach collection="list" item="kj" index="index" separator=";">
18
         <foreach collection="list" item="kj" index="index" separator=";">

+ 5
- 0
slive/src/main/resources/mapper/xz/XzMapper.xml View File

88
         select c.enddate from l_course c left join l_course_class cc on c.courseid=cc.courseid
88
         select c.enddate from l_course c left join l_course_class cc on c.courseid=cc.courseid
89
         WHERE c.kjid=#{kjid} and cc.classid=#{classid} and c.begindate<![CDATA[ >= ]]>#{seldate}
89
         WHERE c.kjid=#{kjid} and cc.classid=#{classid} and c.begindate<![CDATA[ >= ]]>#{seldate}
90
     </select>
90
     </select>
91
+
92
+    <!--根据课节id获取行政直播详情-->
93
+    <select id="getXzByXzkjid" resultType="com.xhkjedu.slive.model.xz.LXz">
94
+        select x.* from l_xz x left join l_xz_kj k on x.xzid=k.xzid where kjid=#{kjid} group by xzid
95
+    </select>
91
 </mapper>
96
 </mapper>

Loading…
Cancel
Save