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/entity/ThCourseDO.java | 7 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThBatchCourseVO.java | 9 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudentBatchCourseVO.java | 11 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/TripartiteInterfaceController.java | 148 + exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchManagerService.java | 3 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThExamRecordServiceImpl.java | 20 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThPlatformBatchRespDTO.java | 27 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudentBatchVO.java | 25 exam-system/src/main/resources/mapper/institutionaccess/ThCourseMapper.xml | 104 + exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyDetailMapper.java | 8 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThCourseChapterRespDTO.java | 1 ruoyi-admin/src/main/resources/application-pro.yml | 10 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThCourseChapter.java | 3 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyAuthServiceImpl.java | 20 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchService.java | 10 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyTrackService.java | 4 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ThreeAccessController.java | 18 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyAuthService.java | 6 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudentMapper.java | 7 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchCourseService.java | 13 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyDetailService.java | 7 ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RepeatedClickAspect.java | 64 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThBatchCourseChapterMapper.java | 21 exam-system/src/main/resources/mapper/institutionaccess/ThStudentBatchMapper.xml | 151 ++ exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThCourseChapterVO.java | 1 exam-system/src/main/resources/mapper/institutionaccess/ThStudyDetailMapper.xml | 137 + exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseManagerService.java | 7 exam-system/src/main/resources/mapper/institutionaccess/ThExamRecordMapper.xml | 62 exam-system/src/main/resources/mapper/institutionaccess/ThStudyTrackMapper.xml | 18 exam-system/src/main/resources/mapper/institutionaccess/ThBatchMapper.xml | 123 + exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThCourseChapterReqDTO.java | 3 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThExamRecordService.java | 5 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThBatch.java | 6 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudentBatchService.java | 39 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThBatchCourseMapper.java | 9 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudyVO.java | 1 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentServiceImpl.java | 27 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThPlatformChapterRespDTO.java | 22 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThExamRecordVO.java | 1 exam-system/src/main/resources/mapper/institutionaccess/ThStudyAuthMapper.xml | 13 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThCourseMapper.java | 11 exam-system/src/main/resources/mapper/institutionaccess/ThCourseChapterMapper.xml | 87 + ruoyi-admin/src/main/resources/application-dev.yml | 10 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThExamRecordReqDTO.java | 2 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudentBatchMapper.java | 38 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThBatchCourse.java | 21 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchCourseChapterReqDTO.java | 17 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/config/ExecutorConfig.java | 80 + exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchCourseServiceImpl.java | 27 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchEndReqDTO.java | 2 ruoyi-common/src/main/java/com/ruoyi/common/annotation/RepeatedClick.java | 16 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchReqDTO.java | 9 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/OpenStatus.java | 7 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyTrackMapper.java | 2 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThStudentReqDTO.java | 2 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseChapterServiceImpl.java | 33 exam-system/src/main/resources/mapper/institutionaccess/ThBatchCourseMapper.xml | 90 + exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/TripartiteInterfaceServiceImpl.java | 1787 ++++++++++++++++++----- exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentBatchServiceImpl.java | 104 + exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudentService.java | 8 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchCourseChapterServiceImpl.java | 72 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchManagerServiceImpl.java | 74 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudentBatch.java | 9 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseManagerServiceImpl.java | 79 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyDetailServiceImpl.java | 28 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThCourseManagerController.java | 5 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyTrackServiceImpl.java | 9 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThExamRecord.java | 2 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentManagerServiceImpl.java | 2 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThExamRecordMapper.java | 3 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseChapterService.java | 11 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThStudentStudyRespDTO.java | 8 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThBatchVO.java | 2 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThBatchMapper.java | 6 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThCourseChapterMapper.java | 7 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchCourseReqDTO.java | 17 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudyDetailVO.java | 2 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchCourseChapterService.java | 25 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseService.java | 13 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/StudentSex.java | 5 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThPlatformCourseRespDTO.java | 23 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThBatchCourseChapter.java | 54 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThPlatformStudentRespDTO.java | 13 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchServiceImpl.java | 28 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyRecordManagerServiceImpl.java | 50 exam-system/src/main/resources/mapper/institutionaccess/ThBatchCourseChapterMapper.xml | 115 + exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThStudyDetailQuery.java | 6 ruoyi-common/src/main/java/com/ruoyi/common/constant/ResultConstants.java | 3 /dev/null | 47 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThBatchCourseChapterVO.java | 28 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyAuthMapper.java | 3 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/TripartiteInterfaceService.java | 2 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseServiceImpl.java | 36 exam-system/src/main/resources/mapper/institutionaccess/ThStudentMapper.xml | 35 94 files changed, 3,669 insertions(+), 677 deletions(-) diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/config/ExecutorConfig.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/config/ExecutorConfig.java new file mode 100644 index 0000000..555e1f0 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/config/ExecutorConfig.java @@ -0,0 +1,80 @@ +package com.gkhy.exam.institutionalaccess.config; + + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.AsyncConfigurer; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; + +import java.lang.reflect.Method; +import java.util.concurrent.Executor; +import java.util.concurrent.ThreadPoolExecutor; + +@Configuration +@EnableAsync +public class ExecutorConfig implements AsyncConfigurer { + private Logger logger = LoggerFactory.getLogger(ExecutorConfig.class); + + /** + * 最小线程数(核心线程数) + */ + @Value("${threadPool.corePoolSize}") + private int corePoolSize; + /** + * 最大线程数 + */ + @Value("${threadPool.maxPoolSize}") + private int maxPoolSize; + /** + * 等待队列(队列最大长度) + */ + @Value("${threadPool.queueCapacity}") + private int queueCapacity; + + + @Bean(name = "SocketTaskExecutor") + public Executor asyncServiceExecutor() { + logger.info("start asyncServiceExecutor"); + + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + //配置核心线程数 + executor.setCorePoolSize(corePoolSize); + //配置最大线程数 + executor.setMaxPoolSize(maxPoolSize); + //配置队列大小 + executor.setQueueCapacity(queueCapacity); + //配置线程池中的线程的名称前缀 + executor.setThreadNamePrefix("async-service-"); + // rejection-policy:当pool已经达到max size的时候,如何处理新任务 + // CALLER_RUNS:不在新线程中执行任务,而是有调用者所在的线程来执行 + executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); + //所有任务完成在关闭线程池 + executor.setWaitForTasksToCompleteOnShutdown(true); + //执行初始化 + executor.initialize(); + return executor; + } + + /** + * 异步异常处理 + * + * @return + */ + @Override + public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() { + return new SpringAsyncExceptionHandler(); + } + + class SpringAsyncExceptionHandler implements AsyncUncaughtExceptionHandler { + @Override + public void handleUncaughtException(Throwable throwable, Method method, Object... obj) { + logger.error("Exception occurs in async method:%s,异常信息如下:", method.getName()); + throwable.printStackTrace(); + } + } +} \ No newline at end of file diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThCourseManagerController.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThCourseManagerController.java index a248fe9..2daf041 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThCourseManagerController.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThCourseManagerController.java @@ -29,4 +29,9 @@ public AjaxResult findById(@PathVariable Long id) { return AjaxResult.success(courseManagerService.findById(id)); } + + @GetMapping("/student/{courseUuid}") + public AjaxResult getStudent(@PathVariable String courseUuid) { + return AjaxResult.success(courseManagerService.getSutdent(courseUuid)); + } } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/TripartiteInterfaceController.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/TripartiteInterfaceController.java index 901a875..bdbaf50 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/TripartiteInterfaceController.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/TripartiteInterfaceController.java @@ -1,24 +1,17 @@ package com.gkhy.exam.institutionalaccess.controller; import com.alibaba.fastjson2.JSONObject; -import com.alibaba.fastjson2.TypeReference; -import com.gkhy.exam.institutionalaccess.enums.*; -import com.gkhy.exam.institutionalaccess.model.req.*; import com.gkhy.exam.institutionalaccess.service.TripartiteInterfaceService; +import com.ruoyi.common.annotation.RepeatedClick; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.signature.AESUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; + @RequestMapping("/gov-server/receive") @@ -28,41 +21,51 @@ private TripartiteInterfaceService tripartiteInterfaceService; @PostMapping("/question/bank") + @RepeatedClick public AjaxResult receiveQuestionBank(@RequestBody JSONObject jsonObject){ return success(tripartiteInterfaceService.receiveQuestionBank(jsonObject)); } @PostMapping("/course") + @RepeatedClick public AjaxResult receiveCourse(@RequestBody JSONObject jsonObject){ return tripartiteInterfaceService.receiveCourse(jsonObject); } @PostMapping("/course/delete") + @RepeatedClick public AjaxResult receiveCourseDelete(@RequestBody JSONObject jsonObject){ return tripartiteInterfaceService.receiveCourseDelete(jsonObject); } @PostMapping("/batch") + @RepeatedClick public AjaxResult receiveBatch(@RequestBody JSONObject jsonObject){ return tripartiteInterfaceService.receiveBatch(jsonObject); } @PostMapping("/batch/open") + @RepeatedClick public AjaxResult receiveBatchOpen(@RequestBody JSONObject jsonObject){ return tripartiteInterfaceService.receiveBatchOpen(jsonObject); } @PostMapping("/student") + @RepeatedClick public AjaxResult receiveStudent(@RequestBody JSONObject jsonObject){ return tripartiteInterfaceService.receiveStudent(jsonObject); } @PostMapping("/study/detail") + @RepeatedClick public AjaxResult receiveStudyDetail(@RequestBody JSONObject jsonObject){ return tripartiteInterfaceService.receiveStudyDetail(jsonObject); } + + @RepeatedClick @PostMapping("/exam/record") public AjaxResult receiveExamRecord(@RequestBody JSONObject jsonObject){ return tripartiteInterfaceService.receiveExamRecord(jsonObject); } + @RepeatedClick @PostMapping("/batch/end") - public AjaxResult receiveBarchEnd(@RequestBody JSONObject jsonObject){ - return tripartiteInterfaceService.receiveBarchEnd(jsonObject); + public AjaxResult receiveBatchEnd(@RequestBody JSONObject jsonObject){ + return tripartiteInterfaceService.receiveBatchEnd(jsonObject); } /** @@ -94,6 +97,7 @@ * @param args */ /*public static void main(String[] args) { + List<ThCourseReqDTO> list = new ArrayList<>(); ThCourseReqDTO thCourseReqDTO = new ThCourseReqDTO(); thCourseReqDTO.setUuid("20bded7f-660c-4380-b7f9-00f3976e1875"); thCourseReqDTO.setCourseCode("java001111"); @@ -105,41 +109,46 @@ //章 ThCourseChapterReqDTO chapterReqDTO1 = new ThCourseChapterReqDTO(); chapterReqDTO1.setUuid("9d470732-6233-4820-82f7-37c80fe8ae68"); - //chapterReqDTO1.setDelFlag((byte)0); + chapterReqDTO1.setDelFlag((byte)0); chapterReqDTO1.setChapterCode("001"); chapterReqDTO1.setChapterName("第一章节 基础理论"); - chapterReqDTO1.setHaveResource((byte)10); + chapterReqDTO1.setHaveResource((byte)0); + chapterReqDTO1.setSerialno(1); + chapterReqDTO1.setLessonNum(new BigDecimal(10)); List<ThCourseChapterReqDTO> childList = new ArrayList<>(); //节 ThCourseChapterReqDTO child11 = new ThCourseChapterReqDTO(); child11.setUuid("d5cd3b26-be11-4ffe-8a34-283c49c85253"); child11.setUrl("https://www.baidu.com"); - //child11.setDelFlag((byte)2); + child11.setDelFlag((byte)2); child11.setChapterCode("1.1"); child11.setChapterName("1.1类"); - child11.setHaveResource((byte)20); + child11.setHaveResource((byte)1); + child11.setSerialno(1); child11.setDuration(1800l); child11.setResourceType((byte)0); child11.setLessonNum(new BigDecimal(1)); ThCourseChapterReqDTO child12= new ThCourseChapterReqDTO(); child12.setUuid("eb7167be-5716-43d0-8e27-12bb43d1dded"); child12.setUrl("https://www.baidu.com1213231"); - //child12.setDelFlag((byte)0); + child12.setDelFlag((byte)0); child12.setChapterCode("1.2"); child12.setChapterName("1.2接口"); - child12.setHaveResource((byte)20); + child12.setHaveResource((byte)1); child12.setLessonNum(new BigDecimal(1.5)); child12.setDuration(4500l); child12.setResourceType((byte)0); + child12.setSerialno(2); ThCourseChapterReqDTO child13= new ThCourseChapterReqDTO(); - child13.setUuid(UUID.randomUUID().toString()); + child13.setUuid("d684081a-6a09-42ce-86b1-58df94d18f6b"); child13.setUrl("https://www.baidu.com3333"); - //child13.setDelFlag((byte)0); + child13.setDelFlag((byte)2); child13.setChapterCode("1.3"); child13.setChapterName("1.3多态"); - child13.setHaveResource((byte)20); + child13.setHaveResource((byte)1); child13.setLessonNum(new BigDecimal(1.5)); child13.setDuration(1800l); + child13.setSerialno(3); child13.setResourceType((byte)0); childList.add(child11); childList.add(child12); @@ -147,20 +156,18 @@ chapterReqDTO1.setChildren(childList); chapterList.add(chapterReqDTO1); thCourseReqDTO.setChapters(chapterList); - - String jsonString = JSONObject.toJSONString(thCourseReqDTO); + list.add(thCourseReqDTO); + String jsonString = JSONObject.toJSONString(list); String encrypt = AESUtils.encrypt(jsonString); System.out.println(encrypt); - String decrypt = AESUtils.decrypt("3G5/kr4d9CCjK6/q8LWZ1TZK6SF/GINWmeKzfmtvPZo0W/4Ydd7qti1VaOO4LQcKNNN67kvSfjCx3xUS1iAiUcWaVllWpVeNW8FWHt/1OQ+coFyslHVXDdCbQIVYpzF/0Q4jdBXpydtEmVsxifazo3l5/a2NBG319hhCXFNJmY5DgF2SUq7t6niKaEom6QbcFTENqV1KNZ87QeI7dl18UveADgxP91XpaRb+4M0JGIYpiXnr/LEDNAYM13eU6LSK+mBc38QQ+WcxijYGFvk1U6rlMYui3aLisyPLaFEwlhZ9Mscsrdw3t+XNJNp6SKiTG4HCOvSBYOGHp2PHhFQBNHzluOlcA5L8a4nogDpThwcl47O474VXnp0WG2+9DYVUTXW/UddZSc/aCCIhe/DTfA7WoZkOnMO8k8fHlXQ0exHnfPxBTxozG3UKyQ6hGHyjWqrfk/oVRcfOcPCQavIwwu9YLQeUpqL88VntE2+sBUPJtGOQrvq6A5No2RHgEGqptrUboMuL/OimEGjTAPdnRKQL+8JqqZf9HSPTCnoSYpTxKAfFf8hKEyMvW8SZzr3BS1MOL11HOTKeaD7kVuCYxEugfrdIzcAFsX9lxHSO2ubHadXektkdpLdMPd8WuLDzUknJqvYPDHBxcIzMea0XAQ=="); + String decrypt = AESUtils.decrypt("lE7/ryHW69pxuwuttBk8edBc7j30BwVoO3j0hl0933QQGMEYUgfVRhD0KlSGJcZoXh5NLQC6k08lJEsRSi8N59ydUG4qPdvk40Txc+O6xaudXHuMBzSePAKqYxQmG7hENVx8+Oarp+Nd4YsUxgcD9pE8RywRd7etZfowZapsbV1azNXjX7e2A0lhfkF1q5cmeQGB+YI0G9zoBeAXPAH+izmdtAnHr8GlB5dnwH7y0ObCWhpxa0o4gAlEn5zw8UNqYHnVpvgjFE15N7XSJqIauSVcmxMK6OMEEwfrzJ4kzDz8WHLoOWz1vXzUYFhb2yR/rp33cOYfTNOSVGWD14BKd2pLNleHp7TUFo4sG4+IwN4nMSYQstROI21BaSrBNQz2EjsB56BCbyc9nSxCBRA2MTxPRxKkjx/pVXUa7IG7wG8lxp7M+noeXygBBfoVFG5pwk0ux73+xZtKQiHi7yFW3kAbeMT16G9J0MzsWd3T3XJt1rDCO192SPNf9x/DFNp/xmMa1hnc18hguoeooTZPiGnkMze29Bp4P0Xn/XYrR1rlpZwkkcwWaw2/XXOiU5cWbzg6VKay6bj8IgKF7iKXcrM1UbgNkHnkb5XMrFG6lBcfI8KsBLPtaNOLWyMfJc+Wk7nSy50W5TkVLcNBDzpEgODNorl/70wYifupz+IRDQWgYw8IEQzUV6iy1RocFwg9SePvQgKsEYdEKYbPTv/wXpN+HgsGRXVb0K0gUl1BvPoXkwejXDIfuCw+6tdihFJdGFJZf4/26PCGkjBbfcMoLRW4chhvjbnFhXO7Kqz2Ah5e5GkXrCMuYWhMLtbP3W+q70Vrk+8CQSr3Q0cWt0vxYPQZjEYkpMLkAdA5x17AIrTvt/CrYTBwHTIKpKaBjv6CmEI9pHWUKERQEuSpuP75JG9cRX8UIQLFtA+tvh4jU/m1X5hqaudRQnIZL5FUJrMoPkBBfZ5LManiMk5jC/UDbozihOuxIgb+tvMONbhejgBk7tGfvqFz53PZNp7dx6VWI4RsYCDcKduCnjKQuOdmSClPbaCphZXu8qObvareOV4pwDD3gyBNn+nkzVgdxU+dy/wdK5HQWrqvelGSUx1SkRyRPh2fbB+33esmaJDUPL3mKQxIaQ06ZK5N9OJeiJcPuv+NPxgcQi/rxUkGNA+yA5luwNm7IMqya9LOyiG1kELwNNHGdcsvB4hsr4C44zMlT9hmHtk/2p/h1LO6A3KSqR+02VSU7+4CCC6lxHEkrufE4FpQN1dofIlkYD9KGjey"); System.out.println(decrypt); - ThCourseReqDTO questionBankReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThCourseReqDTO>() {}); - System.out.println(questionBankReqDTO); }*/ /** * 课程删除 */ - /*public static void main(String[] args) { + /* public static void main(String[] args) { ThCourseDeleteReqDTO thQuestionBankReqDTO = new ThCourseDeleteReqDTO(); thQuestionBankReqDTO.setCourseUuid("20bded7f-660c-4380-b7f9-00f3976e1875"); String jsonString = JSONObject.toJSONString(thQuestionBankReqDTO); @@ -178,14 +185,42 @@ */ /*public static void main(String[] args) { ThBatchReqDTO thBatchReqDTO = new ThBatchReqDTO(); - thBatchReqDTO.setUuid(UUID.randomUUID().toString()); + thBatchReqDTO.setUuid("5096d539-9ec4-499e-a7ef-3fc1c688ba55"); thBatchReqDTO.setBatchName("第一期2024"); thBatchReqDTO.setTrainOrgName("测试机构"); thBatchReqDTO.setHaveExam(HaveExam.YES.getStatus()); - thBatchReqDTO.setOpenStatus(OpenStatus.NO.getStatus()); - List<String> courseList = new ArrayList<>(); - courseList.add(new String("20bded7f-660c-4380-b7f9-00f3976e1875")); - thBatchReqDTO.setCourseUuidList(courseList); + thBatchReqDTO.setStatus(OpenStatus.NO.getStatus()); + thBatchReqDTO.setDelFlag((byte)0); + thBatchReqDTO.setBatchLessonNum(new BigDecimal(40)); + List<ThBatchCourseReqDTO> courseList = new ArrayList<>(); + ThBatchCourseReqDTO courseReqDTO = new ThBatchCourseReqDTO(); + courseReqDTO.setCourseUuid("20bded7f-660c-4380-b7f9-00f3976e1875"); + courseReqDTO.setDelFlag((byte) 0); + courseReqDTO.setCourseLessonNum(new BigDecimal(20)); + //章 + List<ThBatchCourseChapterReqDTO> chapterList = new ArrayList<>(); + ThBatchCourseChapterReqDTO chapterReqDTO = new ThBatchCourseChapterReqDTO(); + chapterReqDTO.setChapterUuid("9d470732-6233-4820-82f7-37c80fe8ae68"); + chapterReqDTO.setDelFlag((byte) 0); + chapterReqDTO.setChapterLessonNum(new BigDecimal(2)); + + //节 + List<ThBatchCourseChapterReqDTO> sectionList = new ArrayList<>(); + ThBatchCourseChapterReqDTO sectionReqDTO1 = new ThBatchCourseChapterReqDTO(); + sectionReqDTO1.setChapterUuid("d5cd3b26-be11-4ffe-8a34-283c49c85253"); + sectionReqDTO1.setDelFlag((byte) 0); + sectionReqDTO1.setChapterLessonNum(new BigDecimal(1)); + ThBatchCourseChapterReqDTO sectionReqDTO2 = new ThBatchCourseChapterReqDTO(); + sectionReqDTO2.setChapterUuid("eb7167be-5716-43d0-8e27-12bb43d1dded"); + sectionReqDTO2.setDelFlag((byte) 0); + sectionReqDTO2.setChapterLessonNum(new BigDecimal(1)); + sectionList.add(sectionReqDTO2); + sectionList.add(sectionReqDTO1); + chapterReqDTO.setChildren(sectionList); + chapterList.add(chapterReqDTO); + courseReqDTO.setChapterList(chapterList); + courseList.add(courseReqDTO); + thBatchReqDTO.setCourseList(courseList); String jsonString = JSONObject.toJSONString(thBatchReqDTO); String encrypt = AESUtils.encrypt(jsonString); @@ -198,17 +233,19 @@ /** * 学生信息上报 */ - /* public static void main(String[] args) { + /* public static void main(String[] args) { ThStudentReqDTO thStudentReqDTO = new ThStudentReqDTO(); - thStudentReqDTO.setName("李四"); - thStudentReqDTO.setIdcard("11111"); + thStudentReqDTO.setUuid("5096d539-9ec4-499e-a7ef-3fc1c688ba51"); + thStudentReqDTO.setName("李四fafas"); + thStudentReqDTO.setIdcard("11112"); thStudentReqDTO.setIndustry("ceshj"); thStudentReqDTO.setPost("post"); - thStudentReqDTO.setPhone("111111"); + thStudentReqDTO.setPhone("111111fafdsafa"); thStudentReqDTO.setSex(StudentSex.BOY.getStatus()); thStudentReqDTO.setTrainOrgName("测试机构"); thStudentReqDTO.setAuthPhoto("http://baidu.om"); - thStudentReqDTO.setBatchUuid("cc90070e-8d30-4c55-b696-7af25fd98900"); + thStudentReqDTO.setBatchUuid("5096d539-9ec4-499e-a7ef-3fc1c688ba55"); + thStudentReqDTO.setDelFlag((byte) 0); List<ThStudentReqDTO> studentList = new ArrayList<>(); studentList.add(thStudentReqDTO); String jsonString = JSONObject.toJSONString(studentList); @@ -223,9 +260,9 @@ /** * 开班 * */ - /*public static void main(String[] args) { +/* public static void main(String[] args) { ThBatchOpenReqDTO thBatchOpenReqDTO = new ThBatchOpenReqDTO(); - thBatchOpenReqDTO.setBatchUuid("b1b70bce-06dc-40b0-a3a1-dd595572eaa1"); + thBatchOpenReqDTO.setBatchUuid("5096d539-9ec4-499e-a7ef-3fc1c688bad1"); String jsonString = JSONObject.toJSONString(thBatchOpenReqDTO); String encrypt = AESUtils.encrypt(jsonString); System.out.println(encrypt); @@ -236,8 +273,7 @@ * */ /* public static void main(String[] args) { ThBatchEndReqDTO thBatchOpenReqDTO = new ThBatchEndReqDTO(); - thBatchOpenReqDTO.setBatchUuid("cc90070e-8d30-4c55-b696-7af25fd98900"); - thBatchOpenReqDTO.setIdcard("11111"); + thBatchOpenReqDTO.setBatchUuid("5096d539-9ec4-499e-a7ef-3fc1c688bad1"); String jsonString = JSONObject.toJSONString(thBatchOpenReqDTO); String encrypt = AESUtils.encrypt(jsonString); System.out.println(encrypt); @@ -248,13 +284,12 @@ * 考试记录 */ /*public static void main(String[] args) { + List<ThExamRecordReqDTO> list = new ArrayList<>(); ThExamRecordReqDTO thExamRecordReqDTO = new ThExamRecordReqDTO(); thExamRecordReqDTO.setUuid(UUID.randomUUID().toString()); - thExamRecordReqDTO.setIdcard("1111"); + thExamRecordReqDTO.setIdcard("11111"); thExamRecordReqDTO.setExamName("考试1"); - thExamRecordReqDTO.setExamNum(1); - thExamRecordReqDTO.setCourseUuid("20bded7f-660c-4380-b7f9-00f3976e1875"); - thExamRecordReqDTO.setBatchUuid("cc90070e-8d30-4c55-b696-7af25fd98900"); + thExamRecordReqDTO.setBatchUuid("5096d539-9ec4-499e-a7ef-3fc1c688ba55"); thExamRecordReqDTO.setExamPassScore(new BigDecimal(80)); thExamRecordReqDTO.setExamIsPass(ExamIsPass.YES.getStatus()); thExamRecordReqDTO.setExamUserScore(new BigDecimal(90)); @@ -262,7 +297,8 @@ thExamRecordReqDTO.setExamSubmitTime(LocalDateTime.now()); thExamRecordReqDTO.setTrainOrgName("测试"); thExamRecordReqDTO.setExamTotalScore(new BigDecimal(100)); - String jsonString = JSONObject.toJSONString(thExamRecordReqDTO); + list.add(thExamRecordReqDTO); + String jsonString = JSONObject.toJSONString(list); String encrypt = AESUtils.encrypt(jsonString); System.out.println(encrypt); @@ -270,11 +306,12 @@ /** * */ - /* public static void main(String[] args) { + /*public static void main(String[] args) { + List<ThStudyDetailReqDTO> list = new ArrayList<>(); ThStudyDetailReqDTO thStudyDetailReqDTO = new ThStudyDetailReqDTO(); - thStudyDetailReqDTO.setUuid(UUID.randomUUID().toString()); + thStudyDetailReqDTO.setUuid("8c061cb1-8560-43b8-abe4-04ae8e763f59"); thStudyDetailReqDTO.setIdcard("11111"); - thStudyDetailReqDTO.setBatchUuid("cc90070e-8d30-4c55-b696-7af25fd98900"); + thStudyDetailReqDTO.setBatchUuid("5096d539-9ec4-499e-a7ef-3fc1c688ba55"); thStudyDetailReqDTO.setCourseUuid("20bded7f-660c-4380-b7f9-00f3976e1875"); thStudyDetailReqDTO.setFinishStatus((byte)0); thStudyDetailReqDTO.setStartPosition(0l); @@ -288,7 +325,7 @@ thStudyDetailReqDTO.setLessonReportUrl("hht"); List<ThStudyTrackReqDTO> thStudyTrackReqDTOList = new ArrayList<>(); ThStudyTrackReqDTO thStudyTrackReqDTO = new ThStudyTrackReqDTO(); - thStudyTrackReqDTO.setUuid(UUID.randomUUID().toString()); + thStudyTrackReqDTO.setUuid("3162d570-9099-4dfb-b2fa-ec705f53758c"); thStudyTrackReqDTO.setStartTime(LocalDateTime.now()); thStudyTrackReqDTO.setEndTime(LocalDateTime.now()); thStudyTrackReqDTO.setTimeInterval(789878l); @@ -296,21 +333,22 @@ List<ThStudytAuthReqDTO> thStudytAuthReqDTOList = new ArrayList<>(); ThStudytAuthReqDTO thStudytAuthReqDTO = new ThStudytAuthReqDTO(); thStudytAuthReqDTO.setUuid(UUID.randomUUID().toString()); - thStudytAuthReqDTO.setAuthPostion(0l); + thStudytAuthReqDTO.setAuthPosition(0l); thStudytAuthReqDTO.setAuthTime(LocalDateTime.now()); thStudytAuthReqDTO.setApprovePhoto("454l"); thStudytAuthReqDTO.setFaceType(FaceType.AUTH.getType()); thStudytAuthReqDTOList.add(thStudytAuthReqDTO); thStudyDetailReqDTO.setTrackList(thStudyTrackReqDTOList); - thStudyDetailReqDTO.setStudentAuthList(thStudytAuthReqDTOList); - String jsonString = JSONObject.toJSONString(thStudyDetailReqDTO); + thStudyDetailReqDTO.setAuthList(thStudytAuthReqDTOList); + list.add(thStudyDetailReqDTO); + String jsonString = JSONObject.toJSONString(list); String encrypt = AESUtils.encrypt(jsonString); System.out.println(encrypt); }*/ - public static void main(String[] args) { - String decrypt = AESUtils.decrypt("PmvIbOPyVJ2pYqmGer1YBAij35Tfdk8lufUv+Y2CyqAds/iyh6PwS4dsnUzNO3El4Sk/WXXwbPGQ7UdaV8jznT/3YPqTeLdkxQ/1/6r9pvxuD2tyds8jo9DIBZYVxHpX3/9Z5Byp1UvszWeTWeaiDN+paKNO5v/TcXrosdce2dMGXLwY0i3GYA1JIbWWTTrvoWKJK+k5VW+5NnnDo+2Gj5CNSNv4c2wT7f3hTRy6B66RrRN3xkucCw4VRJZ+r+RK"); + /* public static void main(String[] args) { + String decrypt = AESUtils.decrypt(""); System.out.println(decrypt); - } + }*/ } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThBatch.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThBatch.java index c349e25..080697a 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThBatch.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThBatch.java @@ -7,6 +7,7 @@ import lombok.Data; import nonapi.io.github.classgraph.json.Id; +import java.math.BigDecimal; import java.time.LocalDateTime; /** @@ -23,9 +24,10 @@ private Long institutionId; private String institutionName; private Byte haveExam; - private Byte openStatus; + private Byte status; private String trainOrgName; - // private Byte finishStatus; + private BigDecimal batchLessonNum; + // private Byte finishStatus; //删除标志(0代表存在 2代表删除) private Byte delFlag; diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThBatchCourse.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThBatchCourse.java index 194aabd..80e2413 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThBatchCourse.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThBatchCourse.java @@ -3,8 +3,12 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import nonapi.io.github.classgraph.json.Id; + +import java.math.BigDecimal; +import java.time.LocalDateTime; @TableName("th_batch_course") @Data @@ -17,4 +21,21 @@ private String batchUuid; private Byte delFlag; private Long institutionId; + private BigDecimal courseLessonNum; + private String courseName; + private String trainOrgName; + /** 创建者 */ + private String createBy; + + /** 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + /** 更新者 */ + private String updateBy; + + /** 更新时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThBatchCourseChapter.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThBatchCourseChapter.java new file mode 100644 index 0000000..900af30 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThBatchCourseChapter.java @@ -0,0 +1,54 @@ +package com.gkhy.exam.institutionalaccess.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import nonapi.io.github.classgraph.json.Id; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + + +@Data +@TableName("th_batch_course_chapter") +public class ThBatchCourseChapter { + @Id + @TableId(type = IdType.AUTO) + private Long id; + private String batchUuid; + private String courseUuid; + private String chapterUuid; + private String chapterCode; + private String chapterName; + //有无资源(10无,20有) + private Byte haveResource; + //资源类型(0视频,1音频) + private Byte resourceType; + private BigDecimal lessonNum; + private Long duration; + //视频路径 + private String url; + private String parentUuid; + private Long institutionId; + //删除标志(0代表存在 2代表删除) + private Byte delFlag; + + /** 创建者 */ + private String createBy; + + /** 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + /** 更新者 */ + private String updateBy; + + /** 更新时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + private Integer serialno; + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThCourseChapter.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThCourseChapter.java index ec6ec8a..9f8718d 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThCourseChapter.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThCourseChapter.java @@ -46,5 +46,8 @@ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime updateTime; + private Integer serialno; + + } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThCourseDO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThCourseDO.java new file mode 100644 index 0000000..3146166 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThCourseDO.java @@ -0,0 +1,7 @@ +package com.gkhy.exam.institutionalaccess.entity; + +import lombok.Data; + +@Data +public class ThCourseDO { +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThExamRecord.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThExamRecord.java index d3fc2ad..880a4d9 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThExamRecord.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThExamRecord.java @@ -21,7 +21,6 @@ private Long id; private String uuid; private String idcard; - private String courseUuid; private String batchUuid; private Long institutionId; private String institutionName; @@ -35,7 +34,6 @@ private BigDecimal examTotalScore; private BigDecimal examPassScore; private Byte examIsPass; - private Integer examNum; //删除标志(0代表存在 2代表删除) private Byte delFlag; diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudentCourse.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudentBatch.java similarity index 83% rename from exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudentCourse.java rename to exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudentBatch.java index 6bafe27..9a4abd3 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudentCourse.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudentBatch.java @@ -9,14 +9,14 @@ import java.time.LocalDateTime; -@TableName("th_student_course") +@TableName("th_student_batch") @Data -public class ThStudentCourse { +public class ThStudentBatch { @Id @TableId(type = IdType.AUTO) private Long id; + private String uuid; private String idcard; - private String courseUuid; private String batchUuid; private String name; private Byte sex; @@ -37,4 +37,7 @@ /** 创建时间 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime createTime; + private String updateBy; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/OpenStatus.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/OpenStatus.java index f15043e..32e3c99 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/OpenStatus.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/OpenStatus.java @@ -2,9 +2,10 @@ public enum OpenStatus { - //开班(0否,1是) - NO((byte)0,"否"), - YES((byte)1,"是"), + //开班(0未开班,1开班,2结束) + NO((byte)0,"未开班"), + START((byte)1,"开班"), + END((byte)2,"结束") ; private Byte status; diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/StudentSex.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/StudentSex.java index 3f304c4..1c1dad2 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/StudentSex.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/StudentSex.java @@ -2,9 +2,10 @@ public enum StudentSex { + NNKNOWN((byte)0,"未知"), + BOY((byte)1,"男"), + GIRL((byte)2,"女"), - BOY((byte)0,"男"), - GIRL((byte)1,"女"), ; private Byte status; diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThBatchCourseChapterMapper.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThBatchCourseChapterMapper.java new file mode 100644 index 0000000..2c03903 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThBatchCourseChapterMapper.java @@ -0,0 +1,21 @@ +package com.gkhy.exam.institutionalaccess.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.gkhy.exam.institutionalaccess.entity.ThBatchCourseChapter; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +@Mapper +public interface ThBatchCourseChapterMapper extends BaseMapper<ThBatchCourseChapter> { + void deleteByBatchUuid(@Param("batchUuid") String batchUuid); + + List<ThBatchCourseChapter> getByBatchUuids(@Param("batchUuids")List<String> batchUuids); + Integer insertBatch(@Param("batchCourseChapterList") List<ThBatchCourseChapter> batchCourseChapterList); + Integer updateBatch(@Param("batchCourseChapterList") List<ThBatchCourseChapter> batchCourseChapterList); + + List<ThBatchCourseChapter> getByChapterUuids(@Param("chapterUuids") List<String> chapterUuids); +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThBatchCourseMapper.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThBatchCourseMapper.java index a51ae88..5d5b7ac 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThBatchCourseMapper.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThBatchCourseMapper.java @@ -14,7 +14,14 @@ public interface ThBatchCourseMapper extends BaseMapper<ThBatchCourse> { void deleteByBatchUuidAndCourseUuid(@Param("list") List<ThBatchCourse> deleteBatchCourseList); - List<ThBatchCourseVO> getListByBatchUuids(@Param("batchUuids")List<String> batchUuids); List<ThBatchCourseVO> getListByBatchUuid(@Param("batchUuid")String batchUuid); + + void deleteByBatchUuid(@Param("batchUuid")String batchUuid); + + List<ThBatchCourse> getByBatchUuids(@Param("batchUuids") List<String> batchUuids); + + Integer insertBatch(@Param("courseList") List<ThBatchCourse> courseList); + + Integer updateBatch(@Param("courseList") List<ThBatchCourse> courseList); } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThBatchMapper.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThBatchMapper.java index b53dae0..41c20f7 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThBatchMapper.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThBatchMapper.java @@ -14,4 +14,10 @@ @Mapper public interface ThBatchMapper extends BaseMapper<ThBatch> { List<ThBatchVO> listByPage(@Param("query") ThBatchQuery query); + + List<ThBatch> getByUuids(@Param("batchUuids") List<String> batchUuids); + Integer insertBatch(@Param("batchList") List<ThBatch> batchList); + Integer updateBatch(@Param("batchList") List<ThBatch> batchList); + + List<ThBatch> getBatchNameByUuids(@Param("batchUuids")List<String> batchUuids); } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThCourseChapterMapper.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThCourseChapterMapper.java index 846c2a8..bca4791 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThCourseChapterMapper.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThCourseChapterMapper.java @@ -15,4 +15,11 @@ List<ThCourseChapterVO> listByCourseUuids(@Param("courseUuids") List<String> courseUuids); List<ThCourseChapterVO> listByCourseUuid(@Param("courseUuid")String courseUuid); + + List<ThCourseChapter> getByUuids(@Param("chapterUuids") List<String> chapterUuids); + + Integer insertBatch(@Param("courseChapterList")List<ThCourseChapter> courseChapterList); + Integer updateBatch(@Param("courseChapterList")List<ThCourseChapter> courseChapterList); + + List<ThCourseChapter> getChapterNameByUuids(@Param("chapterUuids")List<String> chapterUuids); } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThCourseMapper.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThCourseMapper.java index bc8ae80..d9b219b 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThCourseMapper.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThCourseMapper.java @@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.gkhy.exam.institutionalaccess.entity.ThCourse; import com.gkhy.exam.institutionalaccess.model.query.ThCourseQuery; +import com.gkhy.exam.institutionalaccess.model.resp.ThCourseRespDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; @@ -12,5 +13,13 @@ @Repository @Mapper public interface ThCourseMapper extends BaseMapper<ThCourse> { - List<ThCourse> listByPage(@Param("query") ThCourseQuery query); + List<ThCourseRespDTO> listByPage(@Param("query") ThCourseQuery query); + + List<ThCourse> getByUuidList(@Param("courseUuids") List<String> courseUuids); + + Integer insertBatch(@Param("courseList") List<ThCourse> courseList); + + Integer updateBatch(@Param("courseList") List<ThCourse> courseList); + + List<ThCourse> getCourseNameByUuids(@Param("courseUuids")List<String> courseUuids); } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThExamRecordMapper.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThExamRecordMapper.java index 67f10f4..560e342 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThExamRecordMapper.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThExamRecordMapper.java @@ -15,4 +15,7 @@ @Mapper public interface ThExamRecordMapper extends BaseMapper<ThExamRecord> { List<ThExamRecordVO> listByPage(@Param("query") ThExamRecordQuery query); + + List<ThExamRecord> getByUuids(@Param("examUuids") List<String> examUuids); + Integer insertBatch(@Param("list") List<ThExamRecord> list); } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudentBatchMapper.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudentBatchMapper.java new file mode 100644 index 0000000..d62630c --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudentBatchMapper.java @@ -0,0 +1,38 @@ +package com.gkhy.exam.institutionalaccess.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.gkhy.exam.institutionalaccess.entity.ThStudentBatch; +import com.gkhy.exam.institutionalaccess.model.vo.ThStatisticStudentVO; +import com.gkhy.exam.institutionalaccess.model.vo.ThStudentBatchCourseVO; +import com.gkhy.exam.institutionalaccess.model.vo.ThStudentBatchVO; +import com.gkhy.exam.institutionalaccess.model.vo.ThStudentCourseVO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Mapper +@Repository +public interface ThStudentBatchMapper extends BaseMapper<ThStudentBatch> { + + List<ThStatisticStudentVO> statisticByBatchUuid(); + + List<ThStatisticStudentVO> statisticByCourseUuid(); + + List<ThStudentBatchCourseVO> getStudentBatchCourseVOByBatchUuid(@Param("batchUuid") String batchUuid); + + void updateByBatchUuid(@Param("batchUuid")String batchUuid); + + void updateFinishStatusByBatchUuid(@Param("batchUuid")String batchUuid); + + Integer insertBatch(@Param("list") List<ThStudentBatch> saveThStudentBatchList); + + Integer updateBatch(@Param("list") List<ThStudentBatch> updateThStudentBatchList); + + List<ThStudentBatchVO> getStudentBatchVOByBatchUuid(@Param("batchUuid") String batchUuid); + + List<ThStudentBatch> getByIdCards(@Param("idcards") List<String> idcards); + + List<ThStudentBatchVO> getStudentBatchVOByCourseUuid(@Param("courseUuid") String courseUuid); +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudentCourseMapper.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudentCourseMapper.java deleted file mode 100644 index c454a74..0000000 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudentCourseMapper.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.gkhy.exam.institutionalaccess.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.gkhy.exam.institutionalaccess.entity.ThStudentCourse; -import com.gkhy.exam.institutionalaccess.model.vo.ThStatisticStudentVO; -import com.gkhy.exam.institutionalaccess.model.vo.ThStudentCourseVO; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; -import org.springframework.stereotype.Repository; - -import java.util.List; - -@Mapper -@Repository -public interface ThStudentCourseMapper extends BaseMapper<ThStudentCourse> { - - List<ThStatisticStudentVO> statisticByBatchUuid(); - - List<ThStatisticStudentVO> statisticByCourseUuid(); - - List<ThStudentCourseVO> getListByBatchUuid(@Param("batchUuid") String batchUuid); - - void updateByBatchUuid(@Param("batchUuid")String batchUuid); -} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudentMapper.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudentMapper.java index 5d91a2a..a1259be 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudentMapper.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudentMapper.java @@ -11,7 +11,12 @@ @RequestMapping @Mapper public interface ThStudentMapper extends BaseMapper<ThStudent> { - int updateByIdcard(@Param("list") List<ThStudent> list); + Integer updateBatch(@Param("list") List<ThStudent> list); + Integer insertBatch(@Param("list") List<ThStudent> saveSudentList); + + List<ThStudent> getByIdCards(@Param("idcards") List<String> idcards); + + List<ThStudent> getNameByIdcards(@Param("idcards")List<String> idcards); } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyAuthMapper.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyAuthMapper.java index c5530f5..7b84fee 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyAuthMapper.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyAuthMapper.java @@ -12,4 +12,7 @@ @Mapper public interface ThStudyAuthMapper extends BaseMapper<ThStudyAuth> { List<String> getUuidByStudyDetaiId(@Param("studyDetaiId") String studyDetaiId); + + List<ThStudyAuth> getByStudyDetaiUuids(@Param("studyUuids") List<String> studyUuids); + Integer insertBatch(@Param("list") List<ThStudyAuth> list); } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyDetailMapper.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyDetailMapper.java index c6b938a..1cfbd0b 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyDetailMapper.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyDetailMapper.java @@ -20,4 +20,12 @@ List<ThStudyVO> statisticDurationByIdcard(@Param("batchUuid") String batchUuid); List<ThStudyDetailVO> listByBatchUuid(@Param("batchUuid") String batchUuid); + + List<ThStudyDetail> getByUuids(@Param("studyUuids") List<String> studyUuids); + + Integer insertBatch(@Param("list") List<ThStudyDetail> list); + + Integer updateBatch(@Param("list") List<ThStudyDetail> list); + + List<ThStudyDetailVO> listByCourseUuid(@Param("courseUuid")String courseUuid); } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyTrackMapper.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyTrackMapper.java index 955c656..ef311b8 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyTrackMapper.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyTrackMapper.java @@ -13,4 +13,6 @@ public interface ThStudyTrackMapper extends BaseMapper<ThStudyTrack> { List<String> getUuidByStudyDetaiId(@Param("studyDetaiId") String studyDetaiId); + List<ThStudyTrack> getByStudyDetaiUuids(@Param("studyUuids") List<String> studyUuids); + Integer insertBatch(@Param("list") List<ThStudyTrack> list); } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThStudyDetailQuery.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThStudyDetailQuery.java index 7bf5a34..fbdd596 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThStudyDetailQuery.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThStudyDetailQuery.java @@ -15,4 +15,10 @@ private Date startTime; @JsonFormat(pattern = "yyyy-MM-dd") private Date endTime; + + private Integer pageNum; + + /** 每页显示记录数 */ + private Integer pageSize; + private Integer startSize; } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchCourseChapterReqDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchCourseChapterReqDTO.java new file mode 100644 index 0000000..accfb67 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchCourseChapterReqDTO.java @@ -0,0 +1,17 @@ +package com.gkhy.exam.institutionalaccess.model.req; + + +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + +@Data +public class ThBatchCourseChapterReqDTO { + private String chapterUuid; + private BigDecimal chapterLessonNum; + //删除标志(0代表存在 2代表删除) + private Byte delFlag; + //孩子 + private List<ThBatchCourseChapterReqDTO> children; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchCourseReqDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchCourseReqDTO.java new file mode 100644 index 0000000..c5147a5 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchCourseReqDTO.java @@ -0,0 +1,17 @@ +package com.gkhy.exam.institutionalaccess.model.req; + + +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + +@Data +public class ThBatchCourseReqDTO { + private String courseUuid; + //删除标志(0代表存在 2代表删除) + private Byte delFlag; + private BigDecimal courseLessonNum; + private List<ThBatchCourseChapterReqDTO> chapterList; + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchEndReqDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchEndReqDTO.java index 937d808..016bf7a 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchEndReqDTO.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchEndReqDTO.java @@ -5,5 +5,5 @@ @Data public class ThBatchEndReqDTO { private String batchUuid; - private String idcard; + } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchReqDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchReqDTO.java index 26c2eea..5fdef51 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchReqDTO.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchReqDTO.java @@ -1,7 +1,9 @@ package com.gkhy.exam.institutionalaccess.model.req; +import com.gkhy.exam.institutionalaccess.entity.ThCourse; import lombok.Data; +import java.math.BigDecimal; import java.util.List; @Data @@ -12,7 +14,8 @@ private String institutionName; private String trainOrgName; private Byte haveExam; - private Byte openStatus; - //private Byte delFlag; - private List<String> courseUuidList; + private Byte status; + private BigDecimal batchLessonNum; + private Byte delFlag; + private List<ThBatchCourseReqDTO> courseList; } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThCourseChapterReqDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThCourseChapterReqDTO.java index dbb783b..7fbcf6b 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThCourseChapterReqDTO.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThCourseChapterReqDTO.java @@ -22,7 +22,8 @@ //视频路径 private String url; //删除标志(0代表存在 2代表删除) - //private Byte delFlag; + private Byte delFlag; + private Integer serialno; //孩子 private List<ThCourseChapterReqDTO> children; diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThExamRecordReqDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThExamRecordReqDTO.java index 968d18b..86dfa71 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThExamRecordReqDTO.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThExamRecordReqDTO.java @@ -10,7 +10,6 @@ public class ThExamRecordReqDTO { private String uuid; private String idcard; - private String courseUuid; private String batchUuid; private String institutionId; private String institutionName; @@ -24,5 +23,4 @@ private BigDecimal examTotalScore; private BigDecimal examPassScore; private Byte examIsPass; - private Integer examNum; } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThStudentReqDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThStudentReqDTO.java index ee17906..4bf4dff 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThStudentReqDTO.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThStudentReqDTO.java @@ -6,6 +6,7 @@ @Data public class ThStudentReqDTO { + private String uuid; private String name; private Byte sex; private String phone; @@ -16,4 +17,5 @@ private String post; private String trainOrgName; private String batchUuid; + private Byte delFlag; } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThCourseChapterRespDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThCourseChapterRespDTO.java index e50cb8c..df683b0 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThCourseChapterRespDTO.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThCourseChapterRespDTO.java @@ -19,6 +19,7 @@ private Long duration; //视频路径 private String url; + private Integer serialno; private List<ThCourseChapterRespDTO> children; diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThPlatformBatchRespDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThPlatformBatchRespDTO.java new file mode 100644 index 0000000..f7e3dfd --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThPlatformBatchRespDTO.java @@ -0,0 +1,27 @@ +package com.gkhy.exam.institutionalaccess.model.resp; + +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +@Data +public class ThPlatformBatchRespDTO { + //(批次)班级编号 + private String batchUuid; + //(批次)班级名称 + private String batchName; + //班级状态 + private Byte batchStatus; + //班级总学时 + private BigDecimal batchLessonNum; + //班级已完成学时 + private BigDecimal bCompleteLessonNum; + //考试 + private Byte haveExam; + //创建时间 + private LocalDateTime createTime; + //包含课程 + private List<ThPlatformCourseRespDTO> courseList; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThPlatformChapterRespDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThPlatformChapterRespDTO.java new file mode 100644 index 0000000..2a8550e --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThPlatformChapterRespDTO.java @@ -0,0 +1,22 @@ +package com.gkhy.exam.institutionalaccess.model.resp; + + +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class ThPlatformChapterRespDTO { + //章节uuid + private String chapterUuid; + //章节名称 + private String chapterName; + //完成状态 + private Byte chapterStatus; + private BigDecimal chapterLessonNum; + //章节视频总时长 + private BigDecimal chapterDuration; + //已完成 + private BigDecimal chCompleteDuration; + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThPlatformCourseRespDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThPlatformCourseRespDTO.java new file mode 100644 index 0000000..30fcd8b --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThPlatformCourseRespDTO.java @@ -0,0 +1,23 @@ +package com.gkhy.exam.institutionalaccess.model.resp; + +import lombok.Data; +import java.util.List; + +import java.math.BigDecimal; + +@Data +public class ThPlatformCourseRespDTO { + //课程uuid + private String courseUuid; + //课程名称 + private String courseName; + //课程编号 + private String courseCode; + //课程总学时 + private BigDecimal courseLessonNum; + //课程已完成学时 + private BigDecimal coCompleteLessonNum; + + //章节 + private List<ThPlatformChapterRespDTO> chapterList; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThPlatformStudentRespDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThPlatformStudentRespDTO.java new file mode 100644 index 0000000..5b8df7c --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThPlatformStudentRespDTO.java @@ -0,0 +1,13 @@ +package com.gkhy.exam.institutionalaccess.model.resp; + +import lombok.Data; + +import java.util.List; + +@Data +public class ThPlatformStudentRespDTO { + private String studentUuid; + private String name; + private String idcard; + private List<ThPlatformBatchRespDTO> batchList; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThStudentStudyRespDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThStudentStudyRespDTO.java index 80b4078..ea3967a 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThStudentStudyRespDTO.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThStudentStudyRespDTO.java @@ -3,14 +3,18 @@ import lombok.Data; import java.math.BigDecimal; +import java.time.LocalDateTime; @Data public class ThStudentStudyRespDTO { private String idcard; private String name; + //完成 private BigDecimal lessonNum; - private BigDecimal lessonTocal; + //所有 + private BigDecimal batchLessonNum; + private BigDecimal courseLessonNum; private Byte finishStatus; private String url; - private String courseName; + private String batchUuid; } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThBatchCourseChapterVO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThBatchCourseChapterVO.java new file mode 100644 index 0000000..add05d2 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThBatchCourseChapterVO.java @@ -0,0 +1,28 @@ +package com.gkhy.exam.institutionalaccess.model.vo; + +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + +@Data +public class ThBatchCourseChapterVO { + private Long id; + private String batchUuid; + private String courseUuid; + private String chapterUuid; + private String chapterCode; + private String chapterName; + //有无资源(10无,20有) + private Byte haveResource; + //资源类型(0视频,1音频) + private Byte resourceType; + private BigDecimal lessonNum; + private Long duration; + //视频路径 + private String url; + private String parentUuid; + private Integer serialno; + + private List<ThBatchCourseChapterVO> children; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThBatchCourseVO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThBatchCourseVO.java index dbc5db8..74dd566 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThBatchCourseVO.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThBatchCourseVO.java @@ -3,17 +3,24 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.gkhy.exam.institutionalaccess.entity.ThBatchCourse; +import com.gkhy.exam.institutionalaccess.entity.ThBatchCourseChapter; import lombok.Data; import nonapi.io.github.classgraph.json.Id; -@TableName("th_batch_course") +import java.math.BigDecimal; +import java.util.List; + @Data public class ThBatchCourseVO { private Long id; private String courseUuid; private String batchUuid; + private BigDecimal courseLessonNum; private String courseName; + private String trainOrgName; + private List<ThBatchCourseChapterVO> chapterList; //视频时长 private Long duration; diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThBatchVO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThBatchVO.java index 16d4aef..cbaeab4 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThBatchVO.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThBatchVO.java @@ -14,7 +14,7 @@ private Long institutionId; private String institutionName; private Byte haveExam; - private Byte openStatus; + private Byte status; private String trainOrgName; private Integer studentCount; //删除标志(0代表存在 2代表删除) diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThCourseChapterVO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThCourseChapterVO.java index 3eafa27..af09f4f 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThCourseChapterVO.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThCourseChapterVO.java @@ -21,4 +21,5 @@ private String parentUuid; private Long institutionId; private String courseUuid; + private Integer serialno; } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThExamRecordVO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThExamRecordVO.java index a8ccf02..4d5d5d5 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThExamRecordVO.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThExamRecordVO.java @@ -28,7 +28,6 @@ private BigDecimal examTotalScore; private BigDecimal examPassScore; private Byte examIsPass; - private Integer examNum; //删除标志(0代表存在 2代表删除) private Byte delFlag; diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudentBatchCourseVO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudentBatchCourseVO.java new file mode 100644 index 0000000..2ca3ff3 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudentBatchCourseVO.java @@ -0,0 +1,11 @@ +package com.gkhy.exam.institutionalaccess.model.vo; + +import lombok.Data; + +@Data +public class ThStudentBatchCourseVO { + private String idcard; + private String name; + private String batchUuid; + private String courseUuid; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudentBatchVO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudentBatchVO.java new file mode 100644 index 0000000..a138575 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudentBatchVO.java @@ -0,0 +1,25 @@ +package com.gkhy.exam.institutionalaccess.model.vo; + +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class ThStudentBatchVO { + private Long id; + private String idcard; + private String batchUuid; + private String name; + private Byte sex; + private String phone; + private String authPhoto; + private Long institutionId; + private String institutionName; + private String trainOrgName; + private String industry; + private String occupation; + private String post; + private Byte finishStatus; + private BigDecimal batchLessonNum; + private BigDecimal courseLessonNum; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudyDetailVO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudyDetailVO.java index b7000a8..84ebf89 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudyDetailVO.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudyDetailVO.java @@ -25,7 +25,7 @@ private String batchUuid; private String batchName; private String chapterUuid; - private String catalogName; + private String chapterName; private Byte finishStatus; private Long duration; private String durationDesc; diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudyVO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudyVO.java index 5f3982d..a7bb85c 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudyVO.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudyVO.java @@ -7,4 +7,5 @@ private String idcard; private String name; private Long duration; + private String courseUuid; } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchCourseChapterService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchCourseChapterService.java new file mode 100644 index 0000000..621452f --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchCourseChapterService.java @@ -0,0 +1,25 @@ +package com.gkhy.exam.institutionalaccess.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gkhy.exam.institutionalaccess.entity.ThBatchCourseChapter; +import com.gkhy.exam.institutionalaccess.entity.ThCourseChapter; +import org.springframework.scheduling.annotation.Async; + +import java.util.List; + +public interface ThBatchCourseChapterService extends IService<ThBatchCourseChapter> { + void deleteByBatchUuid(String batchUuid); + + List<ThBatchCourseChapter> getByBatchUuid(String batchUuid); + + ThBatchCourseChapter getByUuid(String batchUuid, String courseUuid, String chapterUuid); + + List<ThBatchCourseChapter> getListByBatchUuids(List<String> batchUuids); + + //@Async("SocketTaskExecutor") + Integer insertBatch(List<ThBatchCourseChapter> chapterList); + //@Async("SocketTaskExecutor") + Integer updateBatch(List<ThBatchCourseChapter> chapterList); + + List<ThBatchCourseChapter> getByChapterUuids(List<String> chapterUuids); +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchCourseService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchCourseService.java index 770f3d8..184071e 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchCourseService.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchCourseService.java @@ -3,24 +3,29 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.gkhy.exam.institutionalaccess.entity.ThBatchCourse; -import com.gkhy.exam.institutionalaccess.entity.ThStudentCourse; import com.gkhy.exam.institutionalaccess.model.vo.ThBatchCourseVO; -import com.gkhy.exam.institutionalaccess.model.vo.ThBatchVO; +import org.springframework.scheduling.annotation.Async; import java.util.List; public interface ThBatchCourseService extends IService<ThBatchCourse> { - List<ThBatchCourse> getByBatchUuid(String uuid); + List<ThBatchCourse> getByBatchUuid(String batchUuid); List<String> getCourseUuisByBatchUuid(String batchUuid); void deleteByBatchUuidAndCourseUuid(List<ThBatchCourse> deleteBatchCourseList); - List<ThBatchCourseVO> getListByBatchUuids(List<String> batchUuids); + List<ThBatchCourse> getListByBatchUuids(List<String> batchUuids); List<ThBatchCourseVO> getListByBatchUuid(String batchUuid); boolean isExsit(String courseUuid); List<ThBatchCourse> listByInstitutionId(Long InstitutionId); + + void deleteByBatchUuid(String batchUuid); + //@Async("SocketTaskExecutor") + Integer insertBatch(List<ThBatchCourse> courseList); + //@Async("SocketTaskExecutor") + Integer updateBatch(List<ThBatchCourse> courseList); } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchManagerService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchManagerService.java index abcb8de..3948add 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchManagerService.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchManagerService.java @@ -1,9 +1,11 @@ package com.gkhy.exam.institutionalaccess.service; import com.gkhy.exam.institutionalaccess.entity.ThBatch; +import com.gkhy.exam.institutionalaccess.entity.ThBatchCourse; import com.gkhy.exam.institutionalaccess.model.query.ThBatchQuery; import com.gkhy.exam.institutionalaccess.model.resp.ThBatchCourseRespDTO; import com.gkhy.exam.institutionalaccess.model.resp.ThStudentStudyRespDTO; +import com.gkhy.exam.institutionalaccess.model.vo.ThBatchCourseVO; import com.gkhy.exam.institutionalaccess.model.vo.ThBatchVO; import java.util.List; @@ -14,4 +16,5 @@ List<ThBatchCourseRespDTO> period(String batchUuid); List<ThStudentStudyRespDTO> getStudent(String batchUuid); + } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchService.java index 1dad1fc..25472e4 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchService.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchService.java @@ -4,6 +4,7 @@ import com.gkhy.exam.institutionalaccess.entity.ThBatch; import com.gkhy.exam.institutionalaccess.model.query.ThBatchQuery; import com.gkhy.exam.institutionalaccess.model.vo.ThBatchVO; +import org.springframework.scheduling.annotation.Async; import java.util.List; @@ -13,4 +14,13 @@ List<ThBatch> listByInstitutionId(Long institutionId); List<ThBatchVO> listByPage(ThBatchQuery query); + + List<ThBatch> getByUuids(List<String> batchUuids); + + //@Async("SocketTaskExecutor") + Integer insertBatch(List<ThBatch> batchList); + //@Async("SocketTaskExecutor") + Integer updateBatch(List<ThBatch> batchList); + + List<ThBatch> getBatchNameByUuids(List<String> batchUuids); } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseChapterService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseChapterService.java index edfe1ec..706fa59 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseChapterService.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseChapterService.java @@ -3,6 +3,9 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.gkhy.exam.institutionalaccess.entity.ThCourseChapter; import com.gkhy.exam.institutionalaccess.model.vo.ThCourseChapterVO; +import com.gkhy.exam.institutionalaccess.model.vo.ThStatisticStudentVO; +import org.springframework.scheduling.annotation.Async; + import java.util.List; public interface ThCourseChapterService extends IService<ThCourseChapter> { @@ -14,4 +17,12 @@ ThCourseChapter getByUuid(String batchUuid); + List<ThCourseChapter> getByUuids(List<String> reqAllChapterIds); + + //@Async("SocketTaskExecutor") + Integer insertBatch(List<ThCourseChapter> courseChapterList); + //@Async("SocketTaskExecutor") + Integer updateBatch(List<ThCourseChapter> courseChapterList); + + List<ThCourseChapter> getChapterNameByUuids(List<String> chapterUuids); } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseManagerService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseManagerService.java index 7404b00..ab825c3 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseManagerService.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseManagerService.java @@ -1,7 +1,10 @@ package com.gkhy.exam.institutionalaccess.service; +import com.gkhy.exam.institutionalaccess.entity.ThStudent; +import com.gkhy.exam.institutionalaccess.entity.ThStudentBatch; import com.gkhy.exam.institutionalaccess.model.query.ThCourseQuery; import com.gkhy.exam.institutionalaccess.model.resp.ThCourseRespDTO; +import com.gkhy.exam.institutionalaccess.model.resp.ThStudentStudyRespDTO; import java.util.List; @@ -9,4 +12,8 @@ List<ThCourseRespDTO> listByPage(ThCourseQuery query); ThCourseRespDTO findById(Long id); + + List<ThStudentStudyRespDTO> getSutdent(String courseUuid); + + //List<ThStudentBatchR> getStudent(String ); } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseService.java index 98e1b76..ce92e8b 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseService.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseService.java @@ -3,12 +3,14 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.gkhy.exam.institutionalaccess.entity.ThCourse; import com.gkhy.exam.institutionalaccess.model.query.ThCourseQuery; +import com.gkhy.exam.institutionalaccess.model.resp.ThCourseRespDTO; import org.apache.ibatis.annotations.Param; +import org.springframework.scheduling.annotation.Async; import java.util.List; public interface ThCourseService extends IService<ThCourse> { - List<ThCourse> listByPage(@Param("query") ThCourseQuery query); + List<ThCourseRespDTO> listByPage(@Param("query") ThCourseQuery query); ThCourse getByUuid(String uuid); @@ -16,4 +18,13 @@ List<ThCourse> listByInstitutionId(Long institutionId); + List<ThCourse> getByUuidList(List<String> courseUuids); + + //@Async("SocketTaskExecutor") + Integer insertBatch(List<ThCourse> courseList); + + //@Async("SocketTaskExecutor") + Integer updateBatch(List<ThCourse> courseList); + + List<ThCourse> getCourseNameByUuids(List<String> courseUuids); } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThExamRecordService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThExamRecordService.java index 244b538..8ce2016 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThExamRecordService.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThExamRecordService.java @@ -4,6 +4,7 @@ import com.gkhy.exam.institutionalaccess.entity.ThExamRecord; import com.gkhy.exam.institutionalaccess.model.query.ThExamRecordQuery; import com.gkhy.exam.institutionalaccess.model.vo.ThExamRecordVO; +import org.springframework.scheduling.annotation.Async; import java.util.List; @@ -11,4 +12,8 @@ List<ThExamRecord> listByInstitutionId(Long institutionId); List<ThExamRecordVO> listByPage(ThExamRecordQuery query); + + List<ThExamRecord> getByUuids(List<String> examUuids); + //@Async("SocketTaskExecutor") + Integer insertBatch(List<ThExamRecord> examRecordList); } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudentBatchService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudentBatchService.java new file mode 100644 index 0000000..6ad88d4 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudentBatchService.java @@ -0,0 +1,39 @@ +package com.gkhy.exam.institutionalaccess.service; + + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gkhy.exam.institutionalaccess.entity.ThStudentBatch; +import com.gkhy.exam.institutionalaccess.model.vo.ThStatisticStudentVO; +import com.gkhy.exam.institutionalaccess.model.vo.ThStudentBatchCourseVO; +import com.gkhy.exam.institutionalaccess.model.vo.ThStudentBatchVO; +import com.gkhy.exam.institutionalaccess.model.vo.ThStudentCourseVO; +import org.springframework.scheduling.annotation.Async; + +import java.util.List; + +public interface ThStudentBatchService extends IService<ThStudentBatch> { + List<ThStudentBatch> getByIdCards(List<String> idcards); + List<ThStatisticStudentVO> statisticByBatchUuid(); + + List<ThStudentBatch> listByInstitutionId(Long id); + + List<ThStatisticStudentVO> statisticByCourseUuid(); + + List<ThStudentBatchCourseVO> getStudentBatchCourseVOByBatchUuid(String batchUuid); + + void updateByBatchUuid(String batchUuid); + + ThStudentBatch getByIdcardAndBatchUuid(String idcard, String batchUuid); + + List<ThStudentBatch> getByBatchUuid(String batchUuid); + + void updateFinishStatusByBatchUuid(String batchUuid); + //@Async("SocketTaskExecutor") + Integer insertBatch(List<ThStudentBatch> saveThStudentBatchList); + //@Async("SocketTaskExecutor") + Integer updateBatch(List<ThStudentBatch> updateThStudentBatchList); + + List<ThStudentBatchVO> getStudentBatchVOByBatchUuid(String batchUuid); + + List<ThStudentBatchVO> getStudentBatchVOByCourseUuid(String courseUuid); +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudentCourseService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudentCourseService.java deleted file mode 100644 index 6421100..0000000 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudentCourseService.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.gkhy.exam.institutionalaccess.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gkhy.exam.institutionalaccess.entity.ThCourse; -import com.gkhy.exam.institutionalaccess.entity.ThStudentCourse; -import com.gkhy.exam.institutionalaccess.model.vo.ThStatisticStudentVO; -import com.gkhy.exam.institutionalaccess.model.vo.ThStudentCourseVO; - -import java.util.List; - -public interface ThStudentCourseService extends IService<ThStudentCourse> { - List<ThStudentCourse> getByIdCards(List<String> idcards); - List<ThStatisticStudentVO> statisticByBatchUuid(); - - List<ThStudentCourse> listByInstitutionId(Long id); - - List<ThStatisticStudentVO> statisticByCourseUuid(); - - List<ThStudentCourseVO> getListByBatchUuid(String batchUuid); - - void updateByBatchUuid(String batchUuid); - - List<ThStudentCourse> getByIdcardAndBatchUuid(String idcard, String batchUuid); -} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudentService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudentService.java index 1bc0f2b..aaed8fd 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudentService.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudentService.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.gkhy.exam.institutionalaccess.entity.ThStudent; import com.gkhy.exam.institutionalaccess.model.vo.ThStatisticStudentVO; +import org.springframework.scheduling.annotation.Async; import java.util.List; @@ -11,8 +12,11 @@ ThStudent getByIdcard(String idcard); List<ThStudent> getByIdcards(List<String> idcards); + //@Async("SocketTaskExecutor") + Integer updateBatch(List<ThStudent> updateStudentList); - int updateByIdcard(List<ThStudent> updateStudentList); + //@Async("SocketTaskExecutor") + Integer insertBatch(List<ThStudent> saveSudentList); - + List<ThStudent> getNameByIdcards(List<String> idcards); } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyAuthService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyAuthService.java index 6f43457..58641bf 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyAuthService.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyAuthService.java @@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.gkhy.exam.institutionalaccess.entity.ThStudyAuth; import com.gkhy.exam.institutionalaccess.model.vo.ThStudyAuthVO; +import org.springframework.scheduling.annotation.Async; import java.util.List; @@ -10,5 +11,8 @@ List<String> getUuidByStudyDetaiId(String studyDetaiId); - List<ThStudyAuth> getListByStudyDetaiIds(List<String> detailUuids); + + List<ThStudyAuth> getByStudyDetaiUuids(List<String> studyUuids); + //@Async("SocketTaskExecutor") + Integer insetBatch(List<ThStudyAuth> thStudyAuthList); } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyDetailService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyDetailService.java index 60f236e..36abee1 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyDetailService.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyDetailService.java @@ -18,4 +18,11 @@ List<ThStudyVO> statisticDurationByIdcard(String batchUuid); List<ThStudyDetailVO> listByBatchUuid(String batchUuid); + + List<ThStudyDetail> getByUuids(List<String> studyUuids); + + Integer insertBatch(List<ThStudyDetail> list); + Integer updateBatch(List<ThStudyDetail> list); + + List<ThStudyDetailVO> listByCourseUuid(String courseUuid); } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyTrackService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyTrackService.java index 353bc2a..e14a171 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyTrackService.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyTrackService.java @@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.gkhy.exam.institutionalaccess.entity.ThStudyTrack; +import org.springframework.scheduling.annotation.Async; import java.util.List; @@ -9,4 +10,7 @@ List<String> getUuidByStudyDetaiId(String studyDetaiId); List<ThStudyTrack> getListByStudyDetaiIds(List<String> detailUuids); + //@Async("SocketTaskExecutor") + Integer insertBatch(List<ThStudyTrack> list); + List<ThStudyTrack> getByStudyDetailUuids(List<String> studyUuids); } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/TripartiteInterfaceService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/TripartiteInterfaceService.java index 982d587..bc393cf 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/TripartiteInterfaceService.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/TripartiteInterfaceService.java @@ -21,5 +21,5 @@ AjaxResult receiveBatchOpen(JSONObject jsonObject); - AjaxResult receiveBarchEnd(JSONObject jsonObject); + AjaxResult receiveBatchEnd(JSONObject jsonObject); } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchCourseChapterServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchCourseChapterServiceImpl.java new file mode 100644 index 0000000..dea9dcc --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchCourseChapterServiceImpl.java @@ -0,0 +1,72 @@ +package com.gkhy.exam.institutionalaccess.service.serviceImpl; + +import cn.hutool.core.collection.ListUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gkhy.exam.institutionalaccess.entity.ThBatchCourse; +import com.gkhy.exam.institutionalaccess.entity.ThBatchCourseChapter; +import com.gkhy.exam.institutionalaccess.entity.ThCourseChapter; +import com.gkhy.exam.institutionalaccess.mapper.ThBatchCourseChapterMapper; +import com.gkhy.exam.institutionalaccess.service.ThBatchCourseChapterService; +import com.ruoyi.common.enums.coalmineEnums.DeleteStatusEnum; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +@Service("ThBatchCourseChapterService") +public class ThBatchCourseChapterServiceImpl extends ServiceImpl<ThBatchCourseChapterMapper, ThBatchCourseChapter> implements ThBatchCourseChapterService { + @Override + public void deleteByBatchUuid(String batchUuid) { + baseMapper.deleteByBatchUuid(batchUuid); + } + + @Override + public List<ThBatchCourseChapter> getByBatchUuid(String batchUuid) { + return baseMapper.selectList(new LambdaQueryWrapper<ThBatchCourseChapter>() + .eq(ThBatchCourseChapter::getBatchUuid, batchUuid) + .eq(ThBatchCourseChapter::getDelFlag, DeleteStatusEnum.NO.getStatus())); + } + + @Override + public ThBatchCourseChapter getByUuid(String batchUuid, String courseUuid, String chapterUuid) { + return baseMapper.selectOne(new LambdaQueryWrapper<ThBatchCourseChapter>() + .eq(ThBatchCourseChapter::getBatchUuid, batchUuid) + .eq(ThBatchCourseChapter::getCourseUuid, courseUuid) + .eq(ThBatchCourseChapter::getChapterUuid, chapterUuid) + .eq(ThBatchCourseChapter::getDelFlag, DeleteStatusEnum.NO.getStatus())); + } + + @Override + public List<ThBatchCourseChapter> getListByBatchUuids(List<String> batchUuids) { + List<ThBatchCourseChapter> allBatchCourseChapterList = new ArrayList<>(); + List<List<String>> split = ListUtil.split(batchUuids, 900); + for (List<String> list : split) { + List<ThBatchCourseChapter> thBatchCourseChapterList = baseMapper.getByBatchUuids(list); + allBatchCourseChapterList.addAll(thBatchCourseChapterList); + } + return allBatchCourseChapterList; + } + + @Override + public Integer insertBatch(List<ThBatchCourseChapter> chapterList) { + return baseMapper.insertBatch(chapterList); + } + + @Override + public Integer updateBatch(List<ThBatchCourseChapter> chapterList) { + return baseMapper.updateBatch(chapterList); + } + + @Override + public List<ThBatchCourseChapter> getByChapterUuids(List<String> chapterUuids) { + List<ThBatchCourseChapter> allBatchCourseChapterList = new ArrayList<>(); + List<List<String>> split = ListUtil.split(chapterUuids, 900); + for (List<String> list : split) { + List<ThBatchCourseChapter> thBatchCourseChapterList = baseMapper.getByChapterUuids(list); + allBatchCourseChapterList.addAll(thBatchCourseChapterList); + } + return allBatchCourseChapterList; + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchCourseServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchCourseServiceImpl.java index 257ca7b..87de033 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchCourseServiceImpl.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchCourseServiceImpl.java @@ -1,9 +1,9 @@ package com.gkhy.exam.institutionalaccess.service.serviceImpl; +import cn.hutool.core.collection.ListUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gkhy.exam.institutionalaccess.entity.ThBatchCourse; -import com.gkhy.exam.institutionalaccess.entity.ThStudentCourse; import com.gkhy.exam.institutionalaccess.mapper.ThBatchCourseMapper; import com.gkhy.exam.institutionalaccess.model.vo.ThBatchCourseVO; import com.gkhy.exam.institutionalaccess.service.ThBatchCourseService; @@ -43,8 +43,14 @@ } @Override - public List<ThBatchCourseVO> getListByBatchUuids(List<String> batchUuids) { - return batchCourseMapper.getListByBatchUuids(batchUuids); + public List<ThBatchCourse> getListByBatchUuids(List<String> batchUuids) { + List<ThBatchCourse> allBatchCourseList = new ArrayList<>(); + List<List<String>> split = ListUtil.split(batchUuids, 900); + for (List<String> list : split) { + List<ThBatchCourse> thBatchCourseList = batchCourseMapper.getByBatchUuids(list); + allBatchCourseList.addAll(thBatchCourseList); + } + return allBatchCourseList; } @Override public List<ThBatchCourseVO> getListByBatchUuid(String batchUuid) { @@ -66,4 +72,19 @@ return batchCourseMapper.selectList(new LambdaQueryWrapper<ThBatchCourse>() .eq(ThBatchCourse::getInstitutionId,institutionId).eq(ThBatchCourse::getDelFlag,DeleteStatusEnum.NO.getStatus())); } + + @Override + public void deleteByBatchUuid(String batchUuid) { + batchCourseMapper.deleteByBatchUuid(batchUuid); + } + + @Override + public Integer insertBatch(List<ThBatchCourse> courseList) { + return batchCourseMapper.insertBatch(courseList); + } + + @Override + public Integer updateBatch(List<ThBatchCourse> courseList) { + return batchCourseMapper.updateBatch(courseList); + } } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchManagerServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchManagerServiceImpl.java index 6cc4a93..2c4f659 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchManagerServiceImpl.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchManagerServiceImpl.java @@ -1,10 +1,14 @@ package com.gkhy.exam.institutionalaccess.service.serviceImpl; +import com.gkhy.exam.institutionalaccess.entity.ThBatchCourse; +import com.gkhy.exam.institutionalaccess.entity.ThBatchCourseChapter; +import com.gkhy.exam.institutionalaccess.entity.ThStudentBatch; import com.gkhy.exam.institutionalaccess.entity.ThStudyDetail; import com.gkhy.exam.institutionalaccess.enums.FinishStatus; import com.gkhy.exam.institutionalaccess.model.query.ThBatchQuery; import com.gkhy.exam.institutionalaccess.model.resp.ThBatchCourseRespDTO; +import com.gkhy.exam.institutionalaccess.model.resp.ThCourseChapterRespDTO; import com.gkhy.exam.institutionalaccess.model.resp.ThStudentCourseRespDTO; import com.gkhy.exam.institutionalaccess.model.resp.ThStudentStudyRespDTO; import com.gkhy.exam.institutionalaccess.model.vo.*; @@ -29,21 +33,44 @@ @Autowired private ThBatchCourseService thBatchCourseService; @Autowired - private ThStudentCourseService thStudentCourseService; + private ThStudentBatchService thStudentBatchService; @Autowired private ThStudyDetailService thStudyDetailService; + @Autowired + private ThBatchCourseChapterService thBatchCourseChapterService; @Override public List<ThBatchVO> listByPage(ThBatchQuery query) { List<ThBatchVO> thBatchVOS = thBatchService.listByPage(query); //统计学员 - List<ThStatisticStudentVO> thStatisticStudentVOS = thStudentCourseService.statisticByBatchUuid(); + List<ThStatisticStudentVO> thStatisticStudentVOS = thStudentBatchService.statisticByBatchUuid(); if (!CollectionUtils.isEmpty(thBatchVOS)) { List<String> batchUuids = thBatchVOS.stream().map(ThBatchVO::getUuid).collect(Collectors.toList()); - List<ThBatchCourseVO> batchCourseVOS = thBatchCourseService.getListByBatchUuids(batchUuids); + List<ThBatchCourse> batchCourseList = thBatchCourseService.getListByBatchUuids(batchUuids); + //章节 + List<ThBatchCourseChapter> chapterList = thBatchCourseChapterService.getListByBatchUuids(batchUuids); + for (ThBatchVO thBatchVO : thBatchVOS) { //课程 - List<ThBatchCourseVO> collect = batchCourseVOS.stream().filter(bc -> bc.getBatchUuid().equals(thBatchVO.getUuid())).collect(Collectors.toList()); + List<ThBatchCourseVO> collect = batchCourseList.stream() + .filter(bc -> bc.getBatchUuid().equals(thBatchVO.getUuid())) + .map(bc -> { + ThBatchCourseVO thBatchCourseVO = new ThBatchCourseVO(); + BeanUtils.copyProperties(bc, thBatchCourseVO); + + List<ThBatchCourseChapterVO> chapterVOs = chapterList.stream(). + filter(cc -> cc.getCourseUuid().equals(bc.getCourseUuid()) && cc.getParentUuid().equals("0")) + .map(cc -> { + ThBatchCourseChapterVO thBatchCourseChapterVO = new ThBatchCourseChapterVO(); + BeanUtils.copyProperties(cc, thBatchCourseChapterVO); + thBatchCourseChapterVO.setChildren(getChildren(chapterList,cc.getChapterUuid())); + return thBatchCourseChapterVO; + }) + .collect(Collectors.toList()); + thBatchCourseVO.setChapterList(chapterVOs); + return thBatchCourseVO; + }) + .collect(Collectors.toList()); //学员 List<ThStatisticStudentVO> ssList = thStatisticStudentVOS.stream().filter(ss -> ss.getBatchUuid().equals(thBatchVO.getUuid())).collect(Collectors.toList()); if(ssList.size() > 0) { @@ -57,12 +84,27 @@ return thBatchVOS; } + //获取章节 + private List<ThBatchCourseChapterVO> getChildren(List<ThBatchCourseChapter> chapterList, String parentUuid) { + List<ThBatchCourseChapterVO> sectionList = chapterList + .stream() + .filter(cc -> cc.getParentUuid().equals(parentUuid)) + .map(cc -> { + ThBatchCourseChapterVO thBatchCourseChapterVO = new ThBatchCourseChapterVO(); + BeanUtils.copyProperties(cc, thBatchCourseChapterVO); + return thBatchCourseChapterVO; + }) + .collect(Collectors.toList()); + return sectionList; + } + + @Override public List<ThBatchCourseRespDTO> period(String batchUuid) { - //获取批次关联课程 + //获取批次关联课程(课程的视频总时长) List<ThBatchCourseVO> batchCourseVOS = thBatchCourseService.getListByBatchUuid(batchUuid); - //获取关联学生 - List<ThStudentCourseVO> thStudentCourseVOS = thStudentCourseService.getListByBatchUuid(batchUuid); + //获取关联学生(学时) + List<ThStudentBatchCourseVO> thStudentCourseVOS = thStudentBatchService.getStudentBatchCourseVOByBatchUuid(batchUuid); //根据批次获取学习记录 List<ThStudyVO> studyVOS = thStudyDetailService.statisticDurationByIdcard(batchUuid); List<ThBatchCourseRespDTO> batchCourseRespDTOS = new ArrayList<>(); @@ -75,11 +117,11 @@ //过滤学生 List<ThStudentCourseRespDTO> studentList = thStudentCourseVOS .stream() - .filter(sc -> sc.getBatchUuid().equals(VO.getBatchUuid())) + .filter(sc -> sc.getCourseUuid().equals(VO.getCourseUuid())) .map(sc -> { ThStudentCourseRespDTO thStudentCourseRespDTO = new ThStudentCourseRespDTO(); BeanUtils.copyProperties(sc, thStudentCourseRespDTO); - List<ThStudyVO> collect = studyVOS.stream().filter(s -> s.getIdcard().equals(sc.getIdcard())).collect(Collectors.toList()); + List<ThStudyVO> collect = studyVOS.stream().filter(s -> s.getIdcard().equals(sc.getIdcard()) && s.getCourseUuid().equals(VO.getCourseUuid())).collect(Collectors.toList()); if(collect.size() > 0) { thStudentCourseRespDTO.setDuration(collect.get(0).getDuration()); }else { @@ -100,17 +142,18 @@ @Override public List<ThStudentStudyRespDTO> getStudent(String batchUuid) { //获取学生信息 - List<ThStudentCourseVO> thStudentCourseVOS = thStudentCourseService.getListByBatchUuid(batchUuid); + List<ThStudentBatchVO> thStudentBatches = thStudentBatchService.getStudentBatchVOByBatchUuid(batchUuid); //获取学生学习记录 List<ThStudyDetailVO> studyDetails = thStudyDetailService.listByBatchUuid(batchUuid); List<ThStudentStudyRespDTO> respDTOS = new ArrayList<>(); - if (!CollectionUtils.isEmpty(thStudentCourseVOS)) { - for (ThStudentCourseVO VO : thStudentCourseVOS) { + if (!CollectionUtils.isEmpty(thStudentBatches)) { + for (ThStudentBatchVO VO : thStudentBatches) { ThStudentStudyRespDTO thStudentStudyRespDTO = new ThStudentStudyRespDTO(); thStudentStudyRespDTO.setIdcard(VO.getIdcard()); thStudentStudyRespDTO.setName(VO.getName()); - thStudentStudyRespDTO.setCourseName(VO.getCourseName()); - thStudentStudyRespDTO.setLessonTocal(VO.getLessTotal()); + thStudentStudyRespDTO.setBatchLessonNum(VO.getBatchLessonNum()); + thStudentStudyRespDTO.setFinishStatus(VO.getFinishStatus()); + thStudentStudyRespDTO.setBatchUuid(VO.getBatchUuid()); BigDecimal lessNum = new BigDecimal(0); List<ThStudyDetailVO> collect = studyDetails @@ -121,7 +164,7 @@ for (ThStudyDetailVO studyDetail : collect) { //是否完成 if(studyDetail.getFinishStatus().equals(FinishStatus.YES.getStatus())){ - lessNum.add(studyDetail.getLessonNum()); + lessNum = lessNum.add(studyDetail.getLessonNum()); } //是否有学时报告 if(!StringUtils.isEmpty(studyDetail.getLessonReportUrl())){ @@ -132,7 +175,6 @@ stringBuffer.deleteCharAt(stringBuffer.length()-1); } thStudentStudyRespDTO.setUrl(stringBuffer.toString()); - thStudentStudyRespDTO.setFinishStatus(VO.getFinishStatus()); thStudentStudyRespDTO.setLessonNum(lessNum); respDTOS.add(thStudentStudyRespDTO); } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchServiceImpl.java index 6306e7f..42a34be 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchServiceImpl.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchServiceImpl.java @@ -1,5 +1,6 @@ package com.gkhy.exam.institutionalaccess.service.serviceImpl; +import cn.hutool.core.collection.ListUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gkhy.exam.institutionalaccess.entity.ThBatch; @@ -11,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -32,4 +34,30 @@ public List<ThBatchVO> listByPage(ThBatchQuery query) { return batchMapper.listByPage(query); } + + @Override + public List<ThBatch> getByUuids(List<String> batchUuids) { + List<ThBatch> allBatchList = new ArrayList<>(); + List<List<String>> split = ListUtil.split(batchUuids, 900); + for (List<String> splitBatchUuids : split) { + List<ThBatch> batchList = batchMapper.getByUuids(splitBatchUuids); + allBatchList.addAll(batchList); + } + return allBatchList; + } + + @Override + public Integer insertBatch(List<ThBatch> batchList) { + return batchMapper.insertBatch(batchList); + } + + @Override + public Integer updateBatch(List<ThBatch> batchList) { + return batchMapper.updateBatch(batchList); + } + + @Override + public List<ThBatch> getBatchNameByUuids(List<String> batchUuids) { + return batchMapper.getBatchNameByUuids(batchUuids); + } } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseChapterServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseChapterServiceImpl.java index f6038b2..6413a7f 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseChapterServiceImpl.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseChapterServiceImpl.java @@ -1,16 +1,20 @@ package com.gkhy.exam.institutionalaccess.service.serviceImpl; +import cn.hutool.core.collection.ListUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gkhy.exam.institutionalaccess.entity.ThCourse; import com.gkhy.exam.institutionalaccess.entity.ThCourseChapter; import com.gkhy.exam.institutionalaccess.mapper.ThCourseChapterMapper; import com.gkhy.exam.institutionalaccess.model.vo.ThCourseChapterVO; +import com.gkhy.exam.institutionalaccess.model.vo.ThStatisticStudentVO; import com.gkhy.exam.institutionalaccess.service.ThCourseChapterService; import com.ruoyi.common.enums.coalmineEnums.DeleteStatusEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -38,4 +42,33 @@ public ThCourseChapter getByUuid(String batchUuid) { return courseChapterMapper.selectOne(new LambdaQueryWrapper<ThCourseChapter>().eq(ThCourseChapter::getUuid, batchUuid).eq(ThCourseChapter::getDelFlag, DeleteStatusEnum.NO.getStatus())); } + + @Override + public List<ThCourseChapter> getByUuids(List<String> chapterUuids) { + List<ThCourseChapter> allList = new ArrayList<>(); + //分批量查询 + List<List<String>> list = ListUtil.split(chapterUuids, 900); + for (List<String> uuids : list) { + List<ThCourseChapter> courseListList = courseChapterMapper.getByUuids(uuids); + allList.addAll(courseListList); + } + return allList; + } + + @Override + public Integer insertBatch(List<ThCourseChapter> courseChapterList) { + return courseChapterMapper.insertBatch(courseChapterList); + } + + @Override + public Integer updateBatch(List<ThCourseChapter> courseChapterList) { + return courseChapterMapper.updateBatch(courseChapterList); + } + + @Override + public List<ThCourseChapter> getChapterNameByUuids(List<String> chapterUuids) { + return courseChapterMapper.getChapterNameByUuids(chapterUuids); + } + + } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseManagerServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseManagerServiceImpl.java index 4593d20..bcccccd 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseManagerServiceImpl.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseManagerServiceImpl.java @@ -1,19 +1,28 @@ package com.gkhy.exam.institutionalaccess.service.serviceImpl; +import com.gkhy.exam.institutionalaccess.entity.ThBatchCourse; import com.gkhy.exam.institutionalaccess.entity.ThCourse; import com.gkhy.exam.institutionalaccess.entity.ThCourseChapter; +import com.gkhy.exam.institutionalaccess.entity.ThStudentBatch; +import com.gkhy.exam.institutionalaccess.enums.FinishStatus; import com.gkhy.exam.institutionalaccess.model.query.ThCourseQuery; import com.gkhy.exam.institutionalaccess.model.resp.ThCourseChapterRespDTO; import com.gkhy.exam.institutionalaccess.model.resp.ThCourseRespDTO; +import com.gkhy.exam.institutionalaccess.model.resp.ThStudentStudyRespDTO; import com.gkhy.exam.institutionalaccess.model.vo.ThCourseChapterVO; import com.gkhy.exam.institutionalaccess.model.vo.ThStatisticStudentVO; +import com.gkhy.exam.institutionalaccess.model.vo.ThStudentBatchVO; +import com.gkhy.exam.institutionalaccess.model.vo.ThStudyDetailVO; import com.gkhy.exam.institutionalaccess.service.*; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; +import java.math.BigDecimal; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.stream.Collectors; @@ -25,32 +34,34 @@ @Autowired private ThCourseChapterService courseChapterService; @Autowired - private ThStudentCourseService studentCourseService; + private ThStudentBatchService studentBatchService; + @Autowired + private ThStudentBatchService thStudentBatchService; + @Autowired + private ThStudyDetailService studyDetailService; @Override public List<ThCourseRespDTO> listByPage(ThCourseQuery query) { - List<ThCourse> courseList = courseService.listByPage(query); + List<ThCourseRespDTO> courseList = courseService.listByPage(query); //分许获取数据 - List<ThStatisticStudentVO> thStatisticStudentVOS = studentCourseService.statisticByCourseUuid(); + List<ThStatisticStudentVO> thStatisticStudentVOS = studentBatchService.statisticByCourseUuid(); - List<ThCourseRespDTO> courseRespDTOList = new ArrayList<>(); + //List<ThCourseRespDTO> courseRespDTOList = new ArrayList<>(); if(!CollectionUtils.isEmpty(courseList)){ //根据courseids获取所有章节 List<ThCourseChapterVO> courseChapterVOS = new ArrayList<>(); - List<String> courseUuids = courseList.stream().map(ThCourse::getUuid).collect(Collectors.toList()); + List<String> courseUuids = courseList.stream().map(ThCourseRespDTO::getUuid).collect(Collectors.toList()); if(!CollectionUtils.isEmpty(courseUuids)){ courseChapterVOS = courseChapterService.listByCourseUuids(courseUuids); } - for (ThCourse course : courseList) { - ThCourseRespDTO courseRespDTO = new ThCourseRespDTO(); - BeanUtils.copyProperties(course, courseRespDTO); + for (ThCourseRespDTO courseRespDTO : courseList) { //获取章 List<ThCourseChapterVO> finalCourseChapterVOS = courseChapterVOS; List<ThCourseChapterRespDTO> chapterList = courseChapterVOS .stream() - .filter(cc -> course.getUuid().equals(cc.getCourseUuid()) && cc.getParentUuid().equals("0")) + .filter(cc -> courseRespDTO.getUuid().equals(cc.getCourseUuid()) && cc.getParentUuid().equals("0")) .map(cc -> { ThCourseChapterRespDTO courseChapterRespDTO = new ThCourseChapterRespDTO(); BeanUtils.copyProperties(cc, courseChapterRespDTO); @@ -60,17 +71,16 @@ .collect(Collectors.toList()); courseRespDTO.setOutline(chapterList); //学员数量 - List<ThStatisticStudentVO> statisticList = thStatisticStudentVOS.stream().filter(s -> s.getCourseUuid().equals(course.getUuid())).collect(Collectors.toList()); + List<ThStatisticStudentVO> statisticList = thStatisticStudentVOS.stream().filter(s -> s.getCourseUuid().equals(courseRespDTO.getUuid())).collect(Collectors.toList()); if(statisticList.size()>0){ ThStatisticStudentVO thStatisticStudentVO = statisticList.get(0); courseRespDTO.setStudentCount(thStatisticStudentVO.getCount()); }else { courseRespDTO.setStudentCount(0); } - courseRespDTOList.add(courseRespDTO); } } - return courseRespDTOList; + return courseList; } //获取单条课程 @@ -92,6 +102,51 @@ return thCourseRespDTO; } + @Override + public List<ThStudentStudyRespDTO> getSutdent(String courseUuid) { + //获取该课程下所有学生 + //获取学生信息 + List<ThStudentBatchVO> thStudentBatches = thStudentBatchService.getStudentBatchVOByCourseUuid(courseUuid); + //获取学生学习记录 + List<ThStudyDetailVO> studyDetails = studyDetailService.listByCourseUuid(courseUuid); + List<ThStudentStudyRespDTO> respDTOS = new ArrayList<>(); + if (!CollectionUtils.isEmpty(thStudentBatches)) { + for (ThStudentBatchVO VO : thStudentBatches) { + ThStudentStudyRespDTO thStudentStudyRespDTO = new ThStudentStudyRespDTO(); + thStudentStudyRespDTO.setIdcard(VO.getIdcard()); + thStudentStudyRespDTO.setName(VO.getName()); + thStudentStudyRespDTO.setBatchLessonNum(VO.getBatchLessonNum()); + thStudentStudyRespDTO.setFinishStatus(VO.getFinishStatus()); + thStudentStudyRespDTO.setBatchUuid(VO.getBatchUuid()); + thStudentStudyRespDTO.setCourseLessonNum(VO.getCourseLessonNum()); + BigDecimal lessNum = new BigDecimal(0); + + List<ThStudyDetailVO> collect = studyDetails + .stream() + .filter(sd -> sd.getIdcard().equals(VO.getIdcard())) + .collect(Collectors.toList()); + StringBuffer stringBuffer = new StringBuffer(); + for (ThStudyDetailVO studyDetail : collect) { + //是否完成 + if(studyDetail.getFinishStatus().equals(FinishStatus.YES.getStatus())){ + lessNum = lessNum.add(studyDetail.getLessonNum()); + } + //是否有学时报告 + if(!StringUtils.isEmpty(studyDetail.getLessonReportUrl())){ + stringBuffer.append(studyDetail.getLessonReportUrl()).append(","); + } + } + if(!StringUtils.isEmpty(stringBuffer.toString())){ + stringBuffer.deleteCharAt(stringBuffer.length()-1); + } + thStudentStudyRespDTO.setUrl(stringBuffer.toString()); + thStudentStudyRespDTO.setLessonNum(lessNum); + respDTOS.add(thStudentStudyRespDTO); + } + } + return respDTOS; + } + //获取章节 private List<ThCourseChapterRespDTO> getChildren(List<ThCourseChapterVO> courseChapterVOS, String parentUuid) { List<ThCourseChapterRespDTO> chapterList = courseChapterVOS diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseServiceImpl.java index c24ebd1..7dcc890 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseServiceImpl.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseServiceImpl.java @@ -1,15 +1,19 @@ package com.gkhy.exam.institutionalaccess.service.serviceImpl; +import cn.hutool.core.collection.ListUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gkhy.exam.institutionalaccess.entity.ThCourse; import com.gkhy.exam.institutionalaccess.mapper.ThCourseMapper; import com.gkhy.exam.institutionalaccess.model.query.ThCourseQuery; +import com.gkhy.exam.institutionalaccess.model.resp.ThCourseRespDTO; import com.gkhy.exam.institutionalaccess.service.ThCourseService; import com.ruoyi.common.enums.coalmineEnums.DeleteStatusEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; @@ -19,7 +23,7 @@ private ThCourseMapper courseMapper; @Override - public List<ThCourse> listByPage(ThCourseQuery query) { + public List<ThCourseRespDTO> listByPage(ThCourseQuery query) { return courseMapper.listByPage(query); } @@ -45,4 +49,34 @@ ); return list; } + + @Override + public List<ThCourse> getByUuidList(List<String> courseUuids) { + List<ThCourse> allList = new ArrayList<>(); + //分批量查询 + List<List<String>> list = ListUtil.split(courseUuids, 900); + for (List<String> uuids : list) { + List<ThCourse> courseListList = courseMapper.getByUuidList(uuids); + allList.addAll(courseListList); + + } + + return allList; + } + + @Override + public Integer insertBatch(List<ThCourse> courseList) { + return courseMapper.insertBatch(courseList); + } + + @Override + public Integer updateBatch(List<ThCourse> courseList) { + return courseMapper.updateBatch(courseList); + } + + @Override + public List<ThCourse> getCourseNameByUuids(List<String> courseUuids) { + List<ThCourse> courseListList = courseMapper.getCourseNameByUuids(courseUuids); + return courseListList; + } } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThExamRecordServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThExamRecordServiceImpl.java index 857ea0f..8c990dd 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThExamRecordServiceImpl.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThExamRecordServiceImpl.java @@ -1,5 +1,6 @@ package com.gkhy.exam.institutionalaccess.service.serviceImpl; +import cn.hutool.core.collection.ListUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gkhy.exam.institutionalaccess.entity.ThExamRecord; @@ -10,6 +11,9 @@ import com.ruoyi.common.enums.coalmineEnums.DeleteStatusEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Collections; import java.util.List; @Service("ThExamRecordService") @@ -25,4 +29,20 @@ public List<ThExamRecordVO> listByPage(ThExamRecordQuery query) { return thExamRecordMapper.listByPage(query); } + + @Override + public List<ThExamRecord> getByUuids(List<String> examUuids) { + List<ThExamRecord> allExamRecordList = new ArrayList<>(); + List<List<String>> split = ListUtil.split(examUuids, 900); + for (List<String> list : split) { + List<ThExamRecord> examRecordList = thExamRecordMapper.getByUuids(list); + allExamRecordList.addAll(examRecordList); + } + + return allExamRecordList; + } + @Override + public Integer insertBatch(List<ThExamRecord> examRecordList){ + return baseMapper.insertBatch(examRecordList); + } } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentBatchServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentBatchServiceImpl.java new file mode 100644 index 0000000..0552e57 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentBatchServiceImpl.java @@ -0,0 +1,104 @@ +package com.gkhy.exam.institutionalaccess.service.serviceImpl; + +import cn.hutool.core.collection.ListUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gkhy.exam.institutionalaccess.entity.ThStudentBatch; +import com.gkhy.exam.institutionalaccess.mapper.ThStudentBatchMapper; + +import com.gkhy.exam.institutionalaccess.model.vo.ThStatisticStudentVO; +import com.gkhy.exam.institutionalaccess.model.vo.ThStudentBatchCourseVO; +import com.gkhy.exam.institutionalaccess.model.vo.ThStudentBatchVO; +import com.gkhy.exam.institutionalaccess.model.vo.ThStudentCourseVO; +import com.gkhy.exam.institutionalaccess.service.ThStudentBatchService; +import com.ruoyi.common.enums.coalmineEnums.DeleteStatusEnum; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + + +@Service("ThStudentBatchService") +public class ThStudentBatchServiceImpl extends ServiceImpl<ThStudentBatchMapper, ThStudentBatch> implements ThStudentBatchService { + @Autowired + private ThStudentBatchMapper studentBatchMapper; + @Override + public List<ThStudentBatch> getByIdCards(List<String> idcards) { + List<ThStudentBatch> allStudentBatchList = new ArrayList<>(); + List<List<String>> split = ListUtil.split(idcards, 900); + for (List<String> list : split) { + List<ThStudentBatch> studentBatchList = studentBatchMapper.getByIdCards(list); + allStudentBatchList.addAll(studentBatchList); + } + + return allStudentBatchList; + } + + @Override + public List<ThStatisticStudentVO> statisticByBatchUuid() { + return studentBatchMapper.statisticByBatchUuid(); + } + + + @Override + public List<ThStudentBatch> listByInstitutionId(Long institutionId) { + return studentBatchMapper.selectList(new LambdaQueryWrapper<ThStudentBatch>().eq(ThStudentBatch::getInstitutionId, institutionId) + .eq(ThStudentBatch::getDelFlag,DeleteStatusEnum.NO.getStatus())); + } + + @Override + public List<ThStatisticStudentVO> statisticByCourseUuid() { + return studentBatchMapper.statisticByCourseUuid(); + } + + @Override + public List<ThStudentBatchCourseVO> getStudentBatchCourseVOByBatchUuid(String batchUuid) { + return studentBatchMapper.getStudentBatchCourseVOByBatchUuid(batchUuid); + } + + @Override + public void updateByBatchUuid(String batchUuid) { + studentBatchMapper.updateByBatchUuid(batchUuid); + } + + @Override + public ThStudentBatch getByIdcardAndBatchUuid(String idcard, String batchUuid) { + ThStudentBatch thStudentCourse = studentBatchMapper.selectOne(new LambdaQueryWrapper<ThStudentBatch>().eq(ThStudentBatch::getIdcard, idcard) + .eq(ThStudentBatch::getBatchUuid, batchUuid).eq(ThStudentBatch::getDelFlag, DeleteStatusEnum.NO.getStatus())); + return thStudentCourse; + } + + @Override + public List<ThStudentBatch> getByBatchUuid(String batchUuid) { + List<ThStudentBatch> thStudentCourse = studentBatchMapper.selectList(new LambdaQueryWrapper<ThStudentBatch>() + .eq(ThStudentBatch::getBatchUuid, batchUuid).eq(ThStudentBatch::getDelFlag, DeleteStatusEnum.NO.getStatus())); + return thStudentCourse; + } + + @Override + public void updateFinishStatusByBatchUuid(String batchUuid) { + studentBatchMapper.updateFinishStatusByBatchUuid(batchUuid); + } + + @Override + public Integer insertBatch(List<ThStudentBatch> saveThStudentBatchList) { + return studentBatchMapper.insertBatch(saveThStudentBatchList); + } + + @Override + public Integer updateBatch(List<ThStudentBatch> updateThStudentBatchList) { + return studentBatchMapper.updateBatch(updateThStudentBatchList); + } + + @Override + public List<ThStudentBatchVO> getStudentBatchVOByBatchUuid(String batchUuid) { + return studentBatchMapper.getStudentBatchVOByBatchUuid(batchUuid); + } + + @Override + public List<ThStudentBatchVO> getStudentBatchVOByCourseUuid(String courseUuid) { + return studentBatchMapper.getStudentBatchVOByCourseUuid(courseUuid); + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentCourseServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentCourseServiceImpl.java deleted file mode 100644 index f88d80e..0000000 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentCourseServiceImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.gkhy.exam.institutionalaccess.service.serviceImpl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gkhy.exam.institutionalaccess.entity.ThStudentCourse; -import com.gkhy.exam.institutionalaccess.mapper.ThStudentCourseMapper; -import com.gkhy.exam.institutionalaccess.model.vo.ThStatisticStudentVO; -import com.gkhy.exam.institutionalaccess.model.vo.ThStudentCourseVO; -import com.gkhy.exam.institutionalaccess.service.ThStudentCourseService; -import com.ruoyi.common.enums.coalmineEnums.DeleteStatusEnum; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.Collections; -import java.util.List; - - -@Service("ThStudentCourseService") -public class ThStudentCourseServiceImpl extends ServiceImpl<ThStudentCourseMapper, ThStudentCourse> implements ThStudentCourseService { - @Autowired - private ThStudentCourseMapper studentCourseMapper; - @Override - public List<ThStudentCourse> getByIdCards(List<String> idcards) { - - return studentCourseMapper.selectList(new LambdaQueryWrapper<ThStudentCourse>().in(ThStudentCourse::getIdcard, idcards)); - } - - @Override - public List<ThStatisticStudentVO> statisticByBatchUuid() { - return studentCourseMapper.statisticByBatchUuid(); - } - - - @Override - public List<ThStudentCourse> listByInstitutionId(Long institutionId) { - return studentCourseMapper.selectList(new LambdaQueryWrapper<ThStudentCourse>().eq(ThStudentCourse::getInstitutionId, institutionId)); - } - - @Override - public List<ThStatisticStudentVO> statisticByCourseUuid() { - return studentCourseMapper.statisticByCourseUuid(); - } - - @Override - public List<ThStudentCourseVO> getListByBatchUuid(String batchUuid) { - return studentCourseMapper.getListByBatchUuid(batchUuid); - } - - @Override - public void updateByBatchUuid(String batchUuid) { - studentCourseMapper.updateByBatchUuid(batchUuid); - } - - @Override - public List<ThStudentCourse> getByIdcardAndBatchUuid(String idcard, String batchUuid) { - List<ThStudentCourse> thStudentCourse = studentCourseMapper.selectList(new LambdaQueryWrapper<ThStudentCourse>().eq(ThStudentCourse::getIdcard, idcard) - .eq(ThStudentCourse::getBatchUuid, batchUuid).eq(ThStudentCourse::getDelFlag, DeleteStatusEnum.NO.getStatus())); - return thStudentCourse; - } -} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentManagerServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentManagerServiceImpl.java index 53bda1c..f2f66ea 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentManagerServiceImpl.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentManagerServiceImpl.java @@ -22,6 +22,6 @@ return thStudentService.list(new LambdaQueryWrapper<ThStudent>() .eq(!StringUtils.isEmpty(query.getIdcard()),ThStudent::getIdcard,query.getIdcard()) .like(!StringUtils.isEmpty(query.getName()),ThStudent::getName, query.getName()) - .eq(ThStudent::getDelFlag, DeleteStatusEnum.NO.getStatus())); + .eq(ThStudent::getDelFlag, DeleteStatusEnum.NO.getStatus()).orderByDesc(ThStudent::getUpdateTime)); } } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentServiceImpl.java index 3aa5f6f..4ac5864 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentServiceImpl.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentServiceImpl.java @@ -1,8 +1,10 @@ package com.gkhy.exam.institutionalaccess.service.serviceImpl; +import cn.hutool.core.collection.ListUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gkhy.exam.institutionalaccess.entity.ThStudent; +import com.gkhy.exam.institutionalaccess.entity.ThStudentBatch; import com.gkhy.exam.institutionalaccess.mapper.ThStudentMapper; import com.gkhy.exam.institutionalaccess.model.vo.ThStatisticStudentVO; import com.gkhy.exam.institutionalaccess.service.ThStudentService; @@ -10,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -27,13 +30,29 @@ @Override public List<ThStudent> getByIdcards(List<String> idcards) { - List<ThStudent> students = studentMapper.selectList(new LambdaQueryWrapper<ThStudent>().in(ThStudent::getIdcard, idcards).eq(ThStudent::getDelFlag, DeleteStatusEnum.NO.getStatus())); - return students; + List<ThStudent> allStudentList = new ArrayList<>(); + List<List<String>> split = ListUtil.split(idcards, 900); + for (List<String> list : split) { + List<ThStudent> studentList = studentMapper.getByIdCards(list); + allStudentList.addAll(studentList); + } + return allStudentList; } @Override - public int updateByIdcard(List<ThStudent> updateStudentList) { - return studentMapper.updateByIdcard(updateStudentList); + public Integer updateBatch(List<ThStudent> updateStudentList) { + return studentMapper.updateBatch(updateStudentList); + } + + @Override + public Integer insertBatch(List<ThStudent> saveSudentList) { + return studentMapper.insertBatch(saveSudentList); + } + + @Override + public List<ThStudent> getNameByIdcards(List<String> idcards) { + + return studentMapper.getNameByIdcards(idcards); } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyAuthServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyAuthServiceImpl.java index f221f5c..001a11c 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyAuthServiceImpl.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyAuthServiceImpl.java @@ -1,5 +1,6 @@ package com.gkhy.exam.institutionalaccess.service.serviceImpl; +import cn.hutool.core.collection.ListUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gkhy.exam.institutionalaccess.entity.ThStudyAuth; @@ -9,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -23,7 +25,21 @@ } @Override - public List<ThStudyAuth> getListByStudyDetaiIds(List<String> detailUuids) { - return thStudyAuthMapper.selectList(new LambdaQueryWrapper<ThStudyAuth>().in(ThStudyAuth::getStudyDetailUuid, detailUuids)); + public List<ThStudyAuth> getByStudyDetaiUuids(List<String> studyUuids) { + List<ThStudyAuth> allAuthList = new ArrayList<>(); + List<List<String>> split = ListUtil.split(studyUuids, 900); + for (List<String> list : split) { + List<ThStudyAuth> authList = thStudyAuthMapper.getByStudyDetaiUuids(list); + allAuthList.addAll(authList); + } + + return allAuthList; } + + @Override + public Integer insetBatch(List<ThStudyAuth> thStudyAuthList) { + return baseMapper.insertBatch(thStudyAuthList); + } + + } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyDetailServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyDetailServiceImpl.java index b4018d1..ff95bdb 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyDetailServiceImpl.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyDetailServiceImpl.java @@ -1,5 +1,6 @@ package com.gkhy.exam.institutionalaccess.service.serviceImpl; +import cn.hutool.core.collection.ListUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gkhy.exam.institutionalaccess.entity.ThStudyDetail; @@ -12,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -45,4 +47,30 @@ public List<ThStudyDetailVO> listByBatchUuid(String batchUuid) { return thStudyDetailMapper.listByBatchUuid(batchUuid); } + + @Override + public List<ThStudyDetail> getByUuids(List<String> studyUuids) { + List<ThStudyDetail> allStudyDetailList = new ArrayList<>(); + List<List<String>> split = ListUtil.split(studyUuids, 900); + for (List<String> list : split) { + List<ThStudyDetail> studyDetailList = thStudyDetailMapper.getByUuids(list); + allStudyDetailList.addAll(studyDetailList); + } + return allStudyDetailList; + } + + @Override + public Integer insertBatch(List<ThStudyDetail> list) { + return baseMapper.insertBatch(list); + } + + @Override + public Integer updateBatch(List<ThStudyDetail> list) { + return baseMapper.updateBatch(list); + } + + @Override + public List<ThStudyDetailVO> listByCourseUuid(String courseUuid) { + return baseMapper.listByCourseUuid(courseUuid); + } } diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyRecordManagerServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyRecordManagerServiceImpl.java index 30729bb..8a4a0a6 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyRecordManagerServiceImpl.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyRecordManagerServiceImpl.java @@ -1,15 +1,11 @@ package com.gkhy.exam.institutionalaccess.service.serviceImpl; -import com.gkhy.exam.institutionalaccess.entity.ThStudyAuth; -import com.gkhy.exam.institutionalaccess.entity.ThStudyTrack; +import com.gkhy.exam.institutionalaccess.entity.*; import com.gkhy.exam.institutionalaccess.model.query.ThStudyDetailQuery; import com.gkhy.exam.institutionalaccess.model.vo.ThStudyAuthVO; import com.gkhy.exam.institutionalaccess.model.vo.ThStudyDetailVO; import com.gkhy.exam.institutionalaccess.model.vo.ThStudyTrackVO; -import com.gkhy.exam.institutionalaccess.service.ThStudyAuthService; -import com.gkhy.exam.institutionalaccess.service.ThStudyDetailService; -import com.gkhy.exam.institutionalaccess.service.ThStudyRecordManagerService; -import com.gkhy.exam.institutionalaccess.service.ThStudyTrackService; +import com.gkhy.exam.institutionalaccess.service.*; import com.gkhy.exam.institutionalaccess.utils.ConvertTimeUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -28,18 +24,39 @@ private ThStudyTrackService thStudyTrackService; @Autowired private ThStudyAuthService thStudyAuthService; + @Autowired + private ThCourseChapterService thCourseChapterService;; + @Autowired + private ThCourseService thCourseService; + @Autowired + private ThBatchService thBatchService; + @Autowired + private ThStudentService studentService;; @Override public List<ThStudyDetailVO> listByPage(ThStudyDetailQuery query) { + query.setStartSize((query.getPageNum()-1)*query.getPageSize()); + List<ThStudyDetailVO> thStudyDetailVOS = thStudyDetailService.listByPage(query); if(!CollectionUtils.isEmpty(thStudyDetailVOS)){ List<String> detailUuids = thStudyDetailVOS.stream().map(ThStudyDetailVO::getUuid).collect(Collectors.toList()); //获取认证记录 - List<ThStudyAuth> authList = thStudyAuthService.getListByStudyDetaiIds(detailUuids); + List<ThStudyAuth> authList = thStudyAuthService.getByStudyDetaiUuids(detailUuids); //获取轨迹 List<ThStudyTrack> trackList = thStudyTrackService.getListByStudyDetaiIds(detailUuids); - + //获取章节名称 + List<String> chapterUuids = thStudyDetailVOS.stream().map(ThStudyDetailVO::getChapterUuid).collect(Collectors.toList()); + List<ThCourseChapter> chapterList = thCourseChapterService.getChapterNameByUuids(chapterUuids); + //获取课程名称 + List<String> courseUuids = thStudyDetailVOS.stream().map(ThStudyDetailVO::getCourseUuid).collect(Collectors.toList()); + List<ThCourse> courseList = thCourseService.getCourseNameByUuids(courseUuids); + //获取批次名称 + List<String> batchUuids = thStudyDetailVOS.stream().map(ThStudyDetailVO::getBatchUuid).collect(Collectors.toList()); + List<ThBatch> batchList = thBatchService.getBatchNameByUuids(batchUuids); + //学生信息 + List<String> idcards = thStudyDetailVOS.stream().map(ThStudyDetailVO::getIdcard).collect(Collectors.toList()); + List<ThStudent> studentList = studentService.getNameByIdcards(idcards); for(ThStudyDetailVO thStudyDetailVO : thStudyDetailVOS){ thStudyDetailVO.setDurationDesc(ConvertTimeUtils.convertTimeToString(thStudyDetailVO.getDuration())); thStudyDetailVO.setStartPositionDesc(ConvertTimeUtils.convertTimeToString(thStudyDetailVO.getStartPosition())); @@ -61,6 +78,23 @@ }).collect(Collectors.toList()); thStudyDetailVO.setAuthList(thStudyAuthVOList); thStudyDetailVO.setTrackList(trackVOList); + List<ThCourseChapter> chapterSelectList = chapterList.stream().filter(chapter -> chapter.getUuid().equals(thStudyDetailVO.getChapterUuid())).collect(Collectors.toList()); + if(!CollectionUtils.isEmpty(chapterSelectList)){ + thStudyDetailVO.setChapterName(chapterSelectList.get(0).getChapterName()); + } + List<ThCourse> courseSelectList = courseList.stream().filter(c -> c.getUuid().equals(thStudyDetailVO.getCourseUuid())).collect(Collectors.toList()); + if(!CollectionUtils.isEmpty(courseSelectList)){ + thStudyDetailVO.setCourseName(courseSelectList.get(0).getCourseName()); + } + List<ThBatch> batchSelectList = batchList.stream().filter(b -> b.getUuid().equals(thStudyDetailVO.getBatchUuid())).collect(Collectors.toList()); + if(!CollectionUtils.isEmpty(batchSelectList)){ + thStudyDetailVO.setBatchName(batchSelectList.get(0).getBatchName()); + } + List<ThStudent> studentSelectList = studentList.stream().filter(thStudent -> thStudent.getIdcard().equals(thStudyDetailVO.getIdcard())).collect(Collectors.toList()); + if(!CollectionUtils.isEmpty(studentSelectList)){ + thStudyDetailVO.setName(studentSelectList.get(0).getName()); + } + } } return thStudyDetailVOS; diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyTrackServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyTrackServiceImpl.java index bc46b90..4d5caa7 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyTrackServiceImpl.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyTrackServiceImpl.java @@ -26,4 +26,13 @@ public List<ThStudyTrack> getListByStudyDetaiIds(List<String> detailUuids) { return thStudyTrackMapper.selectList(new LambdaQueryWrapper<ThStudyTrack>().in(ThStudyTrack::getStudyDetailUuid, detailUuids)); } + @Override + public List<ThStudyTrack> getByStudyDetailUuids(List<String> studyUuids){ + return thStudyTrackMapper.getByStudyDetaiUuids(studyUuids); + } + + @Override + public Integer insertBatch(List<ThStudyTrack> list) { + return thStudyTrackMapper.insertBatch(list); + } } 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(); diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThBatchCourseChapterMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThBatchCourseChapterMapper.xml new file mode 100644 index 0000000..24eec06 --- /dev/null +++ b/exam-system/src/main/resources/mapper/institutionaccess/ThBatchCourseChapterMapper.xml @@ -0,0 +1,115 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.gkhy.exam.institutionalaccess.mapper.ThBatchCourseChapterMapper"> + + <update id="deleteByBatchUuid"> + UPDATE th_batch_course_chapter + set del_flag = 2 + where batch_uuid = #{batchUuid} + </update> + + + <select id="getListByBatchUuid" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThBatchCourseVO"> + SELECT + bc.*, + c.course_name , + (SELECT sum(cc.duration) from th_course_chapter cc where cc.course_uuid = bc.course_uuid) duration + FROM + th_batch_course bc + LEFT JOIN th_course c ON c.uuid = bc.course_uuid + WHERE + bc.del_flag = 0 + AND bc.batch_uuid = #{batchUuid} + </select> + + <select id="getByBatchUuids" resultType="com.gkhy.exam.institutionalaccess.entity.ThBatchCourseChapter"> + select id, chapter_uuid, chapter_code,chapter_name,lesson_num,have_resource, duration, + institution_id,resource_type,course_uuid ,parent_uuid, + url,batch_uuid,serialno from th_batch_course_chapter where del_flag = 0 and batch_uuid in + <foreach collection="batchUuids" item="batchUuid" index ="index" open="(" close=")" separator=","> + #{batchUuid} + </foreach> + order by serialno + </select> + + <select id="getByChapterUuids" resultType="com.gkhy.exam.institutionalaccess.entity.ThBatchCourseChapter"> + select id, chapter_uuid, chapter_code,chapter_name,lesson_num,have_resource, duration, + institution_id,resource_type,course_uuid ,parent_uuid, + url,batch_uuid,serialno from th_batch_course_chapter where del_flag = 0 and chapter_uuid in + <foreach collection="chapterUuids" item="chapterUuid" index ="index" open="(" close=")" separator=","> + #{chapterUuid} + </foreach> + </select> + + + <insert id="insertBatch"> + INSERT INTO th_batch_course_chapter ( chapter_uuid, chapter_code,chapter_name,lesson_num,have_resource, duration, + institution_id,resource_type,course_uuid ,parent_uuid, + url, del_flag,create_time,update_time,create_by,update_by,batch_uuid,serialno) VALUES + <foreach collection="batchCourseChapterList" separator="," item="item"> + (#{item.chapterUuid},#{item.chapterCode},#{item.chapterName},#{item.lessonNum},#{item.haveResource},#{item.duration}, + #{item.institutionId},#{item.resourceType},#{item.courseUuid}, + #{item.parentUuid},#{item.url},#{item.delFlag},#{item.createTime}, + #{item.updateTime},#{item.createBy},#{item.updateBy},#{item.batchUuid},#{item.serialno}) + </foreach> + </insert> + + <!--批量修改--> + <update id="updateBatch" parameterType="java.util.List" > + <foreach collection="batchCourseChapterList" item="item" index="index" separator=";"> + UPDATE th_batch_course_chapter + <set> + <if test="item.chapterUuid != null and item.chapterUuid != ''" > + chapter_uuid = #{item.chapterUuid}, + </if> + <if test="item.chapterCode != null and item.chapterCode != ''" > + chapter_code = #{item.chapterCode}, + </if> + <if test="item.chapterName != null and item.chapterName != ''" > + chapter_name = #{item.chapterName}, + </if> + <if test="item.lessonNum != null" > + lesson_num = #{item.lessonNum}, + </if> + <if test="item.haveResource != null" > + have_resource = #{item.haveResource}, + </if> + <if test="item.duration != null" > + duration = #{item.duration}, + </if> + <if test="item.institutionId != null" > + institution_id = #{item.institutionId}, + </if> + <if test="item.resourceType != null" > + resource_type = #{item.resourceType}, + </if> + <if test="item.serialno != null" > + serialno = #{item.serialno}, + </if> + <if test="item.courseUuid != null and item.courseUuid != ''" > + course_uuid = #{item.courseUuid}, + </if> + <if test="item.parentUuid != null and item.parentUuid != ''" > + parent_uuid = #{item.parentUuid}, + </if> + <if test="item.url != null and item.url != ''" > + url = #{item.url}, + </if> + <if test="item.delFlag != null" > + del_flag = #{item.delFlag}, + </if> + <if test="item.updateBy != null and item.updateBy != ''" > + update_by = #{item.updateBy}, + </if> + <if test="item.updateTime != null" > + update_time = #{item.updateTime}, + </if> + <if test="item.batchUuid != null and item.batchUuid != ''" > + batch_uuid = #{item.batchUuid} + </if> + </set> + where id = #{item.id} + </foreach> + </update> +</mapper> + diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThBatchCourseMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThBatchCourseMapper.xml index a96188b..2488a30 100644 --- a/exam-system/src/main/resources/mapper/institutionaccess/ThBatchCourseMapper.xml +++ b/exam-system/src/main/resources/mapper/institutionaccess/ThBatchCourseMapper.xml @@ -4,7 +4,7 @@ <update id="deleteByBatchUuidAndCourseUuid" parameterType="java.util.List" > <foreach collection="list" item="item" index="index" separator=";"> - UPDATE batch_course + UPDATE th_batch_course <set> <if test="item.delFlag != null" > del_flag = #{item.delFlag} @@ -14,28 +14,92 @@ and course_uuid = #{item.courseUuid} </foreach> </update> + <update id="deleteByBatchUuid" > - <select id="getListByBatchUuids" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThBatchCourseVO"> - select bc.*,c.course_name from th_batch_course bc - left join th_course c on c.uuid = bc.course_uuid - where bc.del_flag = 0 - and bc.batch_uuid in - <foreach collection="batchUuids" item="batchUuid" open="(" close=")" separator=","> - #{batchUuid} - </foreach> - </select> + UPDATE th_batch_course + set del_flag = 2 + where batch_uuid = #{batchUuid} + + </update> <select id="getListByBatchUuid" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThBatchCourseVO"> SELECT bc.*, - c.course_name , - (SELECT sum(cc.duration) from th_course_chapter cc where cc.course_uuid = bc.course_uuid) duration + ( + SELECT + sum( cc.duration ) + FROM + th_batch_course_chapter cc + WHERE + cc.course_uuid = bc.course_uuid + AND cc.del_flag = 0 + AND cc.batch_uuid = bc.batch_uuid + ) duration FROM th_batch_course bc - LEFT JOIN th_course c ON c.uuid = bc.course_uuid WHERE bc.del_flag = 0 AND bc.batch_uuid = #{batchUuid} </select> + + <!--批量插入--> + <insert id="insertBatch"> + INSERT INTO th_batch_course (id, course_uuid,course_name,course_lesson_num,batch_uuid, + institution_id, + train_org_name, del_flag,create_time,update_time,create_by,update_by) VALUES + <foreach collection="courseList" separator="," item="item"> + (#{item.id},#{item.courseUuid},#{item.courseName},#{item.courseLessonNum}, + #{item.batchUuid},#{item.institutionId}, + #{item.trainOrgName},#{item.delFlag},#{item.createTime}, + #{item.updateTime},#{item.createBy},#{item.updateBy}) + </foreach> + </insert> + + <!--批量修改--> + <update id="updateBatch" parameterType="java.util.List" > + <foreach collection="courseList" item="item" index="index" separator=";"> + UPDATE th_batch_course + <set> + <if test="item.courseUuid != null and item.courseUuid != ''" > + course_uuid = #{item.courseUuid}, + </if> + <if test="item.courseName != null and item.courseName != ''" > + course_name = #{item.courseName}, + </if> + <if test="item.courseLessonNum != null" > + course_lesson_num = #{item.courseLessonNum}, + </if> + <if test="item.batchUuid != null and item.batchUuid != ''" > + batch_uuid = #{item.batchUuid}, + </if> + <if test="item.institutionId != null" > + institution_id = #{item.institutionId}, + </if> + <if test="item.trainOrgName != null and item.trainOrgName != ''" > + train_org_name = #{item.trainOrgName}, + </if> + <if test="item.delFlag != null" > + del_flag = #{item.delFlag}, + </if> + <if test="item.updateBy != null and item.updateBy != ''" > + update_by = #{item.updateBy}, + </if> + <if test="item.updateTime != null" > + update_time = #{item.updateTime} + </if> + </set> + where id = #{item.id} + </foreach> + </update> + + <select id="getByBatchUuids" resultType="com.gkhy.exam.institutionalaccess.entity.ThBatchCourse"> + select id, course_uuid,course_name,course_lesson_num,batch_uuid, + institution_id,train_org_name + from th_batch_course + where del_flag = 0 and batch_uuid in + <foreach collection="batchUuids" item="batchUuid" index ="index" open="(" close=")" separator=","> + #{batchUuid} + </foreach> + </select> </mapper> diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThBatchMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThBatchMapper.xml index 4f79451..ea40be5 100644 --- a/exam-system/src/main/resources/mapper/institutionaccess/ThBatchMapper.xml +++ b/exam-system/src/main/resources/mapper/institutionaccess/ThBatchMapper.xml @@ -2,7 +2,18 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.gkhy.exam.institutionalaccess.mapper.ThBatchMapper"> <select id="listByPage" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThBatchVO"> - select * from th_batch where del_flag = 0 + select + id, + uuid, + batch_name, + institution_id, + institution_name, + have_exam, + status, + del_flag, + create_time, + update_time + from th_batch where del_flag = 0 <if test="query.institutionId != null"> and institution_id = #{query.institutionId} </if> @@ -15,8 +26,118 @@ <if test="query.endTime != null"><!-- 结束时间检索 --> and date_format(d.create_time,'%y-%m-%d') <= date_format(#{query.endTime},'%y-%m-%d') </if> + order by id desc </select> + <!--批量插入--> + <insert id="insertBatch"> + INSERT INTO th_batch (id, uuid, institution_id, institution_name,batch_name,have_exam,status, + batch_lesson_num,train_org_name, del_flag,create_time,update_time,create_by,update_by) VALUES + <foreach collection="batchList" separator="," item="item"> + (#{item.id},#{item.uuid},#{item.institutionId},#{item.institutionName},#{item.batchName},#{item.haveExam},#{item.status}, + #{item.batchLessonNum},#{item.trainOrgName},#{item.delFlag},#{item.createTime}, + #{item.updateTime},#{item.createBy},#{item.updateBy}) + </foreach> + </insert> + + <!--批量修改--> + <update id="updateBatch" parameterType="java.util.List" > + <foreach collection="batchList" item="item" index="index" separator=";"> + UPDATE th_batch + <set> + <if test="item.batchName != null and item.batchName != ''" > + `batch_name` = #{item.batchName}, + </if> + <if test="item.uuid != null and item.uuid != ''" > + uuid = #{item.uuid}, + </if> + <if test="item.haveExam != null" > + have_exam = #{item.haveExam}, + </if> + <if test="item.status != null" > + status = #{item.status}, + </if> + <if test="item.batchLessonNum != null" > + batch_lesson_num = #{item.batchLessonNum}, + </if> + <if test="item.delFlag != null" > + del_flag = #{item.delFlag}, + </if> + <if test="item.trainOrgName != null and item.trainOrgName != ''" > + train_org_name = #{item.trainOrgName}, + </if> + <if test="item.institutionId != null" > + institution_id = #{item.institutionId}, + </if> + <if test="item.institutionName != null and item.institutionName != ''" > + institution_name = #{item.institutionName}, + </if> + <if test="item.updateBy != null and item.updateBy != ''" > + update_by = #{item.updateBy}, + </if> + <if test="item.updateTime != null" > + update_time = #{item.updateTime} + </if> + </set> + where id = #{item.id} + </foreach> + </update> + + <!-- <update id="updateBatch" parameterType="java.util.List" > + <foreach collection="batchList" item="item" index="index" separator=";"> + UPDATE th_batch + <set> + <if test="item.batchName != null and item.batchName != ''" > + batch_name = #{item.batchName}, + </if> + <if test="item.haveExam != null" > + have_exam = #{item.haveExam}, + </if> + <if test="item.status != null" > + status = #{item.status}, + </if> + <if test="item.delFlag != null" > + del_flag = #{item.delFlag}, + </if> + <if test="item.trainOrgName != null and item.trainOrgName != ''" > + train_org_name = #{item.trainOrgName}, + </if> + <if test="item.institutionId != null" > + institution_id = #{item.institutionId}, + </if> + <if test="item.institutionName != null and item.institutionName != ''" > + institution_name = #{item.institutionName}, + </if> + <if test="item.updateBy != null and item.updateBy != ''" > + update_by = #{item.updateBy}, + </if> + <if test="item.updateTime != null" > + update_time = #{item.updateTime} + </if> + </set> + where id = #{item.id} + </foreach> + </update> + --> + + <select id="getByUuids" resultType="com.gkhy.exam.institutionalaccess.entity.ThBatch"> + select id, uuid, institution_id, institution_name,batch_name,have_exam,status, + batch_lesson_num,train_org_name + from th_batch + where del_flag = 0 and uuid in + <foreach collection="batchUuids" item="uuid" index ="index" open="(" close=")" separator=","> + #{uuid} + </foreach> + </select> + + <select id="getBatchNameByUuids" resultType="com.gkhy.exam.institutionalaccess.entity.ThBatch"> + select id, uuid, batch_name + from th_batch + where del_flag = 0 and uuid in + <foreach collection="batchUuids" item="uuid" index ="index" open="(" close=")" separator=","> + #{uuid} + </foreach> + </select> </mapper> diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThCourseChapterMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThCourseChapterMapper.xml index 91a2d06..9af851c 100644 --- a/exam-system/src/main/resources/mapper/institutionaccess/ThCourseChapterMapper.xml +++ b/exam-system/src/main/resources/mapper/institutionaccess/ThCourseChapterMapper.xml @@ -14,11 +14,24 @@ cc.have_resource, cc.course_uuid, cc.parent_uuid, + cc.serialno, cc.url from th_course_chapter cc where cc.del_flag = 0 and cc.course_uuid in <foreach collection="courseUuids" item="courseUuid" open="(" close=")" separator=","> #{courseUuid} + </foreach> + order by serialno + </select> + + <select id="getChapterNameByUuids" resultType="com.gkhy.exam.institutionalaccess.entity.ThCourseChapter"> + select cc.id, + cc.uuid, + cc.chapter_name + from th_course_chapter cc + where cc.del_flag = 0 and cc.uuid in + <foreach collection="chapterUuids" item="chapterUuid" open="(" close=")" separator=","> + #{chapterUuid} </foreach> </select> @@ -34,9 +47,83 @@ cc.have_resource, cc.course_uuid, cc.parent_uuid, + cc.serialno, cc.url from th_course_chapter cc where cc.del_flag = 0 and cc.course_uuid = #{courseUuid} + order by serialno </select> + + <select id="getByUuids" resultType="com.gkhy.exam.institutionalaccess.entity.ThCourseChapter"> + select id, uuid, chapter_code,chapter_name,lesson_num,have_resource, duration, + institution_id,resource_type,course_uuid ,parent_uuid,serialno, + url from th_course_chapter where del_flag = 0 and uuid in + <foreach collection="chapterUuids" item="uuid" index ="index" open="(" close=")" separator=","> + #{uuid} + </foreach> + </select> + <insert id="insertBatch"> + INSERT INTO th_course_chapter (id, uuid, chapter_code,chapter_name,lesson_num,have_resource, duration, + institution_id,resource_type,course_uuid ,parent_uuid, + url, del_flag,create_time,update_time,create_by,update_by,serialno) VALUES + <foreach collection="courseChapterList" separator="," item="item"> + (#{item.id},#{item.uuid},#{item.chapterCode},#{item.chapterName},#{item.lessonNum},#{item.haveResource},#{item.duration}, + #{item.institutionId},#{item.resourceType},#{item.courseUuid}, + #{item.parentUuid},#{item.url},#{item.delFlag},#{item.createTime}, + #{item.updateTime},#{item.createBy},#{item.updateBy},#{item.serialno}) + </foreach> + </insert> + + <!--批量修改--> + <update id="updateBatch" parameterType="java.util.List" > + <foreach collection="courseChapterList" item="item" index="index" separator=";"> + UPDATE th_course_chapter + <set> + <if test="item.chapterCode != null and item.chapterCode != ''" > + chapter_code = #{item.chapterCode}, + </if> + <if test="item.chapterName != null and item.chapterName != ''" > + chapter_name = #{item.chapterName}, + </if> + <if test="item.lessonNum != null" > + lesson_num = #{item.lessonNum}, + </if> + <if test="item.haveResource != null" > + have_resource = #{item.haveResource}, + </if> + <if test="item.duration != null" > + duration = #{item.duration}, + </if> + <if test="item.institutionId != null" > + institution_id = #{item.institutionId}, + </if> + <if test="item.resourceType != null" > + resource_type = #{item.resourceType}, + </if> + <if test="item.serialno != null" > + serialno = #{item.serialno}, + </if> + <if test="item.courseUuid != null and item.courseUuid != ''" > + course_uuid = #{item.courseUuid}, + </if> + <if test="item.parentUuid != null and item.parentUuid != ''" > + parent_uuid = #{item.parentUuid}, + </if> + <if test="item.url != null and item.url != ''" > + url = #{item.url}, + </if> + <if test="item.delFlag != null" > + del_flag = #{item.delFlag}, + </if> + <if test="item.updateBy != null and item.updateBy != ''" > + update_by = #{item.updateBy}, + </if> + <if test="item.updateTime != null" > + update_time = #{item.updateTime} + </if> + </set> + where id = #{item.id} + </foreach> + </update> </mapper> diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThCourseMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThCourseMapper.xml index cf8d52a..e7a296f 100644 --- a/exam-system/src/main/resources/mapper/institutionaccess/ThCourseMapper.xml +++ b/exam-system/src/main/resources/mapper/institutionaccess/ThCourseMapper.xml @@ -2,12 +2,114 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.gkhy.exam.institutionalaccess.mapper.ThCourseMapper"> - <select id="listByPage" resultType="com.gkhy.exam.institutionalaccess.entity.ThCourse"> + <select id="listByPage" resultType="com.gkhy.exam.institutionalaccess.model.resp.ThCourseRespDTO"> select c.* from th_course c where c.del_flag = 0 <if test="query.institutionId != null"> and c.institution_id = #{query.institutionId} </if> order by c.create_time desc </select> + <!--批量插入--> + <insert id="insertBatch"> + INSERT INTO th_course (id, uuid, course_code, institution_id, institution_name,course_name, + lesson_num,train_org_name, del_flag,create_time,update_time,create_by,update_by) VALUES + <foreach collection="courseList" separator="," item="item"> + (#{item.id},#{item.uuid},#{item.courseCode},#{item.institutionId},#{item.institutionName},#{item.courseName}, + #{item.lessonNum},#{item.trainOrgName},#{item.delFlag},#{item.createTime}, + #{item.updateTime},#{item.createBy},#{item.updateBy}) + </foreach> + </insert> + <!--批量修改--> + <update id="updateBatch" parameterType="java.util.List" > + <foreach collection="courseList" item="item" index="index" separator=";"> + UPDATE th_course + <set> + <if test="item.courseCode != null and item.courseCode != ''" > + course_code = #{item.courseCode}, + </if> + <if test="item.courseName != null and item.courseName != ''" > + course_name = #{item.courseName}, + </if> + <if test="item.lessonNum != null" > + lesson_num = #{item.lessonNum}, + </if> + <if test="item.delFlag != null" > + del_flag = #{item.delFlag}, + </if> + <if test="item.trainOrgName != null and item.trainOrgName != ''" > + train_org_name = #{item.trainOrgName}, + </if> + <if test="item.institutionId != null" > + institution_id = #{item.institutionId}, + </if> + <if test="item.institutionName != null and item.institutionName != ''" > + institution_name = #{item.institutionName}, + </if> + <if test="item.updateBy != null and item.updateBy != ''" > + update_by = #{item.updateBy}, + </if> + <if test="item.updateTime != null" > + update_time = #{item.updateTime} + </if> + </set> + where id = #{item.id} + </foreach> + </update> + <!--<update id="updateBatch" parameterType="java.util.List" > + <foreach collection="courseList" item="item" index="index" separator=";"> + UPDATE th_course + <set> + <if test="item.courseCode != null and item.courseCode != ''" > + course_code = #{item.courseCode}, + </if> + <if test="item.courseName != null and item.courseName != ''" > + course_name = #{item.courseName}, + </if> + <if test="item.lessonNum != null" > + lesson_num = #{item.lessonNum}, + </if> + <if test="item.delFlag != null" > + del_flag = #{item.delFlag}, + </if> + <if test="item.trainOrgName != null and item.trainOrgName != ''" > + train_org_name = #{item.trainOrgName}, + </if> + <if test="item.institutionId != null" > + institution_id = #{item.institutionId}, + </if> + <if test="item.institutionName != null and item.institutionName != ''" > + institution_name = #{item.institutionName}, + </if> + <if test="item.updateBy != null and item.updateBy != ''" > + update_by = #{item.updateBy}, + </if> + <if test="item.updateTime != null" > + update_time = #{item.updateTime} + </if> + </set> + where id = #{item.id} + </foreach> + </update>--> + + + <select id="getByUuidList" resultType="com.gkhy.exam.institutionalaccess.entity.ThCourse"> + select id, uuid, course_code, institution_id, institution_name,course_name, + lesson_num,train_org_name + from th_course + where del_flag = 0 and uuid in + <foreach collection="courseUuids" item="uuid" index ="index" open="(" close=")" separator=","> + #{uuid} + </foreach> + </select> + + <select id="getCourseNameByUuids" resultType="com.gkhy.exam.institutionalaccess.entity.ThCourse"> + select id, uuid,course_name + from th_course + where del_flag = 0 and uuid in + <foreach collection="courseUuids" item="uuid" index ="index" open="(" close=")" separator=","> + #{uuid} + </foreach> + </select> + </mapper> diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThExamRecordMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThExamRecordMapper.xml index 2bfb2fd..08e9404 100644 --- a/exam-system/src/main/resources/mapper/institutionaccess/ThExamRecordMapper.xml +++ b/exam-system/src/main/resources/mapper/institutionaccess/ThExamRecordMapper.xml @@ -1,32 +1,50 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.gkhy.exam.institutionalaccess.mapper.ThExamRecordMapper"> -<select id="listByPage" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThExamRecordVO"> - SELECT + <select id="listByPage" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThExamRecordVO"> + SELECT e.*, s.`name`, - c.course_name, b.batch_name - FROM + FROM th_exam_record e - LEFT JOIN th_student s ON s.idcard = e.idcard - LEFT JOIN th_course c ON c.uuid = e.course_uuid - LEFT JOIN th_batch b ON b.uuid = e.batch_uuid - WHERE e.del_flag = 0 - <if test="query.idcard != null and query.idcard != ''"> - and e.idcard = #{query.idcard} - </if> - <if test="query.name != null and query.name != ''"> - and s.name like concat('%', #{query.name}, '%') - </if> - <if test="query.startTime != null"><!-- 开始时间检索 --> - and date_format(e.exam_start_time,'%y-%m-%d') >= date_format(#{query.startTime},'%y-%m-%d') - </if> - <if test="query.endTime != null"><!-- 结束时间检索 --> - and date_format(e.exam_start_time,'%y-%m-%d') <= date_format(#{query.endTime},'%y-%m-%d') - </if> - order by e.create_time desc -</select> + LEFT JOIN th_student s ON s.idcard = e.idcard + LEFT JOIN th_batch b ON b.uuid = e.batch_uuid + WHERE + e.del_flag = 0 + <if test="query.idcard != null and query.idcard != ''"> + and e.idcard = #{query.idcard} + </if> + <if test="query.name != null and query.name != ''"> + and s.name like concat('%', #{query.name}, '%') + </if> + <if test="query.startTime != null"><!-- 开始时间检索 --> + and date_format(e.exam_start_time,'%y-%m-%d') >= date_format(#{query.startTime},'%y-%m-%d') + </if> + <if test="query.endTime != null"><!-- 结束时间检索 --> + and date_format(e.exam_start_time,'%y-%m-%d') <= date_format(#{query.endTime},'%y-%m-%d') + </if> + order by e.create_time desc + </select> + + <insert id="insertBatch"> + INSERT INTO th_exam_record (id,uuid,idcard,batch_uuid, institution_id, institution_name,train_org_name,exam_name, + exam_start_time,exam_submit_time,exam_user_score,exam_total_score,exam_pass_score,exam_is_pass, + del_flag,create_time,update_time,create_by,update_by) VALUES + <foreach collection="list" separator="," item="item"> + (#{item.id},#{item.uuid},#{item.idcard},#{item.batchUuid},#{item.institutionId},#{item.institutionName},#{item.trainOrgName}, + #{item.examName},#{item.examStartTime},#{item.examSubmitTime},#{item.examUserScore},#{item.examTotalScore},#{item.examPassScore},#{item.examIsPass},#{item.delFlag},#{item.createTime}, + #{item.updateTime},#{item.createBy},#{item.updateBy},#{item.finishStatus}) + </foreach> + </insert> + + <select id="getByUuids" resultType="com.gkhy.exam.institutionalaccess.entity.ThExamRecord" > + select id,uuid,idcard,batch_uuid, institution_id, institution_name,train_org_name,exam_name, + exam_start_time,exam_submit_time,exam_user_score,exam_total_score,exam_pass_score,exam_is_pass from th_exam_record where del_flag = 0 and idcard in + <foreach collection="examUuids" item="examUuid" index ="index" open="(" close=")" separator=","> + #{examUuid} + </foreach> + </select> </mapper> diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThStudentBatchMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThStudentBatchMapper.xml new file mode 100644 index 0000000..3884fef --- /dev/null +++ b/exam-system/src/main/resources/mapper/institutionaccess/ThStudentBatchMapper.xml @@ -0,0 +1,151 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.gkhy.exam.institutionalaccess.mapper.ThStudentBatchMapper"> + <insert id="insertBatch"> + INSERT INTO th_student_batch (uuid,idcard, name, sex, phone, auth_photo,train_org_name, institution_id, institution_name, + industry,occupation,post,del_flag,create_time,update_time,create_by,update_by,finish_status,batch_uuid) VALUES + <foreach collection="list" separator="," item="item"> + (#{item.uuid},#{item.idcard},#{item.name},#{item.sex},#{item.phone},#{item.authPhoto},#{item.trainOrgName},#{item.institutionId},#{item.institutionName}, + #{item.industry},#{item.occupation},#{item.post},#{item.delFlag},#{item.createTime}, + #{item.updateTime},#{item.createBy},#{item.updateBy},#{item.finishStatus},#{item.batchUuid}) + </foreach> + </insert> + + + + <update id="updateBatch" parameterType="java.util.List" > + <foreach collection="list" item="item" index="index" separator=";"> + UPDATE th_student_batch + <set> + <if test="item.uuid != null and item.uuid != ''" > + uuid = #{item.uuid}, + </if> + <if test="item.name != null and item.name != ''" > + name = #{item.name}, + </if> + <if test="item.idcard != null and item.idcard != ''" > + idcard = #{item.idcard}, + </if> + <if test="item.sex != null" > + sex = #{item.sex}, + </if> + <if test="item.phone != null and item.phone != ''" > + phone = #{item.phone}, + </if> + <if test="item.authPhoto != null and item.authPhoto != ''" > + auth_photo = #{item.authPhoto}, + </if> + <if test="item.trainOrgName != null and item.trainOrgName != ''" > + train_org_name = #{item.trainOrgName}, + </if> + <if test="item.institutionId != null" > + institution_id = #{item.institutionId}, + </if> + <if test="item.institutionName != null and item.institutionName != ''" > + institution_name = #{item.institutionName}, + </if> + <if test="item.industry != null and item.industry != ''" > + industry = #{item.industry}, + </if> + <if test="item.occupation != null and item.occupation != ''" > + occupation = #{item.occupation}, + </if> + <if test="item.post != null and item.post != ''" > + post = #{item.post}, + </if> + <if test="item.batchUuid != null and item.batchUuid != ''" > + batch_uuid = #{item.batchUuid}, + </if> + <if test="item.delFlag != null" > + del_flag = #{item.delFlag}, + </if> + <if test="item.finishStatus != null" > + finish_status = #{item.finishStatus}, + </if> + <if test="item.updateBy != null and item.updateBy != ''" > + update_by = #{item.updateBy}, + </if> + <if test="item.updateTime != null" > + update_time = #{item.updateTime} + </if> + </set> + where id = #{item.id} + </foreach> + </update> + + + <select id="statisticByCourseUuid" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThStatisticStudentVO"> + SELECT + c.course_uuid, + count(s.idcard) as count + FROM + th_student_batch s + INNER JOIN th_batch_course c ON s.batch_uuid = c.batch_uuid + WHERE + s.del_flag = 0 + AND c.del_flag = 0 + GROUP BY + c.course_uuid + </select> + + <select id="statisticByBatchUuid" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThStatisticStudentVO"> + SELECT + s.batch_uuid, + count( s.idcard ) AS count + FROM + th_student_batch s + WHERE + s.del_flag = 0 + GROUP BY + s.batch_uuid + </select> + + <select id="getStudentBatchCourseVOByBatchUuid" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThStudentBatchCourseVO"> + SELECT + sb.idcard, + sb.batch_uuid, + sb.`name`, + bc.course_uuid + FROM + th_student_batch sb + INNER JOIN th_batch_course bc ON bc.batch_uuid = sb.batch_uuid + WHERE + sb.del_flag = 0 + AND bc.del_flag = 0 + AND sb.batch_uuid = #{batchUuid} + </select> + + <update id="updateByBatchUuid"> + update th_student_batch set finish_status = 1 where batch_uuid = #{batchUuid} + </update> + <update id="updateFinishStatusByBatchUuid"> + update th_student_batch set finish_status = 1 where batch_uuid = #{batchUuid} + </update> + + <select id="getStudentBatchVOByBatchUuid" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThStudentBatchVO"> + select sb.*, b.batch_lesson_num from th_student_batch sb INNER JOIN th_batch b ON sb.batch_uuid = b.uuid where sb.del_flag = 0 and sb.batch_uuid = #{batchUuid} + </select> + + <select id="getByIdCards" resultType="com.gkhy.exam.institutionalaccess.entity.ThStudentBatch" > + select idcard, name, sex, phone, auth_photo,train_org_name, institution_id, institution_name, + industry,occupation,post,finish_status,batch_uuid from th_student_batch where del_flag = 0 and idcard in + <foreach collection="idcards" item="idcard" index ="index" open="(" close=")" separator=","> + #{idcard} + </foreach> + </select> + <select id="getStudentBatchVOByCourseUuid" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThStudentBatchVO"> + SELECT + sb.*, + b.batch_lesson_num, + bc.course_lesson_num + FROM + th_student_batch sb + INNER JOIN th_batch b ON sb.batch_uuid = b.uuid + INNER JOIN th_batch_course bc ON bc.batch_uuid = b.uuid + WHERE + sb.del_flag = 0 + AND bc.course_uuid = #{courseUuid} + </select> + +</mapper> + diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThStudentCourseMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThStudentCourseMapper.xml deleted file mode 100644 index 339f748..0000000 --- a/exam-system/src/main/resources/mapper/institutionaccess/ThStudentCourseMapper.xml +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.gkhy.exam.institutionalaccess.mapper.ThStudentCourseMapper"> - - <select id="statisticByCourseUuid" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThStatisticStudentVO"> - select course_uuid, count(id) as count from th_student_course where del_flag = 0 group by course_uuid - </select> - - <select id="statisticByBatchUuid" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThStatisticStudentVO"> - SELECT - sc.batch_uuid, - count( sc.id ) AS count - FROM - ( SELECT DISTINCT id, create_by, course_uuid, create_time, batch_uuid, del_flag FROM th_student_course ) sc - GROUP BY - sc.batch_uuid - </select> - - <select id="getListByBatchUuid" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThStudentCourseVO"> - SELECT - sc.idcard, - sc.course_uuid, - sc.batch_uuid, - sc.NAME, - sc.finish_status, - c.course_name, - (( - SELECT - sum( cc.lesson_num ) - FROM - th_course_chapter cc - WHERE - cc.course_uuid = sc.course_uuid - )) less_total - FROM - th_student_course sc - LEFT JOIN th_course c ON c.uuid = sc.course_uuid - WHERE - sc.del_flag = 0 - AND sc.batch_uuid = #{batchUuid} - </select> - - <update id="updateByBatchUuid"> - update th_student_course set finish_status = 1 where batch_uuid = #{batchUuid} - </update> -</mapper> - diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThStudentMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThStudentMapper.xml index 26c98cf..baaefb0 100644 --- a/exam-system/src/main/resources/mapper/institutionaccess/ThStudentMapper.xml +++ b/exam-system/src/main/resources/mapper/institutionaccess/ThStudentMapper.xml @@ -2,7 +2,19 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.gkhy.exam.institutionalaccess.mapper.ThStudentMapper"> - <update id="updateByIdcard" parameterType="java.util.List" > + <insert id="insertBatch"> + INSERT INTO th_student (idcard, name, sex, phone, auth_photo,train_org_name, institution_id, institution_name, + industry,occupation,post,del_flag,create_time,update_time,create_by,update_by) VALUES + <foreach collection="list" separator="," item="item"> + (#{item.idcard},#{item.name},#{item.sex},#{item.phone},#{item.authPhoto},#{item.trainOrgName},#{item.institutionId},#{item.institutionName}, + #{item.industry},#{item.occupation},#{item.post},#{item.delFlag},#{item.createTime}, + #{item.updateTime},#{item.createBy},#{item.updateBy}) + </foreach> + </insert> + + + + <update id="updateBatch" parameterType="java.util.List" > <foreach collection="list" item="item" index="index" separator=";"> UPDATE th_student <set> @@ -28,7 +40,7 @@ institution_id = #{item.institutionId}, </if> <if test="item.institutionName != null and item.institutionName != ''" > - institution_name = #{item.phone}, + institution_name = #{item.institutionName}, </if> <if test="item.industry != null and item.industry != ''" > industry = #{item.industry}, @@ -36,6 +48,10 @@ <if test="item.occupation != null and item.occupation != ''" > occupation = #{item.occupation}, </if> + <if test="item.post != null and item.post != ''" > + post = #{item.post}, + </if> + <if test="item.updateBy != null and item.updateBy != ''" > update_by = #{item.updateBy}, </if> @@ -43,10 +59,23 @@ update_time = #{item.updateTime} </if> </set> - where idcard = #{item.idcard} + where id = #{item.id} </foreach> </update> + <select id="getByIdCards" resultType="com.gkhy.exam.institutionalaccess.entity.ThStudent" > + select idcard, name, sex, phone, auth_photo,train_org_name, institution_id, institution_name, + industry,occupation,post from th_student where del_flag = 0 and idcard in + <foreach collection="idcards" item="idcard" index ="index" open="(" close=")" separator=","> + #{idcard} + </foreach> + </select> + <select id="getNameByIdcards" resultType="com.gkhy.exam.institutionalaccess.entity.ThStudent" > + select idcard, name from th_student where del_flag = 0 and idcard in + <foreach collection="idcards" item="idcard" index ="index" open="(" close=")" separator=","> + #{idcard} + </foreach> + </select> </mapper> diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThStudyAuthMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThStudyAuthMapper.xml index 35507b5..9d86f18 100644 --- a/exam-system/src/main/resources/mapper/institutionaccess/ThStudyAuthMapper.xml +++ b/exam-system/src/main/resources/mapper/institutionaccess/ThStudyAuthMapper.xml @@ -4,6 +4,19 @@ <select id="getUuidByStudyDetaiId" resultType="java.lang.String"> select uuid from th_study_auth where study_detail_uuid = #{studyDetaiId} </select> + <insert id="insertBatch"> + INSERT INTO th_study_auth (id,uuid,approve_photo, auth_position,auth_time, face_type,study_detail_uuid, auth_video) VALUES + <foreach collection="list" separator="," item="item"> + (#{item.id},#{item.uuid},#{item.approvePhoto},#{item.authPosition},#{item.authTime},#{item.faceType},#{item.studyDetailUuid},#{item.authVideo}) + </foreach> + </insert> + + <select id="getByStudyDetaiUuids" resultType="com.gkhy.exam.institutionalaccess.entity.ThStudyAuth" > + select id,uuid,approve_photo, auth_position,auth_time, face_type,study_detail_uuid, auth_video from th_study_auth where 1=1 and study_detail_uuid in + <foreach collection="studyUuids" item="studyUuid" index ="index" open="(" close=")" separator=","> + #{studyUuid} + </foreach> + </select> </mapper> diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThStudyDetailMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThStudyDetailMapper.xml index 47ec001..bce3e7d 100644 --- a/exam-system/src/main/resources/mapper/institutionaccess/ThStudyDetailMapper.xml +++ b/exam-system/src/main/resources/mapper/institutionaccess/ThStudyDetailMapper.xml @@ -3,17 +3,26 @@ <mapper namespace="com.gkhy.exam.institutionalaccess.mapper.ThStudyDetailMapper"> <select id="listByPage" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThStudyDetailVO"> SELECT - d.*, - s.name, - b.batch_name, - c.course_name, - cc.chapter_name + d.id, + d.uuid, + d.serial_num, + d.idcard, + d.institution_name, + d.course_uuid, + d.train_org_name, + d.batch_uuid, + d.chapter_uuid, + d.finish_status, + d.duration, + d.start_time, + d.finish_time, + d.start_position, + d.finish_position, + d.video_url, + d.lesson_report_url, + d.create_time FROM th_study_detail d - LEFT JOIN th_student s ON s.idcard = d.idcard - LEFT JOIN th_batch b ON b.uuid = d.batch_uuid - LEFT JOIN th_course c ON c.uuid = d.course_uuid - LEFT JOIN th_course_chapter cc ON cc.uuid = d.chapter_uuid where d.del_flag = 0 <if test="query.idcard != null and query.idcard != ''"> and d.idcard = #{query.idcard} @@ -21,21 +30,21 @@ <if test="query.courseUuid != null and query.courseUuid != ''"> and d.course_uuid = #{query.courseUuid} </if> - <if test="query.name != null and query.name != ''"> - and s.name like concat('%', #{query.name}, '%') - </if> <if test="query.startTime != null"><!-- 开始时间检索 --> and date_format(d.create_time,'%y-%m-%d') >= date_format(#{query.startTime},'%y-%m-%d') </if> <if test="query.endTime != null"><!-- 结束时间检索 --> and date_format(d.create_time,'%y-%m-%d') <= date_format(#{query.endTime},'%y-%m-%d') </if> - order by d.create_time desc + ORDER BY + d.id DESC + </select> <select id="statisticDurationByIdcard" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThStudyVO"> SELECT d.idcard, + d.course_uuid, sum( d.duration ) duration FROM th_study_detail d @@ -43,7 +52,8 @@ d.del_flag = 0 AND d.batch_uuid = #{batchUuid} GROUP BY - d.idcard + d.idcard, + d.course_uuid </select> <select id="listByBatchUuid" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThStudyDetailVO"> SELECT @@ -58,5 +68,104 @@ AND d.batch_uuid = #{batchUuid} </select> + <insert id="insertBatch"> + INSERT INTO th_study_detail (id,uuid,serial_num, idcard,institution_id, institution_name,course_uuid, train_org_name,batch_uuid,chapter_uuid, + finish_status,duration,start_time,finish_time,start_position,finish_position,video_url,lesson_report_url,del_flag,create_time,update_time,create_by,update_by) VALUES + <foreach collection="list" separator="," item="item"> + (#{item.id},#{item.uuid},#{item.serialNum},#{item.idcard},#{item.institutionId},#{item.institutionName},#{item.courseUuid},#{item.trainOrgName},#{item.batchUuid},#{item.chapterUuid}, + #{item.finishStatus},#{item.duration},#{item.startTime}, + #{item.finishTime},#{item.startPosition},#{item.finishPosition},#{item.videoUrl},#{item.lessonReportUrl},#{item.delFlag},#{item.createTime}, + #{item.updateTime},#{item.createBy},#{item.updateBy}) + </foreach> + </insert> + <update id="updateBatch" parameterType="java.util.List" > + <foreach collection="list" item="item" index="index" separator=";"> + UPDATE th_study_detail + <set> + <if test="item.uuid != null and item.uuid != ''" > + uuid = #{item.uuid}, + </if> + <if test="item.serialNum != null" > + serial_num = #{item.serialNum}, + </if> + <if test="item.idcard != null and item.idcard != ''" > + idcard = #{item.idcard}, + </if> + <if test="item.institutionId != null" > + institution_id = #{item.institutionId}, + </if> + <if test="item.institutionName != null and item.institutionName != ''" > + institution_name = #{item.institutionName}, + </if> + <if test="item.courseUuid != null and item.courseUuid != ''" > + course_uuid = #{item.courseUuid}, + </if> + <if test="item.trainOrgName != null and item.trainOrgName != ''" > + train_org_name = #{item.trainOrgName}, + </if> + <if test="item.batchUuid != null and item.batchUuid != ''" > + batch_uuid = #{item.batchUuid}, + </if> + <if test="item.chapterUuid != null and item.chapterUuid != ''" > + chapter_uuid = #{item.chapterUuid}, + </if> + <if test="item.finishStatus != null" > + finish_status = #{item.finishStatus}, + </if> + <if test="item.duration != null" > + duration = #{item.duration}, + </if> + <if test="item.startTime != null" > + start_time = #{item.startTime}, + </if> + <if test="item.finishTime != null" > + finish_time = #{item.finishTime}, + </if> + <if test="item.startPosition != null" > + start_position = #{item.startPosition}, + </if> + <if test="item.finishPosition != null" > + finish_position = #{item.finishPosition}, + </if> + <if test="item.videoUrl != null and item.videoUrl != ''" > + video_url = #{item.videoUrl}, + </if> + <if test="item.lessonReportUrl != null and item.lessonReportUrl != ''" > + lesson_report_url = #{item.lessonReportUrl}, + </if> + <if test="item.delFlag != null" > + del_flag = #{item.delFlag}, + </if> + <if test="item.updateBy != null and item.updateBy != ''" > + update_by = #{item.updateBy}, + </if> + <if test="item.updateTime != null" > + update_time = #{item.updateTime} + </if> + </set> + where id = #{item.id} + </foreach> + </update> + <select id="getByUuids" resultType="com.gkhy.exam.institutionalaccess.entity.ThStudyDetail" > + select id,uuid,serial_num, idcard,institution_id, institution_name,course_uuid, train_org_name,batch_uuid,chapter_uuid, + finish_status,duration,start_time,finish_time,start_position,finish_position,video_url,lesson_report_url from th_study_detail where del_flag = 0 and uuid in + <foreach collection="studyUuids" item="studyUuid" index ="index" open="(" close=")" separator=","> + #{studyUuid} + </foreach> + </select> + + <select id="listByCourseUuid" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThStudyDetailVO"> + SELECT + d.*, + cc.chapter_name, + cc.lesson_num + FROM + th_study_detail d + INNER JOIN th_batch_course bc on bc.batch_uuid = d.batch_uuid + LEFT JOIN th_course_chapter cc ON cc.uuid = d.chapter_uuid + WHERE + d.del_flag = 0 + AND bc.course_uuid = #{courseUuid} + </select> </mapper> diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThStudyTrackMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThStudyTrackMapper.xml index 5364362..0e1ab9d 100644 --- a/exam-system/src/main/resources/mapper/institutionaccess/ThStudyTrackMapper.xml +++ b/exam-system/src/main/resources/mapper/institutionaccess/ThStudyTrackMapper.xml @@ -1,9 +1,21 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.gkhy.exam.institutionalaccess.mapper.ThStudyTrackMapper"> -<select id="getUuidByStudyDetaiId" resultType="java.lang.String"> - select uuid from th_study_track where study_detail_uuid = #{studyDetaiId} -</select> + <select id="getUuidByStudyDetaiId" resultType="java.lang.String"> + select uuid from th_study_track where study_detail_uuid = #{studyDetaiId} + </select> + <insert id="insertBatch"> + INSERT INTO th_study_track (id,uuid,start_time, end_time,time_interval, study_detail_uuid) VALUES + <foreach collection="list" separator="," item="item"> + (#{item.id},#{item.uuid},#{item.startTime},#{item.endTime},#{item.timeInterval},#{item.studyDetailUuid}) + </foreach> + </insert> + <select id="getByStudyDetaiUuids" resultType="com.gkhy.exam.institutionalaccess.entity.ThStudyTrack" > + select id,uuid,start_time, end_time,time_interval, study_detail_uuid from th_study_track where 1=1 and study_detail_uuid in + <foreach collection="studyUuids" item="studyUuid" index ="index" open="(" close=")" separator=","> + #{studyUuid} + </foreach> + </select> </mapper> diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ThreeAccessController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ThreeAccessController.java index e3dc57b..f0d6831 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ThreeAccessController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ThreeAccessController.java @@ -25,12 +25,24 @@ public static void main(String[] args) { AccessReqDTO accessReqDTO = new AccessReqDTO(); - accessReqDTO.setAccessKey("Opq98lRKQ0NbBR59Ddi0"); - accessReqDTO.setSecretKey("AKKYCSZCYGCxCmxR7bsO"); + /* accessReqDTO.setAccessKey("Opq98lRKQ0NbBR59Ddi0"); + accessReqDTO.setSecretKey("AKKYCSZCYGCxCmxR7bsO");*/ + accessReqDTO.setAccessKey("lJyzhvt87v3o7M0Ic6cT"); + accessReqDTO.setSecretKey("93ED9pfi8fuk8ZVmxSNQ"); String jsonString = JSONObject.toJSONString(accessReqDTO); String encrypt = AESUtils.encrypt(jsonString); System.out.println(encrypt); - String decrypt = AESUtils.decrypt("ASg/NElcGyKiKSUu334t5DXcYjgpxb11mFr5YSf6sHICkQCrZ++NSQ55ZoMw1p+hKgFiuNEPXsDLp2lOtR52zDGaFLFKSQIqEgSJ7IL6YBCExaF3fQSqIFZFX62KygHb"); + String decrypt = AESUtils.decrypt("BhSazFtvofCRelDGgefpPJ5ObweXFr5qU7vhnjZvhGwK1LuCX1ErNvERLfOx1WKbIIYqHe8ZmpwnfTf6k6eaRZtIJ2HJJMspNDWQUdxPKAqETJRfIm/H+u7awqB6IE//e7YEwlIvp/DWqhsmQH5b/g=="); System.out.println(decrypt); } + + /*public static void main(String[] args) { + + String jsonString = "{\"uuid\":\"1edb2886-fc5e-6519-8210-1b89dd2c32b8\",\"batchName\":\"自动推荐二\",\"haveExam\":1,\"status\":2,\"trainOrgName\":\"吉林省安金环境安全技术有限公司\",\"courseList\":[{\"courseUuid\":\"f3386e2c-4c44-11ec-ac7c-00ff07067ec4\",\"courseLessonNum\":50.80,\"delFlag\":0}],\"chapterList\":[{\"chapterUuid\":\"7b251404-4c51-11ec-ac7c-00ff07067ec4\",\"chapterLessonNum\":2.05,\"delFlag\":0,\"children\":[{\"chapterUuid\":\"7b255c0a-4c51-11ec-ac7c-00ff07067ec4\",\"chapterLessonNum\":0.74,\"delFlag\":0,\"children\":null},{\"chapterUuid\":\"7b2570f5-4c51-11ec-ac7c-00ff07067ec4\",\"chapterLessonNum\":0.50,\"delFlag\":0,\"children\":null},{\"chapterUuid\":\"0bb6506a-ac46-11ed-b08c-00ff07067ec4\",\"chapterLessonNum\":0.81,\"delFlag\":0,\"children\":null}]}],\"batchLessonNum\":2.05,\"delFlag\":0}"; + String encrypt = AESUtils.encrypt(jsonString); + System.out.println(encrypt); + String decrypt = AESUtils.decrypt("BhSazFtvofCRelDGgefpPEG4F49MgY8G3hs3mGPsaE8LO964ZGizG/MUov8g8W1rm+CBYy3WdWaWDOrglO6vitPeC+q4gCeIUHFSfEmic1pshDf6TcvHd0DTa5mMvmPKK8RH9e0EGUo/PggbziF3NQ=="); + System.out.println(decrypt); + }*/ + } diff --git a/ruoyi-admin/src/main/resources/application-dev.yml b/ruoyi-admin/src/main/resources/application-dev.yml index aa77ac9..2fd873e 100644 --- a/ruoyi-admin/src/main/resources/application-dev.yml +++ b/ruoyi-admin/src/main/resources/application-dev.yml @@ -24,7 +24,7 @@ druid: # 主库数据源 master: - url: jdbc:mysql://localhost:3306/swspkmas?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:mysql://localhost:3306/swspkmas?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true username: root password: root # 从库数据源 @@ -115,3 +115,11 @@ #用户模块 accountPath: /account/ +#线程池配置 +threadPool: + corePoolSize: 20 + maxPoolSize: 20 + queueCapacity: 10000 + scheduling: + #控制线程是否执行 true:执行;false:不执行 + enabled: true \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/application-pro.yml b/ruoyi-admin/src/main/resources/application-pro.yml index 4f4b79d..f615957 100644 --- a/ruoyi-admin/src/main/resources/application-pro.yml +++ b/ruoyi-admin/src/main/resources/application-pro.yml @@ -24,7 +24,7 @@ druid: # 主库数据源 master: - url: jdbc:mysql://127.0.0.1:7006/swspkmas?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:mysql://127.0.0.1:7006/swspkmas?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true username: root password: 2farwL3yPXfbH2AP # 从库数据源 @@ -115,3 +115,11 @@ #用户模块 accountPath: /account/ +#线程池配置 +threadPool: + corePoolSize: 20 + maxPoolSize: 20 + queueCapacity: 10000 + scheduling: + #控制线程是否执行 true:执行;false:不执行 + enabled: true \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/RepeatedClick.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/RepeatedClick.java new file mode 100644 index 0000000..757e27e --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/RepeatedClick.java @@ -0,0 +1,16 @@ +package com.ruoyi.common.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface RepeatedClick { + + //2秒内都属于重复提交 + int clickTime() default 1; + + String errorMessage() default "访问过于频繁,请稍候再试"; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/ResultConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/ResultConstants.java index 7c2c0d4..b043cfa 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/ResultConstants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/ResultConstants.java @@ -62,7 +62,8 @@ BATCH_IS_NOT_EXIST(1012,"批次(班级)不存在"), BATCH_IS_NOT_OPEN(1013,"批次(班级)未开班,不可结束培训"), BATCH_STUDENT_IS_NOT_EXIST(1014,"该学生培训信息不存在"), - + BATCH_IS_OPEN_NO_DELETE(1015,"批次(班级)已开班或已结束,不可删除"), + THREE_INSTITUTION_OTHER_ERROR(1016,"业务错误"), ; diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RepeatedClickAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RepeatedClickAspect.java new file mode 100644 index 0000000..7eb680f --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RepeatedClickAspect.java @@ -0,0 +1,64 @@ +package com.ruoyi.framework.aspectj; + + + +import com.ruoyi.common.annotation.RepeatedClick; +import com.ruoyi.common.constant.ResultConstants; +import com.ruoyi.common.core.domain.model.InstitutionUser; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.exception.BusinessException; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.framework.security.context.ThreeInContextHolder; +import com.ruoyi.framework.web.service.TokenService; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.concurrent.TimeUnit; + +@Component +@Aspect +public class RepeatedClickAspect { + + + @Autowired + private RedisCache redisCache; + + @Before("@annotation(com.ruoyi.common.annotation.RepeatedClick)") + @ResponseBody + public void beforeRepeatedClick(JoinPoint joinPoint){ + ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + HttpServletRequest arg = requestAttributes.getRequest(); + MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature(); + RepeatedClick annotation = methodSignature.getMethod().getAnnotation(RepeatedClick.class); + if (annotation != null){ + int clickTime = annotation.clickTime(); + String errorMessage = annotation.errorMessage(); + ThreeInContextHolder threeInContextHolder = new ThreeInContextHolder(); + InstitutionUser institutionUser = threeInContextHolder.getContext(); + if (institutionUser != null && institutionUser.getId() != null) { + try { + Long uid = institutionUser.getId(); + String key = "institution_user_id:"+uid+"_"+ arg.getRequestURI() + "_" + arg.getMethod(); + if (redisCache.hasKey(key)){ + throw new ServiceException(errorMessage+" 频繁访问接口: "+ arg.getRequestURI()); + }else { + redisCache.setCacheObject(key, institutionUser, clickTime, TimeUnit.SECONDS); + } + } catch (NumberFormatException e) { + throw new BusinessException(this.getClass(),ResultConstants.PARAM_ERROR.getCode(),"数据参数异常"); + } + } + } + } +} -- Gitblit v1.9.2