From 790c2ba4a0b46edf191e3bac84931f796bd42b8f Mon Sep 17 00:00:00 2001
From: zhangf <1603559716@qq.com>
Date: 星期三, 24 七月 2024 09:02:49 +0800
Subject: [PATCH] 三方对接接口优化

---
 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/TripartiteInterfaceServiceImpl.java | 1787 +++++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 1,359 insertions(+), 428 deletions(-)

diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/TripartiteInterfaceServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/TripartiteInterfaceServiceImpl.java
index 05577ae..6d089ce 100644
--- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/TripartiteInterfaceServiceImpl.java
+++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/TripartiteInterfaceServiceImpl.java
@@ -1,9 +1,11 @@
 package com.gkhy.exam.institutionalaccess.service.serviceImpl;
 
 
+import cn.hutool.core.collection.ListUtil;
 import cn.hutool.core.util.IdUtil;
 import com.alibaba.fastjson2.JSONObject;
 import com.alibaba.fastjson2.TypeReference;
+import com.gkhy.exam.institutionalaccess.config.ExecutorConfig;
 import com.gkhy.exam.institutionalaccess.entity.*;
 import com.gkhy.exam.institutionalaccess.enums.*;
 import com.gkhy.exam.institutionalaccess.model.req.*;
@@ -20,6 +22,8 @@
 import com.ruoyi.common.utils.bean.BeanUtils;
 import com.ruoyi.common.utils.uuid.UUID;
 import com.ruoyi.framework.security.context.ThreeInContextHolder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -32,6 +36,8 @@
 
 @Service("TripartiteInterfaceService")
 public class TripartiteInterfaceServiceImpl implements TripartiteInterfaceService {
+    private Logger logger = LoggerFactory.getLogger(TripartiteInterfaceServiceImpl.class);
+
     @Autowired
     private ThQuestionBankService questionBankService;
     @Autowired
@@ -45,7 +51,7 @@
     @Autowired
     private ThBatchCourseService batchCourseService;
     @Autowired
-    private ThStudentCourseService studentCourseService;
+    private ThStudentBatchService studentBatchService;
     @Autowired
     private ThStudyAuthService studyAuthService;
     @Autowired
@@ -54,6 +60,9 @@
     private ThStudyDetailService studyDetailService;
     @Autowired
     private ThExamRecordService examRecordService;
+
+    @Autowired
+    private ThBatchCourseChapterService batchCourseChapterService;
 
     @Override
     public boolean receiveQuestionBank(JSONObject jsonObject) {
@@ -71,7 +80,16 @@
             throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL);
         }
         //反序列化
-        ThQuestionBankReqDTO questionBankReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThQuestionBankReqDTO>() {});
+        ThQuestionBankReqDTO questionBankReqDTO = null;
+        try {
+            questionBankReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThQuestionBankReqDTO>() {});
+
+        }catch (Exception e){
+            logger.error("组卷反序列化失败!");
+            throw new BusinessException(this.getClass(), ResultConstants.SERIALIZE_ERROR);
+
+        }
+
         //参数校验
         validateQuestion(questionBankReqDTO);
         //根据uuid查询数据
@@ -88,7 +106,7 @@
             qb.setUpdateTime(LocalDateTime.now());
             qb.setCreateBy(institutionUser.getInstitutionalName());
             qb.setUpdateBy(institutionUser.getInstitutionalName());
-            qb.setDelFlag(DeleteStatusEnum.NO.getStatus());
+            //qb.setDelFlag(DeleteStatusEnum.NO.getStatus());
             i = questionBankService.save(qb);
         }else {
             //修改
@@ -113,162 +131,340 @@
         }catch (Exception e){
             throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL);
         }
+        List<ThCourseReqDTO> courseReqDTOList = new ArrayList<>();
         //反序列化
