Procházet zdrojové kódy

Merge remote-tracking branch 'origin/master' into ywx

tags/正式3.2.0
雍文秀 před 2 roky
rodič
revize
f11f6c192e

+ 8
- 9
slive/src/main/java/com/xhkjedu/slive/controller/xz/XzController.java Zobrazit soubor

@@ -137,7 +137,7 @@ public class XzController {
137 137
 
138 138
 
139 139
     /**
140
-     * @Description  保存行政直播课程表
140
+     * @Description  保存行政直播课程表(整个)
141 141
      * @Param [xz]
142 142
      * @Return com.xhkjedu.vo.ResultVo
143 143
      * @Author wn
@@ -159,22 +159,21 @@ public class XzController {
159 159
     @PostMapping("/kcbd")
160 160
     public ResultVo delXzkjDyg(@RequestBody XzDateKjTeaVo kjTeaVo){
161 161
         N_Utils.validation(new Object[]{kjTeaVo.getCourseid(),"课程id",1,kjTeaVo.getClassid(),"班级id",1});
162
-        xzService.delXzkjDyg(kjTeaVo);
163
-        return new ResultVo(0, "成功删除单个课程信息");
162
+        return xzService.delXzkjDyg(kjTeaVo);
164 163
     }
165 164
 
166 165
     /**
167
-     * @Description 修改课程表单个单元格数据
166
+     * @Description 保存课程表单个单元格数据(单元格)
168 167
      * @Param [kjTeaVo]
169 168
      * @Return com.xhkjedu.vo.ResultVo
170 169
      * @Author wn
171 170
      * @Date 2022/4/2 17:11
172 171
      **/
173
-    @PostMapping("/kcbup")
174
-    public ResultVo updateXzkjDyg(@RequestBody XzDateKjTeaVo kjTeaVo){
175
-        N_Utils.validation(new Object[]{kjTeaVo.getCourseid(),"课程id",1,kjTeaVo.getClassid(),"班级id",1,kjTeaVo.getCreateid(),"操作人id",1});
176
-        xzService.updateXzKjDyg(kjTeaVo);
177
-        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);
178 177
     }
179 178
 
180 179
 }

+ 4
- 0
slive/src/main/java/com/xhkjedu/slive/mapper/gradeclass/ClassMapper.java Zobrazit soubor

@@ -3,6 +3,7 @@ package com.xhkjedu.slive.mapper.gradeclass;
3 3
 import com.xhkjedu.slive.base.TkMapper;
4 4
 import com.xhkjedu.slive.model.gradeclass.TClass;
5 5
 import com.xhkjedu.slive.vo.gradeclass.ClassVo;
6
+import com.xhkjedu.slive.vo.xz.XzClassVo;
6 7
 import org.apache.ibatis.annotations.Param;
7 8
 
8 9
 import java.util.List;
@@ -31,4 +32,7 @@ public interface ClassMapper extends TkMapper<TClass> {
31 32
 
32 33
     //删除班级学生及分组学生
33 34
     void deleteClassstu(@Param("zbclassid") Integer zbclassid, @Param("classid")Integer classid);
35
+
36
+    //根据行政直播id获取该学校当前年份指定年级下的行政班和提高班
37
+    List<XzClassVo> listClassByXzid(@Param("xzid")Integer xzid);
34 38
 }

+ 5
- 3
slive/src/main/java/com/xhkjedu/slive/mapper/liveplay/CourseMapper.java Zobrazit soubor

@@ -2,12 +2,14 @@ package com.xhkjedu.slive.mapper.liveplay;
2 2
 
3 3
 import com.xhkjedu.slive.base.TkMapper;
4 4
 import com.xhkjedu.slive.model.liveplay.LCourse;
5
+import com.xhkjedu.slive.model.xz.LXzKj;
5 6
 import com.xhkjedu.slive.vo.liveplay.CTypeVo;
6 7
 import com.xhkjedu.slive.vo.liveplay.CourseParams;
7 8
 import com.xhkjedu.slive.vo.liveplay.CourseSectionVo;
8 9
 import com.xhkjedu.slive.vo.liveplay.CourseStudentVo;
9 10
 import com.xhkjedu.slive.vo.liveplay.CourseVo;
