|
@@ -360,7 +360,8 @@ public class XzService {
|
360
|
360
|
|
361
|
361
|
//保存行政直播课程表
|
362
|
362
|
@Transactional(rollbackFor = Exception.class)
|
363
|
|
- public void saveCourseAll(List<XzDateKjTeaVo> xjTeas, LCourse course) {
|
|
363
|
+ public Integer saveCourseAll(List<XzDateKjTeaVo> xjTeas, LCourse course) {
|
|
364
|
+ Integer courseid = 0;
|
364
|
365
|
try {
|
365
|
366
|
//获取集合中所有的班级id
|
366
|
367
|
List classidlst = xjTeas.stream().map(XzDateKjTeaVo::getClassid).collect(Collectors.toList());
|
|
@@ -393,7 +394,7 @@ public class XzService {
|
393
|
394
|
|
394
|
395
|
//保存课程信息
|
395
|
396
|
courseMapper.insertUseGeneratedKeys(course);
|
396
|
|
- Integer courseid = course.getId();//课程id
|
|
397
|
+ courseid = course.getId();//课程id
|
397
|
398
|
|
398
|
399
|
List<Integer> studentids = new ArrayList<>();
|
399
|
400
|
users.forEach(userVo -> {
|
|
@@ -430,10 +431,12 @@ public class XzService {
|
430
|
431
|
cs.setCreateid(course.getCreateid());
|
431
|
432
|
cs.setCreatetime(course.getCreatetime());
|
432
|
433
|
courseSectionMapper.insertUseGeneratedKeys(cs);//保存课程课节信息
|
|
434
|
+
|
433
|
435
|
} catch (Exception e) {
|
434
|
436
|
log.info("保存行政直播课程表出错:" + e.getMessage());
|
435
|
437
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
436
|
438
|
}
|
|
439
|
+ return courseid;
|
437
|
440
|
}
|
438
|
441
|
|
439
|
442
|
/**
|
|
@@ -557,10 +560,12 @@ public class XzService {
|
557
|
560
|
kjTeaVo.setGradeid(xz.getGradeid());
|
558
|
561
|
kjTeaVo.setSchoolid(xz.getSchoolid());
|
559
|
562
|
|
|
563
|
+ Integer courseid = 0;//存放新添加课程id
|
|
564
|
+
|
560
|
565
|
//先判断是保存当前课程还是后续日期的课
|
561
|
566
|
if (N_Utils.isEmptyInteger(kjTeaVo.getKfollow())) {
|
562
|
567
|
//kfollow为0或者空,则只需要保存当前选中的课程
|
563
|
|
- ((XzService) applicationContext.getBean("xzService")).saveOneXzkjDygForDetail(kjTeaVo);
|
|
568
|
+ courseid = ((XzService) applicationContext.getBean("xzService")).saveOneXzkjDygForDetail(kjTeaVo);
|
564
|
569
|
} else {
|
565
|
570
|
//需要保存后续和当前日期相同的星期相同课节的课程,判断后续日期是否有课程,如果有则提示先删除后再添加
|
566
|
571
|
//获取已生成课程的往后日期
|
|
@@ -571,17 +576,21 @@ public class XzService {
|
571
|
576
|
if (afterlst != null && afterlst.size() > 0) {
|
572
|
577
|
return new ResultVo(1, "同日期同班级同课节有数据,不能保存");
|
573
|
578
|
} else {
|
574
|
|
-
|
575
|
579
|
//获取seldate至结束日期时端内符合条件的日期
|
576
|
580
|
List<String> savedates = LiveUtil.getDaysForMeetDates(kjTeaVo.getSeldate(), xz.getEnddate());
|
577
|
581
|
for (int i = 0; i < savedates.size(); i++) {
|
578
|
582
|
kjTeaVo.setSeldate(savedates.get(i));
|
579
|
|
-// ((XzService)applicationContext.getBean("xzService")).saveOneXzkjDygForDetail(kjTeaVo);
|
|
583
|
+
|
|
584
|
+ Integer rtnid = ((XzService)applicationContext.getBean("xzService")).saveOneXzkjDygForDetail(kjTeaVo);
|
|
585
|
+ if(i==0){
|
|
586
|
+ courseid = rtnid;
|
|
587
|
+ }
|
|
588
|
+
|
580
|
589
|
}
|
581
|
590
|
}
|
582
|
591
|
}
|
583
|
592
|
}
|
584
|
|
- return new ResultVo(0, "成功保存课程表单个课程");
|
|
593
|
+ return new ResultVo(0, "成功保存课程表单个课程",courseid);
|
585
|
594
|
} catch (Exception e) {
|
586
|
595
|
log.error("保存课程表单个课程出错:" + e.getMessage());
|
587
|
596
|
return new ResultVo(1, "保存课程表单个课程失败");
|
|
@@ -590,7 +599,8 @@ public class XzService {
|
590
|
599
|
|
591
|
600
|
//保存单个课程
|
592
|
601
|
@Transactional(rollbackFor = Exception.class)
|
593
|
|
- public void saveOneXzkjDygForDetail(XzDateKjTeaVo kjTeaVo) {
|
|
602
|
+ public Integer saveOneXzkjDygForDetail(XzDateKjTeaVo kjTeaVo) {
|
|
603
|
+ Integer courseid = 0;
|
594
|
604
|
try {
|
595
|
605
|
//先看新选择的教师情况,先判断选中的同一日期课节教师是否还有其他直播课
|
596
|
606
|
CourseVo courseVo = courseMapper.getCourseByDateKjTeacher(kjTeaVo);
|
|
@@ -625,8 +635,9 @@ public class XzService {
|
625
|
635
|
//保存行政直播课程表,调用保存整个课表时的方法
|
626
|
636
|
List<XzDateKjTeaVo> lst = new ArrayList<>();
|
627
|
637
|
lst.add(kjTeaVo);
|
628
|
|
- ((XzService) applicationContext.getBean("xzService")).saveCourseAll(lst, course);
|
|
638
|
+ courseid = ((XzService) applicationContext.getBean("xzService")).saveCourseAll(lst, course);
|
629
|
639
|
} else {
|
|
640
|
+ courseid = courseVo.getCourseid();
|
630
|
641
|
//说明该教师当前有其他直播课,则把班级加入课程,完成直播课学生数量
|
631
|
642
|
TClassStudent cs = new TClassStudent();
|
632
|
643
|
cs.setSchoolid(kjTeaVo.getSchoolid());
|
|
@@ -643,6 +654,7 @@ public class XzService {
|
643
|
654
|
log.error("保存单个课程出错:" + e.getMessage());
|
644
|
655
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
645
|
656
|
}
|
|
657
|
+ return courseid;
|
646
|
658
|
}
|
647
|
659
|
|
648
|
660
|
|