exam-system/pom.xml
@@ -17,7 +17,7 @@ <dependencies> <dependency> <groupId>com.ruoyi</groupId> <artifactId>ruoyi-system</artifactId> <artifactId>ruoyi-framework</artifactId> </dependency> <!--附件依赖--> <dependency> 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(); } } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/InstitutionalManagerController.java
对比新文件 @@ -0,0 +1,61 @@ package com.gkhy.exam.institutionalaccess.controller; import com.ruoyi.system.domain.query.InstitutionManagerQuery; import com.ruoyi.system.domain.req.InstitutionModStatusReqDTO; import com.ruoyi.system.domain.req.InstitutionalManagerAddReqDTO; import com.ruoyi.system.domain.req.InstitutionalManagerModReqDTO; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.system.service.InstitutionalManagerService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; /** * 机构平台管理 */ @RestController @RequestMapping("/th/institutional/manager") public class InstitutionalManagerController extends BaseController { @Autowired private InstitutionalManagerService institutionalManagerService; @PostMapping("/add") private AjaxResult add(@Validated @RequestBody InstitutionalManagerAddReqDTO reqDTO) { return toAjax(institutionalManagerService.add(reqDTO)); } @PostMapping("/mod") private AjaxResult mod(@Validated @RequestBody InstitutionalManagerModReqDTO reqDTO) { return toAjax(institutionalManagerService.mod(reqDTO)); } @DeleteMapping("/del/{id}") private AjaxResult mod(@PathVariable Long id) { return toAjax(institutionalManagerService.del(id)); } @GetMapping("/find/{id}") private AjaxResult findById(@PathVariable Long id) { return success(institutionalManagerService.findById(id)); } @GetMapping("/list/page") public TableDataInfo listByPage(InstitutionManagerQuery query) { startPage(); return getDataTable(this.institutionalManagerService.listByPage(query)); } @GetMapping("/select") public AjaxResult select() { return success(this.institutionalManagerService.selectInstitutionInfo()); } @PostMapping("/mod/status") private AjaxResult modStatus(@Validated @RequestBody InstitutionModStatusReqDTO reqDTO) { return toAjax(institutionalManagerService.modStatus(reqDTO)); } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThBatchManagerController.java
对比新文件 @@ -0,0 +1,34 @@ package com.gkhy.exam.institutionalaccess.controller; import com.gkhy.exam.institutionalaccess.model.query.ThBatchQuery; import com.gkhy.exam.institutionalaccess.service.ThBatchManagerService; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/th/batch") public class ThBatchManagerController extends BaseController { @Autowired private ThBatchManagerService thBatchManagerService; @GetMapping("/list/page") public TableDataInfo listByPage(ThBatchQuery query) { startPage(); return getDataTable(thBatchManagerService.listByPage(query)); } @GetMapping("/period/{batchUuid}") public AjaxResult period(@PathVariable String batchUuid) { return AjaxResult.success(thBatchManagerService.period(batchUuid)); } @GetMapping("/student/{batchUuid}") public AjaxResult getStudent(@PathVariable String batchUuid) { return AjaxResult.success(thBatchManagerService.getStudent(batchUuid)); } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThCourseManagerController.java
对比新文件 @@ -0,0 +1,37 @@ package com.gkhy.exam.institutionalaccess.controller; import com.gkhy.exam.institutionalaccess.model.query.ThCourseQuery; import com.gkhy.exam.institutionalaccess.service.ThCourseManagerService; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @RequestMapping("/th/course") @RestController public class ThCourseManagerController extends BaseController { @Autowired private ThCourseManagerService courseManagerService; /** * 分页 */ @GetMapping("/list/page") public TableDataInfo listByPage(ThCourseQuery query) { startPage(); return getDataTable(courseManagerService.listByPage(query)); } /** * 根据id查询 */ @GetMapping("/find/{id}") 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)); } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThExamRecordManagerController.java
对比新文件 @@ -0,0 +1,22 @@ package com.gkhy.exam.institutionalaccess.controller; import com.gkhy.exam.institutionalaccess.model.query.ThExamRecordQuery; import com.gkhy.exam.institutionalaccess.service.ThExamRecordManagerService; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.page.TableDataInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/th/exam/record") public class ThExamRecordManagerController extends BaseController { @Autowired private ThExamRecordManagerService thExamRecordManagerService; @GetMapping("/list/page") public TableDataInfo listByPage(ThExamRecordQuery query) { startPage(); return getDataTable(thExamRecordManagerService.listByPage(query)); } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThQuestionBankController.java
对比新文件 @@ -0,0 +1,22 @@ package com.gkhy.exam.institutionalaccess.controller; import com.gkhy.exam.institutionalaccess.model.query.ThQuestionBankQuery; import com.gkhy.exam.institutionalaccess.service.ThQuestionBankService; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.page.TableDataInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/th/question/bank") public class ThQuestionBankController extends BaseController { @Autowired private ThQuestionBankService questionBankService; @GetMapping("/page") public TableDataInfo page(ThQuestionBankQuery query) { startPage(); return getDataTable(this.questionBankService.listByPage(query)); } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThStudentManagerController.java
对比新文件 @@ -0,0 +1,23 @@ package com.gkhy.exam.institutionalaccess.controller; import com.gkhy.exam.institutionalaccess.model.query.ThStudentQuery; import com.gkhy.exam.institutionalaccess.service.ThStudentManagerService; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.page.TableDataInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/th/student") public class ThStudentManagerController extends BaseController { @Autowired private ThStudentManagerService thStudentManagerService; @GetMapping("/list/page") public TableDataInfo listByPage(ThStudentQuery query) { startPage(); return getDataTable(thStudentManagerService.listByPage(query)); } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThStudyRecordManagerController.java
对比新文件 @@ -0,0 +1,25 @@ package com.gkhy.exam.institutionalaccess.controller; import com.gkhy.exam.institutionalaccess.model.query.ThStudyDetailQuery; import com.gkhy.exam.institutionalaccess.service.ThStudyRecordManagerService; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/th/study/record") public class ThStudyRecordManagerController extends BaseController { @Autowired private ThStudyRecordManagerService thStudyRecordManagerService; @GetMapping("/list/page") public TableDataInfo listByPage(ThStudyDetailQuery query) { startPage(); return getDataTable(thStudyRecordManagerService.listByPage(query)); } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/TripartiteInterfaceController.java
对比新文件 @@ -0,0 +1,354 @@ package com.gkhy.exam.institutionalaccess.controller; import com.alibaba.fastjson2.JSONObject; 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 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; @RequestMapping("/gov-server/receive") @RestController public class TripartiteInterfaceController extends BaseController { @Autowired 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 receiveBatchEnd(@RequestBody JSONObject jsonObject){ return tripartiteInterfaceService.receiveBatchEnd(jsonObject); } /** * 题库组卷 * @param args */ /*public static void main(String[] args) { ThQuestionBankReqDTO thQuestionBankReqDTO = new ThQuestionBankReqDTO(); thQuestionBankReqDTO.setUuid(UUID.randomUUID().toString()); thQuestionBankReqDTO.setMonth("2024年6月"); thQuestionBankReqDTO.setDelFlag((byte)0); thQuestionBankReqDTO.setUrl("http://www.baidu.com"); thQuestionBankReqDTO.setAddCount(2); thQuestionBankReqDTO.setAssemblyRate(new BigDecimal(80)); thQuestionBankReqDTO.setBrushRate(new BigDecimal(89)); thQuestionBankReqDTO.setReduceCount(4); thQuestionBankReqDTO.setLastMonthCount(450); String jsonString = JSONObject.toJSONString(thQuestionBankReqDTO); String encrypt = AESUtils.encrypt(jsonString); System.out.println(encrypt); String decrypt = AESUtils.decrypt("PmvIbOPyVJ2pYqmGer1YBAij35Tfdk8lufUv+Y2CyqAds/iyh6PwS4dsnUzNO3El4kNaaSbqKO4dpSYLkHZiB41zB6OvNFcfSQr5uguBInWZHVGeWC7FljJkk/z8GB0ydvHSwsy+FGVkA6nMcOJGU31sf4JjO2hL10h6YeVEKtiEW2wOtuYWs067t4aP0q0zTnBWlnfO9i2WT3v0FjNhCXgPKR65HRAqrf+jrzRveLLFGL3be6qBOBwc8QqowMRS+6oUFMXTpzSfU6/QJrmbQw=="); System.out.println(decrypt); ThQuestionBankReqDTO questionBankReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThQuestionBankReqDTO>() {}); System.out.println(questionBankReqDTO); }*/ /** * 课程 * @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"); thCourseReqDTO.setCourseName("java课程"); //thCourseReqDTO.setDelFlag((byte)0); thCourseReqDTO.setLessonNum(new BigDecimal(40)); thCourseReqDTO.setTrainOrgName("机构111"); List<ThCourseChapterReqDTO> chapterList = new ArrayList<>(); //章 ThCourseChapterReqDTO chapterReqDTO1 = new ThCourseChapterReqDTO(); chapterReqDTO1.setUuid("9d470732-6233-4820-82f7-37c80fe8ae68"); chapterReqDTO1.setDelFlag((byte)0); chapterReqDTO1.setChapterCode("001"); chapterReqDTO1.setChapterName("第一章节 基础理论"); 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.setChapterCode("1.1"); child11.setChapterName("1.1类"); 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.setChapterCode("1.2"); child12.setChapterName("1.2接口"); 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("d684081a-6a09-42ce-86b1-58df94d18f6b"); child13.setUrl("https://www.baidu.com3333"); child13.setDelFlag((byte)2); child13.setChapterCode("1.3"); child13.setChapterName("1.3多态"); 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); childList.add(child13); chapterReqDTO1.setChildren(childList); chapterList.add(chapterReqDTO1); thCourseReqDTO.setChapters(chapterList); list.add(thCourseReqDTO); String jsonString = JSONObject.toJSONString(list); String encrypt = AESUtils.encrypt(jsonString); System.out.println(encrypt); 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); }*/ /** * 课程删除 */ /* public static void main(String[] args) { ThCourseDeleteReqDTO thQuestionBankReqDTO = new ThCourseDeleteReqDTO(); thQuestionBankReqDTO.setCourseUuid("20bded7f-660c-4380-b7f9-00f3976e1875"); String jsonString = JSONObject.toJSONString(thQuestionBankReqDTO); String encrypt = AESUtils.encrypt(jsonString); System.out.println(encrypt); String decrypt = AESUtils.decrypt("PmvIbOPyVJ2pYqmGer1YBAij35Tfdk8lufUv+Y2CyqAds/iyh6PwS4dsnUzNO3El4kNaaSbqKO4dpSYLkHZiB41zB6OvNFcfSQr5uguBInWZHVGeWC7FljJkk/z8GB0ydvHSwsy+FGVkA6nMcOJGU31sf4JjO2hL10h6YeVEKtiEW2wOtuYWs067t4aP0q0zTnBWlnfO9i2WT3v0FjNhCXgPKR65HRAqrf+jrzRveLLFGL3be6qBOBwc8QqowMRS+6oUFMXTpzSfU6/QJrmbQw=="); System.out.println(decrypt); ThQuestionBankReqDTO questionBankReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThQuestionBankReqDTO>() {}); System.out.println(questionBankReqDTO); }*/ /** * 批次上报 * @param args */ /*public static void main(String[] args) { ThBatchReqDTO thBatchReqDTO = new ThBatchReqDTO(); thBatchReqDTO.setUuid("5096d539-9ec4-499e-a7ef-3fc1c688ba55"); thBatchReqDTO.setBatchName("第一期2024"); thBatchReqDTO.setTrainOrgName("测试机构"); thBatchReqDTO.setHaveExam(HaveExam.YES.getStatus()); 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); System.out.println(encrypt); String decrypt = AESUtils.decrypt("PmvIbOPyVJ2pYqmGer1YBAij35Tfdk8lufUv+Y2CyqAds/iyh6PwS4dsnUzNO3El4kNaaSbqKO4dpSYLkHZiB41zB6OvNFcfSQr5uguBInWZHVGeWC7FljJkk/z8GB0ydvHSwsy+FGVkA6nMcOJGU31sf4JjO2hL10h6YeVEKtiEW2wOtuYWs067t4aP0q0zTnBWlnfO9i2WT3v0FjNhCXgPKR65HRAqrf+jrzRveLLFGL3be6qBOBwc8QqowMRS+6oUFMXTpzSfU6/QJrmbQw=="); System.out.println(decrypt); ThQuestionBankReqDTO questionBankReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThQuestionBankReqDTO>() {}); System.out.println(questionBankReqDTO); }*/ /** * 学生信息上报 */ /* public static void main(String[] args) { ThStudentReqDTO thStudentReqDTO = new ThStudentReqDTO(); thStudentReqDTO.setUuid("5096d539-9ec4-499e-a7ef-3fc1c688ba51"); thStudentReqDTO.setName("李四fafas"); thStudentReqDTO.setIdcard("11112"); thStudentReqDTO.setIndustry("ceshj"); thStudentReqDTO.setPost("post"); thStudentReqDTO.setPhone("111111fafdsafa"); thStudentReqDTO.setSex(StudentSex.BOY.getStatus()); thStudentReqDTO.setTrainOrgName("测试机构"); thStudentReqDTO.setAuthPhoto("http://baidu.om"); thStudentReqDTO.setBatchUuid("5096d539-9ec4-499e-a7ef-3fc1c688ba55"); thStudentReqDTO.setDelFlag((byte) 0); List<ThStudentReqDTO> studentList = new ArrayList<>(); studentList.add(thStudentReqDTO); String jsonString = JSONObject.toJSONString(studentList); String encrypt = AESUtils.encrypt(jsonString); System.out.println(encrypt); String decrypt = AESUtils.decrypt("PmvIbOPyVJ2pYqmGer1YBAij35Tfdk8lufUv+Y2CyqAds/iyh6PwS4dsnUzNO3El4kNaaSbqKO4dpSYLkHZiB41zB6OvNFcfSQr5uguBInWZHVGeWC7FljJkk/z8GB0ydvHSwsy+FGVkA6nMcOJGU31sf4JjO2hL10h6YeVEKtiEW2wOtuYWs067t4aP0q0zTnBWlnfO9i2WT3v0FjNhCXgPKR65HRAqrf+jrzRveLLFGL3be6qBOBwc8QqowMRS+6oUFMXTpzSfU6/QJrmbQw=="); System.out.println(decrypt); ThQuestionBankReqDTO questionBankReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThQuestionBankReqDTO>() {}); System.out.println(questionBankReqDTO); }*/ /** * 开班 * */ /* public static void main(String[] args) { ThBatchOpenReqDTO thBatchOpenReqDTO = new ThBatchOpenReqDTO(); thBatchOpenReqDTO.setBatchUuid("5096d539-9ec4-499e-a7ef-3fc1c688bad1"); String jsonString = JSONObject.toJSONString(thBatchOpenReqDTO); String encrypt = AESUtils.encrypt(jsonString); System.out.println(encrypt); }*/ /** * 结束培训 * */ /* public static void main(String[] args) { ThBatchEndReqDTO thBatchOpenReqDTO = new ThBatchEndReqDTO(); thBatchOpenReqDTO.setBatchUuid("5096d539-9ec4-499e-a7ef-3fc1c688bad1"); String jsonString = JSONObject.toJSONString(thBatchOpenReqDTO); String encrypt = AESUtils.encrypt(jsonString); System.out.println(encrypt); }*/ /** * 考试记录 */ /*public static void main(String[] args) { List<ThExamRecordReqDTO> list = new ArrayList<>(); ThExamRecordReqDTO thExamRecordReqDTO = new ThExamRecordReqDTO(); thExamRecordReqDTO.setUuid(UUID.randomUUID().toString()); thExamRecordReqDTO.setIdcard("11111"); thExamRecordReqDTO.setExamName("考试1"); thExamRecordReqDTO.setBatchUuid("5096d539-9ec4-499e-a7ef-3fc1c688ba55"); thExamRecordReqDTO.setExamPassScore(new BigDecimal(80)); thExamRecordReqDTO.setExamIsPass(ExamIsPass.YES.getStatus()); thExamRecordReqDTO.setExamUserScore(new BigDecimal(90)); thExamRecordReqDTO.setExamStartTime(LocalDateTime.now()); thExamRecordReqDTO.setExamSubmitTime(LocalDateTime.now()); thExamRecordReqDTO.setTrainOrgName("测试"); thExamRecordReqDTO.setExamTotalScore(new BigDecimal(100)); list.add(thExamRecordReqDTO); String jsonString = JSONObject.toJSONString(list); String encrypt = AESUtils.encrypt(jsonString); System.out.println(encrypt); }*/ /** * */ /*public static void main(String[] args) { List<ThStudyDetailReqDTO> list = new ArrayList<>(); ThStudyDetailReqDTO thStudyDetailReqDTO = new ThStudyDetailReqDTO(); thStudyDetailReqDTO.setUuid("8c061cb1-8560-43b8-abe4-04ae8e763f59"); thStudyDetailReqDTO.setIdcard("11111"); thStudyDetailReqDTO.setBatchUuid("5096d539-9ec4-499e-a7ef-3fc1c688ba55"); thStudyDetailReqDTO.setCourseUuid("20bded7f-660c-4380-b7f9-00f3976e1875"); thStudyDetailReqDTO.setFinishStatus((byte)0); thStudyDetailReqDTO.setStartPosition(0l); thStudyDetailReqDTO.setFinishPosition(4567l); thStudyDetailReqDTO.setChapterUuid("d5cd3b26-be11-4ffe-8a34-283c49c85253"); thStudyDetailReqDTO.setDuration(4567l); thStudyDetailReqDTO.setTrainOrgName("测试"); thStudyDetailReqDTO.setStartTime(LocalDateTime.now()); thStudyDetailReqDTO.setFinishTime(LocalDateTime.now()); thStudyDetailReqDTO.setVideoUrl("hhtht"); thStudyDetailReqDTO.setLessonReportUrl("hht"); List<ThStudyTrackReqDTO> thStudyTrackReqDTOList = new ArrayList<>(); ThStudyTrackReqDTO thStudyTrackReqDTO = new ThStudyTrackReqDTO(); thStudyTrackReqDTO.setUuid("3162d570-9099-4dfb-b2fa-ec705f53758c"); thStudyTrackReqDTO.setStartTime(LocalDateTime.now()); thStudyTrackReqDTO.setEndTime(LocalDateTime.now()); thStudyTrackReqDTO.setTimeInterval(789878l); thStudyTrackReqDTOList.add(thStudyTrackReqDTO); List<ThStudytAuthReqDTO> thStudytAuthReqDTOList = new ArrayList<>(); ThStudytAuthReqDTO thStudytAuthReqDTO = new ThStudytAuthReqDTO(); thStudytAuthReqDTO.setUuid(UUID.randomUUID().toString()); thStudytAuthReqDTO.setAuthPosition(0l); thStudytAuthReqDTO.setAuthTime(LocalDateTime.now()); thStudytAuthReqDTO.setApprovePhoto("454l"); thStudytAuthReqDTO.setFaceType(FaceType.AUTH.getType()); thStudytAuthReqDTOList.add(thStudytAuthReqDTO); thStudyDetailReqDTO.setTrackList(thStudyTrackReqDTOList); 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(""); System.out.println(decrypt); }*/ } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThBatch.java
对比新文件 @@ -0,0 +1,47 @@ 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") public class ThBatch { @Id @TableId(type = IdType.AUTO) private Long id; private String batchName; private String uuid; private Long institutionId; private String institutionName; private Byte haveExam; private Byte status; private String trainOrgName; private BigDecimal batchLessonNum; // private Byte finishStatus; //删除标志(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; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThBatchCourse.java
对比新文件 @@ -0,0 +1,41 @@ 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; @TableName("th_batch_course") @Data public class ThBatchCourse { private static final long serialVersionUID = 1L; @Id @TableId(type = IdType.AUTO) private Long id; private String courseUuid; 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; } 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; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThCourse.java
对比新文件 @@ -0,0 +1,44 @@ package com.gkhy.exam.institutionalaccess.entity; import com.baomidou.mybatisplus.annotation.*; 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_course") @Data public class ThCourse { @Id @TableId(type = IdType.AUTO) private Long id; private String uuid; private String courseCode; private String courseName; private Long institutionId; private String institutionName; private BigDecimal lessonNum; private String trainOrgName; //是否有考试(0无,1有) //private Byte haveExam; //删除标志(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; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThCourseChapter.java
对比新文件 @@ -0,0 +1,53 @@ package com.gkhy.exam.institutionalaccess.entity; import com.baomidou.mybatisplus.annotation.*; 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_course_chapter") @Data public class ThCourseChapter { @Id @TableId(type = IdType.AUTO) private Long id; private String uuid; 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; private String courseUuid; //删除标志(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; } 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 { } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThExamRecord.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.io.Serializable; import java.math.BigDecimal; import java.time.LocalDateTime; @Data @TableName("th_exam_record") public class ThExamRecord implements Serializable { private static final long serialVersionUID = 1L; @Id @TableId(type = IdType.AUTO) private Long id; private String uuid; private String idcard; private String batchUuid; private Long institutionId; private String institutionName; private String trainOrgName; private String examName; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime examStartTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime examSubmitTime; private BigDecimal examUserScore; private BigDecimal examTotalScore; private BigDecimal examPassScore; private Byte examIsPass; //删除标志(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; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThQuestionBank.java
对比新文件 @@ -0,0 +1,46 @@ 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; @TableName("th_question_bank") @Data public class ThQuestionBank { @Id @TableId(type = IdType.AUTO) private Long id; private String uuid; private Long institutionId;; private String institutionName; private int lastMonthCount; private int addCount; private int reduceCount; private BigDecimal brushRate; private BigDecimal assemblyRate; private String url; private String month; //删除标志(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; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudent.java
对比新文件 @@ -0,0 +1,45 @@ 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.time.LocalDateTime; @TableName("th_student") @Data public class ThStudent { @Id @TableId(type = IdType.AUTO) private Long id; private String name; private Byte sex; private String phone; private String idcard; private String authPhoto; private Long institutionId; private String institutionName; private String trainOrgName; private String industry; private String occupation; private String post; //删除标志(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; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudentBatch.java
对比新文件 @@ -0,0 +1,43 @@ 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.time.LocalDateTime; @TableName("th_student_batch") @Data public class ThStudentBatch { @Id @TableId(type = IdType.AUTO) private Long id; private String uuid; 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; //删除标志(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; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudyAuth.java
对比新文件 @@ -0,0 +1,28 @@ 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.io.Serializable; import java.time.LocalDateTime; @TableName("th_study_auth") @Data public class ThStudyAuth implements Serializable { private static final long serialVersionUID = -142792747305486686L; @Id @TableId(type = IdType.AUTO) private Long id; private String uuid; private String approvePhoto; private Long authPosition; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime authTime; private Byte faceType; private String studyDetailUuid; private String authVideo; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudyDetail.java
对比新文件 @@ -0,0 +1,57 @@ 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.io.Serializable; import java.time.LocalDateTime; @TableName("th_study_detail") @Data public class ThStudyDetail implements Serializable { private static final long serialVersionUID = -7594385369742322457L; @Id @TableId(type = IdType.AUTO) private Long id; private String idcard; private String uuid; private String serialNum; private String institutionName; private Long institutionId; private String courseUuid; private String trainOrgName; private String batchUuid; private String chapterUuid; private Byte finishStatus; private Long duration; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime startTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime finishTime; private Long startPosition; private Long finishPosition; private String videoUrl; private String lessonReportUrl; //删除标志(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; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudyTrack.java
对比新文件 @@ -0,0 +1,25 @@ 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.time.LocalDateTime; @TableName("th_study_track") @Data public class ThStudyTrack { @Id @TableId(type = IdType.AUTO) private Long id; private String uuid; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime startTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime endTime; private Long timeInterval; private String studyDetailUuid; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/CourseHaveResourse.java
对比新文件 @@ -0,0 +1,44 @@ package com.gkhy.exam.institutionalaccess.enums; import com.ruoyi.common.enums.coalmineEnums.DeleteStatusEnum; public enum CourseHaveResourse { //有无资源(0无,1有) NO((byte)0,"无资源"), YES((byte)1,"有资源"), ; private Byte status; private String desc; CourseHaveResourse(Byte status, String desc) { this.status = status; this.desc = desc; } public Byte getStatus() { return status; } public void setStatus(Byte status) { this.status = status; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } public static CourseHaveResourse get(Byte status) { for (CourseHaveResourse courseHaveResourse : CourseHaveResourse.values()) { if (courseHaveResourse.getStatus() == status) { return courseHaveResourse; } } return null; } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/CourseResourceType.java
对比新文件 @@ -0,0 +1,42 @@ package com.gkhy.exam.institutionalaccess.enums; public enum CourseResourceType { //资源类型(0视频,1音频) VIDEO((byte)0,"视频"), AUDIO((byte)1,"音频"), ; private Byte type; private String desc; CourseResourceType(Byte type, String desc) { this.type = type; this.desc = desc; } public Byte getType() { return type; } public void setType(Byte type) { this.type = type; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } public static CourseResourceType get(Byte status) { for (CourseResourceType courseResourceType : CourseResourceType.values()) { if (courseResourceType.getType() == status) { return courseResourceType; } } return null; } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/ExamIsPass.java
对比新文件 @@ -0,0 +1,42 @@ package com.gkhy.exam.institutionalaccess.enums; public enum ExamIsPass { NO((byte)0,"否"), YES((byte)1,"是"), ; private Byte status; private String desc; ExamIsPass(Byte status, String desc) { this.status = status; this.desc = desc; } public Byte getStatus() { return status; } public void setStatus(Byte status) { this.status = status; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } public static ExamIsPass get(Byte status) { for (ExamIsPass examIsPass : ExamIsPass.values()) { if (examIsPass.getStatus() == status) { return examIsPass; } } return null; } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/FaceType.java
对比新文件 @@ -0,0 +1,44 @@ package com.gkhy.exam.institutionalaccess.enums; public enum FaceType { //资源类型(0视频,1音频) SIGN((byte)10,"签到"), AUTH((byte)20,"认证"), ; private Byte type; private String desc; FaceType(Byte type, String desc) { this.type = type; this.desc = desc; } public Byte getType() { return type; } public void setType(Byte type) { this.type = type; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } public static FaceType get(Byte status) { for (FaceType faceType : FaceType.values()) { if (faceType.getType() == status) { return faceType; } } return null; } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/FinishStatus.java
对比新文件 @@ -0,0 +1,41 @@ package com.gkhy.exam.institutionalaccess.enums; public enum FinishStatus { //完成(0否,1是) NO((byte)0,"否"), YES((byte)1,"是"), ; private Byte status; private String desc; FinishStatus(Byte status, String desc) { this.status = status; this.desc = desc; } public Byte getStatus() { return status; } public void setStatus(Byte status) { this.status = status; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } public static FinishStatus get(Byte status) { for (FinishStatus finishStatus : FinishStatus.values()) { if (finishStatus.getStatus() == status) { return finishStatus; } } return null; } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/HaveExam.java
对比新文件 @@ -0,0 +1,41 @@ package com.gkhy.exam.institutionalaccess.enums; public enum HaveExam { //有无考试(0无,1有) NO((byte)0,"无"), YES((byte)1,"有"), ; private Byte status; private String desc; HaveExam(Byte status, String desc) { this.status = status; this.desc = desc; } public Byte getStatus() { return status; } public void setStatus(Byte status) { this.status = status; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } public static HaveExam get(Byte status) { for (HaveExam haveExam : HaveExam.values()) { if (haveExam.getStatus() == status) { return haveExam; } } return null; } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/OpenStatus.java
对比新文件 @@ -0,0 +1,43 @@ package com.gkhy.exam.institutionalaccess.enums; public enum OpenStatus { //开班(0未开班,1开班,2结束) NO((byte)0,"未开班"), START((byte)1,"开班"), END((byte)2,"结束") ; private Byte status; private String desc; OpenStatus(Byte status, String desc) { this.status = status; this.desc = desc; } public Byte getStatus() { return status; } public void setStatus(Byte status) { this.status = status; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } public static OpenStatus get(Byte status) { for (OpenStatus openStatus : OpenStatus.values()) { if (openStatus.getStatus() == status) { return openStatus; } } return null; } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/StudentSex.java
对比新文件 @@ -0,0 +1,44 @@ package com.gkhy.exam.institutionalaccess.enums; public enum StudentSex { NNKNOWN((byte)0,"未知"), BOY((byte)1,"男"), GIRL((byte)2,"女"), ; private Byte status; private String desc; StudentSex(Byte status, String desc) { this.status = status; this.desc = desc; } public Byte getStatus() { return status; } public void setStatus(Byte status) { this.status = status; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } public static StudentSex get(Byte status) { for (StudentSex courseHaveResourse : StudentSex.values()) { if (courseHaveResourse.getStatus() == status) { return courseHaveResourse; } } return null; } } 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); } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThBatchCourseMapper.java
对比新文件 @@ -0,0 +1,27 @@ package com.gkhy.exam.institutionalaccess.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.gkhy.exam.institutionalaccess.entity.ThBatchCourse; import com.gkhy.exam.institutionalaccess.model.vo.ThBatchCourseVO; 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 ThBatchCourseMapper extends BaseMapper<ThBatchCourse> { void deleteByBatchUuidAndCourseUuid(@Param("list") List<ThBatchCourse> deleteBatchCourseList); 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); } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThBatchMapper.java
对比新文件 @@ -0,0 +1,23 @@ package com.gkhy.exam.institutionalaccess.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; 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.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import java.util.List; @Repository @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); } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThCourseChapterMapper.java
对比新文件 @@ -0,0 +1,25 @@ package com.gkhy.exam.institutionalaccess.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.gkhy.exam.institutionalaccess.entity.ThCourseChapter; import com.gkhy.exam.institutionalaccess.model.vo.ThCourseChapterVO; 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 ThCourseChapterMapper extends BaseMapper<ThCourseChapter> { 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); } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThCourseMapper.java
对比新文件 @@ -0,0 +1,25 @@ package com.gkhy.exam.institutionalaccess.mapper; 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; import java.util.List; @Repository @Mapper public interface ThCourseMapper extends BaseMapper<ThCourse> { 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); } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThExamRecordMapper.java
对比新文件 @@ -0,0 +1,21 @@ package com.gkhy.exam.institutionalaccess.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; 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.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import java.util.List; @Repository @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); } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThQuestionBankMapper.java
对比新文件 @@ -0,0 +1,11 @@ package com.gkhy.exam.institutionalaccess.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.gkhy.exam.institutionalaccess.entity.ThQuestionBank; import org.apache.ibatis.annotations.Mapper; import org.springframework.stereotype.Repository; @Mapper @Repository public interface ThQuestionBankMapper extends BaseMapper<ThQuestionBank> { } 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); } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudentMapper.java
对比新文件 @@ -0,0 +1,22 @@ package com.gkhy.exam.institutionalaccess.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.gkhy.exam.institutionalaccess.entity.ThStudent; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.springframework.web.bind.annotation.RequestMapping; import java.util.List; @RequestMapping @Mapper public interface ThStudentMapper extends BaseMapper<ThStudent> { 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); } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyAuthMapper.java
对比新文件 @@ -0,0 +1,18 @@ package com.gkhy.exam.institutionalaccess.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.gkhy.exam.institutionalaccess.entity.ThStudyAuth; 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 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); } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyDetailMapper.java
对比新文件 @@ -0,0 +1,31 @@ package com.gkhy.exam.institutionalaccess.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.gkhy.exam.institutionalaccess.entity.ThStudyDetail; import com.gkhy.exam.institutionalaccess.model.query.ThStudyDetailQuery; import com.gkhy.exam.institutionalaccess.model.vo.ThStudyDetailVO; import com.gkhy.exam.institutionalaccess.model.vo.ThStudyVO; 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 ThStudyDetailMapper extends BaseMapper<ThStudyDetail> { List<ThStudyDetailVO> listByPage(@Param("query") ThStudyDetailQuery query); 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); } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyTrackMapper.java
对比新文件 @@ -0,0 +1,18 @@ package com.gkhy.exam.institutionalaccess.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.gkhy.exam.institutionalaccess.entity.ThStudyTrack; 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 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); } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThBatchQuery.java
对比新文件 @@ -0,0 +1,18 @@ package com.gkhy.exam.institutionalaccess.model.query; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.time.LocalDate; import java.util.Date; @Data public class ThBatchQuery { private Long institutionId; private String batchName; @JsonFormat(pattern = "yyyy-MM-dd") private Date startTime; @JsonFormat(pattern = "yyyy-MM-dd") private Date endTime; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThCourseQuery.java
对比新文件 @@ -0,0 +1,9 @@ package com.gkhy.exam.institutionalaccess.model.query; import lombok.Data; @Data public class ThCourseQuery { private Long institutionId; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThExamRecordQuery.java
对比新文件 @@ -0,0 +1,17 @@ package com.gkhy.exam.institutionalaccess.model.query; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.time.LocalDate; import java.util.Date; @Data public class ThExamRecordQuery { private String name; private String idcard; @JsonFormat(pattern = "yyyy-MM-dd") private Date startTime; @JsonFormat(pattern = "yyyy-MM-dd") private Date endTime; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThQuestionBankQuery.java
对比新文件 @@ -0,0 +1,9 @@ package com.gkhy.exam.institutionalaccess.model.query; import lombok.Data; @Data public class ThQuestionBankQuery { private String institutionName; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThStudentQuery.java
对比新文件 @@ -0,0 +1,9 @@ package com.gkhy.exam.institutionalaccess.model.query; import lombok.Data; @Data public class ThStudentQuery { private String idcard; private String name; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThStudyDetailQuery.java
对比新文件 @@ -0,0 +1,24 @@ package com.gkhy.exam.institutionalaccess.model.query; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.time.LocalDate; import java.util.Date; @Data public class ThStudyDetailQuery { private String idcard; private String name; private String courseUuid; @JsonFormat(pattern = "yyyy-MM-dd") private Date startTime; @JsonFormat(pattern = "yyyy-MM-dd") private Date endTime; private Integer pageNum; /** 每页显示记录数 */ private Integer pageSize; private Integer startSize; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/StudentCourseReqDTO.java
对比新文件 @@ -0,0 +1,9 @@ package com.gkhy.exam.institutionalaccess.model.req; import lombok.Data; @Data public class StudentCourseReqDTO { private String courseUuid; private String batchUuid; } 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; } 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; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchEndReqDTO.java
对比新文件 @@ -0,0 +1,9 @@ package com.gkhy.exam.institutionalaccess.model.req; import lombok.Data; @Data public class ThBatchEndReqDTO { private String batchUuid; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchOpenReqDTO.java
对比新文件 @@ -0,0 +1,8 @@ package com.gkhy.exam.institutionalaccess.model.req; import lombok.Data; @Data public class ThBatchOpenReqDTO { private String batchUuid; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchReqDTO.java
对比新文件 @@ -0,0 +1,21 @@ 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 public class ThBatchReqDTO { private String uuid; private String batchName; private Long institutionId; private String institutionName; private String trainOrgName; private Byte haveExam; private Byte status; private BigDecimal batchLessonNum; private Byte delFlag; private List<ThBatchCourseReqDTO> courseList; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThCourseChapterReqDTO.java
对比新文件 @@ -0,0 +1,30 @@ package com.gkhy.exam.institutionalaccess.model.req; import lombok.Data; import java.io.Serializable; import java.math.BigDecimal; import java.util.List; @Data public class ThCourseChapterReqDTO implements Serializable { private static final long serialVersionUID = 2827204834981264000L; private String uuid; private String chapterCode; private String chapterName; //有无资源(0无,1有) private Byte haveResource; //资源类型(0视频,1音频) private Byte resourceType; private BigDecimal lessonNum; private Long duration; //视频路径 private String url; //删除标志(0代表存在 2代表删除) private Byte delFlag; private Integer serialno; //孩子 private List<ThCourseChapterReqDTO> children; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThCourseDeleteReqDTO.java
对比新文件 @@ -0,0 +1,8 @@ package com.gkhy.exam.institutionalaccess.model.req; import lombok.Data; @Data public class ThCourseDeleteReqDTO { private String courseUuid; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThCourseReqDTO.java
对比新文件 @@ -0,0 +1,23 @@ package com.gkhy.exam.institutionalaccess.model.req; import lombok.Data; import java.io.Serializable; import java.math.BigDecimal; import java.util.List; @Data public class ThCourseReqDTO implements Serializable { private static final long serialVersionUID = -2841710093351955259L; private String uuid; private String courseCode; private String courseName; private BigDecimal lessonNum; //是否有考试(0无,1有) //private Byte haveExam; //删除标志(0代表存在 2代表删除) //private Byte delFlag; private String trainOrgName; private List<ThCourseChapterReqDTO> chapters; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThExamRecordReqDTO.java
对比新文件 @@ -0,0 +1,26 @@ package com.gkhy.exam.institutionalaccess.model.req; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.math.BigDecimal; import java.time.LocalDateTime; @Data public class ThExamRecordReqDTO { private String uuid; private String idcard; private String batchUuid; private String institutionId; private String institutionName; private String trainOrgName; private String examName; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime examStartTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime examSubmitTime; private BigDecimal examUserScore; private BigDecimal examTotalScore; private BigDecimal examPassScore; private Byte examIsPass; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThQuestionBankReqDTO.java
对比新文件 @@ -0,0 +1,20 @@ package com.gkhy.exam.institutionalaccess.model.req; import lombok.Data; import java.math.BigDecimal; @Data public class ThQuestionBankReqDTO { private String uuid; private Integer lastMonthCount; private Integer addCount; private Integer reduceCount; private BigDecimal brushRate; private BigDecimal assemblyRate; private String url; private String month; //删除标志(0代表存在 2代表删除) private Byte delFlag; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThStudentReqDTO.java
对比新文件 @@ -0,0 +1,21 @@ package com.gkhy.exam.institutionalaccess.model.req; import lombok.Data; import java.util.List; @Data public class ThStudentReqDTO { private String uuid; private String name; private Byte sex; private String phone; private String idcard; private String authPhoto; private String industry; private String occupation; private String post; private String trainOrgName; private String batchUuid; private Byte delFlag; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThStudyDetailReqDTO.java
对比新文件 @@ -0,0 +1,35 @@ package com.gkhy.exam.institutionalaccess.model.req; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.io.Serializable; import java.time.LocalDateTime; import java.util.List; @Data public class ThStudyDetailReqDTO implements Serializable { private static final long serialVersionUID = 615826232086452263L; private String uuid; private String idcard; private String courseUuid; private String trainOrgName; private String batchUuid; private String chapterUuid; private Byte finishStatus; private Long duration; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime startTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime finishTime; private Long startPosition; private Long finishPosition; private String videoUrl; private String lessonReportUrl; private List<ThStudyTrackReqDTO> trackList; private List<ThStudytAuthReqDTO> authList; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThStudyTrackReqDTO.java
对比新文件 @@ -0,0 +1,20 @@ package com.gkhy.exam.institutionalaccess.model.req; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import java.time.LocalDateTime; @NoArgsConstructor @AllArgsConstructor @Data public class ThStudyTrackReqDTO { private String uuid; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime startTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime endTime; private Long timeInterval; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThStudytAuthReqDTO.java
对比新文件 @@ -0,0 +1,17 @@ package com.gkhy.exam.institutionalaccess.model.req; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.time.LocalDateTime; @Data public class ThStudytAuthReqDTO { private String uuid; private String approvePhoto; private Long authPosition; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime authTime; private Byte faceType; private String authVideo; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThBatchCourseRespDTO.java
对比新文件 @@ -0,0 +1,18 @@ package com.gkhy.exam.institutionalaccess.model.resp; import lombok.Data; import java.util.List; @Data public class ThBatchCourseRespDTO { private String courseUuid; private String batchUuid; private String courseName; private Long duration; private String durationDesc; private List<ThStudentCourseRespDTO> studentList; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThCourseChapterRespDTO.java
对比新文件 @@ -0,0 +1,26 @@ package com.gkhy.exam.institutionalaccess.model.resp; import lombok.Data; import java.math.BigDecimal; import java.util.List; @Data public class ThCourseChapterRespDTO { private Long id; private String uuid; private String chapterCode; private String chapterName; //有无资源(0无,1有) private Byte haveResource; //资源类型(0视频,1音频) private Byte resourceType; private BigDecimal lessonNum; private Long duration; //视频路径 private String url; private Integer serialno; private List<ThCourseChapterRespDTO> children; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThCourseRespDTO.java
对比新文件 @@ -0,0 +1,35 @@ package com.gkhy.exam.institutionalaccess.model.resp; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.models.auth.In; import lombok.Data; import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; @Data public class ThCourseRespDTO { private Long id; private String uuid; private String courseCode; private String courseName; private Long institutionId; private String institutionName; private BigDecimal lessonNum; private Integer studentCount; //删除标志(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 List<ThCourseChapterRespDTO> outline; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThErrorDataRespDTO.java
对比新文件 @@ -0,0 +1,14 @@ package com.gkhy.exam.institutionalaccess.model.resp; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @AllArgsConstructor @NoArgsConstructor @Data public class ThErrorDataRespDTO { private String uuid; private String msg; } 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; } 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; } 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; } 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; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThReturnRespDTO.java
对比新文件 @@ -0,0 +1,6 @@ package com.gkhy.exam.institutionalaccess.model.resp; public class ThReturnRespDTO { } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThStudentCourseRespDTO.java
对比新文件 @@ -0,0 +1,15 @@ package com.gkhy.exam.institutionalaccess.model.resp; import lombok.Data; @Data public class ThStudentCourseRespDTO { private String idcard; private String name; private String courseUuid; private String batchUuid; private Long institutionId; private Long duration; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThStudentRespDTO.java
对比新文件 @@ -0,0 +1,9 @@ package com.gkhy.exam.institutionalaccess.model.resp; public class ThStudentRespDTO { private String name; private String idcard; private Long duration; private Long durationDesc; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThStudentStudyRespDTO.java
对比新文件 @@ -0,0 +1,20 @@ package com.gkhy.exam.institutionalaccess.model.resp; 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 batchLessonNum; private BigDecimal courseLessonNum; private Byte finishStatus; private String url; private String batchUuid; } 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; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThBatchCourseVO.java
对比新文件 @@ -0,0 +1,27 @@ package com.gkhy.exam.institutionalaccess.model.vo; 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; 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; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThBatchVO.java
对比新文件 @@ -0,0 +1,38 @@ package com.gkhy.exam.institutionalaccess.model.vo; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.time.LocalDateTime; import java.util.List; @Data public class ThBatchVO { private Long id; private String batchName; private String uuid; private Long institutionId; private String institutionName; private Byte haveExam; private Byte status; private String trainOrgName; private Integer studentCount; //删除标志(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 List<ThBatchCourseVO> courseVOList; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThCourseChapterVO.java
对比新文件 @@ -0,0 +1,25 @@ package com.gkhy.exam.institutionalaccess.model.vo; import lombok.Data; import java.math.BigDecimal; @Data public class ThCourseChapterVO { private Long id; private String uuid; private String chapterCode; private String chapterName; //有无资源(0无,1有) private Byte haveResource; //资源类型(0视频,1音频) private Byte resourceType; private BigDecimal lessonNum; private Long duration; //视频路径 private String url; private String parentUuid; private Long institutionId; private String courseUuid; private Integer serialno; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThExamRecordVO.java
对比新文件 @@ -0,0 +1,47 @@ package com.gkhy.exam.institutionalaccess.model.vo; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.math.BigDecimal; import java.time.LocalDateTime; @Data public class ThExamRecordVO { private Long id; private String uuid; private String idcard; private String name; private String courseUuid; private String courseName; private String batchUuid; private String batchName; private Long institutionId; private String institutionName; private String trainOrgName; private String examName; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime examStartTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime examSubmitTime; private BigDecimal examUserScore; private BigDecimal examTotalScore; private BigDecimal examPassScore; private Byte examIsPass; //删除标志(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; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStatisticStudentVO.java
对比新文件 @@ -0,0 +1,10 @@ package com.gkhy.exam.institutionalaccess.model.vo; import lombok.Data; @Data public class ThStatisticStudentVO { private String courseUuid; private Integer count; private String batchUuid; } 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; } 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; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudentCourseVO.java
对比新文件 @@ -0,0 +1,18 @@ package com.gkhy.exam.institutionalaccess.model.vo; import lombok.Data; import java.math.BigDecimal; @Data public class ThStudentCourseVO { private String idcard; private String name; private String courseUuid; private String courseName; private String batchUuid; private Long institutionId; private BigDecimal lessTotal; private Byte finishStatus; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudyAuthVO.java
对比新文件 @@ -0,0 +1,20 @@ package com.gkhy.exam.institutionalaccess.model.vo; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.time.LocalDateTime; @Data public class ThStudyAuthVO { private Long id; private String uuid; private String approvePhoto; private Long authPosition; private String authPostionDesc; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime authTime; private Byte faceType; private String studyDetailUuid; private String authVideo; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudyDetailVO.java
对比新文件 @@ -0,0 +1,64 @@ package com.gkhy.exam.institutionalaccess.model.vo; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; @Data public class ThStudyDetailVO { private Long id; private String uuid; private String serialNum; private String idcard; private String name; private String institutionName; private Long institutionId; private String courseUuid; private String courseName; private String trainOrgName; private String batchUuid; private String batchName; private String chapterUuid; private String chapterName; private Byte finishStatus; private Long duration; private String durationDesc; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime startTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime finishTime; private Long startPosition; private String startPositionDesc; private Long finishPosition; private String finishPositionDesc; private String videoUrl; private String lessonReportUrl; private BigDecimal lessonNum; //删除标志(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 List<ThStudyAuthVO> authList; private List<ThStudyTrackVO> trackList; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudyTrackVO.java
对比新文件 @@ -0,0 +1,19 @@ package com.gkhy.exam.institutionalaccess.model.vo; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.time.LocalDateTime; @Data public class ThStudyTrackVO { private Long id; private String uuid; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime startTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime endTime; private Long timeInterval; private String timeIntervalDesc; private String studyDetailUuid; } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudyVO.java
对比新文件 @@ -0,0 +1,11 @@ package com.gkhy.exam.institutionalaccess.model.vo; import lombok.Data; @Data public class ThStudyVO { private String idcard; private String name; private Long duration; private String courseUuid; } 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); } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchCourseService.java
对比新文件 @@ -0,0 +1,31 @@ package com.gkhy.exam.institutionalaccess.service; import com.baomidou.mybatisplus.extension.service.IService; import com.gkhy.exam.institutionalaccess.entity.ThBatchCourse; import com.gkhy.exam.institutionalaccess.model.vo.ThBatchCourseVO; import org.springframework.scheduling.annotation.Async; import java.util.List; public interface ThBatchCourseService extends IService<ThBatchCourse> { List<ThBatchCourse> getByBatchUuid(String batchUuid); List<String> getCourseUuisByBatchUuid(String batchUuid); void deleteByBatchUuidAndCourseUuid(List<ThBatchCourse> deleteBatchCourseList); 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); } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchManagerService.java
对比新文件 @@ -0,0 +1,20 @@ 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; public interface ThBatchManagerService { List<ThBatchVO> listByPage(ThBatchQuery query); List<ThBatchCourseRespDTO> period(String batchUuid); List<ThStudentStudyRespDTO> getStudent(String batchUuid); } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchService.java
对比新文件 @@ -0,0 +1,26 @@ package com.gkhy.exam.institutionalaccess.service; import com.baomidou.mybatisplus.extension.service.IService; 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; public interface ThBatchService extends IService<ThBatch> { ThBatch getByUuid(String uuid); 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); } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseChapterService.java
对比新文件 @@ -0,0 +1,28 @@ package com.gkhy.exam.institutionalaccess.service; 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> { List<ThCourseChapterVO> listByCourseUuids(List<String> courseIds); List<ThCourseChapterVO> listByCourseUuid(String courseUuid); List<ThCourseChapter> listByInstitutionId(Long institutionId); 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); } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseManagerService.java
对比新文件 @@ -0,0 +1,19 @@ 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; public interface ThCourseManagerService { List<ThCourseRespDTO> listByPage(ThCourseQuery query); ThCourseRespDTO findById(Long id); List<ThStudentStudyRespDTO> getSutdent(String courseUuid); //List<ThStudentBatchR> getStudent(String ); } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseService.java
对比新文件 @@ -0,0 +1,30 @@ 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.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<ThCourseRespDTO> listByPage(@Param("query") ThCourseQuery query); ThCourse getByUuid(String uuid); List<ThCourse> selectByUuid(List<String> courseUuidList); 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); } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThExamRecordManagerService.java
对比新文件 @@ -0,0 +1,10 @@ package com.gkhy.exam.institutionalaccess.service; import com.gkhy.exam.institutionalaccess.model.query.ThExamRecordQuery; import com.gkhy.exam.institutionalaccess.model.vo.ThExamRecordVO; import java.util.List; public interface ThExamRecordManagerService { List<ThExamRecordVO> listByPage(ThExamRecordQuery query); } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThExamRecordService.java
对比新文件 @@ -0,0 +1,19 @@ package com.gkhy.exam.institutionalaccess.service; import com.baomidou.mybatisplus.extension.service.IService; 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; public interface ThExamRecordService extends IService<ThExamRecord> { List<ThExamRecord> listByInstitutionId(Long institutionId); List<ThExamRecordVO> listByPage(ThExamRecordQuery query); List<ThExamRecord> getByUuids(List<String> examUuids); //@Async("SocketTaskExecutor") Integer insertBatch(List<ThExamRecord> examRecordList); } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThQuestionBankService.java
对比新文件 @@ -0,0 +1,14 @@ package com.gkhy.exam.institutionalaccess.service; import com.baomidou.mybatisplus.extension.service.IService; import com.gkhy.exam.institutionalaccess.model.query.ThQuestionBankQuery; import com.gkhy.exam.institutionalaccess.entity.ThQuestionBank; import java.util.List; public interface ThQuestionBankService extends IService<ThQuestionBank> { List<ThQuestionBank> listByPage(ThQuestionBankQuery query); ThQuestionBank getQuestionInfoByUuid(String uuid); } 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); } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudentManagerService.java
对比新文件 @@ -0,0 +1,10 @@ package com.gkhy.exam.institutionalaccess.service; import com.gkhy.exam.institutionalaccess.entity.ThStudent; import com.gkhy.exam.institutionalaccess.model.query.ThStudentQuery; import java.util.List; public interface ThStudentManagerService { List<ThStudent> listByPage(ThStudentQuery query); } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudentService.java
对比新文件 @@ -0,0 +1,22 @@ package com.gkhy.exam.institutionalaccess.service; 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; public interface ThStudentService extends IService<ThStudent> { ThStudent getByIdcard(String idcard); List<ThStudent> getByIdcards(List<String> idcards); //@Async("SocketTaskExecutor") Integer updateBatch(List<ThStudent> updateStudentList); //@Async("SocketTaskExecutor") Integer insertBatch(List<ThStudent> saveSudentList); List<ThStudent> getNameByIdcards(List<String> idcards); } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyAuthService.java
对比新文件 @@ -0,0 +1,18 @@ package com.gkhy.exam.institutionalaccess.service; 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; public interface ThStudyAuthService extends IService<ThStudyAuth> { List<String> getUuidByStudyDetaiId(String studyDetaiId); List<ThStudyAuth> getByStudyDetaiUuids(List<String> studyUuids); //@Async("SocketTaskExecutor") Integer insetBatch(List<ThStudyAuth> thStudyAuthList); } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyDetailService.java
对比新文件 @@ -0,0 +1,28 @@ package com.gkhy.exam.institutionalaccess.service; import com.baomidou.mybatisplus.extension.service.IService; import com.gkhy.exam.institutionalaccess.entity.ThStudyDetail; import com.gkhy.exam.institutionalaccess.model.query.ThStudyDetailQuery; import com.gkhy.exam.institutionalaccess.model.vo.ThStudyDetailVO; import com.gkhy.exam.institutionalaccess.model.vo.ThStudyVO; import java.util.List; public interface ThStudyDetailService extends IService<ThStudyDetail> { ThStudyDetail getByUuid(String uuid); Long getCount(); List<ThStudyDetailVO> listByPage(ThStudyDetailQuery query); 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); } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyRecordManagerService.java
对比新文件 @@ -0,0 +1,10 @@ package com.gkhy.exam.institutionalaccess.service; import com.gkhy.exam.institutionalaccess.model.query.ThStudyDetailQuery; import com.gkhy.exam.institutionalaccess.model.vo.ThStudyDetailVO; import java.util.List; public interface ThStudyRecordManagerService { List<ThStudyDetailVO> listByPage(ThStudyDetailQuery query); } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyTrackService.java
对比新文件 @@ -0,0 +1,16 @@ package com.gkhy.exam.institutionalaccess.service; import com.baomidou.mybatisplus.extension.service.IService; import com.gkhy.exam.institutionalaccess.entity.ThStudyTrack; import org.springframework.scheduling.annotation.Async; import java.util.List; public interface ThStudyTrackService extends IService<ThStudyTrack> { List<String> getUuidByStudyDetaiId(String studyDetaiId); List<ThStudyTrack> getListByStudyDetaiIds(List<String> detailUuids); //@Async("SocketTaskExecutor") Integer insertBatch(List<ThStudyTrack> list); List<ThStudyTrack> getByStudyDetailUuids(List<String> studyUuids); } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/TripartiteInterfaceService.java
对比新文件 @@ -0,0 +1,25 @@ package com.gkhy.exam.institutionalaccess.service; import com.alibaba.fastjson2.JSONObject; import com.ruoyi.common.core.domain.AjaxResult; public interface TripartiteInterfaceService { boolean receiveQuestionBank(JSONObject jsonObject); AjaxResult receiveCourse(JSONObject jsonObject); AjaxResult receiveStudent(JSONObject jsonObject); AjaxResult receiveBatch(JSONObject jsonObject); AjaxResult receiveStudyDetail(JSONObject jsonObject); AjaxResult receiveExamRecord(JSONObject jsonObject); AjaxResult receiveCourseDelete(JSONObject jsonObject); AjaxResult receiveBatchOpen(JSONObject jsonObject); AjaxResult receiveBatchEnd(JSONObject jsonObject); } 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; } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchCourseServiceImpl.java
对比新文件 @@ -0,0 +1,90 @@ 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.mapper.ThBatchCourseMapper; import com.gkhy.exam.institutionalaccess.model.vo.ThBatchCourseVO; import com.gkhy.exam.institutionalaccess.service.ThBatchCourseService; import com.ruoyi.common.enums.coalmineEnums.DeleteStatusEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; @Service("ThBatchCourseService") public class ThBatchCourseServiceImpl extends ServiceImpl<ThBatchCourseMapper, ThBatchCourse> implements ThBatchCourseService { @Autowired private ThBatchCourseMapper batchCourseMapper; @Override public List<ThBatchCourse> getByBatchUuid(String batchUuid) { List<ThBatchCourse> batchCourseList = batchCourseMapper.selectList(new LambdaQueryWrapper<ThBatchCourse>().eq(ThBatchCourse::getBatchUuid,batchUuid) .eq(ThBatchCourse::getDelFlag, DeleteStatusEnum.NO.getStatus())); return batchCourseList; } public List<String> getCourseUuisByBatchUuid(String batchUuid){ List<String> courseUuis = new ArrayList<String>(); List<ThBatchCourse> list = this.getByBatchUuid(batchUuid); if(!CollectionUtils.isEmpty(list)){ courseUuis = list.stream().map(ThBatchCourse::getCourseUuid).collect(Collectors.toList()); } return courseUuis; } @Override public void deleteByBatchUuidAndCourseUuid(List<ThBatchCourse> deleteBatchCourseList) { batchCourseMapper.deleteByBatchUuidAndCourseUuid(deleteBatchCourseList); } @Override 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) { List<ThBatchCourseVO> thBatchCourseVOS = batchCourseMapper.getListByBatchUuid(batchUuid); return thBatchCourseVOS; } @Override public boolean isExsit(String courseUuid) { Long count = batchCourseMapper.selectCount(new LambdaQueryWrapper<ThBatchCourse>().eq(ThBatchCourse::getCourseUuid,courseUuid).eq(ThBatchCourse::getDelFlag, DeleteStatusEnum.NO.getStatus())); if(count > 0){ return true; } return false; } @Override public List<ThBatchCourse> listByInstitutionId(Long institutionId) { 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); } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchManagerServiceImpl.java
对比新文件 @@ -0,0 +1,184 @@ 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.*; 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; 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.List; import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors; @Service("ThBatchManagerService") public class ThBatchManagerServiceImpl implements ThBatchManagerService { @Autowired private ThBatchService thBatchService; @Autowired private ThBatchCourseService thBatchCourseService; @Autowired 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 = thStudentBatchService.statisticByBatchUuid(); if (!CollectionUtils.isEmpty(thBatchVOS)) { List<String> batchUuids = thBatchVOS.stream().map(ThBatchVO::getUuid).collect(Collectors.toList()); List<ThBatchCourse> batchCourseList = thBatchCourseService.getListByBatchUuids(batchUuids); //章节 List<ThBatchCourseChapter> chapterList = thBatchCourseChapterService.getListByBatchUuids(batchUuids); for (ThBatchVO thBatchVO : thBatchVOS) { //课程 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) { thBatchVO.setStudentCount(ssList.get(0).getCount()); }else { thBatchVO.setStudentCount(0); } thBatchVO.setCourseVOList(collect); } } 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<ThStudentBatchCourseVO> thStudentCourseVOS = thStudentBatchService.getStudentBatchCourseVOByBatchUuid(batchUuid); //根据批次获取学习记录 List<ThStudyVO> studyVOS = thStudyDetailService.statisticDurationByIdcard(batchUuid); List<ThBatchCourseRespDTO> batchCourseRespDTOS = new ArrayList<>(); if (!CollectionUtils.isEmpty(batchCourseVOS)) { for (ThBatchCourseVO VO : batchCourseVOS) { ThBatchCourseRespDTO thBatchCourseRespDTO = new ThBatchCourseRespDTO(); BeanUtils.copyProperties(VO, thBatchCourseRespDTO); //视频时长 thBatchCourseRespDTO.setDurationDesc(ConvertTimeUtils.convertTimeToString(VO.getDuration())); //过滤学生 List<ThStudentCourseRespDTO> studentList = thStudentCourseVOS .stream() .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()) && s.getCourseUuid().equals(VO.getCourseUuid())).collect(Collectors.toList()); if(collect.size() > 0) { thStudentCourseRespDTO.setDuration(collect.get(0).getDuration()); }else { thStudentCourseRespDTO.setDuration(0l); } return thStudentCourseRespDTO; }) .collect(Collectors.toList()); thBatchCourseRespDTO.setStudentList(studentList); batchCourseRespDTOS.add(thBatchCourseRespDTO); } } return batchCourseRespDTOS; } @Override public List<ThStudentStudyRespDTO> getStudent(String batchUuid) { //获取学生信息 List<ThStudentBatchVO> thStudentBatches = thStudentBatchService.getStudentBatchVOByBatchUuid(batchUuid); //获取学生学习记录 List<ThStudyDetailVO> studyDetails = thStudyDetailService.listByBatchUuid(batchUuid); 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()); 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; } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchServiceImpl.java
对比新文件 @@ -0,0 +1,63 @@ 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; import com.gkhy.exam.institutionalaccess.mapper.ThBatchMapper; import com.gkhy.exam.institutionalaccess.model.query.ThBatchQuery; import com.gkhy.exam.institutionalaccess.model.vo.ThBatchVO; import com.gkhy.exam.institutionalaccess.service.ThBatchService; 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("ThBatchService") public class ThBatchServiceImpl extends ServiceImpl<ThBatchMapper, ThBatch> implements ThBatchService { @Autowired private ThBatchMapper batchMapper; @Override public ThBatch getByUuid(String uuid) { return batchMapper.selectOne(new LambdaQueryWrapper<ThBatch>().eq(ThBatch::getUuid, uuid).eq(ThBatch::getDelFlag, DeleteStatusEnum.NO.getStatus())); } @Override public List<ThBatch> listByInstitutionId(Long institutionId) { return batchMapper.selectList(new LambdaQueryWrapper<ThBatch>().eq(ThBatch::getInstitutionId, institutionId).eq(ThBatch::getDelFlag, DeleteStatusEnum.NO.getStatus())); } @Override 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); } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseChapterServiceImpl.java
对比新文件 @@ -0,0 +1,74 @@ 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; @Service("ThCourseChapterService") public class ThCourseChapterServiceImpl extends ServiceImpl<ThCourseChapterMapper, ThCourseChapter> implements ThCourseChapterService { @Autowired private ThCourseChapterMapper courseChapterMapper; @Override public List<ThCourseChapterVO> listByCourseUuids(List<String> courseUuids) { return courseChapterMapper.listByCourseUuids(courseUuids); } @Override public List<ThCourseChapterVO> listByCourseUuid(String courseUuid) { return courseChapterMapper.listByCourseUuid(courseUuid); } @Override public List<ThCourseChapter> listByInstitutionId(Long institutionId) { return courseChapterMapper.selectList(new LambdaQueryWrapper<ThCourseChapter>().eq(ThCourseChapter::getInstitutionId, institutionId).eq(ThCourseChapter::getDelFlag, DeleteStatusEnum.NO.getStatus())); } @Override 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); } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseManagerServiceImpl.java
对比新文件 @@ -0,0 +1,164 @@ 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; @Service("ThCourseManagerService") public class ThCourseManagerServiceImpl implements ThCourseManagerService { @Autowired private ThCourseService courseService; @Autowired private ThCourseChapterService courseChapterService; @Autowired private ThStudentBatchService studentBatchService; @Autowired private ThStudentBatchService thStudentBatchService; @Autowired private ThStudyDetailService studyDetailService; @Override public List<ThCourseRespDTO> listByPage(ThCourseQuery query) { List<ThCourseRespDTO> courseList = courseService.listByPage(query); //分许获取数据 List<ThStatisticStudentVO> thStatisticStudentVOS = studentBatchService.statisticByCourseUuid(); //List<ThCourseRespDTO> courseRespDTOList = new ArrayList<>(); if(!CollectionUtils.isEmpty(courseList)){ //根据courseids获取所有章节 List<ThCourseChapterVO> courseChapterVOS = new ArrayList<>(); List<String> courseUuids = courseList.stream().map(ThCourseRespDTO::getUuid).collect(Collectors.toList()); if(!CollectionUtils.isEmpty(courseUuids)){ courseChapterVOS = courseChapterService.listByCourseUuids(courseUuids); } for (ThCourseRespDTO courseRespDTO : courseList) { //获取章 List<ThCourseChapterVO> finalCourseChapterVOS = courseChapterVOS; List<ThCourseChapterRespDTO> chapterList = courseChapterVOS .stream() .filter(cc -> courseRespDTO.getUuid().equals(cc.getCourseUuid()) && cc.getParentUuid().equals("0")) .map(cc -> { ThCourseChapterRespDTO courseChapterRespDTO = new ThCourseChapterRespDTO(); BeanUtils.copyProperties(cc, courseChapterRespDTO); courseChapterRespDTO.setChildren(getChildren(finalCourseChapterVOS,cc.getUuid())); return courseChapterRespDTO; }) .collect(Collectors.toList()); courseRespDTO.setOutline(chapterList); //学员数量 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); } } } return courseList; } //获取单条课程 @Override public ThCourseRespDTO findById(Long id) { ThCourse thCourse = courseService.getById(id); ThCourseRespDTO thCourseRespDTO = new ThCourseRespDTO(); BeanUtils.copyProperties(thCourse, thCourseRespDTO); List<ThCourseChapterVO> thCourseChapterVOS = courseChapterService.listByCourseUuid(thCourse.getUuid()); List<ThCourseChapterRespDTO> chapterRespDTOS = thCourseChapterVOS.stream() .filter(c -> c.getParentUuid().equals("0")) .map(c -> { ThCourseChapterRespDTO chapterRespDTO = new ThCourseChapterRespDTO(); BeanUtils.copyProperties(c, chapterRespDTO); chapterRespDTO.setChildren(getChildren(thCourseChapterVOS,c.getUuid())); return chapterRespDTO; }).collect(Collectors.toList()); thCourseRespDTO.setOutline(chapterRespDTOS); 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 .stream() .filter(cc -> cc.getParentUuid().equals(parentUuid)) .map(cc -> { ThCourseChapterRespDTO courseChapterRespDTO = new ThCourseChapterRespDTO(); BeanUtils.copyProperties(cc, courseChapterRespDTO); return courseChapterRespDTO; }) .collect(Collectors.toList()); return chapterList; } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseServiceImpl.java
对比新文件 @@ -0,0 +1,82 @@ 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; @Service("ThCourseService") public class ThCourseServiceImpl extends ServiceImpl<ThCourseMapper, ThCourse> implements ThCourseService { @Autowired private ThCourseMapper courseMapper; @Override public List<ThCourseRespDTO> listByPage(ThCourseQuery query) { return courseMapper.listByPage(query); } @Override public ThCourse getByUuid(String uuid) { ThCourse course = courseMapper.selectOne(new LambdaQueryWrapper<ThCourse>().eq(ThCourse::getUuid, uuid).eq(ThCourse::getDelFlag, DeleteStatusEnum.NO.getStatus())); return course; } @Override public List<ThCourse> selectByUuid(List<String> courseUuidList) { List<ThCourse> courseList = courseMapper.selectList(new LambdaQueryWrapper<ThCourse>().in(ThCourse::getUuid, courseUuidList) .eq(ThCourse::getDelFlag, DeleteStatusEnum.NO.getStatus())); return courseList; } @Override public List<ThCourse> listByInstitutionId(Long institutionId) { List<ThCourse> list = courseMapper.selectList(new LambdaQueryWrapper<ThCourse>() .eq(ThCourse::getInstitutionId, institutionId) .eq(ThCourse::getDelFlag, DeleteStatusEnum.NO.getStatus()) ); 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; } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThExamRecordManagerServiceImpl.java
对比新文件 @@ -0,0 +1,19 @@ package com.gkhy.exam.institutionalaccess.service.serviceImpl; import com.gkhy.exam.institutionalaccess.model.query.ThExamRecordQuery; import com.gkhy.exam.institutionalaccess.model.vo.ThExamRecordVO; import com.gkhy.exam.institutionalaccess.service.ThExamRecordManagerService; import com.gkhy.exam.institutionalaccess.service.ThExamRecordService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service("ThExamRecordManagerService") public class ThExamRecordManagerServiceImpl implements ThExamRecordManagerService { @Autowired private ThExamRecordService thExamRecordService; @Override public List<ThExamRecordVO> listByPage(ThExamRecordQuery query) { return thExamRecordService.listByPage(query); } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThExamRecordServiceImpl.java
对比新文件 @@ -0,0 +1,48 @@ 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; import com.gkhy.exam.institutionalaccess.mapper.ThExamRecordMapper; import com.gkhy.exam.institutionalaccess.model.query.ThExamRecordQuery; import com.gkhy.exam.institutionalaccess.model.vo.ThExamRecordVO; import com.gkhy.exam.institutionalaccess.service.ThExamRecordService; 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") public class ThExamRecordServiceImpl extends ServiceImpl<ThExamRecordMapper, ThExamRecord> implements ThExamRecordService { @Autowired private ThExamRecordMapper thExamRecordMapper; @Override public List<ThExamRecord> listByInstitutionId(Long institutionId) { return thExamRecordMapper.selectList(new LambdaQueryWrapper<ThExamRecord>().eq(ThExamRecord::getInstitutionId, institutionId).eq(ThExamRecord::getDelFlag, DeleteStatusEnum.NO.getStatus())); } @Override 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); } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThQuestionBankServiceImpl.java
对比新文件 @@ -0,0 +1,32 @@ 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.model.query.ThQuestionBankQuery; import com.gkhy.exam.institutionalaccess.entity.ThQuestionBank; import com.gkhy.exam.institutionalaccess.mapper.ThQuestionBankMapper; import com.gkhy.exam.institutionalaccess.service.ThQuestionBankService; import com.ruoyi.common.enums.coalmineEnums.DeleteStatusEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service("ThQuestionBankService") public class ThQuestionBankServiceImpl extends ServiceImpl<ThQuestionBankMapper, ThQuestionBank> implements ThQuestionBankService { @Autowired private ThQuestionBankMapper questionBankMapper; @Override public List<ThQuestionBank> listByPage(ThQuestionBankQuery query) { List<ThQuestionBank> questionBanks = questionBankMapper.selectList(new LambdaQueryWrapper<ThQuestionBank>() .eq(ThQuestionBank::getDelFlag, DeleteStatusEnum.NO.getStatus()) .orderByDesc(ThQuestionBank::getCreateTime)); return questionBanks; } @Override public ThQuestionBank getQuestionInfoByUuid(String uuid) { ThQuestionBank questionBank = questionBankMapper.selectOne(new LambdaQueryWrapper<ThQuestionBank>().eq(ThQuestionBank::getUuid, uuid).eq(ThQuestionBank::getDelFlag, DeleteStatusEnum.NO.getStatus())); return questionBank; } } 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); } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentManagerServiceImpl.java
对比新文件 @@ -0,0 +1,27 @@ package com.gkhy.exam.institutionalaccess.service.serviceImpl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.gkhy.exam.institutionalaccess.entity.ThStudent; import com.gkhy.exam.institutionalaccess.model.query.ThStudentQuery; import com.gkhy.exam.institutionalaccess.service.ThStudentManagerService; import com.gkhy.exam.institutionalaccess.service.ThStudentService; import com.ruoyi.common.enums.coalmineEnums.DeleteStatusEnum; import com.ruoyi.common.utils.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service("ThStudentManagerService") public class ThStudentManagerServiceImpl implements ThStudentManagerService { @Autowired private ThStudentService thStudentService; @Override public List<ThStudent> listByPage(ThStudentQuery query) { 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()).orderByDesc(ThStudent::getUpdateTime)); } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentServiceImpl.java
对比新文件 @@ -0,0 +1,59 @@ 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; 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("ThStudentService") public class ThStudentServiceImpl extends ServiceImpl<ThStudentMapper, ThStudent> implements ThStudentService { @Autowired private ThStudentMapper studentMapper; @Override public ThStudent getByIdcard(String idcard) { return studentMapper.selectOne(new LambdaQueryWrapper<ThStudent>().eq(ThStudent::getIdcard, idcard) .eq(ThStudent::getDelFlag, DeleteStatusEnum.NO.getStatus())); } @Override public List<ThStudent> getByIdcards(List<String> idcards) { 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 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); } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyAuthServiceImpl.java
对比新文件 @@ -0,0 +1,45 @@ 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; import com.gkhy.exam.institutionalaccess.mapper.ThStudyAuthMapper; import com.gkhy.exam.institutionalaccess.model.vo.ThStudyAuthVO; import com.gkhy.exam.institutionalaccess.service.ThStudyAuthService; 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("ThStudyAuthService") public class ThStudyAuthServiceImpl extends ServiceImpl<ThStudyAuthMapper,ThStudyAuth> implements ThStudyAuthService { @Autowired private ThStudyAuthMapper thStudyAuthMapper; @Override public List<String> getUuidByStudyDetaiId(String studyDetaiId) { return thStudyAuthMapper.getUuidByStudyDetaiId(studyDetaiId); } @Override 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); } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyDetailServiceImpl.java
对比新文件 @@ -0,0 +1,76 @@ 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; import com.gkhy.exam.institutionalaccess.mapper.ThStudyDetailMapper; import com.gkhy.exam.institutionalaccess.model.query.ThStudyDetailQuery; import com.gkhy.exam.institutionalaccess.model.vo.ThStudyDetailVO; import com.gkhy.exam.institutionalaccess.model.vo.ThStudyVO; import com.gkhy.exam.institutionalaccess.service.ThStudyDetailService; 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("ThStudyDetailService") public class ThStudyDetailServiceImpl extends ServiceImpl<ThStudyDetailMapper, ThStudyDetail> implements ThStudyDetailService { @Autowired private ThStudyDetailMapper thStudyDetailMapper; @Override public ThStudyDetail getByUuid(String uuid) { return thStudyDetailMapper.selectOne(new LambdaQueryWrapper<ThStudyDetail>().eq(ThStudyDetail::getUuid,uuid).eq(ThStudyDetail::getDelFlag, DeleteStatusEnum.NO.getStatus())); } @Override public Long getCount() { return thStudyDetailMapper.selectCount(new LambdaQueryWrapper<>()); } @Override public List<ThStudyDetailVO> listByPage(ThStudyDetailQuery query) { return thStudyDetailMapper.listByPage(query); } @Override public List<ThStudyVO> statisticDurationByIdcard(String batchUuid) { return thStudyDetailMapper.statisticDurationByIdcard(batchUuid); } @Override 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); } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyRecordManagerServiceImpl.java
对比新文件 @@ -0,0 +1,104 @@ package com.gkhy.exam.institutionalaccess.service.serviceImpl; 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.*; import com.gkhy.exam.institutionalaccess.utils.ConvertTimeUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @Service("ThStudyRecordManagerService") public class ThStudyRecordManagerServiceImpl implements ThStudyRecordManagerService { @Autowired private ThStudyDetailService thStudyDetailService; @Autowired 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.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())); thStudyDetailVO.setFinishPositionDesc(ConvertTimeUtils.convertTimeToString(thStudyDetailVO.getFinishPosition())); List<ThStudyAuthVO> thStudyAuthVOList = authList.stream().filter(a -> a.getStudyDetailUuid().equals(thStudyDetailVO.getUuid())) .map(a -> { ThStudyAuthVO thStudyAuthVO = new ThStudyAuthVO(); BeanUtils.copyProperties(a, thStudyAuthVO); thStudyAuthVO.setAuthPostionDesc(ConvertTimeUtils.convertTimeToString(a.getAuthPosition())); return thStudyAuthVO; }).collect(Collectors.toList()); List<ThStudyTrackVO> trackVOList = trackList.stream().filter(t -> t.getStudyDetailUuid().equals(thStudyDetailVO.getUuid())) .map(t -> { ThStudyTrackVO thStudyTrackVO = new ThStudyTrackVO(); BeanUtils.copyProperties(t, thStudyTrackVO); thStudyTrackVO.setTimeIntervalDesc(ConvertTimeUtils.convertTimeToString(t.getTimeInterval())); return thStudyTrackVO; }).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; } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyTrackServiceImpl.java
对比新文件 @@ -0,0 +1,38 @@ 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.ThStudyTrack; import com.gkhy.exam.institutionalaccess.mapper.ThStudyTrackMapper; import com.gkhy.exam.institutionalaccess.service.ThStudyTrackService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Collections; import java.util.List; @Service("ThStudyTrackService") public class ThStudyTrackServiceImpl extends ServiceImpl<ThStudyTrackMapper, ThStudyTrack> implements ThStudyTrackService { @Autowired private ThStudyTrackMapper thStudyTrackMapper; @Override public List<String> getUuidByStudyDetaiId(String studyDetaiId) { return thStudyTrackMapper.getUuidByStudyDetaiId(studyDetaiId); } @Override 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); } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/TripartiteInterfaceServiceImpl.java
对比新文件 @@ -0,0 +1,2077 @@ 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.*; import com.gkhy.exam.institutionalaccess.model.resp.ThErrorDataRespDTO; import com.gkhy.exam.institutionalaccess.model.vo.ThCourseChapterVO; import com.gkhy.exam.institutionalaccess.service.*; import com.ruoyi.common.constant.ResultConstants; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.model.InstitutionUser; import com.ruoyi.common.enums.coalmineEnums.DeleteStatusEnum; import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.signature.AESUtils; import com.ruoyi.common.utils.StringUtils; 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; import org.springframework.util.CollectionUtils; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @Service("TripartiteInterfaceService") public class TripartiteInterfaceServiceImpl implements TripartiteInterfaceService { private Logger logger = LoggerFactory.getLogger(TripartiteInterfaceServiceImpl.class); @Autowired private ThQuestionBankService questionBankService; @Autowired private ThCourseService courseService; @Autowired private ThCourseChapterService courseChapterService; @Autowired private ThStudentService studentService; @Autowired private ThBatchService batchService; @Autowired private ThBatchCourseService batchCourseService; @Autowired private ThStudentBatchService studentBatchService; @Autowired private ThStudyAuthService studyAuthService; @Autowired private ThStudyTrackService studyTrackService; @Autowired private ThStudyDetailService studyDetailService; @Autowired private ThExamRecordService examRecordService; @Autowired private ThBatchCourseChapterService batchCourseChapterService; @Override public boolean receiveQuestionBank(JSONObject jsonObject) { InstitutionUser institutionUser = ThreeInContextHolder.getContext(); String data = jsonObject.getString("data"); if(StringUtils.isEmpty(data)){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); } //解密 String decrypt = ""; try { decrypt = AESUtils.decrypt(data); }catch (Exception e){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); } //反序列化 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查询数据 ThQuestionBank qb = questionBankService.getQuestionInfoByUuid(questionBankReqDTO.getUuid()); boolean i = true; if(qb == null){ //新增 qb = new ThQuestionBank(); BeanUtils.copyProperties(questionBankReqDTO, qb); qb.setUuid(questionBankReqDTO.getUuid()); qb.setInstitutionId(institutionUser.getId()); qb.setInstitutionName(institutionUser.getInstitutionalName()); qb.setCreateTime(LocalDateTime.now()); qb.setUpdateTime(LocalDateTime.now()); qb.setCreateBy(institutionUser.getInstitutionalName()); qb.setUpdateBy(institutionUser.getInstitutionalName()); //qb.setDelFlag(DeleteStatusEnum.NO.getStatus()); i = questionBankService.save(qb); }else { //修改 BeanUtils.copyProperties(questionBankReqDTO, qb); i = questionBankService.updateById(qb); } return i; } @Transactional @Override public AjaxResult receiveCourse(JSONObject jsonObject) { InstitutionUser institutionUser = ThreeInContextHolder.getContext(); String data = jsonObject.getString("data"); if(StringUtils.isEmpty(data)){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); } //解密 String decrypt = ""; try { decrypt = AESUtils.decrypt(data); }catch (Exception e){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); } List<ThCourseReqDTO> courseReqDTOList = new ArrayList<>(); //反序列化 try { courseReqDTOList = JSONObject.parseObject(decrypt, new TypeReference<List<ThCourseReqDTO>>() {}); }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; } 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; } 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.setInstitutionId(institutionUser.getId()); chapter.setCreateTime(LocalDateTime.now()); chapter.setUpdateTime(LocalDateTime.now()); //chapter.setDelFlag(DeleteStatusEnum.NO.getStatus()); 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.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()); 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); } } } } } //数据插入 //课程插入 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 @Override public AjaxResult receiveStudent(JSONObject jsonObject) { InstitutionUser institutionUser = ThreeInContextHolder.getContext(); String data = jsonObject.getString("data"); if(StringUtils.isEmpty(data)){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); } //解密 String decrypt = ""; try { decrypt = AESUtils.decrypt(data); }catch (Exception e){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); } //反序列化 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> 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.getUuid(),"身份证不可为空")); continue; } if(StringUtils.isEmpty(studentReqDTO.getName())){ errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getUuid(),"姓名不可为空")); continue; } if(StringUtils.isEmpty(studentReqDTO.getPhone())){ errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getUuid(),"手机号不可为空")); continue; } if(studentReqDTO.getSex() == null || StudentSex.get(studentReqDTO.getSex()) == null){ errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getUuid(),"性别不可为空")); continue; } if(StringUtils.isEmpty(studentReqDTO.getAuthPhoto())){ 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.getUuid(),"培训机构名称不可为空")); continue; } if(StringUtils.isEmpty(studentReqDTO.getBatchUuid())){ errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getUuid(),"关联批次(班级)不可为空")); continue; } List<ThBatch> collect = batchList.stream().filter(batchCourse -> batchCourse.getUuid().equals(studentReqDTO.getBatchUuid())).collect(Collectors.toList()); if (CollectionUtils.isEmpty(collect)) { errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getUuid(), "批次(班级)不存在,请先添加批次(班级)")); continue; } saveStudentReqDTOList.add(studentReqDTO); } List<ThStudent> saveSudentList = new ArrayList<>(); List<ThStudent> updateStudentList = new ArrayList<>(); 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); }else { //新增 ThStudent student = new ThStudent(); BeanUtils.copyProperties(studentReqDTO, student); student.setId(IdUtil.getSnowflake(0,0).nextId()); student.setUpdateBy(institutionUser.getInstitutionalName()); student.setUpdateTime(LocalDateTime.now()); student.setCreateBy(institutionUser.getInstitutionalName()); student.setCreateTime(LocalDateTime.now()); student.setInstitutionId(institutionUser.getId()); student.setInstitutionName(institutionUser.getInstitutionalName()); student.setDelFlag(DeleteStatusEnum.NO.getStatus()); saveSudentList.add(student); } //获取班级学生 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); } } //学生表新增 List<List<ThStudent>> splitSaveStudentList = ListUtil.split(saveSudentList, 500); for (List<ThStudent> studentList : splitSaveStudentList) { studentService.insertBatch(studentList); } //学生表更新 List<List<ThStudent>> splitUpdateStudentList = ListUtil.split(updateStudentList, 500); for (List<ThStudent> studentList : splitUpdateStudentList) { studentService.updateBatch(studentList); } //学生关联班级表 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); } /** * 班次 * @param jsonObject * @return */ @Transactional @Override public AjaxResult receiveBatch(JSONObject jsonObject) { InstitutionUser institutionUser = ThreeInContextHolder.getContext(); String data = jsonObject.getString("data"); if(StringUtils.isEmpty(data)){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); } //解密 String decrypt = ""; try { decrypt = AESUtils.decrypt(data); }catch (Exception e){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); } //反序列化 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()); }else { batchCourse.setDelFlag(DeleteStatusEnum.NO.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()) || 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); } } } } } //插入班级数据 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 @Override public AjaxResult receiveStudyDetail(JSONObject jsonObject) { InstitutionUser institutionUser = ThreeInContextHolder.getContext(); String data = jsonObject.getString("data"); if(StringUtils.isEmpty(data)){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); } //解密 String decrypt = ""; try { decrypt = AESUtils.decrypt(data); }catch (Exception e){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); } //反序列化 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); } //参数校验 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 @Override public AjaxResult receiveExamRecord(JSONObject jsonObject) { InstitutionUser institutionUser = ThreeInContextHolder.getContext(); String data = jsonObject.getString("data"); if(StringUtils.isEmpty(data)){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); } //解密 String decrypt = ""; try { decrypt = AESUtils.decrypt(data); }catch (Exception e){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); } //反序列化 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())){ errorDataRespDTOS.add(new ThErrorDataRespDTO(examRecordReqDTO.getUuid(),"考试记录uuid不符合规范")); continue; } if(StringUtils.isEmpty(examRecordReqDTO.getIdcard())){ errorDataRespDTOS.add(new ThErrorDataRespDTO(examRecordReqDTO.getUuid(),"身份证不可为空")); continue; } if(StringUtils.isEmpty(examRecordReqDTO.getBatchUuid())){ errorDataRespDTOS.add(new ThErrorDataRespDTO(examRecordReqDTO.getUuid(),"批次(班级)不可为空")); continue; } 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(),"无学生"+examRecordReqDTO.getIdcard()+"培训信息")); continue; } if(StringUtils.isEmpty(examRecordReqDTO.getTrainOrgName())){ errorDataRespDTOS.add(new ThErrorDataRespDTO(examRecordReqDTO.getUuid(),"培训机构名称不可为空")); continue; } if(StringUtils.isEmpty(examRecordReqDTO.getExamName())){ errorDataRespDTOS.add(new ThErrorDataRespDTO(examRecordReqDTO.getUuid(),"考试名称不可为空")); continue; } if(examRecordReqDTO.getExamStartTime() == null){ errorDataRespDTOS.add(new ThErrorDataRespDTO(examRecordReqDTO.getUuid(),"开考时间不可为空")); continue; } if(examRecordReqDTO.getExamSubmitTime() == null){ errorDataRespDTOS.add(new ThErrorDataRespDTO(examRecordReqDTO.getUuid(),"结束时间不可为空")); continue; } if(examRecordReqDTO.getExamUserScore() == null){ errorDataRespDTOS.add(new ThErrorDataRespDTO(examRecordReqDTO.getUuid(),"学习成绩不可为空")); continue; } if(examRecordReqDTO.getExamTotalScore() == null){ errorDataRespDTOS.add(new ThErrorDataRespDTO(examRecordReqDTO.getUuid(),"试卷总分不可为空")); continue; } if(examRecordReqDTO.getExamPassScore() == null){ errorDataRespDTOS.add(new ThErrorDataRespDTO(examRecordReqDTO.getUuid(),"合格分数不可为空")); continue; } if(examRecordReqDTO.getExamIsPass() == null || ExamIsPass.get(examRecordReqDTO.getExamIsPass()) == 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 = new ThExamRecord(); BeanUtils.copyProperties(examRecordReqDTO,thExamRecord); thExamRecord.setInstitutionId(institutionUser.getId()); thExamRecord.setInstitutionName(institutionUser.getInstitutionalName()); thExamRecord.setCreateTime(LocalDateTime.now()); thExamRecord.setUpdateTime(LocalDateTime.now()); thExamRecord.setCreateBy(institutionUser.getInstitutionalName()); thExamRecord.setUpdateBy(institutionUser.getInstitutionalName()); thExamRecord.setDelFlag(DeleteStatusEnum.NO.getStatus()); saveExamRecordList.add(thExamRecord); } } List<List<ThExamRecord>> splitSaveExamList = ListUtil.split(saveExamRecordList, 500); for (List<ThExamRecord> list : splitSaveExamList) { examRecordService.saveBatch(list); } return AjaxResult.success(errorDataRespDTOS); } @Transactional @Override public AjaxResult receiveCourseDelete(JSONObject jsonObject) { InstitutionUser institutionUser = ThreeInContextHolder.getContext(); String data = jsonObject.getString("data"); if(StringUtils.isEmpty(data)){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); } //解密 String decrypt = ""; try { decrypt = AESUtils.decrypt(data); }catch (Exception e){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); } //反序列化 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); } ThCourse thCourse = courseService.getByUuid(thCourseDeleteReqDTO.getCourseUuid()); List<ThCourseChapterVO> thCourseChapterVOS = courseChapterService.listByCourseUuid(thCourseDeleteReqDTO.getCourseUuid()); if(thCourse == null){ throw new BusinessException(ResultConstants.COURSE_IS_NOT_EXIST); } boolean exsit = batchCourseService.isExsit(thCourseDeleteReqDTO.getCourseUuid()); if(exsit){ throw new BusinessException(ResultConstants.BATCH_COURSE_EXIST); } thCourse.setDelFlag(DeleteStatusEnum.YES.getStatus()); thCourse.setUpdateTime(LocalDateTime.now()); thCourse.setUpdateBy(institutionUser.getInstitutionalName()); List<ThCourseChapter> thCourseChapters = thCourseChapterVOS.stream().map(cc -> { ThCourseChapter thCourseChapter = new ThCourseChapter(); BeanUtils.copyProperties(cc, thCourseChapter); thCourseChapter.setUpdateTime(LocalDateTime.now()); thCourseChapter.setUpdateBy(institutionUser.getInstitutionalName()); thCourseChapter.setDelFlag(DeleteStatusEnum.YES.getStatus()); return thCourseChapter; }).collect(Collectors.toList()); courseService.updateById(thCourse); //删除章节 if(thCourseChapters.size() > 0){ courseChapterService.updateBatchById(thCourseChapters); } return AjaxResult.success(); } @Override public AjaxResult receiveBatchOpen(JSONObject jsonObject) { InstitutionUser institutionUser = ThreeInContextHolder.getContext(); String data = jsonObject.getString("data"); if(StringUtils.isEmpty(data)){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); } //解密 String decrypt = ""; try { decrypt = AESUtils.decrypt(data); }catch (Exception e){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); } //反序列化 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,"批次(班级)不可为空"); } ThBatch thBatch = batchService.getByUuid(thBatchOpenReqDTO.getBatchUuid()); if(thBatch == null){ throw new BusinessException(ResultConstants.BATCH_IS_NOT_EXIST); } 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); return AjaxResult.success(); } @Transactional @Override public AjaxResult receiveBatchEnd(JSONObject jsonObject) { InstitutionUser institutionUser = ThreeInContextHolder.getContext(); String data = jsonObject.getString("data"); if(StringUtils.isEmpty(data)){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); } //解密 String decrypt = ""; try { decrypt = AESUtils.decrypt(data); }catch (Exception e){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); } //反序列化 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,"批次(班级)不可为空"); } ThBatch thBatch = batchService.getByUuid(thBatchEndReqDTO.getBatchUuid()); if(thBatch == null){ throw new BusinessException(ResultConstants.BATCH_IS_NOT_EXIST); } 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) { if (studentDetailReqDTO == null) { throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"学习记录清单不可为空"); } if(StringUtils.isEmpty(studentDetailReqDTO.getUuid()) || !UUID.checkIsUuid(studentDetailReqDTO.getUuid())){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"学习记录uuid不符合规范"); } if(StringUtils.isEmpty(studentDetailReqDTO.getIdcard())){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"身份证不可为空"); } if(StringUtils.isEmpty(studentDetailReqDTO.getCourseUuid())){ 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(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,"课程章节不存在"); } if(StringUtils.isEmpty(studentDetailReqDTO.getTrainOrgName())){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"培训机构名称不可为空"); } if(studentDetailReqDTO.getFinishStatus() == null || FinishStatus.get(studentDetailReqDTO.getFinishStatus()) == null){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"完成状态不规范"); } if(studentDetailReqDTO.getDuration() == null){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"学习时长(秒)不可为空"); } if(studentDetailReqDTO.getStartTime() == null){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"开始时间不可为空"); } if(studentDetailReqDTO.getFinishTime() == null){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"结束时间不可为空"); } if(studentDetailReqDTO.getStartPosition() == null){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"开始位置不可为空"); } if(studentDetailReqDTO.getFinishPosition() == null){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"结束位置不可为空"); } if(StringUtils.isEmpty(studentDetailReqDTO.getLessonReportUrl())){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"学时报告不可为空"); } //认证记录集合 if(CollectionUtils.isEmpty(studentDetailReqDTO.getAuthList())){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"认证记录集合不可为空"); } studentDetailReqDTO.getAuthList().forEach(item -> { if(StringUtils.isEmpty(item.getUuid()) || !UUID.checkIsUuid(item.getUuid())){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,item.getUuid() + ",认证记录uuid不符合规范"); } if(StringUtils.isEmpty(item.getApprovePhoto())){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,item.getUuid() + ",认证照片不可为空"); } if(item.getAuthPosition() == null){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,item.getUuid() + ",认证位置不可为空"); } if(item.getAuthTime() == null){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,item.getUuid() + ",认证时间不可为空"); } if(item.getFaceType() == null || FaceType.get(item.getFaceType()) == null){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,item.getUuid() + ",认证类型不规范"); } }); //学习轨迹集合 if(CollectionUtils.isEmpty(studentDetailReqDTO.getTrackList())){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"学习轨迹集合不可为空"); } studentDetailReqDTO.getTrackList().forEach(item -> { if(StringUtils.isEmpty(item.getUuid()) || !UUID.checkIsUuid(item.getUuid())){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,item.getUuid() + ",认证记录uuid不符合规范"); } if(item.getStartTime() == null){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,item.getUuid() + ",轨迹开始时间不可为空"); } if(item.getEndTime() == null){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,item.getUuid() + ",轨迹结束时间不可为空"); } if(item.getTimeInterval() == null) { throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,item.getUuid() + ",时间间隔(秒)不可为空"); } }); } /** * 校验班次信息 * @param batchReqDTO */ private void validateBatch(ThBatchReqDTO batchReqDTO) { } /** * 校验学生信息 * @param studentReqDTOS */ private void validateStudent(List<ThStudentReqDTO> studentReqDTOS, Long institutionId) { if(CollectionUtils.isEmpty(studentReqDTOS)){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"学生信息不可为空"); } //获取所有该机构所有课程 List<ThCourse> courseList = courseService.listByInstitutionId(institutionId); for (ThStudentReqDTO studentReqDTO : studentReqDTOS) { if(StringUtils.isEmpty(studentReqDTO.getIdcard())){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"身份证不可为空"); } if(StringUtils.isEmpty(studentReqDTO.getName())){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"姓名不可为空"); } if(StringUtils.isEmpty(studentReqDTO.getPhone())){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"手机号不可为空"); } if(studentReqDTO.getSex() == null || StudentSex.get(studentReqDTO.getSex()) == null){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"性别不可为空"); } if(StringUtils.isEmpty(studentReqDTO.getAuthPhoto())){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"实名认证照不可为空"); } if (StringUtils.isEmpty(studentReqDTO.getTrainOrgName())){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"培训机构名称不可为空"); } /*if(CollectionUtils.isEmpty(studentReqDTO.getBatchUuids())){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"关联课程uuidd不可为空"); }*/ /*for (String batchaUuid : studentReqDTO.getBatchUuids()) { List<ThCourse> collect = courseList.stream().filter(course -> course.getUuid().equals(courseReqDTO.getCourseUuid())).collect(Collectors.toList()); if(CollectionUtils.isEmpty(collect)){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"课程uuid不存在,请先添加课程"); } }*/ } } /** * 校验课程 * @param courseReqDTO */ private void validateCourse(ThCourseReqDTO courseReqDTO) { if(courseReqDTO == null){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_ERROR); } if(StringUtils.isEmpty(courseReqDTO.getUuid()) || !UUID.checkIsUuid(courseReqDTO.getUuid())){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"uuid不符合规范"); } if(StringUtils.isEmpty(courseReqDTO.getCourseCode())){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"课程标识不可为空"); } if(StringUtils.isEmpty(courseReqDTO.getCourseName())){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"课程名称不可为空"); } if(StringUtils.isEmpty(courseReqDTO.getTrainOrgName())){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"培训机构名称不可为空"); } if(courseReqDTO.getLessonNum() == null){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"总课时不可为空"); } /* if(courseReqDTO.getDelFlag() == null || DeleteStatusEnum.getDeleteStatusEnum(courseReqDTO.getDelFlag()) == null ){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"删除标识不符合规范"); }*/ if(CollectionUtils.isEmpty(courseReqDTO.getChapters())){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"课程大纲(大章)不可为空"); } for (ThCourseChapterReqDTO chapter : courseReqDTO.getChapters()) { if(StringUtils.isEmpty(chapter.getChapterCode())){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"章节(大章)标识不可为空"); } if(StringUtils.isEmpty(chapter.getChapterName())){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_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,"是否有资源不符合规范"); } if(CollectionUtils.isEmpty(chapter.getChildren())){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"章节(小节)列表不可为空"); } for (ThCourseChapterReqDTO child : chapter.getChildren()) { if(StringUtils.isEmpty(child.getChapterCode())){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"章节(小节)标识不可为空"); } if(StringUtils.isEmpty(child.getChapterName())){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"章节(小节)名称不可为空"); } if(child.getDuration() == null){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"章节(小节)视频时长(秒)不可为空"); } if (child.getLessonNum() == null){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"章节(小节)课时(保留1位小数)不可为空"); } 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 ){ 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,"是否有资源不符合规范"); } } } } /** * 校验题库组卷数据 * @param questionBankReqDTO */ private void validateQuestion(ThQuestionBankReqDTO questionBankReqDTO){ if(questionBankReqDTO == null){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_ERROR); } if(StringUtils.isEmpty(questionBankReqDTO.getUuid()) || !UUID.checkIsUuid(questionBankReqDTO.getUuid())){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"题库组卷uuid不符合规范"); } if(StringUtils.isEmpty(questionBankReqDTO.getUrl())){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"题库组卷预览路径不可为空"); } if(questionBankReqDTO.getLastMonthCount() == null){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"上月题库总题目数不可为空"); } if(questionBankReqDTO.getAddCount() == null){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"新增题目数不可为空"); } if(questionBankReqDTO.getReduceCount() == null){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"减少题目数不可为空"); } if(questionBankReqDTO.getBrushRate() == null){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"刷题应用率不可为空"); } if(questionBankReqDTO.getAssemblyRate() == null){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"组卷应用率不可为空"); } if(questionBankReqDTO.getMonth() == null){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_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(); String strCount = count.toString(); while (strCount.length() < 5){ strCount = "0" + strCount; } return strCount; } } exam-system/src/main/java/com/gkhy/exam/institutionalaccess/utils/ConvertTimeUtils.java
对比新文件 @@ -0,0 +1,38 @@ package com.gkhy.exam.institutionalaccess.utils; public class ConvertTimeUtils { //1分钟 private static final Long MINUTE = 60l; //1小时 private static final Long HOUR = 60l * MINUTE; //一天 private static final Long DAY = 24l * HOUR; /** * * @param time (秒) * @return */ public static String convertTimeToString(Long time) { if(time < MINUTE){ //小于1分钟 return String.format("%02d", time) + "秒"; }else if (time < HOUR){ //小于1小时 Long m = time / MINUTE; Long s = time % MINUTE; return String.format("%02d", m) + "分" + String.format("%02d", s) + "秒"; }else { //大于1小时 Long h = time / HOUR; Long m = time % HOUR/MINUTE; Long s = time % HOUR % MINUTE; return String.format("%02d", h) + "时" + String.format("%02d", m) + "分" + String.format("%02d", s) + "秒"; } } public static void main(String[] args) { Long time = 3601l; System.out.println(convertTimeToString(time)); } } 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> exam-system/src/main/resources/mapper/institutionaccess/ThBatchCourseMapper.xml
对比新文件 @@ -0,0 +1,105 @@ <?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.ThBatchCourseMapper"> <update id="deleteByBatchUuidAndCourseUuid" parameterType="java.util.List" > <foreach collection="list" item="item" index="index" separator=";"> UPDATE th_batch_course <set> <if test="item.delFlag != null" > del_flag = #{item.delFlag} </if> </set> where batch_uuid = #{item.batchUuid} and course_uuid = #{item.courseUuid} </foreach> </update> <update id="deleteByBatchUuid" > 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.*, ( 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 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> exam-system/src/main/resources/mapper/institutionaccess/ThBatchMapper.xml
对比新文件 @@ -0,0 +1,143 @@ <?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.ThBatchMapper"> <select id="listByPage" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThBatchVO"> 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> <if test="query.batchName != null and query.batchName != ''"> and batch_name like concat('%', #{query.batchaName}, '%') </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 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> exam-system/src/main/resources/mapper/institutionaccess/ThCourseChapterMapper.xml
对比新文件 @@ -0,0 +1,129 @@ <?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.ThCourseChapterMapper"> <select id="listByCourseUuids" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThCourseChapterVO"> select cc.id, cc.uuid, cc.chapter_code, cc.chapter_name, cc.lesson_num, cc.duration, cc.institution_id, cc.resource_type, 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> <select id="listByCourseUuid" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThCourseChapterVO"> select cc.id, cc.uuid, cc.chapter_code, cc.chapter_name, cc.lesson_num, cc.duration, cc.institution_id, cc.resource_type, 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> exam-system/src/main/resources/mapper/institutionaccess/ThCourseMapper.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.ThCourseMapper"> <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> exam-system/src/main/resources/mapper/institutionaccess/ThExamRecordMapper.xml
对比新文件 @@ -0,0 +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 e.*, s.`name`, b.batch_name FROM th_exam_record e 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> exam-system/src/main/resources/mapper/institutionaccess/ThQuestionBankMapper.xml
对比新文件 @@ -0,0 +1,8 @@ <?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.ThQuestionBankMapper"> </mapper> 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> exam-system/src/main/resources/mapper/institutionaccess/ThStudentMapper.xml
对比新文件 @@ -0,0 +1,81 @@ <?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.ThStudentMapper"> <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> <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.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="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> exam-system/src/main/resources/mapper/institutionaccess/ThStudyAuthMapper.xml
对比新文件 @@ -0,0 +1,22 @@ <?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.ThStudyAuthMapper"> <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> exam-system/src/main/resources/mapper/institutionaccess/ThStudyDetailMapper.xml
对比新文件 @@ -0,0 +1,171 @@ <?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.ThStudyDetailMapper"> <select id="listByPage" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThStudyDetailVO"> SELECT 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 where d.del_flag = 0 <if test="query.idcard != null and query.idcard != ''"> and d.idcard = #{query.idcard} </if> <if test="query.courseUuid != null and query.courseUuid != ''"> and d.course_uuid = #{query.courseUuid} </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.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 WHERE d.del_flag = 0 AND d.batch_uuid = #{batchUuid} GROUP BY d.idcard, d.course_uuid </select> <select id="listByBatchUuid" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThStudyDetailVO"> SELECT d.*, cc.chapter_name, cc.lesson_num FROM th_study_detail d LEFT JOIN th_course_chapter cc ON cc.uuid = d.chapter_uuid where d.del_flag = 0 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> exam-system/src/main/resources/mapper/institutionaccess/ThStudyTrackMapper.xml
对比新文件 @@ -0,0 +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> <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> ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ThreeAccessController.java
对比新文件 @@ -0,0 +1,48 @@ package com.ruoyi.web.controller.system; import com.alibaba.fastjson2.JSONObject; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.signature.AESUtils; import com.ruoyi.framework.web.domain.threeAccess.req.AccessReqDTO; import com.ruoyi.framework.web.service.ThreeInstitutionService; 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.RestController; @RestController public class ThreeAccessController extends BaseController { @Autowired private ThreeInstitutionService threeInstitutionService; @PostMapping("/gov-server/token") public AjaxResult getToken(@RequestBody JSONObject jsonObject){ return ok(threeInstitutionService.getToken(jsonObject)); } public static void main(String[] args) { AccessReqDTO accessReqDTO = new AccessReqDTO(); /* 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("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); }*/ } 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 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 ruoyi-admin/src/main/resources/application.yml
@@ -57,6 +57,14 @@ secret: abcdefghijklmnopqrstuvwxyz # 令牌有效期(默认30分钟) expireTime: 30 threeToken: # 令牌自定义标识 header: accessToken # 令牌密钥 secret: Q5mn+yLZHyI7gp=+ffbPgjq2UL # 令牌有效期(默认7天) expireTime: 7 # MyBatis-plus配置 mybatis-plus: 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 "访问过于频繁,请稍候再试"; } ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java
@@ -12,6 +12,8 @@ */ public static final String LOGIN_TOKEN_KEY = "swspkmas:login_tokens:"; public static final String THREE_INSTITUTION_TOKEN_KEY = "swspkmas:three_institution_tokens:"; /** * 验证码 redis key */ @@ -50,4 +52,9 @@ * 登录账户密码错误次数 redis key */ public static final String PWD_ERR_CNT_KEY = "swspkmas:pwd_err_cnt:"; /** * 七天内访问请求token次数 */ public static final String THREE_TOKEN_CNT_KEY = "swspkmas:three_token_cnt:"; } ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java
@@ -85,6 +85,10 @@ public static final String LOGIN_USER_KEY = "login_user_key"; /** * 三方令牌前缀 */ public static final String INSTITUTION_USER_KEY = "three_institution_user_key"; /** * 用户ID */ public static final String JWT_USERID = "userid"; ruoyi-common/src/main/java/com/ruoyi/common/constant/ResultConstants.java
@@ -45,6 +45,25 @@ FILE_UPLOAD_FAIL(603,"文件上传失败"), FILE_DOWNLOAD_FAIL(604,"文件下载失败"), FILE_DOWNLOAD_EXPERTION(605,"文件下载异常"), //三方对接 THREE_INSTITUTION_PARAMM_NULL(1000,"参数为空或格式不合规"), THREE_INSTITUTION_PARAMM_ERROR(1001,"参数结构错误"), ACCESSkEY_ERROR_NULL(1002,"accessKey不能为空"), SECRETKEY_ERROR_NULL(1003,"sercetKey不能为空"), ACCESSkEY_INVALID(1004,"accessKey不存在"), SERIALIZE_ERROR(1005,"反序列化异常"), INSTITUTION_AUTHENTICATION(1006,"培训平台鉴权失败"), ACCESS_TOKEN_OVERDUE(1007,"accessToken过期"), ACCESS_TOKEN_LOSE(1008,"accessToken丢失"), COURSE_IS_EXIST(1009,"课程已存在"), COURSE_IS_NOT_EXIST(1010,"课程不存在"), BATCH_COURSE_EXIST(1011,"批次(班级)已关联,不可删除"), 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,"业务错误"), ; ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java
@@ -113,6 +113,13 @@ { return AjaxResult.success(message); } /** * 返回成功消息 */ public AjaxResult ok(Object data) { return AjaxResult.success(data); } /** * 返回成功消息 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java
@@ -3,6 +3,7 @@ import java.util.HashMap; import java.util.Objects; import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.common.constant.ResultConstants; import com.ruoyi.common.utils.StringUtils; /** @@ -170,6 +171,11 @@ return new AjaxResult(code, msg, null); } public static AjaxResult error(ResultConstants resultConstants) { return new AjaxResult(resultConstants.getCode(), resultConstants.getDesc(), null); } /** * 是否为成功消息 * ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/InstitutionUser.java
对比新文件 @@ -0,0 +1,48 @@ package com.ruoyi.common.core.domain.model; import lombok.Data; import java.util.Map; @Data public class InstitutionUser { private Long id; //编号 private Long institutionCode; //机构名称 private String institutionalName; //key private String accessKey; //密钥 private String secretKey; //联系人电话 private String phone; //联系人 private String contacts; //过期时间 private Long expireTime; private String token; /** * 请求IP地址 */ private String ipaddr; /** * 访问地点 */ private String location; /** * 浏览器类型 */ private String browser; /** * 操作系统 */ private String os; } ruoyi-common/src/main/java/com/ruoyi/common/enums/InstitutionStatus.java
对比新文件 @@ -0,0 +1,32 @@ package com.ruoyi.common.enums; public enum InstitutionStatus { YES((byte)0,"启用"), NO((byte)1,"禁止"), ; private Byte status; private String desc; InstitutionStatus(Byte status, String desc) { this.status = status; this.desc = desc; } public Byte getStatus() { return status; } public void setStatus(Byte status) { this.status = status; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } } ruoyi-common/src/main/java/com/ruoyi/common/enums/coalmineEnums/DeleteStatusEnum.java
@@ -29,4 +29,13 @@ public void setDesc(String desc) { this.desc = desc; } public static DeleteStatusEnum getDeleteStatusEnum(Byte status) { for (DeleteStatusEnum deleteStatusEnum : DeleteStatusEnum.values()) { if (deleteStatusEnum.getStatus() == status) { return deleteStatusEnum; } } return null; } } ruoyi-common/src/main/java/com/ruoyi/common/exception/BusinessException.java
@@ -10,11 +10,11 @@ private String message; // public BusinessException(ResultCode error) { // super(error.getDesc()); // this.code = error.getCode(); // this.message = error.getDesc(); // } public BusinessException(ResultConstants error) { super(error.getDesc()); this.code = error.getCode(); this.message = error.getDesc(); } public BusinessException(Class causeClass, ResultConstants error) { super(error.getDesc()); ruoyi-common/src/main/java/com/ruoyi/common/signature/AESUtils.java
对比新文件 @@ -0,0 +1,94 @@ package com.ruoyi.common.signature; import com.ruoyi.common.constant.Constants; import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import java.util.Base64; public class AESUtils { private static final String key="Bd26jqDDJcdnBocn"; private static final String iv ="oVKRQCjElggSbd8D"; /** * @Description AES算法加密明文 * @param data 明文 * @param key 密钥,长度16 * @param iv 偏移量,长度16 * @return 密文 */ public static String encrypt(String data){ try { Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); int blockSize = cipher.getBlockSize(); byte[] dataBytes = data.getBytes(Constants.UTF8); int plaintextLength = dataBytes.length; if (plaintextLength % blockSize != 0) { plaintextLength = plaintextLength + (blockSize - (plaintextLength % blockSize)); } byte[] plaintext = new byte[plaintextLength]; System.arraycopy(dataBytes, 0, plaintext, 0, dataBytes.length); SecretKeySpec keyspec = new SecretKeySpec(key.getBytes(), "AES"); IvParameterSpec ivspec = new IvParameterSpec(iv.getBytes()); // CBC模式,需要一个向量iv,可增加加密算法的强度 cipher.init(Cipher.ENCRYPT_MODE, keyspec, ivspec); byte[] encrypted = cipher.doFinal(plaintext); // BASE64做转码。 String aseEncode = Base64.getEncoder().encodeToString(encrypted); return aseEncode.trim(); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e.getMessage()); } } /** * @Description AES算法解密密文 * @param data 密文 * @param key 密钥,长度16 * @param iv 偏移量,长度16 * @return 明文 */ public static String decrypt(String data){ try { byte[] encryptCode = Base64.getDecoder().decode(data);//先用base64解密 Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); SecretKeySpec keyspec = new SecretKeySpec(key.getBytes(), "AES"); IvParameterSpec ivspec = new IvParameterSpec(iv.getBytes()); cipher.init(Cipher.DECRYPT_MODE, keyspec, ivspec); byte[] original = cipher.doFinal(encryptCode); String originalString = new String(original); return originalString.trim(); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e.getMessage()); } } public static void main(String[] args) throws Exception { String key="Bd26jqDDJcdnBocn"; String iv ="oVKRQCjElggSbd8D"; /* System.out.println("****************************************"); String encode = AESUtils.encrypt("测试", key, iv); System.out.println(encode); System.out.println("****************************************"); String decode = AESUtils.decrypt(encode, key, iv); System.out.println(decode); System.out.println("****************************************");*/ } } ruoyi-common/src/main/java/com/ruoyi/common/signature/Signature.java
文件已删除 ruoyi-common/src/main/java/com/ruoyi/common/signature/Signature11.java
文件已删除 ruoyi-common/src/main/java/com/ruoyi/common/utils/RandomUtil.java
对比新文件 @@ -0,0 +1,40 @@ package com.ruoyi.common.utils; import java.util.Random; public class RandomUtil { /** * 字符串池 */ private static String[] STR_ARR = new String[] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" }; /** * * 根据指定的长度生成的含有大小写字母及数字的字符串 * * @param length * 指定的长度 * @return 按照指定的长度生成的含有大小写字母及数字的字符串 */ public static String generateRandomString(int length) { StringBuilder sb = new StringBuilder(); Random rand = new Random(); for (int i = 0; i < length; i++) { sb.append(STR_ARR[rand.nextInt(STR_ARR.length)]); } return sb.toString(); } public static void main(String[] args) { String s = generateRandomString(26); System.out.println(s); } } ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/UUID.java
@@ -481,4 +481,21 @@ { return ThreadLocalRandom.current(); } /** * 检查字符串是否是合法的uuid, * * @param uuidStr * @return 是返回true,不是返回false */ public static boolean checkIsUuid(String uuidStr) { try { UUID.fromString(uuidStr).toString(); } catch (Exception e) { //e.printStackTrace(); return false; } return true; } } 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(),"数据参数异常"); } } } } } ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java
@@ -2,6 +2,8 @@ import java.io.File; import java.util.concurrent.TimeUnit; import com.ruoyi.framework.interceptor.ThreeInstitutionInterceptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; @@ -31,6 +33,9 @@ @Autowired private RepeatSubmitInterceptor repeatSubmitInterceptor; @Autowired private ThreeInstitutionInterceptor threeInstitutionInterceptor; @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { @@ -56,6 +61,7 @@ public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(repeatSubmitInterceptor).addPathPatterns("/**"); registry.addInterceptor(threeInstitutionInterceptor).addPathPatterns("/gov-server/receive/**"); } /** ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
@@ -111,7 +111,7 @@ // 过滤请求 .authorizeRequests() // 对于登录login 注册register 验证码captchaImage 允许匿名访问 .antMatchers("/login","/login/move", "/register", "/captchaImage","/uploadfile/**").permitAll() .antMatchers("/login","/login/move", "/register", "/captchaImage","/uploadfile/**","/gov-server/**").permitAll() // 静态资源,可匿名访问 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/ThreeInstitutionInterceptor.java
对比新文件 @@ -0,0 +1,71 @@ package com.ruoyi.framework.interceptor; import com.alibaba.fastjson2.JSON; import com.ruoyi.common.constant.ResultConstants; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.model.InstitutionUser; import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.framework.security.context.ThreeInContextHolder; import com.ruoyi.framework.web.service.TokenService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; import org.springframework.stereotype.Component; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; /** * 自定义三方对接数据校验 */ @Component public class ThreeInstitutionInterceptor implements HandlerInterceptor { @Autowired private TokenService tokenService; @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { InstitutionUser institutionUser = tokenService.getThreeInUser(request); if (StringUtils.isNotNull(institutionUser)) { tokenService.verifyThreeInToken(institutionUser); ThreeInContextHolder.setContext(institutionUser); }else { toJson(response,ResultConstants.ACCESS_TOKEN_OVERDUE.getCode(),ResultConstants.ACCESS_TOKEN_OVERDUE.getDesc()); return false; } return true; } private void toJson(HttpServletResponse response,int code, String msg) throws IOException { AjaxResult result = AjaxResult.error(code, msg); // 设置编码格式 response.setContentType("text/json;charset=utf-8"); // 处理跨域问题 response.setHeader("Access-Control-Allow-Origin", "*"); response.setHeader("Access-Control-Allow-Methods", "POST, GET, DELETE, OPTIONS"); PrintWriter out = response.getWriter(); out.write(JSON.toJSONString(result)); out.flush(); out.close(); } public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { // 清除threadLocal ThreeInContextHolder.clearContext(); } } ruoyi-framework/src/main/java/com/ruoyi/framework/security/context/ThreeInContextHolder.java
对比新文件 @@ -0,0 +1,26 @@ package com.ruoyi.framework.security.context; import com.ruoyi.common.core.domain.model.InstitutionUser; /** * 三方身份信息 */ public class ThreeInContextHolder { private static final ThreadLocal<InstitutionUser> contextHolder = new ThreadLocal<>(); public static InstitutionUser getContext() { return contextHolder.get(); } public static void setContext(InstitutionUser context) { contextHolder.set(context); } public static void clearContext() { contextHolder.remove(); } } ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/threeAccess/req/AccessReqDTO.java
对比新文件 @@ -0,0 +1,11 @@ package com.ruoyi.framework.web.domain.threeAccess.req; import lombok.Data; @Data public class AccessReqDTO { //key private String accessKey; //密钥 private String secretKey; } ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/threeAccess/resp/AccessRespDTO.java
对比新文件 @@ -0,0 +1,10 @@ package com.ruoyi.framework.web.domain.threeAccess.resp; import lombok.Data; @Data public class AccessRespDTO { private String accessToken; private Long expireTime; } ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java
@@ -10,6 +10,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.converter.HttpMessageNotReadableException; import org.springframework.security.access.AccessDeniedException; import org.springframework.validation.BindException; import org.springframework.web.HttpRequestMethodNotSupportedException; @@ -40,6 +41,16 @@ @Autowired private ObjectMapper objectMapper; @ExceptionHandler(HttpMessageNotReadableException.class) public AjaxResult handleHttpMessageNotReadableException(HttpMessageNotReadableException e, HttpServletRequest request) { String requestURI = request.getRequestURI(); log.error("请求地址'{}',参数异常'{}'", requestURI, e.getMessage()); return AjaxResult.error(ResultConstants.THREE_INSTITUTION_PARAMM_NULL); } /** * 通用异常 */ ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
@@ -3,6 +3,7 @@ import javax.annotation.Resource; import com.ruoyi.framework.web.domain.login.LoginVo; import com.ruoyi.system.service.InstitutionalManagerService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.AuthenticationManager; @@ -54,6 +55,7 @@ @Autowired private ISysConfigService configService; /** * 登录验证 @@ -220,4 +222,5 @@ loginVo.setToken(tokenService.createToken(loginUser)); return loginVo; } } ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/ThreeInstitutionService.java
对比新文件 @@ -0,0 +1,85 @@ package com.ruoyi.framework.web.service; import com.alibaba.fastjson2.JSONObject; import com.ruoyi.common.constant.ResultConstants; import com.ruoyi.common.core.domain.model.InstitutionUser; import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.signature.AESUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.ip.IpUtils; import com.ruoyi.framework.web.domain.threeAccess.req.AccessReqDTO; import com.ruoyi.framework.web.domain.threeAccess.resp.AccessRespDTO; import com.ruoyi.system.domain.InstitutionalManager; import com.ruoyi.system.service.InstitutionalManagerService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.time.LocalDateTime; @Component public class ThreeInstitutionService{ @Autowired private InstitutionalManagerService managerService; @Autowired private TokenService tokenService; public String getToken(JSONObject jsonObject){ String data = jsonObject.getString("data"); if(StringUtils.isEmpty(data)){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); } //解密 String decrypt = ""; try { decrypt = AESUtils.decrypt(data); }catch (Exception e){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); } //反序列化 AccessReqDTO accessReqDTO = JSONObject.parseObject(decrypt, AccessReqDTO.class); if(accessReqDTO==null){ throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_ERROR); } if (StringUtils.isEmpty(accessReqDTO.getAccessKey())){ throw new BusinessException(this.getClass(), ResultConstants.ACCESSkEY_ERROR_NULL); } if (StringUtils.isEmpty(accessReqDTO.getSecretKey())){ throw new BusinessException(this.getClass(), ResultConstants.SECRETKEY_ERROR_NULL); } InstitutionalManager institutional = managerService.getInstitutionalByAccessKey(accessReqDTO.getAccessKey()); if(institutional==null){ throw new BusinessException(this.getClass(), ResultConstants.ACCESSkEY_INVALID); } //简单校验 if(!institutional.getSecretKey().equals(accessReqDTO.getSecretKey())){ throw new BusinessException(this.getClass(), ResultConstants.INSTITUTION_AUTHENTICATION); } //封装数据 InstitutionUser institutionUser = new InstitutionUser(); BeanUtils.copyProperties(institutional,institutionUser); String threeInToken = tokenService.createThreeInToken(institutionUser); //封装 AccessRespDTO accessRespDTO = new AccessRespDTO(); accessRespDTO.setExpireTime(institutionUser.getExpireTime()); accessRespDTO.setAccessToken(threeInToken); String jsonString = JSONObject.toJSONString(accessRespDTO); //加密 String encrypt = AESUtils.encrypt(jsonString); //记录访问请求token时间以及地址 recordInstitution(institutional.getId()); return encrypt; } private void recordInstitution(Long institutionId) { InstitutionalManager institutionalManager = new InstitutionalManager(); institutionalManager.setId(institutionId); institutionalManager.setAccessIp(IpUtils.getIpAddr()); institutionalManager.setAccessTime(LocalDateTime.now()); managerService.updateById(institutionalManager); } } ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java
@@ -4,6 +4,11 @@ import java.util.Map; import java.util.concurrent.TimeUnit; import javax.servlet.http.HttpServletRequest; import com.ruoyi.common.constant.ResultConstants; import com.ruoyi.common.core.domain.model.InstitutionUser; import com.ruoyi.common.exception.BusinessException; import io.swagger.models.auth.In; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -45,11 +50,31 @@ @Value("${token.expireTime}") private int expireTime; //三方头自定义标识 @Value("${threeToken.header}") private String threeInHeader; //三方密钥 @Value("${threeToken.secret}") private String threeInsecret; //三方token过期时间 @Value("${threeToken.expireTime}") private int threeInExpireTime; protected static final long MILLIS_SECOND = 1000; protected static final long MILLIS_MINUTE = 60 * MILLIS_SECOND; protected static final long MILLIS_HOUR = 60 * MILLIS_MINUTE; protected static final long MILLIS_DAY = 24 * MILLIS_HOUR; private static final Long MILLIS_MINUTE_TEN = 20 * 60 * 1000L; @Autowired private RedisCache redisCache; @@ -82,6 +107,7 @@ return null; } /** * 设置用户身份信息 */ @@ -92,6 +118,8 @@ refreshToken(loginUser); } } /** * 删除用户身份信息 @@ -152,6 +180,8 @@ String userKey = getTokenKey(loginUser.getToken()); redisCache.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES); } /** * 设置用户代理信息 @@ -228,4 +258,114 @@ { return CacheConstants.LOGIN_TOKEN_KEY + uuid; } /** * 三方机构校验tokenKey * @param uuid * @return */ private String getThreeInTokenKey(String uuid){ return CacheConstants.THREE_INSTITUTION_TOKEN_KEY + uuid; } /** * 获取三方用户身份信息 * * @return 用户信息 */ public InstitutionUser getThreeInUser(HttpServletRequest request) { // 获取请求携带的令牌 String token = request.getHeader(threeInHeader); if (StringUtils.isNotEmpty(token)) { try { // 解析对应的权限以及用户信息 String userKey = getThreeInTokenKey(token); InstitutionUser institutionUser = redisCache.getCacheObject(userKey); return institutionUser; } catch (Exception e) { log.error("获取三方用户信息异常'{}'", e.getMessage()); } } else { throw new BusinessException(ResultConstants.ACCESS_TOKEN_LOSE); } return null; } /** * 设置三方用户身份信息 */ public void setInstitutionUser(InstitutionUser institutionUser) { if (StringUtils.isNotNull(institutionUser) && StringUtils.isNotEmpty(institutionUser.getToken())) { refreshThreeInToken(institutionUser); } } /** * 刷新三方令牌有效期 * * @param institutionUser 验证信息 */ public void refreshThreeInToken(InstitutionUser institutionUser) { // 根据uuid将机构缓存 String userKey = getThreeInTokenKey(institutionUser.getToken()); institutionUser.setExpireTime(System.currentTimeMillis() + threeInExpireTime * MILLIS_DAY); redisCache.setCacheObject(userKey, institutionUser, threeInExpireTime, TimeUnit.DAYS); } /** * 创建三方机构令牌 * * @param institutionUser 用户信息 * @return 令牌 */ public String createThreeInToken(InstitutionUser institutionUser) { String token = IdUtils.fastUUID(); institutionUser.setToken(token); setThreeInAgent(institutionUser); refreshThreeInToken(institutionUser); return token; } /** * 设置用户代理信息 * * @param institutionUser 登录信息 */ public void setThreeInAgent(InstitutionUser institutionUser) { UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent")); String ip = IpUtils.getIpAddr(); institutionUser.setIpaddr(ip); institutionUser.setLocation(AddressUtils.getRealAddressByIP(ip)); institutionUser.setBrowser(userAgent.getBrowser().getName()); institutionUser.setOs(userAgent.getOperatingSystem().getName()); } /** * 验证令牌有效期,相差不足20分钟,自动刷新缓存 * * @param institutionUser * @return */ public void verifyThreeInToken(InstitutionUser institutionUser) { long expireTime = institutionUser.getExpireTime(); long currentTime = System.currentTimeMillis(); if (expireTime - currentTime <= MILLIS_MINUTE_TEN) { refreshThreeInToken(institutionUser); } } } ruoyi-system/src/main/java/com/ruoyi/system/domain/InstitutionalManager.java
对比新文件 @@ -0,0 +1,53 @@ package com.ruoyi.system.domain; import com.baomidou.mybatisplus.annotation.*; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import org.springframework.data.annotation.Id; import java.time.LocalDateTime; @TableName("institution_manager") @Data public class InstitutionalManager { @Id @TableId(type = IdType.AUTO) private Long id; //编号 private Long institutionCode; //机构名称 private String institutionalName; //key private String accessKey; //密钥 private String secretKey; //联系人电话 private String phone; //联系人 private String contacts; private LocalDateTime accessTime; //访问ip private String accessIp; //0启用,1禁用 private Byte status; //删除标识(0未删除,1删除) private Byte delFlag; /** 创建者 */ @TableField(fill = FieldFill.INSERT) private String createBy; /** 创建时间 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @TableField(fill = FieldFill.INSERT) private LocalDateTime createTime; /** 更新者 */ @TableField(fill = FieldFill.INSERT_UPDATE) private String updateBy; /** 更新时间 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @TableField(fill = FieldFill.INSERT_UPDATE) private LocalDateTime updateTime; } ruoyi-system/src/main/java/com/ruoyi/system/domain/query/InstitutionManagerQuery.java
对比新文件 @@ -0,0 +1,9 @@ package com.ruoyi.system.domain.query; import lombok.Data; @Data public class InstitutionManagerQuery { private String institutionManagerName; } ruoyi-system/src/main/java/com/ruoyi/system/domain/req/InstitutionModStatusReqDTO.java
对比新文件 @@ -0,0 +1,9 @@ package com.ruoyi.system.domain.req; import lombok.Data; @Data public class InstitutionModStatusReqDTO { private Long id; private Byte status; } ruoyi-system/src/main/java/com/ruoyi/system/domain/req/InstitutionalManagerAddReqDTO.java
对比新文件 @@ -0,0 +1,15 @@ package com.ruoyi.system.domain.req; import lombok.Data; import javax.validation.constraints.NotEmpty; @Data public class InstitutionalManagerAddReqDTO { @NotEmpty(message = "机构名称不可为空") private String institutionalName; @NotEmpty(message = "联系人电话不可为空") private String phone; @NotEmpty(message = "联系人不可为空") private String contacts; } ruoyi-system/src/main/java/com/ruoyi/system/domain/req/InstitutionalManagerModReqDTO.java
对比新文件 @@ -0,0 +1,20 @@ package com.ruoyi.system.domain.req; import lombok.Data; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; @Data public class InstitutionalManagerModReqDTO { @NotNull(message = "主键不可为空") private Long id; @NotEmpty(message = "机构名称不可为空") private String institutionalName; @NotEmpty(message = "联系人电话不可为空") private String phone; @NotEmpty(message = "联系人不可为空") private String contacts; /* @NotNull(message = "状态") private Byte status;*/ } ruoyi-system/src/main/java/com/ruoyi/system/mapper/InstitutionalManagerMapper.java
对比新文件 @@ -0,0 +1,20 @@ package com.ruoyi.system.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.system.domain.InstitutionalManager; import com.ruoyi.system.domain.query.InstitutionManagerQuery; 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 InstitutionalManagerMapper extends BaseMapper<InstitutionalManager> { } ruoyi-system/src/main/java/com/ruoyi/system/service/InstitutionalManagerService.java
对比新文件 @@ -0,0 +1,30 @@ package com.ruoyi.system.service; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.system.domain.InstitutionalManager; import com.ruoyi.system.domain.query.InstitutionManagerQuery; import com.ruoyi.system.domain.req.InstitutionModStatusReqDTO; import com.ruoyi.system.domain.req.InstitutionalManagerAddReqDTO; import com.ruoyi.system.domain.req.InstitutionalManagerModReqDTO; import java.util.List; public interface InstitutionalManagerService extends IService<InstitutionalManager> { int add(InstitutionalManagerAddReqDTO reqDTO); int mod(InstitutionalManagerModReqDTO reqDTO); int del(Long id); InstitutionalManager findById(Long id); List<InstitutionalManager> listByPage(InstitutionManagerQuery query); InstitutionalManager getInstitutionalByAccessKey(String accessKey); int modStatus(InstitutionModStatusReqDTO reqDTO); List<InstitutionalManager> selectInstitutionInfo(); } ruoyi-system/src/main/java/com/ruoyi/system/service/impl/InstitutionalManagerServiceImpl.java
对比新文件 @@ -0,0 +1,110 @@ package com.ruoyi.system.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.InstitutionStatus; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.domain.InstitutionalManager; import com.ruoyi.system.domain.query.InstitutionManagerQuery; import com.ruoyi.system.domain.req.InstitutionModStatusReqDTO; import com.ruoyi.system.service.InstitutionalManagerService; import com.ruoyi.system.domain.req.InstitutionalManagerAddReqDTO; import com.ruoyi.system.domain.req.InstitutionalManagerModReqDTO; import com.ruoyi.system.mapper.InstitutionalManagerMapper; import com.ruoyi.common.enums.coalmineEnums.DeleteStatusEnum; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.RandomUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service("InstitutionalManagerService") public class InstitutionalManagerServiceImpl extends ServiceImpl<InstitutionalManagerMapper, InstitutionalManager> implements InstitutionalManagerService { @Autowired private InstitutionalManagerMapper institutionalManagerMapper; @Override public int add(InstitutionalManagerAddReqDTO reqDTO) { String accessKey = RandomUtil.generateRandomString(20); String secretKey = RandomUtil.generateRandomString(20); InstitutionalManager institutionalManager = new InstitutionalManager(); institutionalManager.setInstitutionalName(reqDTO.getInstitutionalName()); institutionalManager.setDelFlag(DeleteStatusEnum.NO.getStatus()); institutionalManager.setAccessKey(accessKey); institutionalManager.setSecretKey(secretKey); institutionalManager.setInstitutionCode(generateCode()); institutionalManager.setPhone(reqDTO.getPhone()); institutionalManager.setContacts(reqDTO.getContacts()); institutionalManager.setStatus(InstitutionStatus.YES.getStatus()); return institutionalManagerMapper.insert(institutionalManager); } @Override public int mod(InstitutionalManagerModReqDTO reqDTO) { InstitutionalManager institutionalManager = new InstitutionalManager(); institutionalManager.setId(reqDTO.getId()); institutionalManager.setInstitutionalName(reqDTO.getInstitutionalName()); institutionalManager.setPhone(reqDTO.getPhone()); institutionalManager.setContacts(reqDTO.getContacts()); //institutionalManager.setStatus(reqDTO.getStatus()); return institutionalManagerMapper.updateById(institutionalManager); } @Override public int del(Long id) { InstitutionalManager institutionalManager = this.findById(id); if(institutionalManager == null){ throw new ServiceException("该数据不存在"); } institutionalManager.setId(id); institutionalManager.setDelFlag(DeleteStatusEnum.YES.getStatus()); return baseMapper.updateById(institutionalManager); } @Override public InstitutionalManager findById(Long id) { return institutionalManagerMapper.selectOne(new LambdaQueryWrapper<InstitutionalManager>().eq(InstitutionalManager::getId, id) .eq(InstitutionalManager::getDelFlag, DeleteStatusEnum.NO.getStatus())); } @Override public List<InstitutionalManager> listByPage(InstitutionManagerQuery query) { return institutionalManagerMapper.selectList(new LambdaQueryWrapper<InstitutionalManager>().eq(InstitutionalManager::getDelFlag,DeleteStatusEnum.NO.getStatus()) .eq(!StringUtils.isEmpty(query.getInstitutionManagerName()),InstitutionalManager::getInstitutionalName,query.getInstitutionManagerName())); } @Override public InstitutionalManager getInstitutionalByAccessKey(String accessKey) { InstitutionalManager institutionalManager = institutionalManagerMapper.selectOne(new LambdaQueryWrapper<InstitutionalManager>() .eq(InstitutionalManager::getAccessKey, accessKey) .eq(InstitutionalManager::getDelFlag, DeleteStatusEnum.NO.getStatus())); return institutionalManager; } @Override public int modStatus(InstitutionModStatusReqDTO reqDTO) { InstitutionalManager institutionalManager = new InstitutionalManager(); institutionalManager.setId(reqDTO.getId()); institutionalManager.setStatus(reqDTO.getStatus()); return institutionalManagerMapper.updateById(institutionalManager); } @Override public List<InstitutionalManager> selectInstitutionInfo() { return institutionalManagerMapper.selectList(new LambdaQueryWrapper<InstitutionalManager>().eq(InstitutionalManager::getDelFlag,DeleteStatusEnum.NO.getStatus())); } //生成编码 private Long generateCode() { Long code = 1000l; Long count = institutionalManagerMapper.selectCount(new LambdaQueryWrapper<>()); code += count; return code; } } ruoyi-system/src/main/resources/mapper/system/InstitutionManagerMapper.xml
对比新文件 @@ -0,0 +1,19 @@ <?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.ruoyi.system.mapper.InstitutionalManagerMapper"> <select id="list" resultType="com.ruoyi.system.domain.InstitutionalManager"> select * from institution_manager where del_flag = 0 <if test="query.institutionalName != null and query.institutionalName != ''"> and institutional_name like concat('%', #{query.institutionalName}, '%') </if> order by create_time desc </select> </mapper>