-        ThCourseReqDTO courseReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThCourseReqDTO>() {});
-        //校验
-        validateCourse(courseReqDTO);
-        //获取数据
-        ThCourse course= courseService.getByUuid(courseReqDTO.getUuid());
-        if(course == null){
-            //新增
-            //课程
-            course = new ThCourse();
-            BeanUtils.copyProperties(courseReqDTO, course);
-            course.setId(IdUtil.getSnowflake(0,0).nextId());
-            course.setCreateTime(LocalDateTime.now());
-            course.setUpdateTime(LocalDateTime.now());
-            course.setCreateBy(institutionUser.getInstitutionalName());
-            course.setUpdateBy(institutionUser.getInstitutionalName());
-            course.setInstitutionId(institutionUser.getId());
-            course.setDelFlag(DeleteStatusEnum.NO.getStatus());
-            course.setInstitutionName(institutionUser.getInstitutionalName());
+        try {
+            courseReqDTOList = JSONObject.parseObject(decrypt, new TypeReference<List<ThCourseReqDTO>>() {});
 
-            //章节(章)
-            List<ThCourseChapter> chapterList = new ArrayList<>();
-            for (ThCourseChapterReqDTO chapterReqDTO : courseReqDTO.getChapters()) {
-                ThCourseChapter chapter = new ThCourseChapter();
-                BeanUtils.copyProperties(chapterReqDTO, chapter);
-                chapter.setCourseUuid(course.getUuid());
-                chapter.setId(IdUtil.getSnowflake(0,0).nextId());
-                chapter.setParentUuid("0");
-                chapter.setInstitutionId(institutionUser.getId());
-                chapter.setCreateTime(LocalDateTime.now());
-                chapter.setUpdateTime(LocalDateTime.now());
-                chapter.setDelFlag(DeleteStatusEnum.NO.getStatus());
-                chapter.setCreateBy(institutionUser.getInstitutionalName());
-                chapter.setUpdateBy(institutionUser.getInstitutionalName());
-                chapterList.add(chapter);
-                //章节(节)
-                for (ThCourseChapterReqDTO child : chapterReqDTO.getChildren()) {
-                    ThCourseChapter section = new ThCourseChapter();
-                    BeanUtils.copyProperties(child, section);
-                    section.setCourseUuid(course.getUuid());
-                    section.setId(IdUtil.getSnowflake(0,0).nextId());
-                    section.setParentUuid(chapter.getUuid());
-                    section.setInstitutionId(institutionUser.getId());
-                    section.setCreateTime(LocalDateTime.now());
-                    section.setUpdateTime(LocalDateTime.now());
-                    section.setDelFlag(DeleteStatusEnum.NO.getStatus());
-                    section.setCreateBy(institutionUser.getInstitutionalName());
-                    section.setUpdateBy(institutionUser.getInstitutionalName());
-                    chapterList.add(section);
+        }catch (Exception e){
+            logger.error("课程反序列化失败!");
+            throw new BusinessException(this.getClass(), ResultConstants.SERIALIZE_ERROR);
+
+        }
+
+        if(CollectionUtils.isEmpty(courseReqDTOList)){
+            throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_ERROR,"数据推送不可以为空");
+        }
+        //暂时不限制不能超过1000条
+        List<String> reqAllCourseIds = new ArrayList<>();
+        List<String> reqAllChapterIds = new ArrayList<>();
+        List<ThErrorDataRespDTO> errorDataRespDTOS = new ArrayList<>();
+        List<ThCourseReqDTO> saveCourseReqDTOList = new ArrayList<>();
+        for (ThCourseReqDTO courseReqDTO : courseReqDTOList) {
+            if(StringUtils.isEmpty(courseReqDTO.getUuid()) || !UUID.checkIsUuid(courseReqDTO.getUuid())){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(courseReqDTO.getUuid(),"课程uuid不符合规范"));
+                continue;
+            }
+            if(StringUtils.isEmpty(courseReqDTO.getCourseCode())){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(courseReqDTO.getUuid(),"课程标识不可为空"));
+                continue;
+            }
+            if(StringUtils.isEmpty(courseReqDTO.getCourseName())){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(courseReqDTO.getUuid(),"课程名称不可为空"));
+                continue;
+            }
+            if(StringUtils.isEmpty(courseReqDTO.getTrainOrgName())){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(courseReqDTO.getUuid(),"培训机构名称不可为空"));
+                continue;
+            }
+            if(courseReqDTO.getLessonNum() == null){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(courseReqDTO.getUuid(),"课程总课时不可为空"));
+                continue;
+            }
+            if(CollectionUtils.isEmpty(courseReqDTO.getChapters())){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(courseReqDTO.getUuid(),"课程大纲(大章)不可为空"));
+                continue;
+            }
+            //章
+            boolean errorflag = false;
+            List<String> chapterIds = new ArrayList<>();
+            for (ThCourseChapterReqDTO chapter : courseReqDTO.getChapters()) {
+
+                if(StringUtils.isEmpty(chapter.getUuid()) || !UUID.checkIsUuid(chapter.getUuid())){
+                    errorflag = true;
+                    errorDataRespDTOS.add(new ThErrorDataRespDTO(courseReqDTO.getUuid(),"章uuid("+chapter.getUuid()+")不符合规范"));
+                    break;
                 }
-
-            }
-            courseService.save(course);
-            if(chapterList.size() > 0){
-                courseChapterService.saveBatch(chapterList);
-            }
-
-        }else {
-
-            //获取所有章节
-            List<ThCourseChapterVO> courseChapterVOS = courseChapterService.listByCourseUuid(course.getUuid());
-            //修改
-            //章
-            List<ThCourseChapter> saveChapterList = new ArrayList<>();
-            List<ThCourseChapter> updateChapterList = new ArrayList<>();
-            //章
-            for (ThCourseChapterReqDTO chapterReqDTO : courseReqDTO.getChapters()) {
-                List<ThCourseChapterVO> chapterSelectList = courseChapterVOS.stream().filter(cc -> cc.getUuid().equals(chapterReqDTO.getUuid())).collect(Collectors.toList());
-                if(chapterSelectList.size() > 0){
-                    ThCourseChapterVO courseChapterVO = chapterSelectList.get(0);
-                    //修改
-                    ThCourseChapter chapter = new ThCourseChapter();
-                    BeanUtils.copyProperties(chapterReqDTO, chapter);
-                    chapter.setId(courseChapterVO.getId());
-                    chapter.setUpdateBy(institutionUser.getInstitutionalName());
-                    chapter.setUpdateTime(LocalDateTime.now());
-                    updateChapterList.add(chapter);
-
-                    for (ThCourseChapterReqDTO child : chapterReqDTO.getChildren()) {
-                        List<ThCourseChapterVO> sectionSelectList = courseChapterVOS.stream().filter(cc -> cc.getUuid().equals(child.getUuid()) && cc.getParentUuid().equals(courseChapterVO.getUuid())).collect(Collectors.toList());
-                        if(sectionSelectList.size() > 0){
-                            //修改
-                            ThCourseChapterVO sectionChapterVO = sectionSelectList.get(0);
-                            ThCourseChapter section = new ThCourseChapter();
-                            BeanUtils.copyProperties(child, section);
-                            section.setId(sectionChapterVO.getId());
-                            section.setUpdateBy(institutionUser.getInstitutionalName());
-                            section.setUpdateTime(LocalDateTime.now());
-                            updateChapterList.add(section);
-                        }else {
-                            //新增
-                            ThCourseChapter sectionChapter= new ThCourseChapter();
-                            BeanUtils.copyProperties(child, sectionChapter);
-                            sectionChapter.setId(IdUtil.getSnowflake(0,0).nextId());
-                            sectionChapter.setCourseUuid(course.getUuid());
-                            sectionChapter.setParentUuid(courseChapterVO.getUuid());
-                            sectionChapter.setInstitutionId(institutionUser.getId());
-                            sectionChapter.setDelFlag(DeleteStatusEnum.NO.getStatus());
-                            sectionChapter.setUpdateBy(institutionUser.getInstitutionalName());
-                            sectionChapter.setUpdateTime(LocalDateTime.now());
-                            sectionChapter.setCreateBy(institutionUser.getInstitutionalName());
-                            sectionChapter.setCreateTime(LocalDateTime.now());
-                            saveChapterList.add(sectionChapter);
-                        }
+                if(StringUtils.isEmpty(chapter.getChapterCode())){
+                    errorflag = true;
+                    errorDataRespDTOS.add(new ThErrorDataRespDTO(courseReqDTO.getUuid(),"章节(大章)("+chapter.getUuid()+")标识不可为空"));
+                    break;
+                }
+                if(StringUtils.isEmpty(chapter.getChapterName())){
+                    errorflag = true;
+                    errorDataRespDTOS.add(new ThErrorDataRespDTO(courseReqDTO.getUuid(),"章节(大章)("+chapter.getUuid()+")名称不可为空"));
+                    break;
+                }
+                if(chapter.getDelFlag() == null || DeleteStatusEnum.getDeleteStatusEnum(chapter.getDelFlag()) == null ){
+                    errorflag = true;
+                    errorDataRespDTOS.add(new ThErrorDataRespDTO(courseReqDTO.getUuid(),"章节(大章)("+chapter.getUuid()+")删除标识不符合规范"));
+                    break;
+                }
+                if (chapter.getLessonNum() == null){
+                    errorflag = true;
+                    errorDataRespDTOS.add(new ThErrorDataRespDTO(courseReqDTO.getUuid(),"章节(大章)("+chapter.getUuid()+")课时(保留1位小数)不可为空"));
+                    break;
+                }
+                if (chapter.getSerialno() == null){
+                    errorflag = true;
+                    errorDataRespDTOS.add(new ThErrorDataRespDTO(courseReqDTO.getUuid(),"章节(大章)("+chapter.getUuid()+")序号不可为空"));
+                    break;
+                }
+                if(chapter.getHaveResource() == null || CourseHaveResourse.get(chapter.getHaveResource()) == null){
+                    errorflag = true;
+                    errorDataRespDTOS.add(new ThErrorDataRespDTO(courseReqDTO.getUuid(),"章节(大章)("+chapter.getUuid()+")是否有资源不符合规范"));
+                    break;
+                }
+                if(CollectionUtils.isEmpty(chapter.getChildren())){
+                    errorflag = true;
+                    errorDataRespDTOS.add(new ThErrorDataRespDTO(courseReqDTO.getUuid(),"章节(大章)("+chapter.getUuid()+")包含的章节(小节)列表不可为空"));
+                    break;
+                }
+                List<String> sectionIds = new ArrayList<>();
+                for (ThCourseChapterReqDTO child : chapter.getChildren()) {
+                    if(StringUtils.isEmpty(child.getUuid()) || !UUID.checkIsUuid(child.getUuid())){
+                        errorflag = true;
+                        errorDataRespDTOS.add(new ThErrorDataRespDTO(courseReqDTO.getUuid(),"章节(小节)uuid("+child.getUuid()+")不符合规范"));
+                        break;
                     }
-                }else {
-                    //新增
+                    if(StringUtils.isEmpty(child.getChapterCode())){
+                        errorflag = true;
+                        errorDataRespDTOS.add(new ThErrorDataRespDTO(courseReqDTO.getUuid(),"章节(小节)("+child.getUuid()+")标识不可为空"));
+                        break;
+                    }
+                    if(StringUtils.isEmpty(child.getChapterName())){
+                        errorflag = true;
+                        errorDataRespDTOS.add(new ThErrorDataRespDTO(courseReqDTO.getUuid(),"章节(小节)("+child.getUuid()+")名称不可为空"));
+                        break;
+                    }
+                    if(child.getDuration() == null){
+                        errorflag = true;
+                        errorDataRespDTOS.add(new ThErrorDataRespDTO(courseReqDTO.getUuid(),"章节(小节)("+child.getUuid()+")视频时长(秒)不可为空"));
+                        break;
+                    }
+                    if (chapter.getSerialno() == null){
+                        errorflag = true;
+                        errorDataRespDTOS.add(new ThErrorDataRespDTO(courseReqDTO.getUuid(),"章节(小节)("+child.getUuid()+")序号不可为空"));
+                        break;
+                    }
+                    if (child.getLessonNum() == null){
+                        errorflag = true;
+                        errorDataRespDTOS.add(new ThErrorDataRespDTO(courseReqDTO.getUuid(),"章节(小节)("+child.getUuid()+")课时(保留1位小数)不可为空"));
+                        break;
+                    }
+                    if(child.getResourceType() == null || CourseResourceType.get(child.getResourceType()) == null){
+                        errorflag = true;
+                        errorDataRespDTOS.add(new ThErrorDataRespDTO(courseReqDTO.getUuid(),"章节(小节)"+child.getUuid()+"资源类型不规范"));
+                        break;
+                    }
+                    if(child.getDelFlag() == null || DeleteStatusEnum.getDeleteStatusEnum(child.getDelFlag()) == null ){
+                        errorflag = true;
+                        errorDataRespDTOS.add(new ThErrorDataRespDTO(courseReqDTO.getUuid(),"章节(小节)("+child.getUuid()+")删除标识不符合规范"));
+                        break;
+                    }
+                    if(child.getHaveResource() == null || CourseHaveResourse.get(child.getHaveResource()) == null){
+                        errorflag = true;
+                        errorDataRespDTOS.add(new ThErrorDataRespDTO(courseReqDTO.getUuid(),"章节(小节)("+chapter.getUuid()+")是否有资源不符合规范"));
+                        break;
+                    }
+                    sectionIds.add(child.getUuid());
+                }
+                if(errorflag){
+                    break;
+                }
+                //章
+                chapterIds.add(chapter.getUuid());
+                //节
+                chapterIds.addAll(sectionIds);
+            }
+            if(errorflag){
+                continue;
+            }
+
+            reqAllCourseIds.add(courseReqDTO.getUuid());
+            reqAllChapterIds.addAll(chapterIds);
+            saveCourseReqDTOList.add(courseReqDTO);
+        }
+
+        //获取课程数据
+        List<ThCourse> oldCourseList = courseService.getByUuidList(reqAllCourseIds);
+        //获取章节数据
+        List<ThCourseChapter> oldCourseChapterList = courseChapterService.getByUuids(reqAllChapterIds);
+        //变量
+        List<ThCourse> saveCourseList = new ArrayList<>();
+        List<ThCourse> updateCourseList = new ArrayList<>();
+        List<ThCourseChapter> updateCourseChapterList = new ArrayList<>();
+        List<ThCourseChapter> saveCourseChapterList = new ArrayList<>();
+        //获取数据
+        for (ThCourseReqDTO courseReqDTO : saveCourseReqDTOList){
+            List<ThCourse> oCourseSelectList = oldCourseList.stream().filter(oc -> oc.getUuid().equals(courseReqDTO.getUuid())).collect(Collectors.toList());
+            if(oCourseSelectList.size() == 0){
+                //新增
+                //课程
+                ThCourse course = new ThCourse();
+                BeanUtils.copyProperties(courseReqDTO, course);
+                course.setId(IdUtil.getSnowflake(0,0).nextId());
+                course.setCreateTime(LocalDateTime.now());
+                course.setUpdateTime(LocalDateTime.now());
+                course.setCreateBy(institutionUser.getInstitutionalName());
+                course.setUpdateBy(institutionUser.getInstitutionalName());
+                course.setInstitutionId(institutionUser.getId());
+                course.setDelFlag(DeleteStatusEnum.NO.getStatus());
+                course.setInstitutionName(institutionUser.getInstitutionalName());
+                saveCourseList.add(course);
+                //章节(章)
+                for (ThCourseChapterReqDTO chapterReqDTO : courseReqDTO.getChapters()) {
                     ThCourseChapter chapter = new ThCourseChapter();
                     BeanUtils.copyProperties(chapterReqDTO, chapter);
+                    chapter.setCourseUuid(course.getUuid());
                     chapter.setId(IdUtil.getSnowflake(0,0).nextId());
                     chapter.setParentUuid("0");
-                    chapter.setCourseUuid(course.getUuid());
                     chapter.setInstitutionId(institutionUser.getId());
-                    chapter.setDelFlag(DeleteStatusEnum.NO.getStatus());
                     chapter.setCreateTime(LocalDateTime.now());
                     chapter.setUpdateTime(LocalDateTime.now());
+                    //chapter.setDelFlag(DeleteStatusEnum.NO.getStatus());
                     chapter.setCreateBy(institutionUser.getInstitutionalName());
                     chapter.setUpdateBy(institutionUser.getInstitutionalName());
-                    saveChapterList.add(chapter);
+                    saveCourseChapterList.add(chapter);
                     //章节(节)
                     for (ThCourseChapterReqDTO child : chapterReqDTO.getChildren()) {
                         ThCourseChapter section = new ThCourseChapter();
                         BeanUtils.copyProperties(child, section);
+                        section.setCourseUuid(course.getUuid());
                         section.setId(IdUtil.getSnowflake(0,0).nextId());
                         section.setParentUuid(chapter.getUuid());
-                        section.setCourseUuid(course.getUuid());
-                        section.setDelFlag(DeleteStatusEnum.NO.getStatus());
                         section.setInstitutionId(institutionUser.getId());
                         section.setCreateTime(LocalDateTime.now());
                         section.setUpdateTime(LocalDateTime.now());
+                        //section.setDelFlag(DeleteStatusEnum.NO.getStatus());
                         section.setCreateBy(institutionUser.getInstitutionalName());
                         section.setUpdateBy(institutionUser.getInstitutionalName());
-                        saveChapterList.add(section);
+                        saveCourseChapterList.add(section);
+                    }
+                }
+            }else {
+                ThCourse course = oCourseSelectList.get(0);
+                //课程
+                course.setCourseCode(courseReqDTO.getCourseCode());
+                course.setCourseName(courseReqDTO.getCourseName());
+                course.setLessonNum(courseReqDTO.getLessonNum());
+                //course.setDelFlag(DeleteStatusEnum.NO.getStatus());
+                course.setUpdateBy(institutionUser.getInstitutionalName());
+                course.setUpdateTime(LocalDateTime.now());
+                updateCourseList.add(course);
+                //过滤该课程所有章节
+                List<ThCourseChapter> oldCourseChapterSelectList = oldCourseChapterList.stream().filter(occ -> occ.getCourseUuid().equals(course.getUuid())).collect(Collectors.toList());
+                //修改
+                //章
+               /* List<ThCourseChapter> saveChapterList = new ArrayList<>();
+                List<ThCourseChapter> updateChapterList = new ArrayList<>();*/
+                //章
+                for (ThCourseChapterReqDTO chapterReqDTO : courseReqDTO.getChapters()) {
+                    List<ThCourseChapter> chapterSelectList = oldCourseChapterSelectList.stream().filter(cc -> cc.getUuid().equals(chapterReqDTO.getUuid())).collect(Collectors.toList());
+                    if(chapterSelectList.size() > 0){
+                        //存在,修改
+                        ThCourseChapter chapter = chapterSelectList.get(0);
+                        BeanUtils.copyProperties(chapterReqDTO, chapter);
+                        chapter.setUpdateBy(institutionUser.getInstitutionalName());
+                        chapter.setUpdateTime(LocalDateTime.now());
+                        updateCourseChapterList.add(chapter);
+
+                        if(chapterReqDTO.getDelFlag().equals(DeleteStatusEnum.NO.getStatus())){
+                            //非删除(章)
+                            for (ThCourseChapterReqDTO child : chapterReqDTO.getChildren()) {
+                                List<ThCourseChapter> sectionSelectList = oldCourseChapterSelectList.stream().filter(cc -> cc.getUuid().equals(child.getUuid()) && cc.getParentUuid().equals(chapter.getUuid())).collect(Collectors.toList());
+                                if(sectionSelectList.size() > 0){
+                                    //修改
+                                    ThCourseChapter section = sectionSelectList.get(0);
+                                    BeanUtils.copyProperties(child, section);
+                                    section.setUpdateBy(institutionUser.getInstitutionalName());
+                                    section.setUpdateTime(LocalDateTime.now());
+                                    updateCourseChapterList.add(section);
+                                }else {
+                                    //新增
+                                    ThCourseChapter section= new ThCourseChapter();
+                                    BeanUtils.copyProperties(child, section);
+                                    section.setId(IdUtil.getSnowflake(0,0).nextId());
+                                    section.setCourseUuid(course.getUuid());
+                                    section.setParentUuid(chapter.getUuid());
+                                    section.setInstitutionId(institutionUser.getId());
+                                    //section.setDelFlag(DeleteStatusEnum.NO.getStatus());
+                                    section.setUpdateBy(institutionUser.getInstitutionalName());
+                                    section.setUpdateTime(LocalDateTime.now());
+                                    section.setCreateBy(institutionUser.getInstitutionalName());
+                                    section.setCreateTime(LocalDateTime.now());
+                                    saveCourseChapterList.add(section);
+                                }
+                            }
+                        }else{
+                            //删除(章)
+                            List<ThCourseChapter> sectionSelectList = oldCourseChapterSelectList
+                                    .stream()
+                                    .filter(cc -> cc.getParentUuid().equals(chapter.getUuid()))
+                                    .collect(Collectors.toList());
+                            sectionSelectList.forEach(section ->{
+                                section.setUpdateBy(institutionUser.getInstitutionalName());
+                                section.setUpdateTime(LocalDateTime.now());
+                                section.setDelFlag(DeleteStatusEnum.YES.getStatus());
+                            });
+                            updateCourseChapterList.addAll(sectionSelectList);
+                        }
+
+                    }else {
+                        //不存在,新增
+                        ThCourseChapter chapter = new ThCourseChapter();
+                        BeanUtils.copyProperties(chapterReqDTO, chapter);
+                        chapter.setId(IdUtil.getSnowflake(0,0).nextId());
+                        chapter.setParentUuid("0");
+                        chapter.setCourseUuid(course.getUuid());
+                        chapter.setInstitutionId(institutionUser.getId());
+                        //chapter.setDelFlag(chapter.getDelFlag());
+                        chapter.setCreateTime(LocalDateTime.now());
+                        chapter.setUpdateTime(LocalDateTime.now());
+                        chapter.setCreateBy(institutionUser.getInstitutionalName());
+                        chapter.setUpdateBy(institutionUser.getInstitutionalName());
+                        saveCourseChapterList.add(chapter);
+                        //章节(节)
+                        for (ThCourseChapterReqDTO child : chapterReqDTO.getChildren()) {
+                            ThCourseChapter section = new ThCourseChapter();
+                            BeanUtils.copyProperties(child, section);
+                            section.setId(IdUtil.getSnowflake(0,0).nextId());
+                            section.setParentUuid(chapter.getUuid());
+                            section.setCourseUuid(course.getUuid());
+                            //section.setDelFlag(child.getDelFlag());
+                            section.setInstitutionId(institutionUser.getId());
+                            section.setCreateTime(LocalDateTime.now());
+                            section.setUpdateTime(LocalDateTime.now());
+                            section.setCreateBy(institutionUser.getInstitutionalName());
+                            section.setUpdateBy(institutionUser.getInstitutionalName());
+                            saveCourseChapterList.add(section);
+                        }
                     }
                 }
             }
-
-            //课程
-            course.setCourseCode(courseReqDTO.getCourseCode());
-            course.setCourseName(courseReqDTO.getCourseName());
-            course.setLessonNum(courseReqDTO.getLessonNum());
-            course.setDelFlag(DeleteStatusEnum.NO.getStatus());
-            course.setUpdateBy(institutionUser.getInstitutionalName());
-            course.setUpdateTime(LocalDateTime.now());
-            courseService.updateById(course);
-            //新增章节
-            if(saveChapterList.size() > 0){
-                courseChapterService.saveBatch(saveChapterList);
-            }
-            //修改章节
-            if(updateChapterList.size() > 0){
-                courseChapterService.updateBatchById(updateChapterList);
-            }
-
         }
-        return AjaxResult.success();
+        //数据插入
+        //课程插入
+        List<List<ThCourse>> splitSaveCourseList = ListUtil.split(saveCourseList, 500);
+        for(List<ThCourse> courseList : splitSaveCourseList){
+            courseService.insertBatch(courseList);
+        }
+        //修改课程
+        List<List<ThCourse>> splitUpdateCourseList = ListUtil.split(updateCourseList, 500);
+        for(List<ThCourse> courseList : splitUpdateCourseList){
+            courseService.updateBatch(courseList);
+        }
+        //插入章节
+        List<List<ThCourseChapter>> splitSaveChapterList = ListUtil.split(saveCourseChapterList, 500);
+        for(List<ThCourseChapter> chapterList : splitSaveChapterList){
+            courseChapterService.insertBatch(chapterList);
+        }
+        //修改章节
+        List<List<ThCourseChapter>> splitUpdateChapterList = ListUtil.split(updateCourseChapterList, 500);
+        for(List<ThCourseChapter> chapterList : splitUpdateChapterList){
+            courseChapterService.updateBatch(chapterList);
+        }
+        return AjaxResult.success(errorDataRespDTOS);
     }
 
     @Transactional
@@ -288,95 +484,99 @@
             throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL);
         }
         //反序列化