10 11
 import com.xhkjedu.slive.vo.liveplay.SectionDateVo;
12
+import com.xhkjedu.slive.vo.xz.XzDateKjTeaVo;
11 13
 import org.apache.ibatis.annotations.Param;
12 14
 
13 15
 import java.util.List;
@@ -107,7 +109,7 @@ public interface CourseMapper extends TkMapper<LCourse> {
107 109
     //获取指定课节班级日期下的课程信息
108 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 Zobrazit soubor

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

+ 4
- 3
slive/src/main/java/com/xhkjedu/slive/mapper/xz/XzMapper.java Zobrazit soubor

@@ -2,8 +2,6 @@ package com.xhkjedu.slive.mapper.xz;
2 2
 
3 3
 import com.xhkjedu.slive.base.TkMapper;
4 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 5
 import org.apache.ibatis.annotations.Param;
8 6
 import org.springframework.stereotype.Repository;
9 7
 
@@ -43,8 +41,11 @@ public interface XzMapper extends TkMapper<LXz> {
43 41
     List<Map> listXzKjsAfterSaveXz(@Param("xzid") Integer xzid);
44 42
 
45 43
     //取指定课节指定日期所有班级的课程和教师
46
-    List<XzDateKjVo> listXzDateKjDetail(@Param("selectdate") String selectdate,@Param("xzid") Integer xzid);
44
+    List<Map> listXzDateKjDetail(@Param("selectdate") String selectdate,@Param("xzid") Integer xzid,@Param("classid")Integer classid);
47 45
 
48 46
     //获取指定课节班级对应的课程的日期
49 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
 }

+ 1
- 0
slive/src/main/java/com/xhkjedu/slive/service/liveplay/CourseService.java Zobrazit soubor

@@ -110,6 +110,7 @@ public class CourseService {
110 110
             //课程信息
111 111
             model.setClassid(classid);
112 112
             model.setDeleted(1);
113
+            model.setCourseclass(0);
113 114
             courseMapper.insertUseGeneratedKeys(model);
114 115
             List<ClassVo> classes = new ArrayList<>();
115 116
             if (model.getCoursetype() == 1) {

+ 31
- 13
slive/src/main/java/com/xhkjedu/slive/service/xz/XzKjService.java Zobrazit soubor

@@ -1,11 +1,15 @@
1 1
 package com.xhkjedu.slive.service.xz;
2 2
 
3
+import com.xhkjedu.slive.mapper.liveplay.CourseMapper;
3 4
 import com.xhkjedu.slive.mapper.xz.XzKjMapper;
4 5
 import com.xhkjedu.slive.model.xz.LXzKj;
5 6
 import com.xhkjedu.slive.vo.xz.XzDateKjVo;
6 7
 import com.xhkjedu.utils.N_Utils;
7 8
 import com.xhkjedu.vo.ResultVo;
9
+import lombok.extern.slf4j.Slf4j;
8 10
 import org.springframework.stereotype.Service;
11
+import org.springframework.transaction.annotation.Transactional;
12
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
9 13
 
10 14
 import javax.annotation.Resource;
11 15
 import java.util.List;
@@ -16,9 +20,12 @@ import java.util.List;
16 20
  * Date 2022/3/30 15:26
17 21
  **/
18 22
 @Service
23
+@Slf4j
19 24
 public class XzKjService {
20 25
     @Resource
21 26
     private XzKjMapper xzKjMapper;
27
+    @Resource
28
+    private CourseMapper courseMapper;
22 29
 
23 30
     /**
24 31
      * @Description  获取行政直播课节基本信息
@@ -37,23 +44,34 @@ public class XzKjService {
37 44
      * @Author wn
38 45
      * @Date 2022/3/30 21:51
39 46
      **/
47
+    @Transactional(rollbackFor = Exception.class)
40 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
 }

+ 128
- 101
slive/src/main/java/com/xhkjedu/slive/service/xz/XzService.java Zobrazit soubor

@@ -18,6 +18,7 @@ import com.xhkjedu.slive.service.gradeclass.ClassService;
18 18
 import com.xhkjedu.slive.utils.LiveUtil;
19 19
 import com.xhkjedu.slive.vo.gradeclass.ClassVo;
20 20
 import com.xhkjedu.slive.vo.liveplay.CourseVo;
21
+import com.xhkjedu.slive.vo.xz.XzClassVo;
21 22
 import com.xhkjedu.slive.vo.xz.XzDateVo;
22 23
 import com.xhkjedu.slive.vo.xz.XzDateKjTeaVo;
23 24
 import com.xhkjedu.slive.vo.xz.XzDateKjVo;
@@ -32,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional;
32 33
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
33 34
 
34 35
 import javax.annotation.Resource;
36
+import javax.annotation.security.DenyAll;
35 37
 import java.util.ArrayList;
36 38
 import java.util.HashMap;
37 39
 import java.util.List;
@@ -68,6 +70,10 @@ public class XzService {
68 70
     private ClassStudentMapper classStudentMapper;
69 71
     @Resource
70 72
     private GroupMapper groupMapper;
73
+
74
+    @Autowired
75
+    ApplicationContext applicationContext;
76
+
71 77
     /**
72 78
      * @Description 行政直播列表
73 79
      * @Param [schoolid]
@@ -109,9 +115,9 @@ public class XzService {
109 115
             }
110 116
             //批量保存行政直播对应的课节
111 117
             xzKjMapper.insertList(kjlst);
112
-            return new ResultVo(0, "保存行政直播成功",xzid);
113
-        }catch (Exception e){
114
-            log.error("保存行政直播出错:"+e.getMessage());
118
+            return new ResultVo(0, "保存行政直播成功", xzid);
119
+        } catch (Exception e) {
120
+            log.error("保存行政直播出错:" + e.getMessage());
115 121
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
116 122
             return new ResultVo(1, "保存行政直播成功失败");
117 123
         }
@@ -231,12 +237,12 @@ public class XzService {
231 237
                         course.setEndtime(dateKjVo.getEndtime());
232 238
                         course.setKjid(dateKjVo.getKjid());
233 239
                         //保存行政直播课程表,该方式解决事务不生效问题
234
-                        ((XzService) AopContext.currentProxy()).saveCourseAll(xjTeas, course);
240
+                        ((XzService)applicationContext.getBean("xzService")).saveCourseAll(xjTeas, course);
235 241
                     }
236 242
                 }
237 243
             }
238
-        }catch (Exception e){
239
-            log.error("保存行政直播课程表出错:"+e.getMessage());
244
+        } catch (Exception e) {
245
+            log.error("保存行政直播课程表出错:" + e.getMessage());
240 246
         }
241 247
 
242 248
         return new ResultVo(0, "保存行政直播课程表成功");
@@ -316,9 +322,6 @@ public class XzService {
316 322
                 cc.setCreateid(course.getCreateid());
317 323
                 cc.setCreatetime(course.getCreatetime());
318 324
                 cclist.add(cc);
319
-                //通知班级
320
-                ClassVo classVo = new ClassVo();
321
-                classVo.setClassid(cid);
322 325
             }
323 326
             courseClassMapper.insertList(cclist);//保存原班级和直播的关联关系
324 327
 
@@ -336,7 +339,6 @@ public class XzService {
336 339
             cs.setCreateid(course.getCreateid());
337 340
             cs.setCreatetime(course.getCreatetime());
338 341
             courseSectionMapper.insertUseGeneratedKeys(cs);//保存课程课节信息
339
-
340 342
         } catch (Exception e) {
341 343
             log.info("保存行政直播课程表出错:" + e.getMessage());
342 344
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@@ -357,19 +359,29 @@ public class XzService {
357 359
 
358 360
         Map map = new HashMap();
359 361
         List<XzDateKjVo> kjs = xzKjMapper.listXzKjsByXzid(xz.getXzid());
360
-        map.put("kjs",kjs);//保存所有课节信息
362
+        map.put("kjs", kjs);//保存所有课节信息
363
+
364
+        List<XzDateVo> classdatelst = new ArrayList<>();//班级日期课节
361 365
 
362
-        List<XzDateVo> datelst = new ArrayList<>();//保存指定日期
366
+        //根据行政直播id获取该学校当前年份指定年级下的行政班和提高班
367
+        List<XzClassVo> classlst = classMapper.listClassByXzid(xz.getXzid());
363 368
         //先获取选择要看的有效日期,不能超出行政直播结束的日期
364
-        List<String> seldates = LiveUtil.listDateAfterDates(xz.getBegindate(),xz.getEnddate(),7);
365
-        for(int i=0;i<seldates.size();i++){
366
-            List<XzDateKjVo> kjlst = xzMapper.listXzDateKjDetail(seldates.get(i),xz.getXzid());//获取课节详情
367
-            XzDateVo dateVo = new XzDateVo();
368
-            dateVo.setSelectdate(seldates.get(i));
369
-            dateVo.setKjs(kjlst);
370
-            datelst.add(dateVo);
369
+        List<String> seldates = LiveUtil.listDateAfterDates(xz.getBegindate(), xz.getEnddate(), 7);
370
+
371
+        for (int i = 0; i < classlst.size(); i++) {
372
+            XzClassVo classVo = classlst.get(i);
373
+            List<XzDateVo> datelst = new ArrayList<>();//保存指定日期
374
+            for (int j = 0; j < seldates.size(); j++) {
375
+                List<Map> kjlst = xzMapper.listXzDateKjDetail(seldates.get(j), xz.getXzid(),classVo.getClassid());//获取课节详情
376
+                XzDateVo dateVo = new XzDateVo();
377
+                dateVo.setSelectdate(seldates.get(j));
378
+                dateVo.setKjsmap(kjlst);
379
+                datelst.add(dateVo);
380
+            }
381
+            classVo.setDates(datelst);
371 382
         }
372
-        map.put("xzdates", datelst);
383
+
384
+        map.put("xzdates", classlst);
373 385
         return map;
374 386
     }
375 387
 
@@ -385,44 +397,45 @@ public class XzService {
385 397
             //判断课程的状态,如果已经开始上课则不能删除
386 398
             LCourse course = courseMapper.selectByPrimaryKey(kjTeaVo.getCourseid());
387 399
             Integer kjid = course.getKjid();
388
-            Integer classid= kjTeaVo.getClassid();//行政班id
389
-            if(course.getCoursestate() > 0){
390
-                throw new Exception("选择的课程已经开始上课,不允许删除");
391
-            }else{
400
+            Integer classid = kjTeaVo.getClassid();//行政班id
401
+            if (course.getCoursestate() > 0) {
402
+                return new ResultVo(1,"选择的课程已经开始上课,不允许删除");
403
+            } else {
392 404
                 //先判断是删除当前课程还是后续日期的课
393
-                if(N_Utils.isEmptyInteger(kjTeaVo.getKfollow())){
405
+                if (N_Utils.isEmptyInteger(kjTeaVo.getKfollow())) {
394 406
                     //kfollow为0或者空,则只需要删除当前选中的课程
395
-                    ((XzService) AopContext.currentProxy()).delXzkjDygForDetail(kjTeaVo,course.getClassid());
396
-                }else{
407
+                    ((XzService)applicationContext.getBean("xzService")).delXzkjDygForDetail(kjTeaVo, course.getClassid());
408
+                } else {
397 409
                     //需要删除后续和当前日期相同的星期相同课节的课程
398
-                    //获取已生成课程的最后日期
399
-                    List<String> alldates = xzMapper.getAllDatesForKj(kjid,classid,course.getBegindate());
400
-                    if(alldates!=null && alldates.size()>0){
410
+                    //获取已生成课程从所选删除课程开始日期到结束日期内所有日期
411
+                    List<String> alldates = xzMapper.getAllDatesForKj(kjid, classid, course.getBegindate());
412
+                    if (alldates != null && alldates.size() > 0) {
401 413
                         //已经成课程中符合周的需要删除的日期
402
-                        List<String> deldates = LiveUtil.getMeetDayOfDates(alldates,course.getBegindate());
403
-                        if(deldates!=null && deldates.size()>0){
404
-                            for(int i=0;i<deldates.size();i++){
414
+                        List<String> deldates = LiveUtil.getMeetDayOfDates(alldates, course.getBegindate());
415
+                        if (deldates != null && deldates.size() > 0) {
416
+                            for (int i = 0; i < deldates.size(); i++) {
405 417
                                 //先获取指定日期对应的课程
406
-                                CourseVo courseVo = courseMapper.getCourseByKjidAndClassid(kjid,classid,deldates.get(i));
407
-                                ((XzService) AopContext.currentProxy()).delXzkjDygForDetail(kjTeaVo,courseVo.getClassid());
418
+                                CourseVo courseVo = courseMapper.getCourseByKjidAndClassid(kjid, classid, deldates.get(i));
419
+                                kjTeaVo.setCourseid(courseVo.getCourseid());
420
+                                ((XzService)applicationContext.getBean("xzService")).delXzkjDygForDetail(kjTeaVo,courseVo.getClassid());
408 421
                             }
409 422
                         }
410 423
                     }
411 424
                 }
412
-                return new ResultVo(0,"成功删除课程表单个课程");
425
+                return new ResultVo(0, "成功删除课程表单个课程");
413 426
             }
414
-        }catch (Exception e){
415
-            log.error("删除课程表单个课程出错:"+e.getMessage());
416
-            return new ResultVo(1,"删除课程表单个课程失败");
427
+        } catch (Exception e) {
428
+            log.error("删除课程表单个课程出错:" + e.getMessage());
429
+            return new ResultVo(1, "删除课程表单个课程失败");
417 430
         }
418 431
     }
419 432
 
420 433
     //删除单个课程表
421 434
     @Transactional(rollbackFor = Exception.class)
422
-    public void delXzkjDygForDetail(XzDateKjTeaVo kjTeaVo,Integer zbclassid) {
435
+    public void delXzkjDygForDetail(XzDateKjTeaVo kjTeaVo, Integer zbclassid) {
423 436
         try {
424 437
             //删除单个单元格中设置的教师信息,先判断该单元格对应的课程是否有其他班级
425
-            Integer coursenum = courseClassMapper.getOtherClassnumByCourseid(kjTeaVo.getCourseid(), kjTeaVo.getClassid());
438
+            Integer coursenum = courseClassMapper.getOtherClassnumByCourseid(kjTeaVo.getCourseid(),kjTeaVo.getClassid());
426 439
             if (coursenum == 0) {
427 440
                 //说明该课程仅关联一个班级,直接删除该课程以及该课程对应的直播班
428 441
                 courseMapper.deleteCourseClassByCourseid(kjTeaVo.getCourseid());
@@ -434,95 +447,109 @@ public class XzService {
434 447
                 classMapper.updateNum2(zbclassid);//更改班级以及班级分组人数
435 448
                 courseMapper.updateStuNum(kjTeaVo.getCourseid());//更新直播课学生数量
436 449
             }
437
-        }catch (Exception e){
438
-           log.error("删除单个课程出错:"+e.getMessage());
439
-           TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
450
+        } catch (Exception e) {
451
+            log.error("删除单个课程出错:" + e.getMessage());
452
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
440 453
         }
441 454
     }
442 455
 
443 456
     /**
444
-     * @Description 修改单个单元格
457
+     * @Description 保存单个单元格(单元格)
445 458
      * @Param [kjTeaVo]
446 459
      * @Return com.xhkjedu.vo.ResultVo
447 460
      * @Author wn
448 461
      * @Date 2022/4/2 15:19
449 462
      **/
450
-    public ResultVo updateXzKjDyg(XzDateKjTeaVo kjTeaVo){
463
+    public ResultVo saveOneXzKjDyg(XzDateKjTeaVo kjTeaVo) {
451 464
         try {
452
-            //判断课程的状态,如果已经开始上课则不能修改
453
-            LCourse course = courseMapper.selectByPrimaryKey(kjTeaVo.getCourseid());
454
-            Integer kjid = course.getKjid();
455
-            Integer classid= kjTeaVo.getClassid();//行政班id
456
-            if(course.getCoursestate() > 0){
457
-                throw new Exception("选择的课程已经开始上课,不允许修改");
458
-            }else{
459
-                //先判断是修改当前课程还是后续日期的课
460
-                if(N_Utils.isEmptyInteger(kjTeaVo.getKfollow())){
461
-                    //kfollow为0或者空,则只需要修改当前选中的课程
462
-                    ((XzService) AopContext.currentProxy()).updateXzkjDygForDetail(kjTeaVo,course);
463
-                }else{
464
-                    //需要修改后续和当前日期相同的星期相同课节的课程
465
-                    //获取已生成课程的最后日期
466
-                    List<String> alldates = xzMapper.getAllDatesForKj(kjid,classid,course.getBegindate());
467
-                    if(alldates!=null && alldates.size()>0){
468
-                        //已经成课程中符合周的需要修改的日期
469
-                        List<String> deldates = LiveUtil.getMeetDayOfDates(alldates,course.getBegindate());
470
-                        if(deldates!=null && deldates.size()>0){
471
-                            for(int i=0;i<deldates.size();i++){
472
-                                //先获取指定日期对应的课程
473
-                                course.setBegintime(deldates.get(i));
474
-                                ((XzService) AopContext.currentProxy()).updateXzkjDygForDetail(kjTeaVo,course);
475
-                            }
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);
473
+            } else {
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);
476 489
                         }
477 490
                     }
478 491
                 }
479
-                return new ResultVo(0,"成功修改课程表单个课程");
480 492
             }
481
-        }catch (Exception e){
482
-            log.error("修改课程表单个课程出错:"+e.getMessage());
483
-            return new ResultVo(1,"修改课程表单个课程失败");
493
+            return new ResultVo(0, "成功保存课程表单个课程");
494
+        } catch (Exception e) {
495
+            log.error("保存课程表单个课程出错:" + e.getMessage());
496
+            return new ResultVo(1, "保存课程表单个课程失败");
484 497
         }
485 498
     }
486 499
 
487
-    //修改单个课程
500
+    //保存单个课程
488 501
     @Transactional(rollbackFor = Exception.class)
489
-    public void updateXzkjDygForDetail(XzDateKjTeaVo kjTeaVo,LCourse course) {
502
+    public void saveOneXzkjDygForDetail(XzDateKjTeaVo kjTeaVo) {
490 503
         try {
491 504
             //先看新选择的教师情况,先判断选中的同一日期课节教师是否还有其他直播课
492
-            CourseVo courseVo = courseMapper.getCourseByDateKjTeacher(course.getKjid(),kjTeaVo.getTeacherid(),course.getBegindate());
493
-            if(courseVo==null){
494
-                //说明该老师之前没有直播课,则直接修改课程任课教师,直播班关联教师以及科目
495
-                courseMapper.updateCourseSectionClassTeacher(course.getCourseid(),kjTeaVo.getTeacherid(),kjTeaVo.getSubjectid());
496
-            }else{
505
+            CourseVo courseVo = courseMapper.getCourseByDateKjTeacher(kjTeaVo);
506
+            if (courseVo == null) {
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);
538
+            } else {
497 539
                 //说明该教师当前有其他直播课,则把班级加入课程,完成直播课学生数量
498 540
                 TClassStudent cs = new TClassStudent();
499
-                cs.setSchoolid(course.getSchoolid());
541
+                cs.setSchoolid(kjTeaVo.getSchoolid());
500 542
                 cs.setClassid(kjTeaVo.getClassid());
501 543
                 cs.setCreateid(kjTeaVo.getCreateid());
502
-                classStudentMapper.saveAllClassStu(cs,courseVo.getClassid());
544
+                classStudentMapper.saveAllClassStu(cs, courseVo.getClassid());
503 545
                 //获取直播班对应全班学生分组id
504 546
                 Integer groupid = groupMapper.getGroupIdByClassid(courseVo.getClassid());
505
-                groupMapper.saveAllClassGroupStu(cs,courseVo.getClassid(),groupid);
547
+                groupMapper.saveAllClassGroupStu(cs, courseVo.getClassid(), groupid);
506 548
                 classMapper.updateNum2(courseVo.getClassid());//更改直播班级以及班级分组人数
507 549
                 courseMapper.updateStuNum(courseVo.getCourseid());//更新直播课学生数量
508
-
509
-                //把指定的班级从原直播班中移除
510
-                //修改原单元格中设置的教师信息,先判断该单元格对应的课程是否有其他班级
511
-                Integer coursenum = courseClassMapper.getOtherClassnumByCourseid(kjTeaVo.getCourseid(), kjTeaVo.getClassid());
512
-                if (coursenum == 0) {
513
-                    //说明该课程仅关联一个班级,直接修改该课程以及该课程对应的直播班
514
-                    courseMapper.deleteCourseClassByCourseid(kjTeaVo.getCourseid());
515
-                } else {
516
-                    //说明关联的还有其他班级,修改该班级在直播班级中的学生,
517
-                    courseClassMapper.deleteByCourseidAndClassid(kjTeaVo.getCourseid(), kjTeaVo.getClassid());
518
-                    //处理对应直播班级中学生
519
-                    classMapper.deleteClassstu(course.getClassid(), kjTeaVo.getClassid());
520
-                    classMapper.updateNum2(course.getClassid());//更改班级以及班级分组人数
521
-                    courseMapper.updateStuNum(kjTeaVo.getCourseid());//更新直播课学生数量
522
-                }
523 550
             }
524
-        }catch (Exception e){
525
-            log.error("修改单个课程出错:"+e.getMessage());
551
+        } catch (Exception e) {
552
+            log.error("保存单个课程出错:" + e.getMessage());
526 553
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
527 554
         }
528 555
     }

+ 25
- 1
slive/src/main/java/com/xhkjedu/slive/utils/LiveUtil.java Zobrazit soubor

@@ -75,7 +75,7 @@ public class LiveUtil {
75 75
         DateTimeFormatter fomatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
76 76
         LocalDate datas = LocalDate.parse(beginstr, fomatter);
77 77
         LocalDate enddate = LocalDate.parse(endstr,fomatter);
78
-
78
+        //days是的往后一周
79 79
         int i=0;
80 80
         while (i<days){
81 81
             int td = i ;
@@ -102,6 +102,7 @@ public class LiveUtil {
102 102
         LocalDate startDate = LocalDate.parse(startDateStr, fomatter);
103 103
         LocalDate endDate = LocalDate.parse(endDateStr, fomatter);
104 104
 
105
+        //指定的周几
105 106
         DayOfWeek dayOfWeek = DayOfWeek.of(weekDate);
106 107
         long distance = ChronoUnit.DAYS.between(startDate, endDate);
107 108
 
@@ -136,4 +137,27 @@ public class LiveUtil {
136 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
 }

+ 23
- 0
slive/src/main/java/com/xhkjedu/slive/vo/xz/XzClassVo.java Zobrazit soubor

@@ -0,0 +1,23 @@
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/4/6 10:53
11
+ **/
12
+@Data
13
+public class XzClassVo {
14
+    private Integer classid;//班级id
15
+
16
+    private String classname; //班级名称
17
+
18
+    private Integer gradeid;//年级
19
+
20
+    private Integer classtype;//班级类型
21
+
22
+    private List<XzDateVo> dates;//行政课日期
23
+}

+ 5
- 0
slive/src/main/java/com/xhkjedu/slive/vo/xz/XzDateKjTeaVo.java Zobrazit soubor

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

+ 4
- 0
slive/src/main/java/com/xhkjedu/slive/vo/xz/XzDateVo.java Zobrazit soubor

@@ -2,7 +2,9 @@ package com.xhkjedu.slive.vo.xz;
2 2
 
3 3
 import lombok.Data;
4 4
 
5
+import java.util.ArrayList;
5 6
 import java.util.List;
7
+import java.util.Map;
6 8
 
7 9
 /**
8 10
  * @Description 行政直播日期
@@ -14,5 +16,7 @@ public class XzDateVo {
14 16
     private String selectdate;//当前选择日期
15 17
     private List<XzDateKjVo> kjs;//行政直播课节集合
16 18
 
19
+    private List<Map> kjsmap = new ArrayList<>();
20
+
17 21
 
18 22
 }

+ 8
- 0
slive/src/main/resources/mapper/gradeclass/ClassMapper.xml Zobrazit soubor

@@ -48,4 +48,12 @@
48 48
         left join t_group_student gs on cs.classid=gs.classid and cs.studentid=gs.studentid
49 49
         where cs.classid=#{zbclassid} and cs2.classid=#{classid} and cs.xzed=0
50 50
     </delete>
51
+
52
+    <!--获取年级下所有行政班和提高班-->
53
+    <select id="listClassByXzid" resultType="com.xhkjedu.slive.vo.xz.XzClassVo">
54
+        select DISTINCT c.classid,c.classname,c.classtype,c.gradeid from t_class c
55
+        left join t_school s on c.schoolid=s.schoolid and c.year=s.year
56
+        left join l_xz x on s.schoolid=x.schoolid and c.gradeid=x.gradeid
57
+        where x.xzid=#{xzid} and c.classstate=1 and c.classtype in (1,2)
58
+    </select>
51 59
 </mapper>

+ 7
- 6
slive/src/main/resources/mapper/liveplay/CourseMapper.xml Zobrazit soubor

@@ -517,12 +517,13 @@
517 517
     <!--获取指定指定日期教师课节下教师的直播课-->
518 518
     <select id="getCourseByDateKjTeacher" resultType="com.xhkjedu.slive.vo.liveplay.CourseVo">
519 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 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 528
     </update>
528 529
 </mapper>

+ 6
- 0
slive/src/main/resources/mapper/xz/XzKjMapper.xml Zobrazit soubor

@@ -7,6 +7,12 @@
7 7
         select * from l_xz_kj where xzid=#{xzid} order by kjorder asc
8 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 17
     <update id="updateBatchXzKj" parameterType="java.util.List">
12 18
         <foreach collection="list" item="kj" index="index" separator=";">

+ 9
- 22
slive/src/main/resources/mapper/xz/XzMapper.xml Zobrazit soubor

@@ -70,40 +70,27 @@
70 70
         left join l_xz_kj k on x.xzid=k.xzid where x.xzid=#{xzid} order by k.kjorder
71 71
     </select>
72 72
 
73
-    <resultMap id="xzkjsForDate" type="com.xhkjedu.slive.vo.xz.XzDateKjVo">
74
-        <result property="kjid" column="kjid"></result>
75
-        <result property="kjname" column="kjname"></result>
76
-        <result property="kjorder" column="kjorder"></result>
77
-        <result property="begintime" column="begintime"></result>
78
-        <result property="endtime" column="endtime"></result>
79
-        <collection property="kjteas" ofType="com.xhkjedu.slive.vo.xz.XzDateKjTeaVo"
80
-                    javaType="java.util.List">
81
-            <result property="classid" column="classid"></result>
82
-            <result property="classname" column="classname"></result>
83
-            <result property="teacherid" column="teacherid"></result>
84
-            <result property="teachername" column="teachername"></result>
85
-            <result property="courseid" column="courseid"></result>
86
-            <result property="subjectid" column="subjectid"></result>
87
-            <result property="subjectname" column="subjectname"></result>
88
-        </collection>
89
-    </resultMap>
90
-
91 73
     <!--获取指定课节指定日期所有班级的课程和教师-->
92
-    <select id="listXzDateKjDetail" resultMap="xzkjsForDate">
93
-        select k.kjid,k.kjname,k.kjorder,k.begintime,k.endtime,
74
+    <select id="listXzDateKjDetail" resultType="java.util.Map">
75
+        select k.kjid,k.kjname,
94 76
         c.classid,lc.classname,c.teacherid,u.username as teachername,
95 77
         c.subjectid,s.subjectname,c.kjid,c.courseid,c.coursestate
96 78
         from l_course c left join l_course_class cc on c.courseid=cc.courseid
97 79
         left join t_class lc on cc.classid=lc.classid
98 80
         left join t_user u on c.teacherid=u.userid
99 81
         left join t_subject s on c.subjectid=s.subjectid left join l_xz_kj k on c.kjid=k.kjid
100
-        where c.begindate=#{selectdate} and c.courseclass=1 and k.xzid=#{xzid}
82
+        where c.begindate=#{selectdate} and c.courseclass=1 and k.xzid=#{xzid} and cc.classid=#{classid}
101 83
         order by k.kjorder, lc.classtype, lc.classorder
102 84
     </select>
103 85
 
104 86
     <!--获取指定课节班级对应的课程的日期-->
105 87
     <select id="getAllDatesForKj" resultType="java.lang.String">
106 88
         select c.enddate from l_course c left join l_course_class cc on c.courseid=cc.courseid
107
-        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>
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
108 95
     </select>
109 96
 </mapper>

Načítá se…
Zrušit
Uložit