Browse Source

修改保存单个课程返回值

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

+ 20
- 8
slive/src/main/java/com/xhkjedu/slive/service/xz/XzService.java View File

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

+ 2
- 0
suser/src/main/java/com/xhkjedu/suser/controller/gradeclass/ClassStudentController.java View File

105
         Integer classid = tClassStudent.getClassid();
105
         Integer classid = tClassStudent.getClassid();
106
         N_Utils.validation(new Object[]{classid, "班级id", 1,tClassStudent.getSchoolid(),"学校id",1});
106
         N_Utils.validation(new Object[]{classid, "班级id", 1,tClassStudent.getSchoolid(),"学校id",1});
107
         Integer page = tClassStudent.getPage();
107
         Integer page = tClassStudent.getPage();
108
+        Integer year = classStudentService.getSchoolyear(tClassStudent.getSchoolid());
109
+        tClassStudent.setYear(year);
108
         if (N_Utils.isEmptyInteger(page)) {
110
         if (N_Utils.isEmptyInteger(page)) {
109
             List<ClassStudentVo> list = classStudentService.listStudentForliveclass(tClassStudent);
111
             List<ClassStudentVo> list = classStudentService.listStudentForliveclass(tClassStudent);
110
             return new ResultVo(0,"获取列表成功",list);
112
             return new ResultVo(0,"获取列表成功",list);

+ 4
- 2
suser/src/main/java/com/xhkjedu/suser/service/gradeclass/ClassStudentService.java View File

236
         return classStudentMapper.findAll(student);
236
         return classStudentMapper.findAll(student);
237
     }
237
     }
238
 
238
 
239
+    public Integer getSchoolyear(Integer schoolid){
240
+        return schoolMapper.getYearById(schoolid);
241
+    }
242
+
239
     //直播班中班级集合
243
     //直播班中班级集合
240
     public List<ClassStudentVo> listStudentForliveclass(TClassStudent student) {
244
     public List<ClassStudentVo> listStudentForliveclass(TClassStudent student) {
241
         setOrderField(student);
245
         setOrderField(student);
242
-        Integer year = schoolMapper.getYearById(student.getSchoolid());
243
-        student.setYear(year);
244
         List<ClassStudentVo> rtnlst = classStudentMapper.listStudentForliveclass(student);
246
         List<ClassStudentVo> rtnlst = classStudentMapper.listStudentForliveclass(student);
245
         for (int i=0;i<rtnlst.size();i++){
247
         for (int i=0;i<rtnlst.size();i++){
246
             ClassStudentVo cs = rtnlst.get(i);
248
             ClassStudentVo cs = rtnlst.get(i);

+ 1
- 1
suser/src/main/resources/mapper/gradeclass/ClassStudentMapper.xml View File

120
 
120
 
121
     <!--直播班中学生信息-->
121
     <!--直播班中学生信息-->
122
     <select id="listStudentForliveclass" resultType="com.xhkjedu.suser.vo.gradeclass.ClassStudentVo">
122
     <select id="listStudentForliveclass" resultType="com.xhkjedu.suser.vo.gradeclass.ClassStudentVo">
123
-        select cs.csid,cs.classid,u.username studentname,u.studentno,u.usersex,u.userid studentid,u.loginname,cs.createtime
123
+        select distinct cs.csid,cs.classid,u.username studentname,u.studentno,u.usersex,u.userid studentid,u.loginname,cs.createtime
124
         ,u.bindmac,u.mac,u.headpic,u.userphone,u.usertime,
124
         ,u.bindmac,u.mac,u.headpic,u.userphone,u.usertime,
125
         (select concat(c2.gradeid,'_',c2.classname) from t_class_student cs2 left join t_class c2 on cs2.classid=c2.classid
125
         (select concat(c2.gradeid,'_',c2.classname) from t_class_student cs2 left join t_class c2 on cs2.classid=c2.classid
126
         where cs2.studentid=cs.studentid and c2.classtype=1 and c2.classstate=1 and c2.year=#{student.year} order by c2.classid desc limit 1)classname
126
         where cs2.studentid=cs.studentid and c2.classtype=1 and c2.classstate=1 and c2.year=#{student.year} order by c2.classid desc limit 1)classname

Loading…
Cancel
Save