-        List<ThStudentReqDTO> studentReqDTOs = JSONObject.parseObject(decrypt, new TypeReference<List<ThStudentReqDTO>>() {});
-        //获取批次课程
-        List<ThBatchCourse> batchCourseList = batchCourseService.listByInstitutionId(institutionUser.getId());
-        //获取批次学生
-        List<ThStudentCourse> studentCourseList = studentCourseService.listByInstitutionId(institutionUser.getId());
+        List<ThStudentReqDTO> studentReqDTOs = new ArrayList<>();
+        try {
+            studentReqDTOs = JSONObject.parseObject(decrypt, new TypeReference<List<ThStudentReqDTO>>() {});
+        }catch (Exception e){
+            logger.error("学员序列化失败!");
+            throw new BusinessException(this.getClass(), ResultConstants.SERIALIZE_ERROR);
+        }
         //参数校验
         if(CollectionUtils.isEmpty(studentReqDTOs)){
             throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"学生信息不可为空");
         }
+
+        List<String> idcardList = new ArrayList<>();
+        List<String> batchUuidList = new ArrayList<>();
+        for(ThStudentReqDTO studentReqDTO : studentReqDTOs){
+            //去重
+            if(!idcardList.contains(studentReqDTO.getIdcard()) && StringUtils.isNotEmpty(studentReqDTO.getIdcard())){
+                idcardList.add(studentReqDTO.getIdcard());
+            }
+            if(!batchUuidList.contains(studentReqDTO.getBatchUuid()) && StringUtils.isNotEmpty(studentReqDTO.getBatchUuid())){
+                batchUuidList.add(studentReqDTO.getBatchUuid());
+            }
+
+        }
+        //获取批次
+        List<ThBatch> batchList = batchService.getByUuids(batchUuidList);
+        //获取批次学生
+        List<ThStudentBatch> studentBatchList = studentBatchService.getByIdCards(idcardList);
+        //获取学生表学生
+        List<ThStudent> students = studentService.getByIdcards(idcardList);
         //错误
         List<ThErrorDataRespDTO> errorDataRespDTOS = new ArrayList<>();
-        List<ThStudentReqDTO> studentReqDTOList = new ArrayList<>();
+        List<ThStudentReqDTO> saveStudentReqDTOList = new ArrayList<>();
         for (ThStudentReqDTO studentReqDTO : studentReqDTOs) {
-
+            if(StringUtils.isEmpty(studentReqDTO.getUuid()) || !UUID.checkIsUuid(studentReqDTO.getUuid())){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getUuid(),"学生uuid不符合规范"));
+                continue;
+            }
             if(StringUtils.isEmpty(studentReqDTO.getIdcard())){
-                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getIdcard(),"身份证不可为空"));
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getUuid(),"身份证不可为空"));
                 continue;
             }
             if(StringUtils.isEmpty(studentReqDTO.getName())){
-                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getIdcard(),"姓名不可为空"));
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getUuid(),"姓名不可为空"));
                 continue;
             }
             if(StringUtils.isEmpty(studentReqDTO.getPhone())){
-                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getIdcard(),"手机号不可为空"));
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getUuid(),"手机号不可为空"));
                 continue;
             }
             if(studentReqDTO.getSex() == null || StudentSex.get(studentReqDTO.getSex()) == null){
-                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getIdcard(),"性别不可为空"));
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getUuid(),"性别不可为空"));
                 continue;
             }
             if(StringUtils.isEmpty(studentReqDTO.getAuthPhoto())){
-                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getIdcard(),"实名认证照不可为空"));
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getUuid(),"实名认证照不可为空"));
                 continue;
             }
+            if(studentReqDTO.getDelFlag() == null || DeleteStatusEnum.getDeleteStatusEnum(studentReqDTO.getDelFlag()) == null ){
+                throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"学生删除标识不符合规范");
+            }
             if (StringUtils.isEmpty(studentReqDTO.getTrainOrgName())){
-                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getIdcard(),"培训机构名称不可为空"));
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getUuid(),"培训机构名称不可为空"));
                 continue;
             }
             if(StringUtils.isEmpty(studentReqDTO.getBatchUuid())){
-                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getIdcard(),"关联批次(班级)不可为空"));
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getUuid(),"关联批次(班级)不可为空"));
                 continue;
             }
-            List<ThBatchCourse> collect = batchCourseList.stream().filter(batchCourse -> batchCourse.getBatchUuid().equals(studentReqDTO.getBatchUuid())).collect(Collectors.toList());
+            List<ThBatch> collect = batchList.stream().filter(batchCourse -> batchCourse.getUuid().equals(studentReqDTO.getBatchUuid())).collect(Collectors.toList());
             if (CollectionUtils.isEmpty(collect)) {
-                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getIdcard(), "批次(班级)不存在,请先添加批次(班级)"));
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getUuid(), "批次(班级)不存在,请先添加批次(班级)"));
                 continue;
             }
-            List<ThStudentCourse> collect1 = studentCourseList.stream().filter(student -> student.getBatchUuid().equals(studentReqDTO.getBatchUuid()) && student.getIdcard().equals(studentReqDTO.getIdcard())).collect(Collectors.toList());
-            if (!CollectionUtils.isEmpty(collect1)) {
-                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getIdcard(), "学生不可重复加入批次(班级)"));
-                continue;
-            }
-            studentReqDTOList.add(studentReqDTO);
+            saveStudentReqDTOList.add(studentReqDTO);
         }
-        if(CollectionUtils.isEmpty(studentReqDTOList)){
-            return AjaxResult.success(errorDataRespDTOS);
-        }
-        //根据idcards查询
-        List<String> idcards = studentReqDTOList.stream().map(ThStudentReqDTO::getIdcard).collect(Collectors.toList());
-        List<ThStudent> students = studentService.getByIdcards(idcards);
-        //List<ThStudentCourse> thStudentCourseList = studentCourseService.getByIdCards(idcards);
 
         List<ThStudent> saveSudentList = new ArrayList<>();
-        List<ThStudentCourse> saveThStudentCourseList = new ArrayList<>();
         List<ThStudent> updateStudentList = new ArrayList<>();
