From 1a316551c8e46b793904090cfa84781bf77fef2a Mon Sep 17 00:00:00 2001
From: zhangf <1603559716@qq.com>
Date: Wed, 11 Sep 2024 15:51:49 +0800
Subject: [PATCH] 增加科目类别
---
exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/TripartiteInterfaceServiceImpl.java | 74 ++++++++++++++++++++++++++++++-------
1 files changed, 60 insertions(+), 14 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 6d089ce..4db8897 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
@@ -5,7 +5,6 @@
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.*;
@@ -60,9 +59,10 @@
private ThStudyDetailService studyDetailService;
@Autowired
private ThExamRecordService examRecordService;
-
@Autowired
private ThBatchCourseChapterService batchCourseChapterService;
+ @Autowired
+ private ThSubjectTypeService subjectTypeService;
@Override
public boolean receiveQuestionBank(JSONObject jsonObject) {
@@ -163,10 +163,10 @@
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;
@@ -546,7 +546,7 @@
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())){
@@ -728,6 +728,8 @@
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<>();
@@ -742,8 +744,25 @@
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){
@@ -752,6 +771,14 @@
}
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){
@@ -1287,6 +1314,7 @@
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) {
@@ -1325,11 +1353,15 @@
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){
@@ -1425,6 +1457,13 @@
continue;
}
saveStudyDetailReqDTOS.add(studentDetailReqDTO);
+
+ //判断需要修改的批次学生
+ if(studentDetailReqDTO.getCompleteStatus().equals(FinishStatus.YES.getStatus())){
+ ThStudentBatch thStudentBatch = StudentBatchSelectList.get(0);
+ thStudentBatch.setFinishStatus(studentDetailReqDTO.getCompleteStatus());
+ updateStudentBatchList.add(thStudentBatch);
+ }
}
//获取历史记录
@@ -1532,6 +1571,11 @@
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);
}
@@ -1603,7 +1647,7 @@
continue;
}
if(StringUtils.isEmpty(examRecordReqDTO.getTrainOrgName())){
- errorDataRespDTOS.add(new ThErrorDataRespDTO(examRecordReqDTO.getUuid(),"培训机构名称不可为空"));
+ errorDataRespDTOS.add(new ThErrorDataRespDTO(examRecordReqDTO.getUuid(),"所属培训机构统一社会信用代码不可为空"));
continue;
}
if(StringUtils.isEmpty(examRecordReqDTO.getExamName())){
@@ -1757,6 +1801,7 @@
thBatch.setStatus(OpenStatus.START.getStatus());
thBatch.setUpdateTime(LocalDateTime.now());
thBatch.setUpdateBy(institutionUser.getInstitutionalName());
+ thBatch.setActualStartTime(LocalDateTime.now());
batchService.updateById(thBatch);
return AjaxResult.success();
}
@@ -1798,10 +1843,11 @@
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) {
@@ -1836,7 +1882,7 @@
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,"完成状态不规范");
@@ -1936,7 +1982,7 @@
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不可为空");
@@ -1970,7 +2016,7 @@
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,"总课时不可为空");
--
Gitblit v1.9.2