| | |
| | | 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.*; |
| | |
| | | private ThStudyDetailService studyDetailService; |
| | | @Autowired |
| | | private ThExamRecordService examRecordService; |
| | | |
| | | @Autowired |
| | | private ThBatchCourseChapterService batchCourseChapterService; |
| | | @Autowired |
| | | private ThSubjectTypeService subjectTypeService; |
| | | |
| | | @Override |
| | | public boolean receiveQuestionBank(JSONObject jsonObject) { |
| | |
| | | errorDataRespDTOS.add(new ThErrorDataRespDTO(courseReqDTO.getUuid(),"课程名称不可为空")); |
| | | continue; |
| | | } |
| | | if(StringUtils.isEmpty(courseReqDTO.getTrainOrgName())){ |
| | | errorDataRespDTOS.add(new ThErrorDataRespDTO(courseReqDTO.getUuid(),"培训机构名称不可为空")); |
| | | /*if(StringUtils.isEmpty(courseReqDTO.getTrainOrgName())){ |
| | | errorDataRespDTOS.add(new ThErrorDataRespDTO(courseReqDTO.getUuid(),"所属培训机构统一社会信用代码不可为空")); |
| | | continue; |
| | | } |
| | | }*/ |
| | | if(courseReqDTO.getLessonNum() == null){ |
| | | errorDataRespDTOS.add(new ThErrorDataRespDTO(courseReqDTO.getUuid(),"课程总课时不可为空")); |
| | | continue; |
| | |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"学生删除标识不符合规范"); |
| | | } |
| | | if (StringUtils.isEmpty(studentReqDTO.getTrainOrgName())){ |
| | | errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getUuid(),"培训机构名称不可为空")); |
| | | errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getUuid(),"所属培训机构统一社会信用代码不可为空")); |
| | | continue; |
| | | } |
| | | if(StringUtils.isEmpty(studentReqDTO.getBatchUuid())){ |
| | |
| | | List<ThCourse> thCourseList = courseService.getByUuidList(reqCourseUuids); |
| | | //获取章节 |
| | | List<ThCourseChapter> thCourseChapterList = courseChapterService.getByUuids(reqChapterUuids); |
| | | //获取科目类别 |
| | | List<ThSubjectType> subjectTypeList = subjectTypeService.getSubjectTypeList(); |
| | | //校验 |
| | | List<ThErrorDataRespDTO> errorDataRespDTOS = new ArrayList<>(); |
| | | List<ThBatchReqDTO> saveBatchReqDTOList = new ArrayList<>(); |
| | |
| | | errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"班次(班级)名称不可为空")); |
| | | continue; |
| | | } |
| | | if(StringUtils.isEmpty(batchReqDTO.getSubjectCode())){ |
| | | errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"班次(班级)科目类别不可为空")); |
| | | continue; |
| | | } |
| | | if(batchReqDTO.getExpectEndTime() == null){ |
| | | errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"班次(班级)预期开始时间不可为空")); |
| | | continue; |
| | | } |
| | | if(batchReqDTO.getExpectStartTime() == null){ |
| | | errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"班次(班级)预期结束时间不可为空")); |
| | | continue; |
| | | } |
| | | List<ThSubjectType> selectSubjectTypeList = subjectTypeList.stream().filter(st -> st.getCode().equals(batchReqDTO.getSubjectCode())).collect(Collectors.toList()); |
| | | if(selectSubjectTypeList.size() == 0){ |
| | | errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"班次(班级)科目类别不合法")); |
| | | continue; |
| | | } |
| | | if(StringUtils.isEmpty(batchReqDTO.getTrainOrgName())){ |
| | | errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"培训机构名称不可为空")); |
| | | errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"所属培训机构统一社会信用代码不可为空")); |
| | | continue; |
| | | } |
| | | if(batchReqDTO.getHaveExam() == null || HaveExam.get(batchReqDTO.getHaveExam()) == null){ |
| | |
| | | } |
| | | if(batchReqDTO.getStatus() == null || OpenStatus.get(batchReqDTO.getStatus()) == null ){ |
| | | errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"批次(班级)状态标识不符合规范")); |
| | | continue; |
| | | } |
| | | if(batchReqDTO.getStatus().equals(OpenStatus.START.getStatus()) && batchReqDTO.getActualStartTime() == null){ |
| | | errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"开班后,实际开班时间不可为空")); |
| | | continue; |
| | | } |
| | | if(batchReqDTO.getStatus().equals(OpenStatus.END.getStatus()) && batchReqDTO.getActualEndTime() == null){ |
| | | errorDataRespDTOS.add(new ThErrorDataRespDTO(batchReqDTO.getUuid(),"结班,实际结束时间不可为空")); |
| | | continue; |
| | | } |
| | | if(batchReqDTO.getBatchLessonNum() == null){ |
| | |
| | | List<ThStudentBatch> thStudentBatches = studentBatchService.getByIdCards(idcards); |
| | | List<ThBatchCourseChapter> batchCourseChapters = batchCourseChapterService.getByChapterUuids(chapterUuids); |
| | | //校验 |
| | | List<ThStudentBatch> updateStudentBatchList = new ArrayList<>(); |
| | | List<ThErrorDataRespDTO> errorDataRespDTOS = new ArrayList<>(); |
| | | List<ThStudyDetailReqDTO> saveStudyDetailReqDTOS = new ArrayList<>(); |
| | | for (ThStudyDetailReqDTO studentDetailReqDTO : thStudyDetailReqDTOS) { |
| | |
| | | continue; |
| | | } |
| | | if(StringUtils.isEmpty(studentDetailReqDTO.getTrainOrgName())){ |
| | | errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"培训机构名称不可为空")); |
| | | errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"所属培训机构统一社会信用代码不可为空")); |
| | | continue; |
| | | } |
| | | if(studentDetailReqDTO.getFinishStatus() == null || FinishStatus.get(studentDetailReqDTO.getFinishStatus()) == null){ |
| | | errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"完成状态不规范")); |
| | | errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"章节学习状态不规范")); |
| | | continue; |
| | | } |
| | | if(studentDetailReqDTO.getCompleteStatus() == null || StudentFinishStatus.get(studentDetailReqDTO.getCompleteStatus()) == null){ |
| | | errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"该学生在此批次(班级)学习状态不规范")); |
| | | continue; |
| | | } |
| | | if(studentDetailReqDTO.getDuration() == null){ |
| | |
| | | continue; |
| | | } |
| | | saveStudyDetailReqDTOS.add(studentDetailReqDTO); |
| | | |
| | | //判断需要修改的批次学生 |
| | | if(studentDetailReqDTO.getCompleteStatus().equals(FinishStatus.YES.getStatus())){ |
| | | ThStudentBatch thStudentBatch = StudentBatchSelectList.get(0); |
| | | thStudentBatch.setFinishStatus(studentDetailReqDTO.getCompleteStatus()); |
| | | updateStudentBatchList.add(thStudentBatch); |
| | | } |
| | | } |
| | | |
| | | //获取历史记录 |
| | |
| | | for (List<ThStudyTrack> thStudyTracks : splitSaveTrackList) { |
| | | studyTrackService.insertBatch(thStudyTracks); |
| | | } |
| | | //修改学生完成状态 |
| | | List<List<ThStudentBatch>> splitUpdateThStudentBatchList = ListUtil.split(updateStudentBatchList, 500); |
| | | for (List<ThStudentBatch> studentBatcheList : splitUpdateThStudentBatchList) { |
| | | studentBatchService.updateBatch(studentBatcheList); |
| | | } |
| | | return AjaxResult.success(errorDataRespDTOS); |
| | | } |
| | | |
| | |
| | | continue; |
| | | } |
| | | if(StringUtils.isEmpty(examRecordReqDTO.getTrainOrgName())){ |
| | | errorDataRespDTOS.add(new ThErrorDataRespDTO(examRecordReqDTO.getUuid(),"培训机构名称不可为空")); |
| | | errorDataRespDTOS.add(new ThErrorDataRespDTO(examRecordReqDTO.getUuid(),"所属培训机构统一社会信用代码不可为空")); |
| | | continue; |
| | | } |
| | | if(StringUtils.isEmpty(examRecordReqDTO.getExamName())){ |
| | |
| | | thBatch.setStatus(OpenStatus.START.getStatus()); |
| | | thBatch.setUpdateTime(LocalDateTime.now()); |
| | | thBatch.setUpdateBy(institutionUser.getInstitutionalName()); |
| | | thBatch.setActualStartTime(LocalDateTime.now()); |
| | | batchService.updateById(thBatch); |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | thBatch.setStatus(OpenStatus.END.getStatus()); |
| | | thBatch.setUpdateTime(LocalDateTime.now()); |
| | | thBatch.setUpdateBy(institutionUser.getInstitutionalName()); |
| | | thBatch.setActualEndTime(LocalDateTime.now()); |
| | | batchService.updateById(thBatch); |
| | | studentBatchService.updateFinishStatusByBatchUuid(thBatchEndReqDTO.getBatchUuid()); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | private void validateStudyDetail(ThStudyDetailReqDTO studentDetailReqDTO) { |
| | |
| | | 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,"培训机构名称不可为空"); |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"所属培训机构统一社会信用代码不可为空"); |
| | | } |
| | | if(studentDetailReqDTO.getFinishStatus() == null || FinishStatus.get(studentDetailReqDTO.getFinishStatus()) == null){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"完成状态不规范"); |
| | |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"实名认证照不可为空"); |
| | | } |
| | | if (StringUtils.isEmpty(studentReqDTO.getTrainOrgName())){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"培训机构名称不可为空"); |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"所属培训机构统一社会信用代码不可为空"); |
| | | } |
| | | /*if(CollectionUtils.isEmpty(studentReqDTO.getBatchUuids())){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"关联课程uuidd不可为空"); |
| | |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"课程名称不可为空"); |
| | | } |
| | | if(StringUtils.isEmpty(courseReqDTO.getTrainOrgName())){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"培训机构名称不可为空"); |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"所属培训机构统一社会信用代码不可为空"); |
| | | } |
| | | if(courseReqDTO.getLessonNum() == null){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"总课时不可为空"); |