-        for (ThStudentReqDTO studentReqDTO : studentReqDTOList) {
+        List<ThStudentBatch> saveThStudentBatchList = new ArrayList<>();
+        List<ThStudentBatch> updateThStudentBatchList = new ArrayList<>();
+        for (ThStudentReqDTO studentReqDTO : saveStudentReqDTOList) {
+            //学生表中过滤
             List<ThStudent> collect = students.stream().filter(s -> s.getIdcard().equals(studentReqDTO.getIdcard())).collect(Collectors.toList());
             if(collect.size() > 0){
-
-                //修改
                 ThStudent student = collect.get(0);
+                //修改
                 BeanUtils.copyProperties(studentReqDTO, student);
                 student.setUpdateBy(institutionUser.getInstitutionalName());
                 student.setUpdateTime(LocalDateTime.now());
                 student.setInstitutionId(institutionUser.getId());
                 student.setInstitutionName(institutionUser.getInstitutionalName());
                 updateStudentList.add(student);
-
-                List<ThBatchCourse> scSelectList = batchCourseList.stream().filter(batchCourse -> batchCourse.getBatchUuid().equals(studentReqDTO.getBatchUuid())).collect(Collectors.toList());
-                for (ThBatchCourse thStudentCourse : scSelectList) {
-                    //新增
-                    ThStudentCourse sc = new ThStudentCourse();
-                    BeanUtils.copyProperties(student, sc);
-                    sc.setId(IdUtil.getSnowflake(0,0).nextId());
-                    sc.setCourseUuid(thStudentCourse.getCourseUuid());
-                    sc.setBatchUuid(thStudentCourse.getBatchUuid());
-                    sc.setFinishStatus(FinishStatus.NO.getStatus());
-                    saveThStudentCourseList.add(sc);
-                }
             }else {
                 //新增
                 ThStudent student = new ThStudent();
@@ -390,27 +590,64 @@
                 student.setInstitutionName(institutionUser.getInstitutionalName());
                 student.setDelFlag(DeleteStatusEnum.NO.getStatus());
                 saveSudentList.add(student);
-
-                List<ThBatchCourse> scSelectList = batchCourseList.stream().filter(batchCourse -> batchCourse.getBatchUuid().equals(studentReqDTO.getBatchUuid())).collect(Collectors.toList());
-                for (ThBatchCourse batchCourse : scSelectList) {
-                    ThStudentCourse thStudentCourse = new ThStudentCourse();
-                    BeanUtils.copyProperties(student, thStudentCourse);
-                    thStudentCourse.setId(IdUtil.getSnowflake(0,0).nextId());
-                    thStudentCourse.setCourseUuid(batchCourse.getCourseUuid());
-                    thStudentCourse.setBatchUuid(batchCourse.getBatchUuid());
-                    thStudentCourse.setFinishStatus(FinishStatus.NO.getStatus());
-                    saveThStudentCourseList.add(thStudentCourse);
+            }
+            //获取班级学生
+            List<ThStudentBatch> selectBatchStudentList = studentBatchList.stream()
+                    .filter(sb -> sb.getBatchUuid().equals(studentReqDTO.getBatchUuid())
+                    && sb.getIdcard().equals(studentReqDTO.getIdcard()))
+                    .collect(Collectors.toList());
+            //判断是否存在(已经加入过该班级)
+            if(selectBatchStudentList.size() > 0){
+                ThStudentBatch thStudentBatch = selectBatchStudentList.get(0);
+                //存在
+                if(studentReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())){
+                    //删除(学生退出班级)
+                    thStudentBatch.setDelFlag(DeleteStatusEnum.YES.getStatus());
+                    updateThStudentBatchList.add(thStudentBatch);
+                }else {
+                    //修改
+                    BeanUtils.copyProperties(studentReqDTO, thStudentBatch);
+                    thStudentBatch.setUpdateBy(institutionUser.getInstitutionalName());
+                    thStudentBatch.setUpdateTime(LocalDateTime.now());
+                    updateThStudentBatchList.add(thStudentBatch);
                 }
+
+            }else {
+                //不存在,新增
+                ThStudentBatch thStudentBatch = new ThStudentBatch();
+                BeanUtils.copyProperties(studentReqDTO, thStudentBatch);
+                thStudentBatch.setId(IdUtil.getSnowflake(0,0).nextId());
+                thStudentBatch.setUpdateBy(institutionUser.getInstitutionalName());
+                thStudentBatch.setUpdateTime(LocalDateTime.now());
+                thStudentBatch.setCreateBy(institutionUser.getInstitutionalName());
+                thStudentBatch.setCreateTime(LocalDateTime.now());
+                thStudentBatch.setInstitutionId(institutionUser.getId());
+                thStudentBatch.setInstitutionName(institutionUser.getInstitutionalName());
+                thStudentBatch.setFinishStatus(FinishStatus.NO.getStatus());
+                thStudentBatch.setDelFlag(DeleteStatusEnum.NO.getStatus());
+                saveThStudentBatchList.add(thStudentBatch);
             }
         }
-        if(saveSudentList.size() > 0){
-            studentService.saveBatch(saveSudentList);
+        //学生表新增
+        List<List<ThStudent>> splitSaveStudentList = ListUtil.split(saveSudentList, 500);
+        for (List<ThStudent> studentList : splitSaveStudentList) {
+            studentService.insertBatch(studentList);
         }
-        if(updateStudentList.size() > 0){
-            studentService.updateByIdcard(updateStudentList);
+        //学生表更新
+        List<List<ThStudent>> splitUpdateStudentList = ListUtil.split(updateStudentList, 500);
+        for (List<ThStudent> studentList : splitUpdateStudentList) {
+            studentService.updateBatch(studentList);
         }
-        if(saveThStudentCourseList.size() > 0){
-            studentCourseService.saveBatch(saveThStudentCourseList);
+        //学生关联班级表
+        List<List<ThStudentBatch>> splitSaveThStudentBatchList = ListUtil.split(saveThStudentBatchList, 500);
+        for (List<ThStudentBatch> studentBatcheList : splitSaveThStudentBatchList) {
+            studentBatchService.insertBatch(studentBatcheList);
+        }
+
+        //学生关联班级表修改
+        List<List<ThStudentBatch>> splitUpdateThStudentBatchList = ListUtil.split(updateThStudentBatchList, 500);
+        for (List<ThStudentBatch> studentBatcheList : splitUpdateThStudentBatchList) {
+            studentBatchService.updateBatch(studentBatcheList);
         }
         return AjaxResult.success(errorDataRespDTOS);
     }
@@ -437,81 +674,573 @@
             throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL);
         }
         //反序列化
-        ThBatchReqDTO batchReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThBatchReqDTO>() {});
-        //参数校验
-        validateBatch(batchReqDTO);
-        //获取数据
-        ThBatch batch = batchService.getByUuid(batchReqDTO.getUuid());
-        if(batch != null){
-            //修改
-            List<String> oldCourseUuids = batchCourseService.getCourseUuisByBatchUuid(batch.getUuid());
-            BeanUtils.copyProperties(batchReqDTO, batch);
-            batch.setUpdateBy(institutionUser.getInstitutionalName());
-            batch.setUpdateTime(LocalDateTime.now());
-            batch.setInstitutionId(institutionUser.getId());
-            batch.setInstitutionName(institutionUser.getInstitutionalName());
-            batchService.updateById(batch);
-            //关联课程
-            //差集(old-new)| 删除
-            List<ThBatchCourse> deleteBatchCourseList = oldCourseUuids
-                    .stream()
-                    .filter(item -> !batchReqDTO.getCourseUuidList().contains(item))
-                    .map(item -> {
-                        ThBatchCourse batchCourse = new ThBatchCourse();
-                        batchCourse.setBatchUuid(batchReqDTO.getUuid());
-                        batchCourse.setCourseUuid(item);
+        List<ThBatchReqDTO> batchReqDTOList = new ArrayList<>();
+        try {
+            batchReqDTOList = JSONObject.parseObject(decrypt, new TypeReference<List<ThBatchReqDTO>>() {});
+
+        }catch (Exception e){
+            logger.error("班级序列化失败!");
+            throw new BusinessException(this.getClass(), ResultConstants.SERIALIZE_ERROR);
+
+        }
+        if(CollectionUtils.isEmpty(batchReqDTOList)){
+            throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"批次(班级)集合不可为空");
+        }
+        //过滤出本次请求所有班级课程章节
+        List<String> reqAllBatchUuids = new ArrayList<>();
+        List<String> reqCourseUuids = new ArrayList<>();
+        List<String> reqChapterUuids = new ArrayList<>();
+        for(ThBatchReqDTO batchReqDTO : batchReqDTOList){
+            if(!reqAllBatchUuids.contains(batchReqDTO.getUuid()) && StringUtils.isNotEmpty(batchReqDTO.getUuid())){
+                reqAllBatchUuids.add(batchReqDTO.getUuid());
+            }
+            if(!CollectionUtils.isEmpty(batchReqDTO.getCourseList())){
+                for (ThBatchCourseReqDTO thCourseReqDTO : batchReqDTO.getCourseList()){
+                    if(!reqCourseUuids.contains(thCourseReqDTO.getCourseUuid()) && StringUtils.isNotEmpty(thCourseReqDTO.getCourseUuid())){
+                        reqCourseUuids.add(thCourseReqDTO.getCourseUuid());
+                    }
+                    if(!CollectionUtils.isEmpty(thCourseReqDTO.getChapterList())){
+                        for (ThBatchCourseChapterReqDTO chapter : thCourseReqDTO.getChapterList()){
+                            //去重
+                            if(!reqChapterUuids.contains(chapter.getChapterUuid()) && StringUtils.isNotEmpty(chapter.getChapterUuid())){
+                                reqChapterUuids.add(chapter.getChapterUuid());
+                            }
+                            if(!CollectionUtils.isEmpty(chapter.getChildren())){
+                                for (ThBatchCourseChapterReqDTO section : chapter.getChildren()){
+                                    //去重
+                                    if(!reqChapterUuids.contains(section.getChapterUuid()) && StringUtils.isNotEmpty(section.getChapterUuid())){
+                                        reqChapterUuids.add(section.getChapterUuid());
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        //获取已存在班级
+        List<ThBatch> oldBatchList = batchService.getByUuids(reqAllBatchUuids);
+        //获取已存在班级课程
+        List<ThBatchCourse> oldbatchCourseList = batchCourseService.getListByBatchUuids(reqAllBatchUuids);
+        //获取已存在班级课程章节
+        List<ThBatchCourseChapter> oldbatchCourseChapterList = batchCourseChapterService.getListByBatchUuids(reqAllBatchUuids);
+        //获取课程
+        List<ThCourse> thCourseList = courseService.getByUuidList(reqCourseUuids);
+        //获取章节
+        List<ThCourseChapter> thCourseChapterList = courseChapterService.getByUuids(reqChapterUuids);
+        //校验
+        List<ThErrorDataRespDTO> errorDataRespDTOS = new ArrayList<>();
+        List<ThBatchReqDTO> saveBatchReqDTOList = new ArrayList<>();
+        for (ThBatchReqDTO batchReqDTO : batchReqDTOList) {
+            //获取该机构所有课程和章节
+            //参数校验
+            if(StringUtils.isEmpty(batchReqDTO.getUuid()) || !UUID.checkIsUuid(batchReqDTO.getUuid())){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"批次(班级)uuid不符合规范"));
+                continue;
+            }
+            if(StringUtils.isEmpty(batchReqDTO.getBatchName())){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"班次(班级)名称不可为空"));
+                continue;
+            }
+            if(StringUtils.isEmpty(batchReqDTO.getTrainOrgName())){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"培训机构名称不可为空"));
+                continue;
+            }
+            if(batchReqDTO.getHaveExam() == null || HaveExam.get(batchReqDTO.getHaveExam()) == null){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"有无考试不规范"));
+                continue;
+            }
+            if(batchReqDTO.getStatus() == null || OpenStatus.get(batchReqDTO.getStatus()) == null ){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"批次(班级)状态标识不符合规范"));
+                continue;
+            }
+            if(batchReqDTO.getBatchLessonNum() == null){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"批次(班级)课时不可为空"));
+                continue;
+            }
+            if(batchReqDTO.getDelFlag() == null || DeleteStatusEnum.getDeleteStatusEnum(batchReqDTO.getDelFlag()) == null ){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"批次(班级)删除标识不符合规范"));
+                continue;
+            }
+            if(CollectionUtils.isEmpty(batchReqDTO.getCourseList())){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"关联课程不可为空"));
+                continue;
+            }
+            boolean errorFlag = false;
+            //校验课程
+            for (ThBatchCourseReqDTO thBatchCourseReqDTO : batchReqDTO.getCourseList()) {
+                if(StringUtils.isEmpty(thBatchCourseReqDTO.getCourseUuid()) || !UUID.checkIsUuid(thBatchCourseReqDTO.getCourseUuid())){
+                    errorFlag = true;
+                    errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"课程uuid("+thBatchCourseReqDTO.getCourseUuid()+")不符合规范"));
+                    break;
+                }
+                if(thBatchCourseReqDTO.getCourseLessonNum() == null){
+                    errorFlag = true;
+                    errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"课程("+thBatchCourseReqDTO.getCourseUuid()+")课时不可为空"));
+                    break;
+                }
+                List<ThCourse> selectCourseList = thCourseList.stream().filter(c -> c.getUuid().equals(thBatchCourseReqDTO.getCourseUuid())).collect(Collectors.toList());
+                if(selectCourseList.size() == 0){
+                    errorFlag = true;
+                    errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"课程("+thBatchCourseReqDTO.getCourseUuid()+")不存在"));
+                    break;
+                }
+                if(thBatchCourseReqDTO.getDelFlag() == null || DeleteStatusEnum.getDeleteStatusEnum(thBatchCourseReqDTO.getDelFlag()) == null ){
+                    errorFlag = true;
+                    errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"课程("+thBatchCourseReqDTO.getCourseUuid()+")删除标识不符合规范"));
+                    break;
+                }
+                if(CollectionUtils.isEmpty(thBatchCourseReqDTO.getChapterList())){
+                    errorFlag = true;
+                    errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"课程("+thBatchCourseReqDTO.getCourseUuid()+")章节(大章)不可为空"));
+                    break;
+                }
+                //校验章节(大)
+                for (ThBatchCourseChapterReqDTO chapter : thBatchCourseReqDTO.getChapterList()) {
+                    if(StringUtils.isEmpty(chapter.getChapterUuid()) || !UUID.checkIsUuid(chapter.getChapterUuid())){
+                        errorFlag = true;
+                        errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"章节(大章)uuid("+chapter.getChapterUuid()+")不符合规范"));
+                        break;
+                    }
+                    if(chapter.getChapterLessonNum() == null){
+                        errorFlag = true;
+                        errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"章节(大章)("+chapter.getChapterUuid()+")课时不可为空"));
+                        break;
+                    }
+                    if(chapter.getDelFlag() == null || DeleteStatusEnum.getDeleteStatusEnum(chapter.getDelFlag()) == null ){
+                        errorFlag = true;
+                        errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"章节(大章)("+chapter.getChapterUuid()+")删除标识不符合规范"));
+                        break;
+                    }
+                    //校验章节存在否
+                    List<ThCourseChapter> chapterSelectList = thCourseChapterList
+                            .stream()
+                            .filter(courseChapter -> courseChapter.getUuid().equals(chapter.getChapterUuid())
+                                    && courseChapter.getCourseUuid().equals(thBatchCourseReqDTO.getCourseUuid())
+                                    && courseChapter.getParentUuid().equals("0")
+                            ).collect(Collectors.toList());
+                    if(chapterSelectList.size() == 0){
+                        errorFlag = true;
+                        errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"章节(大章)("+chapter.getChapterUuid()+")不存在"));
+                        break;
+                    }
+                    if(CollectionUtils.isEmpty(chapter.getChildren())){
+                        errorFlag = true;
+                        errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"大章("+chapter.getChapterUuid()+")包含章节(小节)不可为空"));
+                        break;
+                    }
+                    for (ThBatchCourseChapterReqDTO child : chapter.getChildren()) {
+
+                        if(StringUtils.isEmpty(child.getChapterUuid()) || !UUID.checkIsUuid(child.getChapterUuid())){
+                            errorFlag = true;
+                            errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"章节(小节)uuid("+child.getChapterUuid()+")不符合规范"));
+                            break;
+                        }
+                        if(child.getDelFlag() == null || DeleteStatusEnum.getDeleteStatusEnum(child.getDelFlag()) == null ){
+                            errorFlag = true;
+                            errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"章节(小节)("+child.getChapterUuid()+")删除标识不符合规范"));
+                            break;
+                        }
+                        List<ThCourseChapter> sectionSelectList = thCourseChapterList
+                                .stream()
+                                .filter(courseChapter -> courseChapter.getUuid().equals(child.getChapterUuid())
+                                        && courseChapter.getCourseUuid().equals(thBatchCourseReqDTO.getCourseUuid())
+                                        && courseChapter.getParentUuid().equals(chapter.getChapterUuid())
+                                ).collect(Collectors.toList());
+                        if(sectionSelectList.size() == 0){
+                            errorFlag = true;
+                            errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"章节(小节)("+child.getChapterUuid()+")不存在"));
+                            break;
+                        }
+                    }
+                    if(errorFlag){
+                        break;
+                    }
+                }
+                if(errorFlag){
+                    break;
+                }
+            }
+            if(errorFlag){
+                continue;
+            }
+            saveBatchReqDTOList.add(batchReqDTO);
+        }
+
+        //数据填充
+        List<ThBatch> saveBatchList = new ArrayList<>();
+        List<ThBatch> updateBatchList = new ArrayList<>();
+        List<ThBatchCourse> saveBatchCourseList = new ArrayList<>();
+        List<ThBatchCourse> updateBatchCourseList = new ArrayList<>();
+        List<ThBatchCourseChapter> saveBatchCourseChapterList = new ArrayList<>();
+        List<ThBatchCourseChapter> updateBatchCourseChapterList = new ArrayList<>();
+        for (ThBatchReqDTO batchReqDTO : saveBatchReqDTOList) {
+            List<ThBatch> oldBatchSelectList = oldBatchList.stream().filter(ob -> ob.getUuid().equals(batchReqDTO.getUuid())).collect(Collectors.toList());
+            if(!CollectionUtils.isEmpty(oldBatchSelectList)){
+                ThBatch batch = oldBatchSelectList.get(0);
+                if(batchReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())){
+
+                    //删除班级
+                    batch.setDelFlag(batchReqDTO.getDelFlag());
+                    batch.setUpdateBy(institutionUser.getInstitutionalName());
+                    batch.setUpdateTime(LocalDateTime.now());
+                    updateBatchList.add(batch);
+                    List<ThBatchCourse> delectBatchCourseList = oldbatchCourseList
+                            .stream()
+                            .filter(obc -> obc.getBatchUuid().equals(batch.getUuid()))
+                            .collect(Collectors.toList());
+                    delectBatchCourseList.forEach(item -> {
+                        item.setDelFlag(DeleteStatusEnum.YES.getStatus());
+                        item.setUpdateBy(institutionUser.getInstitutionalName());
+                        item.setUpdateTime(LocalDateTime.now());
+                    });
+                    updateBatchCourseList.addAll(delectBatchCourseList);
+                    List<ThBatchCourseChapter> deleteBatchCourseChapterList = oldbatchCourseChapterList
+                            .stream()
+                            .filter(obcc -> obcc.getBatchUuid().equals(batch.getUuid()))
+                            .collect(Collectors.toList());
+                    deleteBatchCourseChapterList.forEach(item -> {
+                        item.setDelFlag(DeleteStatusEnum.YES.getStatus());
+                        item.setUpdateBy(institutionUser.getInstitutionalName());
+                        item.setUpdateTime(LocalDateTime.now());
+                    });
+                    updateBatchCourseChapterList.addAll(deleteBatchCourseChapterList);
+                }else {
+                    //非删除
+
+                    BeanUtils.copyProperties(batchReqDTO,batch);
+                    batch.setUpdateBy(institutionUser.getInstitutionalName());
+                    batch.setUpdateTime(LocalDateTime.now());
+                    updateBatchList.add(batch);
+
+                    //修改课程
+                    for(ThBatchCourseReqDTO courseReqDTO : batchReqDTO.getCourseList()){
+                        List<ThBatchCourse> oldBatchCourseSelectList = oldbatchCourseList.stream().filter(c -> c.getCourseUuid().equals(courseReqDTO.getCourseUuid())).collect(Collectors.toList());
+                        if(CollectionUtils.isEmpty(oldBatchCourseSelectList)){
+                            //获取该课程信息
+                            List<ThCourse> courseInfoList = thCourseList.stream().filter(c -> c.getUuid().equals(courseReqDTO.getCourseUuid())).collect(Collectors.toList());
+
+                            //插入课程
+                            ThBatchCourse batchCourse = new ThBatchCourse();
+                            BeanUtils.copyProperties(courseReqDTO,batchCourse);
+                            batchCourse.setCourseName(courseInfoList.get(0).getCourseName());
+                            batchCourse.setBatchUuid(batch.getUuid());
+                            //batchCourse.setCourseUuid(courseReqDTO.getCouserUuid());
+                            batchCourse.setInstitutionId(institutionUser.getId());
+                            batchCourse.setCreateBy(institutionUser.getInstitutionalName());
+                            batchCourse.setCreateTime(LocalDateTime.now());
+                            batchCourse.setUpdateBy(institutionUser.getInstitutionalName());
+                            batchCourse.setUpdateTime(LocalDateTime.now());
+                            if(batchReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())){
+                                batchCourse.setDelFlag(DeleteStatusEnum.YES.getStatus());
+                            }
+                            saveBatchCourseList.add(batchCourse);
+
+                            //插入章
+                            for(ThBatchCourseChapterReqDTO chapterReqDTO : courseReqDTO.getChapterList()){
+                                //获取其章
+                                List<ThCourseChapter> chapterInfoList = thCourseChapterList.stream().filter(cc -> cc.getCourseUuid().equals(batchCourse.getCourseUuid())
+                                        && cc.getUuid().equals(chapterReqDTO.getChapterUuid())).collect(Collectors.toList());
+
+                                ThBatchCourseChapter chapter = new ThBatchCourseChapter();
+                                BeanUtils.copyProperties(chapterInfoList.get(0),chapter);
+                                chapter.setBatchUuid(batch.getUuid());
+                                chapter.setLessonNum(chapterReqDTO.getChapterLessonNum());
+                                chapter.setId(IdUtil.getSnowflake(0,0).nextId());
+                                if(batchReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())
+                                        || courseReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())){
+                                    chapter.setDelFlag(DeleteStatusEnum.YES.getStatus());
+                                }else {
+                                    chapter.setDelFlag(chapterReqDTO.getDelFlag());
+                                }
+                                chapter.setDelFlag(DeleteStatusEnum.YES.getStatus());
+                                chapter.setChapterUuid(chapterReqDTO.getChapterUuid());
+                                chapter.setCreateBy(institutionUser.getInstitutionalName());
+                                chapter.setCreateTime(LocalDateTime.now());
+                                chapter.setUpdateBy(institutionUser.getInstitutionalName());
+                                chapter.setUpdateTime(LocalDateTime.now());
+                                saveBatchCourseChapterList.add(chapter);
+
+                                //插入节
+                                for(ThBatchCourseChapterReqDTO sectionReqDTO : chapterReqDTO.getChildren()){
+                                    //获取节
+                                    List<ThCourseChapter> sectionInfoList = thCourseChapterList.stream()
+                                            .filter(cc -> cc.getCourseUuid().equals(batchCourse.getCourseUuid())
+                                                    && cc.getUuid().equals(sectionReqDTO.getChapterUuid())).collect(Collectors.toList());
+
+                                    ThBatchCourseChapter section = new ThBatchCourseChapter();
+                                    BeanUtils.copyProperties(sectionInfoList.get(0),section);
+                                    section.setBatchUuid(batch.getUuid());
+                                    section.setLessonNum(sectionReqDTO.getChapterLessonNum());
+                                    section.setId(IdUtil.getSnowflake(0,0).nextId());
+                                    if(batchReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())
+                                            || courseReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())
+                                            || chapterReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())){
+                                        section.setDelFlag(DeleteStatusEnum.YES.getStatus());
+                                    }else {
+                                        section.setDelFlag(sectionReqDTO.getDelFlag());
+                                    }
+                                    section.setChapterUuid(sectionReqDTO.getChapterUuid());
+                                    section.setCreateBy(institutionUser.getInstitutionalName());
+                                    section.setCreateTime(LocalDateTime.now());
+                                    section.setUpdateBy(institutionUser.getInstitutionalName());
+                                    section.setUpdateTime(LocalDateTime.now());
+                                    saveBatchCourseChapterList.add(section);
+                                }
+                            }
+
+                        }else {
+                            //修改
+                            ThBatchCourse batchCourse = oldBatchCourseSelectList.get(0);
+                            batchCourse.setDelFlag(courseReqDTO.getDelFlag());
+                            batchCourse.setCourseLessonNum(courseReqDTO.getCourseLessonNum());
+                            batchCourse.setUpdateBy(institutionUser.getInstitutionalName());
+                            batchCourse.setUpdateTime(LocalDateTime.now());
+                            if(batchReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())){
+                                batchCourse.setDelFlag(DeleteStatusEnum.YES.getStatus());
+                            }
+                            updateBatchCourseList.add(batchCourse);
+
+                            //章
+                            for(ThBatchCourseChapterReqDTO chapterReqDTO : courseReqDTO.getChapterList()){
+                                List<ThBatchCourseChapter> oldChapterInfoList = oldbatchCourseChapterList.stream().filter(ochapter -> ochapter.getCourseUuid().equals(batchCourse.getCourseUuid())
+                                        && ochapter.getChapterUuid().equals(chapterReqDTO.getChapterUuid())).collect(Collectors.toList());
+                                //章是否存在
+                                if(!CollectionUtils.isEmpty(oldChapterInfoList)){
+                                    //存在修改
+                                    ThBatchCourseChapter chapter = oldChapterInfoList.get(0);
+                                    BeanUtils.copyProperties(chapterReqDTO,chapter);
+                                    chapter.setLessonNum(chapterReqDTO.getChapterLessonNum());
+                                    chapter.setUpdateBy(institutionUser.getInstitutionalName());
+                                    chapter.setUpdateTime(LocalDateTime.now());
+                                    if(batchReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())
+                                            || courseReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())){
+                                        chapter.setDelFlag(DeleteStatusEnum.YES.getStatus());
+                                    }
+                                    updateBatchCourseChapterList.add(chapter);
+                                    for(ThBatchCourseChapterReqDTO sectionReqDTO : chapterReqDTO.getChildren()){
+                                        List<ThBatchCourseChapter> oldsectionInfoList = oldbatchCourseChapterList.stream().filter(section -> section.getCourseUuid().equals(batchCourse.getCourseUuid())
+                                                && section.getChapterUuid().equals(sectionReqDTO.getChapterUuid())).collect(Collectors.toList());
+                                        if(!CollectionUtils.isEmpty(oldsectionInfoList)){
+                                            //存在,修改
+                                            ThBatchCourseChapter section = oldsectionInfoList.get(0);
+                                            BeanUtils.copyProperties(sectionReqDTO,section);
+                                            section.setLessonNum(sectionReqDTO.getChapterLessonNum());
+                                            section.setUpdateBy(institutionUser.getInstitutionalName());
+                                            section.setUpdateTime(LocalDateTime.now());
+                                            if(batchReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())
+                                                    || courseReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())
+                                                    || chapterReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())){
+                                                section.setDelFlag(DeleteStatusEnum.YES.getStatus());
+                                            }
+                                            updateBatchCourseChapterList.add(section);
+                                        }else {
+                                            //不存在,新增
+                                            //获取节
+                                            List<ThCourseChapter> sectionInfoList = thCourseChapterList.stream()
+                                                    .filter(cc -> cc.getCourseUuid().equals(batchCourse.getCourseUuid())
+                                                            && cc.getUuid().equals(sectionReqDTO.getChapterUuid())).collect(Collectors.toList());
+
+                                            ThBatchCourseChapter section = new ThBatchCourseChapter();
+                                            BeanUtils.copyProperties(sectionInfoList.get(0),section);
+                                            section.setBatchUuid(batch.getUuid());
+                                            section.setChapterUuid(sectionInfoList.get(0).getUuid());
+                                            section.setLessonNum(sectionReqDTO.getChapterLessonNum());
+                                            section.setId(IdUtil.getSnowflake(0,0).nextId());
+                                            section.setDelFlag(sectionReqDTO.getDelFlag());
+                                            if(batchReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())
+                                                    || courseReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())
+                                                    || chapterReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())){
+                                                section.setDelFlag(DeleteStatusEnum.YES.getStatus());
+                                            }
+                                            section.setCreateBy(institutionUser.getInstitutionalName());
+                                            section.setCreateTime(LocalDateTime.now());
+                                            section.setUpdateBy(institutionUser.getInstitutionalName());
+                                            section.setUpdateTime(LocalDateTime.now());
+                                            saveBatchCourseChapterList.add(section);
+                                        }
+                                    }
+
+                                }else {
+                                    //不存在,新增
+                                    //获取其章
+                                    List<ThCourseChapter> chapterInfoList = thCourseChapterList.stream().filter(cc -> cc.getCourseUuid().equals(batchCourse.getCourseUuid())
+                                            && cc.getUuid().equals(chapterReqDTO.getChapterUuid())).collect(Collectors.toList());
+
+                                    ThBatchCourseChapter chapter = new ThBatchCourseChapter();
+                                    BeanUtils.copyProperties(chapterInfoList.get(0),chapter);
+                                    chapter.setChapterUuid(chapterInfoList.get(0).getUuid());
+                                    chapter.setBatchUuid(batch.getUuid());
+                                    chapter.setLessonNum(chapterReqDTO.getChapterLessonNum());
+                                    chapter.setId(IdUtil.getSnowflake(0,0).nextId());
+                                    chapter.setDelFlag(chapterReqDTO.getDelFlag());
+                                    chapter.setCreateBy(institutionUser.getInstitutionalName());
+                                    chapter.setCreateTime(LocalDateTime.now());
+                                    chapter.setUpdateBy(institutionUser.getInstitutionalName());
+                                    chapter.setUpdateTime(LocalDateTime.now());
+                                    if(batchReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())
+                                            || courseReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())){
+                                        chapter.setDelFlag(DeleteStatusEnum.YES.getStatus());
+                                    }
+                                    saveBatchCourseChapterList.add(chapter);
+
+                                    //插入节
+                                    for(ThBatchCourseChapterReqDTO sectionReqDTO : chapterReqDTO.getChildren()){
+                                        //获取节
+                                        List<ThCourseChapter> sectionInfoList = thCourseChapterList.stream()
+                                                .filter(cc -> cc.getCourseUuid().equals(batchCourse.getCourseUuid())
+                                                        && cc.getUuid().equals(sectionReqDTO.getChapterUuid())).collect(Collectors.toList());
+
+                                        ThBatchCourseChapter section = new ThBatchCourseChapter();
+                                        BeanUtils.copyProperties(sectionInfoList.get(0),section);
+                                        section.setChapterUuid(sectionInfoList.get(0).getUuid());
+                                        section.setBatchUuid(batch.getUuid());
+                                        section.setLessonNum(sectionReqDTO.getChapterLessonNum());
+                                        section.setId(IdUtil.getSnowflake(0,0).nextId());
+                                        section.setDelFlag(sectionReqDTO.getDelFlag());
+                                        section.setCreateBy(institutionUser.getInstitutionalName());
+                                        section.setCreateTime(LocalDateTime.now());
+                                        section.setUpdateBy(institutionUser.getInstitutionalName());
+                                        section.setUpdateTime(LocalDateTime.now());
+                                        if(batchReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())
+                                                || courseReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())
+                                                || chapterReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())){
+                                            section.setDelFlag(DeleteStatusEnum.YES.getStatus());
+                                        }
+                                        saveBatchCourseChapterList.add(section);
+                                    }
+                                }
+
+                            }
+                        }
+                    }
+                }
+            }else {
+                //新增
+                //班次新增
+                ThBatch batch = new ThBatch();
+                BeanUtils.copyProperties(batchReqDTO, batch);
+                batch.setUpdateBy(institutionUser.getInstitutionalName());
+                batch.setUpdateTime(LocalDateTime.now());
+                batch.setCreateBy(institutionUser.getInstitutionalName());
+                batch.setCreateTime(LocalDateTime.now());
+                batch.setInstitutionId(institutionUser.getId());
+                batch.setInstitutionName(institutionUser.getInstitutionalName());
+                saveBatchList.add(batch);
+
+                for(ThBatchCourseReqDTO courseReqDTO : batchReqDTO.getCourseList()) {
+                    //获取该课程信息
+                    List<ThCourse> courseInfoList = thCourseList.stream().filter(c -> c.getUuid().equals(courseReqDTO.getCourseUuid())).collect(Collectors.toList());
+
+                    //插入课程
+                    ThBatchCourse batchCourse = new ThBatchCourse();
+                    BeanUtils.copyProperties(courseReqDTO, batchCourse);
+                    batchCourse.setCourseName(courseInfoList.get(0).getCourseName());
+                    batchCourse.setBatchUuid(batch.getUuid());
+                    //batchCourse.setCourseUuid(courseReqDTO.getCouserUuid());
+                    batchCourse.setInstitutionId(institutionUser.getId());
+                    batchCourse.setCreateBy(institutionUser.getInstitutionalName());
+                    batchCourse.setCreateTime(LocalDateTime.now());
+                    batchCourse.setUpdateBy(institutionUser.getInstitutionalName());
+                    batchCourse.setUpdateTime(LocalDateTime.now());
+                    if(batchReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())
+                            || courseReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())){
                         batchCourse.setDelFlag(DeleteStatusEnum.YES.getStatus());
-                        return batchCourse;
-                    })
-                    .collect(Collectors.toList());
-            //差集(new-old) | 新增
-            List<ThBatchCourse> saveBatchCourseList = batchReqDTO.getCourseUuidList().stream()
-                    .filter(item -> !oldCourseUuids.contains(item))
-                    .map(item -> {
-                        ThBatchCourse batchCourse = new ThBatchCourse();
-                        batchCourse.setBatchUuid(batchReqDTO.getUuid());
-                        batchCourse.setCourseUuid(item);
+                    }else {
                         batchCourse.setDelFlag(DeleteStatusEnum.NO.getStatus());
-                        batchCourse.setInstitutionId(institutionUser.getId());
-                        return batchCourse;
-                    }).collect(Collectors.toList());
-            if(saveBatchCourseList.size() > 0){
-                batchCourseService.saveBatch(saveBatchCourseList);
-            }
-            if (deleteBatchCourseList.size() > 0){
-                batchCourseService.deleteByBatchUuidAndCourseUuid(deleteBatchCourseList);
-            }
-        }else {
-            //新增
-            //班次新增
-            batch = new ThBatch();
-            BeanUtils.copyProperties(batchReqDTO, batch);
-            batch.setUpdateBy(institutionUser.getInstitutionalName());
-            batch.setUpdateTime(LocalDateTime.now());
-            batch.setDelFlag(DeleteStatusEnum.NO.getStatus());
-            batch.setCreateBy(institutionUser.getInstitutionalName());
-            batch.setCreateTime(LocalDateTime.now());
-            batch.setInstitutionId(institutionUser.getId());
-            batch.setInstitutionName(institutionUser.getInstitutionalName());
-            //batch.setFinishStatus(FinishStatus.NO.getStatus());
-            batchService.save(batch);
-            //关联课程
-            List<ThBatchCourse> batchCourseList = new ArrayList<>();
-            for (String uuid : batchReqDTO.getCourseUuidList()) {
-                ThBatchCourse batchCourse = new ThBatchCourse();
-                batchCourse.setBatchUuid(batch.getUuid());
-                batchCourse.setCourseUuid(uuid);
-                batchCourse.setDelFlag(DeleteStatusEnum.NO.getStatus());
-                batchCourse.setInstitutionId(institutionUser.getId());
-                batchCourseList.add(batchCourse);
-            }
-            if(batchCourseList.size() > 0){
-                batchCourseService.saveBatch(batchCourseList);
+                    }
+                    saveBatchCourseList.add(batchCourse);
+
+                    //插入章
+                    for (ThBatchCourseChapterReqDTO chapterReqDTO : courseReqDTO.getChapterList()) {
+                        //获取其章
+                        List<ThCourseChapter> chapterInfoList = thCourseChapterList.stream().filter(cc -> cc.getCourseUuid().equals(batchCourse.getCourseUuid())
+                                && cc.getUuid().equals(chapterReqDTO.getChapterUuid())).collect(Collectors.toList());
+
+                        ThBatchCourseChapter chapter = new ThBatchCourseChapter();
+                        BeanUtils.copyProperties(chapterInfoList.get(0), chapter);
+                        chapter.setBatchUuid(batch.getUuid());
+                        chapter.setLessonNum(chapterReqDTO.getChapterLessonNum());
+                        chapter.setId(IdUtil.getSnowflake(0, 0).nextId());
+                        if(batchReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())
+                                || courseReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())
+                                || chapterReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())){
+                            chapter.setDelFlag(DeleteStatusEnum.YES.getStatus());
+                        }else {
+                            chapter.setDelFlag(DeleteStatusEnum.NO.getStatus());
+                        }
+                        chapter.setChapterUuid(chapterReqDTO.getChapterUuid());
+                        chapter.setChapterUuid(chapterReqDTO.getChapterUuid());
+                        saveBatchCourseChapterList.add(chapter);
+
+                        //插入节
+                        for (ThBatchCourseChapterReqDTO sectionReqDTO : chapterReqDTO.getChildren()) {
+                            //获取节
+                            List<ThCourseChapter> sectionInfoList = thCourseChapterList.stream()
+                                    .filter(cc -> cc.getCourseUuid().equals(batchCourse.getCourseUuid())
+                                            && cc.getUuid().equals(sectionReqDTO.getChapterUuid())).collect(Collectors.toList());
+
+                            ThBatchCourseChapter section = new ThBatchCourseChapter();
+                            BeanUtils.copyProperties(sectionInfoList.get(0), section);
+                            section.setBatchUuid(batch.getUuid());
+                            section.setLessonNum(sectionReqDTO.getChapterLessonNum());
+                            section.setId(IdUtil.getSnowflake(0, 0).nextId());
+                            if(batchReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())
+                                    || courseReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())
+                                    || chapterReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())
+                                    || sectionReqDTO.getDelFlag().equals(DeleteStatusEnum.YES.getStatus())){
+                                section.setDelFlag(DeleteStatusEnum.YES.getStatus());
+                            }else {
+                                section.setDelFlag(DeleteStatusEnum.NO.getStatus());
+                            }
+                            section.setChapterUuid(sectionReqDTO.getChapterUuid());
+                            section.setCreateBy(institutionUser.getInstitutionalName());
+                            section.setCreateTime(LocalDateTime.now());
+                            section.setUpdateBy(institutionUser.getInstitutionalName());
+                            section.setUpdateTime(LocalDateTime.now());
+                            section.setBatchUuid(batch.getUuid());
+                            section.setChapterUuid(sectionReqDTO.getChapterUuid());
+                            saveBatchCourseChapterList.add(section);
+                        }
+                    }
+                }
             }
 
         }
 
-        return AjaxResult.success();
+        //插入班级数据
+        List<List<ThBatch>> splitSaveBatchList = ListUtil.split(saveBatchList, 500);
+        for (List<ThBatch> batchList : splitSaveBatchList) {
+            batchService.insertBatch(batchList);
+        }
+        //修改班级数据
+        List<List<ThBatch>> splitUpdateBatchList = ListUtil.split(updateBatchList, 500);
+        for (List<ThBatch> batchList : splitUpdateBatchList) {
+            batchService.updateBatch(batchList);
+        }
+        //插入课程
+        List<List<ThBatchCourse>> splitSaveBatchCourseList = ListUtil.split(saveBatchCourseList, 500);
+        for (List<ThBatchCourse> courseList : splitSaveBatchCourseList) {
+            batchCourseService.insertBatch(courseList);
+        }
+        //修改课程
+        List<List<ThBatchCourse>> splitUpdateBatchCourseList = ListUtil.split(updateBatchCourseList, 500);
+        for (List<ThBatchCourse> courseList : splitUpdateBatchCourseList) {
+            batchCourseService.updateBatch(courseList);
+        }
+
+        //插入章节
+        List<List<ThBatchCourseChapter>> splitSaveBatchCourseChapterList = ListUtil.split(saveBatchCourseChapterList, 500);
+        for (List<ThBatchCourseChapter> chapterList : splitSaveBatchCourseChapterList) {
+            batchCourseChapterService.insertBatch(chapterList);
+        }
+        //修改章节
+        List<List<ThBatchCourseChapter>> splitUpdateBatchCourseChapterList = ListUtil.split(updateBatchCourseChapterList, 500);
+        for (List<ThBatchCourseChapter> chapterList : splitUpdateBatchCourseChapterList) {
+            batchCourseChapterService.updateBatch(chapterList);
+        }
+
+        return AjaxResult.success(errorDataRespDTOS);
     }
 
     @Transactional
@@ -531,82 +1260,279 @@
             throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL);
         }
         //反序列化
-        ThStudyDetailReqDTO studyDetailReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThStudyDetailReqDTO>() {});
-        //参数校验
-        validateStudyDetail(studyDetailReqDTO);
-
-        ThStudyDetail thStudyDetail = studyDetailService.getByUuid(studyDetailReqDTO.getUuid());
-        if(thStudyDetail == null){
-            //新增学习清单
-            thStudyDetail = new ThStudyDetail();
-            BeanUtils.copyProperties(studyDetailReqDTO, thStudyDetail);
-            thStudyDetail.setUpdateBy(institutionUser.getInstitutionalName());
-            thStudyDetail.setUpdateTime(LocalDateTime.now());
-            thStudyDetail.setCreateBy(institutionUser.getInstitutionalName());
-            thStudyDetail.setCreateTime(LocalDateTime.now());
-            thStudyDetail.setInstitutionId(institutionUser.getId());
-            thStudyDetail.setInstitutionName(institutionUser.getInstitutionalName());
-            thStudyDetail.setDelFlag(DeleteStatusEnum.NO.getStatus());
-            thStudyDetail.setSerialNum(generateSerialNum());
-
-            //新增认证记录
-            List<ThStudyAuth> thStudyAuthList = studyDetailReqDTO.getAuthList().stream().map(sa -> {
-                ThStudyAuth thStudyAuth = new ThStudyAuth();
-                BeanUtils.copyProperties(sa, thStudyAuth);
-                thStudyAuth.setStudyDetailUuid(studyDetailReqDTO.getUuid());
-                return thStudyAuth;
-            }).collect(Collectors.toList());
-
-            //新增学习轨迹
-            List<ThStudyTrack> thStudyTrackList = studyDetailReqDTO.getTrackList().stream().map(track -> {
-                ThStudyTrack thStudyTrack = new ThStudyTrack();
-                BeanUtils.copyProperties(track, thStudyTrack);
-                thStudyTrack.setStudyDetailUuid(studyDetailReqDTO.getUuid());
-                return thStudyTrack;
-            }).collect(Collectors.toList());
-
-            studyDetailService.save(thStudyDetail);
-            if(thStudyAuthList.size() > 0){
-                studyAuthService.saveBatch(thStudyAuthList);
-            }
-            if(thStudyTrackList.size() > 0){
-                studyTrackService.saveBatch(thStudyTrackList);
-            }
-        }else {
-            //获取轨迹数据
-
-            //获取认证数据
-            List<String> oldAuthIdList = studyAuthService.getUuidByStudyDetaiId(thStudyDetail.getUuid());
-            List<String> oldTrackIdList = studyTrackService.getUuidByStudyDetaiId(thStudyDetail.getUuid());
-            //修改
-            BeanUtils.copyProperties(studyDetailReqDTO, thStudyDetail);
-            thStudyDetail.setUpdateBy(institutionUser.getInstitutionalName());
-            thStudyDetail.setUpdateTime(LocalDateTime.now());
-
-            List<ThStudyAuth> saveAuthList = studyDetailReqDTO.getAuthList().stream()
-                    .filter(a -> oldAuthIdList.contains(a.getUuid()))
-                    .map(a -> {
-                        ThStudyAuth thStudyAuth = new ThStudyAuth();
-                        BeanUtils.copyProperties(a, thStudyAuth);
-                        thStudyAuth.setStudyDetailUuid(studyDetailReqDTO.getUuid());
-                        return thStudyAuth;
-                    })
-                    .collect(Collectors.toList());
-
-            List<ThStudyTrack> saveTrackList = studyDetailReqDTO.getTrackList().stream()
-                    .filter(t -> oldTrackIdList.contains(t.getUuid()))
-                    .map(t -> {
-                        ThStudyTrack thStudyTrack = new ThStudyTrack();
-                        BeanUtils.copyProperties(t, thStudyTrack);
-                        thStudyTrack.setStudyDetailUuid(studyDetailReqDTO.getUuid());
-                        return thStudyTrack;
-                    }).collect(Collectors.toList());
-
-            studyDetailService.updateById(thStudyDetail);
-            studyAuthService.saveBatch(saveAuthList);
-            studyTrackService.saveBatch(saveTrackList);
+        List<ThStudyDetailReqDTO> thStudyDetailReqDTOS = new ArrayList<>();
+        try {
+           thStudyDetailReqDTOS = JSONObject.parseObject(decrypt, new TypeReference<List<ThStudyDetailReqDTO>>() {});
+        }catch (Exception e){
+            logger.error("学习记录序列化失败!");
+            throw new BusinessException(this.getClass(), ResultConstants.SERIALIZE_ERROR);
         }
-        return AjaxResult.success();
+        //参数校验
+        if(CollectionUtils.isEmpty(thStudyDetailReqDTOS)){
+            throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"学习记录清单不可为空");
+        }
+        //获取班级学生以及章节
+        List<String> chapterUuids = new ArrayList<>();
+        List<String> idcards = new ArrayList<>();
+        List<String> studyUuids = new ArrayList<>();
+        for (ThStudyDetailReqDTO studentDetailReqDTO : thStudyDetailReqDTOS) {
+            if(!idcards.contains(studentDetailReqDTO.getIdcard()) && StringUtils.isNotEmpty(studentDetailReqDTO.getIdcard())){
+                idcards.add(studentDetailReqDTO.getIdcard());
+            }
+            if(!chapterUuids.contains(studentDetailReqDTO.getChapterUuid()) && StringUtils.isNotEmpty(studentDetailReqDTO.getChapterUuid())){
+                chapterUuids.add(studentDetailReqDTO.getChapterUuid());
+            }
+            studyUuids.add(studentDetailReqDTO.getUuid());
+        }
+        List<ThStudentBatch> thStudentBatches = studentBatchService.getByIdCards(idcards);
+        List<ThBatchCourseChapter> batchCourseChapters = batchCourseChapterService.getByChapterUuids(chapterUuids);
+        //校验
+        List<ThErrorDataRespDTO> errorDataRespDTOS = new ArrayList<>();
+        List<ThStudyDetailReqDTO> saveStudyDetailReqDTOS = new ArrayList<>();
+        for (ThStudyDetailReqDTO studentDetailReqDTO : thStudyDetailReqDTOS) {
+            if(StringUtils.isEmpty(studentDetailReqDTO.getUuid()) || !UUID.checkIsUuid(studentDetailReqDTO.getUuid())){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"学习记录uuid标识不规范"));
+                continue;
+            }
+            if(StringUtils.isEmpty(studentDetailReqDTO.getIdcard())){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"学生身份证不可为空"));
+                continue;
+            }
+            if(StringUtils.isEmpty(studentDetailReqDTO.getCourseUuid())){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"课程不可为空"));
+                continue;
+            }
+            if(StringUtils.isEmpty(studentDetailReqDTO.getBatchUuid())){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"批次不可为空"));
+                continue;
+            }
+            if(StringUtils.isEmpty(studentDetailReqDTO.getChapterUuid())){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"章节不可为空"));
+                continue;
+            }
+            //获取该平台课程
+            List<ThStudentBatch> StudentBatchSelectList = thStudentBatches.stream().filter(sb -> sb.getIdcard().equals(studentDetailReqDTO.getIdcard()) &&
+                    sb.getBatchUuid().equals(studentDetailReqDTO.getBatchUuid())).collect(Collectors.toList());
+                    studentBatchService.getByIdcardAndBatchUuid(studentDetailReqDTO.getIdcard(),studentDetailReqDTO.getBatchUuid());
+            List<ThBatchCourseChapter> chapterSelectList = batchCourseChapters.stream().filter(bcc -> bcc.getChapterUuid().equals(studentDetailReqDTO.getChapterUuid())
+                    && bcc.getCourseUuid().equals(studentDetailReqDTO.getCourseUuid()) && bcc.getBatchUuid().equals(studentDetailReqDTO.getBatchUuid())).collect(Collectors.toList());
+            if(StudentBatchSelectList.size() == 0){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"批次(班级)中学生信息不存在"));
+                continue;
+            }
+            if(chapterSelectList.size() == 0){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"课程章节不存在"));
+                continue;
+            }
+            if(StringUtils.isEmpty(studentDetailReqDTO.getTrainOrgName())){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"培训机构名称不可为空"));
+                continue;
+            }
+            if(studentDetailReqDTO.getFinishStatus() == null || FinishStatus.get(studentDetailReqDTO.getFinishStatus()) == null){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"完成状态不规范"));
+                continue;
+            }
+            if(studentDetailReqDTO.getDuration() == null){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"学习时长(秒)不可为空"));
+                continue;
+            }
+            if(studentDetailReqDTO.getStartTime() == null){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"开始时间不可为空"));
+                continue;
+            }
+            if(studentDetailReqDTO.getFinishTime() == null){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"结束时间不可为空"));
+                continue;
+            }
+            if(studentDetailReqDTO.getStartPosition() == null){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"开始位置不可为空"));
+                continue;
+            }
+            if(studentDetailReqDTO.getFinishPosition() == null){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"结束位置不可为空"));
+                continue;
+            }
+            if(StringUtils.isEmpty(studentDetailReqDTO.getLessonReportUrl())){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"学时报告不可为空"));
+                continue;
+            }
+            //认证记录集合
+//            if(CollectionUtils.isEmpty(studentDetailReqDTO.getAuthList())){
+//                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"认证记录集合不可为空"));
+//                continue;
+//            }
+            //学习轨迹集合
+            if(CollectionUtils.isEmpty(studentDetailReqDTO.getTrackList())){
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"学习轨迹集合不可为空"));
+                continue;
+            }
+
+            /*boolean authFlag = false;
+            for(ThStudytAuthReqDTO item : studentDetailReqDTO.getAuthList()){
+                if(StringUtils.isEmpty(item.getUuid()) || !UUID.checkIsUuid(item.getUuid())){
+                    authFlag = true;
+                    errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"认证记录uuid("+item.getUuid()+")不符合规范"));
+                    break;
+                }
+                if(StringUtils.isEmpty(item.getApprovePhoto())){
+                    authFlag = true;
+                    errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"认证记录uuid("+item.getUuid()+"),认证照片不可为空"));
+                    break;
+                }
+                if(item.getAuthPosition() == null){
+                    authFlag = true;
+                    errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"认证记录uuid("+item.getUuid()+"),认证位置不可为空"));
+                    break;
+                }
+                if(item.getAuthTime() == null){
+                    authFlag = true;
+                    errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"认证记录uuid("+item.getUuid()+"),认证时间不可为空"));
+                    break;
+                }
+                if(item.getFaceType() == null || FaceType.get(item.getFaceType()) == null){
+                    authFlag = true;
+                    errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"认证记录uuid("+item.getUuid()+"),认证类型不规范"));
+                    break;
+                }
+            }
+            if(authFlag){
+                continue;
+            }*/
+            boolean trackFlag = false;
+            for(ThStudyTrackReqDTO item : studentDetailReqDTO.getTrackList()){
+                if(StringUtils.isEmpty(item.getUuid()) || !UUID.checkIsUuid(item.getUuid())){
+                    trackFlag = true;
+                    errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"学习轨迹uuid("+item.getUuid()+")不符合规范"));
+                    break;
+                }
+                if(item.getStartTime() == null){
+                    trackFlag = true;
+                    errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"学习轨迹uuid("+item.getUuid()+"),轨迹开始时间不可为空"));
+                    break;
+                }
+                if(item.getEndTime() == null){
+                    trackFlag = true;
+                    errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"学习轨迹uuid("+item.getUuid()+"),轨迹结束时间不可为空"));
+                    break;
+                }
+                if(item.getTimeInterval() == null) {
+                    trackFlag = true;
+                    errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"学习轨迹uuid("+item.getUuid()+"),时间间隔(秒)不可为空"));
+                    break;
+                }
+            }
+            if(trackFlag){
+                continue;
+            }
+            saveStudyDetailReqDTOS.add(studentDetailReqDTO);
+        }
+
+        //获取历史记录
+        List<ThStudyDetail> oldThStudyDetails = studyDetailService.getByUuids(studyUuids);
+        List<ThStudyAuth> oldStudyAuthList = studyAuthService.getByStudyDetaiUuids(studyUuids);
+        List<ThStudyTrack> oldStudyTrackList = studyTrackService.getByStudyDetailUuids(studyUuids);
+        List<ThStudyDetail> saveStudyDetailList = new ArrayList<>();
+        List<ThStudyDetail> updateStudyDetailList = new ArrayList<>();
+        List<ThStudyAuth> saveStudyAuthList = new ArrayList<>();
+        List<ThStudyTrack> saveStudyTrackList = new ArrayList<>();
+
+        for(ThStudyDetailReqDTO studyDetailReqDTO : saveStudyDetailReqDTOS){
+            List<ThStudyDetail> oldStudyDetailList = oldThStudyDetails
+                    .stream()
+                    .filter(sd -> sd.getUuid().equals(studyDetailReqDTO.getUuid()))
+                    .collect(Collectors.toList());
+            if(oldStudyDetailList.size() == 0){
+                //新增学习清单
+                ThStudyDetail thStudyDetail = new ThStudyDetail();
+                BeanUtils.copyProperties(studyDetailReqDTO, thStudyDetail);
+                thStudyDetail.setUpdateBy(institutionUser.getInstitutionalName());
+                thStudyDetail.setUpdateTime(LocalDateTime.now());
+                thStudyDetail.setCreateBy(institutionUser.getInstitutionalName());
+                thStudyDetail.setCreateTime(LocalDateTime.now());
+                thStudyDetail.setInstitutionId(institutionUser.getId());
+                thStudyDetail.setInstitutionName(institutionUser.getInstitutionalName());
+                thStudyDetail.setDelFlag(DeleteStatusEnum.NO.getStatus());
+                thStudyDetail.setSerialNum(generateSerialNum());
+                saveStudyDetailList.add(thStudyDetail);
+                //新增认证记录
+                List<ThStudyAuth> thStudyAuthList = studyDetailReqDTO.getAuthList().stream().map(sa -> {
+                    ThStudyAuth thStudyAuth = new ThStudyAuth();
+                    BeanUtils.copyProperties(sa, thStudyAuth);
+                    thStudyAuth.setStudyDetailUuid(studyDetailReqDTO.getUuid());
+                    return thStudyAuth;
+                }).collect(Collectors.toList());
+                saveStudyAuthList.addAll(thStudyAuthList);
+
+                //新增学习轨迹
+                List<ThStudyTrack> thStudyTrackList = studyDetailReqDTO.getTrackList().stream().map(track -> {
+                    ThStudyTrack thStudyTrack = new ThStudyTrack();
+                    BeanUtils.copyProperties(track, thStudyTrack);
+                    thStudyTrack.setStudyDetailUuid(studyDetailReqDTO.getUuid());
+                    return thStudyTrack;
+                }).collect(Collectors.toList());
+                saveStudyTrackList.addAll(thStudyTrackList);
+
+            }else {
+                ThStudyDetail thStudyDetail = oldStudyDetailList.get(0);
+                //修改
+                BeanUtils.copyProperties(studyDetailReqDTO, thStudyDetail);
+                thStudyDetail.setUpdateBy(institutionUser.getInstitutionalName());
+                thStudyDetail.setUpdateTime(LocalDateTime.now());
+                updateStudyDetailList.add(thStudyDetail);
+
+                //过滤该记录的认证记录
+                List<String> authUuids = oldStudyAuthList
+                        .stream()
+                        .filter(a -> a.getStudyDetailUuid().equals(thStudyDetail.getUuid()))
+                        .map(ThStudyAuth::getUuid).collect(Collectors.toList());
+                //过滤出记录的轨迹记录
+                List<String> trackUuids = oldStudyTrackList
+                        .stream()
+                        .filter(t -> t.getStudyDetailUuid().equals(thStudyDetail.getUuid()))
+                        .map(ThStudyTrack::getUuid).collect(Collectors.toList());
+                List<ThStudyAuth> saveAuthList = studyDetailReqDTO.getAuthList().stream()
+                        .filter(a -> !authUuids.contains(a.getUuid()))
+                        .map(a -> {
+                            ThStudyAuth thStudyAuth = new ThStudyAuth();
+                            BeanUtils.copyProperties(a, thStudyAuth);
+                            thStudyAuth.setStudyDetailUuid(studyDetailReqDTO.getUuid());
+                            return thStudyAuth;
+                        })
+                        .collect(Collectors.toList());
+                saveStudyAuthList.addAll(saveAuthList);
+
+                List<ThStudyTrack> saveTrackList = studyDetailReqDTO.getTrackList().stream()
+                        .filter(t -> !trackUuids.contains(t.getUuid()))
+                        .map(t -> {
+                            ThStudyTrack thStudyTrack = new ThStudyTrack();
+                            BeanUtils.copyProperties(t, thStudyTrack);
+                            thStudyTrack.setStudyDetailUuid(studyDetailReqDTO.getUuid());
+                            return thStudyTrack;
+                        }).collect(Collectors.toList());
+                saveStudyTrackList.addAll(saveTrackList);
+            }
+        }
+        //插入学习记录
+        List<List<ThStudyDetail>> splitSaveDetailList = ListUtil.split(saveStudyDetailList, 500);
+        for (List<ThStudyDetail> thStudyDetails : splitSaveDetailList) {
+            studyDetailService.insertBatch(thStudyDetails);
+        }
+        //修改学习记录
+        List<List<ThStudyDetail>> splitUpdateDetailList = ListUtil.split(updateStudyDetailList, 500);
+        for (List<ThStudyDetail> thStudyDetails : splitUpdateDetailList) {
+            studyDetailService.updateBatch(thStudyDetails);
+        }
+        //插入认证记录
+        List<List<ThStudyAuth>> splitSaveAuthList = ListUtil.split(saveStudyAuthList, 500);
+        for (List<ThStudyAuth> thStudyAuths : splitSaveAuthList) {
+            studyAuthService.insetBatch(thStudyAuths);
+        }
+        //插入学习轨迹
+        List<List<ThStudyTrack>> splitSaveTrackList = ListUtil.split(saveStudyTrackList, 500);
+        for (List<ThStudyTrack> thStudyTracks : splitSaveTrackList) {
+            studyTrackService.insertBatch(thStudyTracks);
+        }
+        return AjaxResult.success(errorDataRespDTOS);
     }
 
     @Transactional
@@ -626,17 +1552,34 @@
             throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL);
         }
         //反序列化
-        List<ThExamRecordReqDTO> examRecordReqDTOS = JSONObject.parseObject(decrypt, new TypeReference<List<ThExamRecordReqDTO>>() {});
-        //参数校验
-        //获取该平台课程
-        List<ThStudentCourse> studentCourseList = studentCourseService.listByInstitutionId(institutionUser.getId());
-        List<ThExamRecord> oldExamRecordList = examRecordService.listByInstitutionId(institutionUser.getId());
-        List<ThErrorDataRespDTO> errorDataRespDTOS = new ArrayList<>();
-        List<ThExamRecord> saveExamRecordList = new ArrayList<>();
-        List<ThExamRecord> updateExamRecordList = new ArrayList<>();
+        List<ThExamRecordReqDTO> examRecordReqDTOS = new ArrayList<>();
+        try {
+            examRecordReqDTOS = JSONObject.parseObject(decrypt, new TypeReference<List<ThExamRecordReqDTO>>() {});
+        }catch (Exception e){
+            logger.error("考试记录序列化失败!");
+            throw new BusinessException(this.getClass(), ResultConstants.SERIALIZE_ERROR);
+        }
         if (CollectionUtils.isEmpty(examRecordReqDTOS)) {
             throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"考试记录不可为空");
         }
+        List<String> idcards = new ArrayList<>();
+        //List<String> batchUuids = new ArrayList<>();
+        List<String> examUuids = new ArrayList<>();
+        for (ThExamRecordReqDTO examRecordReqDTO : examRecordReqDTOS) {
+            if(!idcards.contains(examRecordReqDTO.getIdcard())){
+                idcards.add(examRecordReqDTO.getIdcard());
+            }
+            /*if(!batchUuids.contains(examRecordReqDTO.getBatchUuid())){
+                batchUuids.add(examRecordReqDTO.getBatchUuid());
+            }*/
+            examUuids.add(examRecordReqDTO.getUuid());
+        }
+        //参数校验
+        List<ThStudentBatch> studentBatchList = studentBatchService.getByIdCards(idcards);
+        List<ThExamRecord> oldExamRecordList = examRecordService.getByUuids(examUuids);
+        List<ThErrorDataRespDTO> errorDataRespDTOS = new ArrayList<>();
+        List<ThExamRecord> saveExamRecordList = new ArrayList<>();
+
         for (ThExamRecordReqDTO examRecordReqDTO : examRecordReqDTOS) {
 
             if(StringUtils.isEmpty(examRecordReqDTO.getUuid()) || !UUID.checkIsUuid(examRecordReqDTO.getUuid())){
@@ -647,20 +1590,16 @@
                 errorDataRespDTOS.add(new ThErrorDataRespDTO(examRecordReqDTO.getUuid(),"身份证不可为空"));
                 continue;
             }
-            if(StringUtils.isEmpty(examRecordReqDTO.getCourseUuid())){
-                errorDataRespDTOS.add(new ThErrorDataRespDTO(examRecordReqDTO.getUuid(),"课程不可为空"));
-                continue;
-            }
+
             if(StringUtils.isEmpty(examRecordReqDTO.getBatchUuid())){
-                errorDataRespDTOS.add(new ThErrorDataRespDTO(examRecordReqDTO.getUuid(),"批次不可为空"));
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(examRecordReqDTO.getUuid(),"批次(班级)不可为空"));
                 continue;
             }
 
-            List<ThStudentCourse> thStudentCourses = studentCourseList.stream().filter(sc -> sc.getCourseUuid().equals(examRecordReqDTO.getCourseUuid())
-                    && sc.getBatchUuid().equals(examRecordReqDTO.getBatchUuid())
+            List<ThStudentBatch> thStudentCourses = studentBatchList.stream().filter(sc -> sc.getBatchUuid().equals(examRecordReqDTO.getBatchUuid())
                     && sc.getIdcard().equals(examRecordReqDTO.getIdcard())).collect(Collectors.toList());
             if(thStudentCourses.size() == 0){
-                errorDataRespDTOS.add(new ThErrorDataRespDTO(examRecordReqDTO.getUuid(),"无该学生培训信息"));
+                errorDataRespDTOS.add(new ThErrorDataRespDTO(examRecordReqDTO.getUuid(),"无学生"+examRecordReqDTO.getIdcard()+"培训信息"));
                 continue;
             }
             if(StringUtils.isEmpty(examRecordReqDTO.getTrainOrgName())){
@@ -696,18 +1635,9 @@
                 errorDataRespDTOS.add(new ThErrorDataRespDTO(examRecordReqDTO.getUuid(),"是否通过考试状态不规范"));
                 continue;
             }
-            if(examRecordReqDTO.getExamNum() == null){
-                errorDataRespDTOS.add(new ThErrorDataRespDTO(examRecordReqDTO.getUuid(),"考试次数不可为空"));
-                continue;
-            }
+
             List<ThExamRecord> examRecordSelectList = oldExamRecordList.stream().filter(e -> e.getUuid().equals(examRecordReqDTO.getUuid())).collect(Collectors.toList());
-            if(examRecordSelectList.size() > 0){
-                ThExamRecord thExamRecord = examRecordSelectList.get(0);
-                BeanUtils.copyProperties(examRecordReqDTO,thExamRecord);
-                thExamRecord.setUpdateTime(LocalDateTime.now());
-                thExamRecord.setUpdateBy(institutionUser.getInstitutionalName());
-                updateExamRecordList.add(thExamRecord);
-            }else {
+            if(examRecordSelectList.size() == 0){
                 //新增
                 ThExamRecord thExamRecord = new ThExamRecord();
                 BeanUtils.copyProperties(examRecordReqDTO,thExamRecord);
@@ -721,11 +1651,9 @@
                 saveExamRecordList.add(thExamRecord);
             }
         }
-        if(saveExamRecordList.size() > 0){
-            examRecordService.saveBatch(saveExamRecordList);
-        }
-        if(updateExamRecordList.size() > 0){
-            examRecordService.updateBatchById(updateExamRecordList);
+        List<List<ThExamRecord>> splitSaveExamList = ListUtil.split(saveExamRecordList, 500);
+        for (List<ThExamRecord> list : splitSaveExamList) {
+            examRecordService.saveBatch(list);
         }
         return AjaxResult.success(errorDataRespDTOS);
     }
@@ -746,7 +1674,19 @@
             throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL);
         }
         //反序列化
-        ThCourseDeleteReqDTO thCourseDeleteReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThCourseDeleteReqDTO>() {});
+
+        ThCourseDeleteReqDTO thCourseDeleteReqDTO = null;
+        try {
+            thCourseDeleteReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThCourseDeleteReqDTO>() {});
+
+        }catch (Exception e){
+            logger.error("课程删除反序列化失败!");
+            throw new BusinessException(this.getClass(), ResultConstants.SERIALIZE_ERROR);
+
+        }
+        if(thCourseDeleteReqDTO == null){
+            throw new BusinessException(ResultConstants.THREE_INSTITUTION_PARAMM_NULL);
+        }
         if(StringUtils.isEmpty(thCourseDeleteReqDTO.getCourseUuid())){
             throw new BusinessException(ResultConstants.THREE_INSTITUTION_PARAMM_NULL);
         }
@@ -770,6 +1710,7 @@
             thCourseChapter.setDelFlag(DeleteStatusEnum.YES.getStatus());
             return thCourseChapter;
         }).collect(Collectors.toList());
+        courseService.updateById(thCourse);
         //删除章节
         if(thCourseChapters.size() > 0){
             courseChapterService.updateBatchById(thCourseChapters);
@@ -793,7 +1734,16 @@
             throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL);
         }
         //反序列化
-        ThBatchOpenReqDTO thBatchOpenReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThBatchOpenReqDTO>() {});
+        ThBatchOpenReqDTO thBatchOpenReqDTO = null;
+        try {
+            thBatchOpenReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThBatchOpenReqDTO>() {});
+        }catch (Exception e){
+            logger.error("班级开始反序列化失败!");
+            throw new BusinessException(this.getClass(), ResultConstants.SERIALIZE_ERROR);
+        }
+        if(thBatchOpenReqDTO == null){
+            throw new BusinessException(this.getClass(),ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"批次(班级)不可为空");
+        }
         if(StringUtils.isEmpty(thBatchOpenReqDTO.getBatchUuid())){
             throw new BusinessException(this.getClass(),ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"批次(班级)不可为空");
         }
@@ -801,7 +1751,10 @@
         if(thBatch == null){
             throw new BusinessException(ResultConstants.BATCH_IS_NOT_EXIST);
         }
-        thBatch.setOpenStatus(OpenStatus.YES.getStatus());
+        if(!thBatch.getStatus().equals(OpenStatus.NO.getStatus())){
+            throw new BusinessException(this.getClass(),ResultConstants.THREE_INSTITUTION_OTHER_ERROR,"已开班或已结束不可重新开班");
+        }
+        thBatch.setStatus(OpenStatus.START.getStatus());
         thBatch.setUpdateTime(LocalDateTime.now());
         thBatch.setUpdateBy(institutionUser.getInstitutionalName());
         batchService.updateById(thBatch);
@@ -809,7 +1762,7 @@
     }
     @Transactional
     @Override
-    public AjaxResult receiveBarchEnd(JSONObject jsonObject) {
+    public AjaxResult receiveBatchEnd(JSONObject jsonObject) {
         InstitutionUser institutionUser = ThreeInContextHolder.getContext();
 
         String data = jsonObject.getString("data");
@@ -824,31 +1777,35 @@
             throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL);
         }
         //反序列化
-        ThBatchEndReqDTO thBatchEndReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThBatchEndReqDTO>() {});
+        ThBatchEndReqDTO thBatchEndReqDTO = null;
+        try {
+            thBatchEndReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThBatchEndReqDTO>() {});
+        }catch (Exception e){
+            logger.error("班级结束反序列化失败!");
+            throw new BusinessException(this.getClass(), ResultConstants.SERIALIZE_ERROR);
+        }
+        if(thBatchEndReqDTO == null){
+            throw new BusinessException(this.getClass(),ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"批次(班级)不可为空");
+        }
+
         if(StringUtils.isEmpty(thBatchEndReqDTO.getBatchUuid())){
             throw new BusinessException(this.getClass(),ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"批次(班级)不可为空");
         }
-        if(StringUtils.isEmpty(thBatchEndReqDTO.getIdcard())){
-            throw new BusinessException(this.getClass(),ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"学生身份证不可为空");
+        ThBatch thBatch = batchService.getByUuid(thBatchEndReqDTO.getBatchUuid());
+        if(thBatch == null){
+            throw new BusinessException(ResultConstants.BATCH_IS_NOT_EXIST);
         }
-        List<ThStudentCourse> thStudentCourses = studentCourseService.getByIdcardAndBatchUuid(thBatchEndReqDTO.getIdcard(), thBatchEndReqDTO.getBatchUuid());
-        if(CollectionUtils.isEmpty(thStudentCourses)){
-            throw new BusinessException(ResultConstants.BATCH_STUDENT_IS_NOT_EXIST);
-        }
-        thStudentCourses.stream().forEach(sc -> {
-            sc.setFinishStatus(FinishStatus.YES.getStatus());
-        });
-
-        studentCourseService.updateBatchById(thStudentCourses);
+        thBatch.setStatus(OpenStatus.END.getStatus());
+        thBatch.setUpdateTime(LocalDateTime.now());
+        thBatch.setUpdateBy(institutionUser.getInstitutionalName());
+        batchService.updateById(thBatch);
+        studentBatchService.updateFinishStatusByBatchUuid(thBatchEndReqDTO.getBatchUuid());
         return AjaxResult.success();
     }
 
 
     private void validateStudyDetail(ThStudyDetailReqDTO studentDetailReqDTO) {
-        //获取该平台课程
-        ThCourse course = courseService.getByUuid(studentDetailReqDTO.getCourseUuid());
-        ThBatch batch = batchService.getByUuid(studentDetailReqDTO.getBatchUuid());
-        ThCourseChapter chapter = courseChapterService.getByUuid(studentDetailReqDTO.getChapterUuid());
+
 
         if (studentDetailReqDTO == null) {
             throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"学习记录清单不可为空");
@@ -862,20 +1819,21 @@
         if(StringUtils.isEmpty(studentDetailReqDTO.getCourseUuid())){
             throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"课程不可为空");
         }
-        if(course == null){
-            throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"课程不存在");
-        }
         if(StringUtils.isEmpty(studentDetailReqDTO.getBatchUuid())){
             throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"批次不可为空");
         }
-        if(batch == null){
-            throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"批次不存在");
-        }
+
         if(StringUtils.isEmpty(studentDetailReqDTO.getChapterUuid())){
             throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"章节不可为空");
         }
+        //获取该平台课程
+        ThStudentBatch thStudentBatch = studentBatchService.getByIdcardAndBatchUuid(studentDetailReqDTO.getIdcard(),studentDetailReqDTO.getBatchUuid());
+        ThBatchCourseChapter chapter = batchCourseChapterService.getByUuid(studentDetailReqDTO.getBatchUuid(),studentDetailReqDTO.getCourseUuid(),studentDetailReqDTO.getChapterUuid());
+        if(thStudentBatch == null){
+            throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"批次(班级)中学生信息不存在");
+        }
         if(chapter == null){
-            throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"章节不存在");
+            throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"课程章节不存在");
         }
         if(StringUtils.isEmpty(studentDetailReqDTO.getTrainOrgName())){
             throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"培训机构名称不可为空");
@@ -948,32 +1906,7 @@
      * @param batchReqDTO
      */
     private void validateBatch(ThBatchReqDTO batchReqDTO) {
-        if(StringUtils.isEmpty(batchReqDTO.getUuid()) || !UUID.checkIsUuid(batchReqDTO.getUuid())){
-            throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"uuid不符合规范");
-        }
-        if(StringUtils.isEmpty(batchReqDTO.getBatchName())){
-            throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"班次名称不可为空");
-        }
-        if(StringUtils.isEmpty(batchReqDTO.getTrainOrgName())){
-            throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"培训机构名称不可为空");
-        }
-        if(batchReqDTO.getHaveExam() == null || HaveExam.get(batchReqDTO.getHaveExam()) == null){
-            throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"有无考试不规范");
-        }
-        if(batchReqDTO.getOpenStatus() == null || OpenStatus.get(batchReqDTO.getOpenStatus()) == null ){
-            throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"开班标识不符合规范");
-        }
-//        if(batchReqDTO.getDelFlag() == null || DeleteStatusEnum.getDeleteStatusEnum(batchReqDTO.getDelFlag()) == null ){
-//            throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"删除标识不符合规范");
-//        }
-        if(CollectionUtils.isEmpty(batchReqDTO.getCourseUuidList())){
-            throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"关联课程不可为空");
-        }
-        List<ThCourse> courseList = courseService.selectByUuid(batchReqDTO.getCourseUuidList());
-        if(courseList.size() != batchReqDTO.getCourseUuidList().size()){
-            throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"关联课程不存在,请先上报课程");
 
-        }
     }
 
     /**
@@ -1055,12 +1988,12 @@
             if(StringUtils.isEmpty(chapter.getChapterName())){
                 throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"章节(大章)名称不可为空");
             }
-            /*if(chapter.getDelFlag() == null || DeleteStatusEnum.getDeleteStatusEnum(chapter.getDelFlag()) == null ){
+            if(chapter.getDelFlag() == null || DeleteStatusEnum.getDeleteStatusEnum(chapter.getDelFlag()) == null ){
                 throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"章节(大章)删除标识不符合规范");
             }
             if (chapter.getLessonNum() == null){
                 throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"章节(大章)课时(保留1位小数)不可为空");
-            }*/
+            }
             if(chapter.getHaveResource() == null || CourseHaveResourse.get(chapter.getHaveResource()) == null){
                 throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"是否有资源不符合规范");
             }
@@ -1085,15 +2018,13 @@
                 if(child.getResourceType() == null || CourseResourceType.get(child.getResourceType()) == null){
                     throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"资源类型不规范");
                 }
-                /*if(child.getDelFlag() == null || DeleteStatusEnum.getDeleteStatusEnum(child.getDelFlag()) == null ){
+                if(child.getDelFlag() == null || DeleteStatusEnum.getDeleteStatusEnum(child.getDelFlag()) == null ){
                     throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"章节(小节)删除标识不符合规范");
-                }*/
+                }
                 if(child.getHaveResource() == null || CourseHaveResourse.get(child.getHaveResource()) == null){
                     throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"是否有资源不符合规范");
                 }
             }
-
-
         }
     }
 
@@ -1131,9 +2062,9 @@
          if(questionBankReqDTO.getMonth() == null){
              throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"年月不可为空");
          }
-        /* if(questionBankReqDTO.getDelFlag() == null || DeleteStatusEnum.getDeleteStatusEnum(questionBankReqDTO.getDelFlag()) == null ){
+         if(questionBankReqDTO.getDelFlag() == null || DeleteStatusEnum.getDeleteStatusEnum(questionBankReqDTO.getDelFlag()) == null ){
              throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"删除标识不符合规范");
-         }*/
+         }
     }
     private String generateSerialNum() {
         Long count = studyDetailService.getCount();

--
Gitblit v1.9.2