From 21362fd048558832cdcaca8ee957d2d7aa753be2 Mon Sep 17 00:00:00 2001 From: zhangf <1603559716@qq.com> Date: 星期一, 24 六月 2024 09:04:41 +0800 Subject: [PATCH] 三方接口 --- exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThBatchCourseVO.java | 20 ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java | 11 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThQuestionBankReqDTO.java | 20 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/TripartiteInterfaceController.java | 316 +++ exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchManagerService.java | 17 ruoyi-common/src/main/java/com/ruoyi/common/signature/AESUtils.java | 94 exam-system/src/main/resources/mapper/institutionaccess/ThCourseMapper.xml | 13 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/InstitutionUser.java | 48 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThExamRecordManagerServiceImpl.java | 19 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentCourseServiceImpl.java | 60 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyAuthServiceImpl.java | 29 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchService.java | 16 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThErrorDataRespDTO.java | 14 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudyTrackVO.java | 19 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudentMapper.java | 17 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchCourseService.java | 26 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchOpenReqDTO.java | 8 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudentCourseService.java | 24 exam-system/src/main/resources/mapper/institutionaccess/ThStudyDetailMapper.xml | 62 ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/UUID.java | 17 exam-system/src/main/resources/mapper/institutionaccess/ThQuestionBankMapper.xml | 8 exam-system/src/main/resources/mapper/institutionaccess/ThStudyTrackMapper.xml | 9 ruoyi-system/src/main/java/com/ruoyi/system/service/InstitutionalManagerService.java | 30 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/ExamIsPass.java | 42 ruoyi-admin/src/main/resources/application.yml | 10 ruoyi-system/src/main/java/com/ruoyi/system/domain/query/InstitutionManagerQuery.java | 9 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThStudentQuery.java | 9 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudyDetail.java | 57 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/HaveExam.java | 41 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThCourseChapterReqDTO.java | 29 ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java | 140 + exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThStudentRespDTO.java | 9 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThExamRecordVO.java | 48 exam-system/src/main/resources/mapper/institutionaccess/ThStudyAuthMapper.xml | 9 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThBatchCourse.java | 20 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThQuestionBankMapper.java | 11 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThCourseQuery.java | 9 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThReturnRespDTO.java | 6 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/CourseHaveResourse.java | 44 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThCourseDeleteReqDTO.java | 8 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/OpenStatus.java | 42 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyTrackMapper.java | 16 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudyAuthVO.java | 20 ruoyi-system/src/main/java/com/ruoyi/system/domain/req/InstitutionModStatusReqDTO.java | 9 exam-system/src/main/resources/mapper/institutionaccess/ThBatchCourseMapper.xml | 41 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThStudyTrackReqDTO.java | 20 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/TripartiteInterfaceServiceImpl.java | 1146 +++++++++++ exam-system/pom.xml | 2 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudentService.java | 18 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchManagerServiceImpl.java | 142 + exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentManagerServiceImpl.java | 27 ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java | 4 ruoyi-common/src/main/java/com/ruoyi/common/exception/BusinessException.java | 10 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudentManagerService.java | 10 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThExamRecordMapper.java | 18 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseChapterService.java | 17 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThBatchVO.java | 38 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/FinishStatus.java | 41 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThBatchMapper.java | 17 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThCourseChapterMapper.java | 18 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/StudentSex.java | 43 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchServiceImpl.java | 35 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyRecordManagerServiceImpl.java | 70 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThStudyDetailQuery.java | 18 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudent.java | 45 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/CourseResourceType.java | 42 ruoyi-common/src/main/java/com/ruoyi/common/utils/RandomUtil.java | 40 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThCourse.java | 44 ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java | 7 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyAuthMapper.java | 15 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudentCourseVO.java | 18 ruoyi-system/src/main/java/com/ruoyi/system/mapper/InstitutionalManagerMapper.java | 20 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThBatchManagerController.java | 34 ruoyi-system/src/main/java/com/ruoyi/system/domain/InstitutionalManager.java | 53 ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/threeAccess/resp/AccessRespDTO.java | 10 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudentCourseMapper.java | 24 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/StudentCourseReqDTO.java | 9 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/FaceType.java | 44 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThExamRecordServiceImpl.java | 28 ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/ThreeInstitutionInterceptor.java | 71 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyRecordManagerService.java | 10 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyDetailMapper.java | 23 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThCourseChapterRespDTO.java | 25 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThStudentCourseRespDTO.java | 15 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThQuestionBankServiceImpl.java | 32 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThQuestionBankQuery.java | 9 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThCourseChapter.java | 50 ruoyi-system/src/main/java/com/ruoyi/system/domain/req/InstitutionalManagerAddReqDTO.java | 15 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStatisticStudentVO.java | 10 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyTrackService.java | 12 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ThreeAccessController.java | 36 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudyAuth.java | 28 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyAuthService.java | 14 ruoyi-system/src/main/java/com/ruoyi/system/domain/req/InstitutionalManagerModReqDTO.java | 20 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThStudyDetailReqDTO.java | 35 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyDetailService.java | 21 ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/threeAccess/req/AccessReqDTO.java | 11 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThExamRecordQuery.java | 17 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThCourseChapterVO.java | 24 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThBatchCourseRespDTO.java | 18 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseManagerService.java | 12 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThStudyRecordManagerController.java | 25 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThBatchQuery.java | 18 exam-system/src/main/resources/mapper/institutionaccess/ThExamRecordMapper.xml | 32 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThCourseReqDTO.java | 23 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThQuestionBankService.java | 14 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThExamRecordManagerController.java | 22 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThQuestionBankController.java | 22 exam-system/src/main/resources/mapper/institutionaccess/ThBatchMapper.xml | 22 ruoyi-framework/src/main/java/com/ruoyi/framework/security/context/ThreeInContextHolder.java | 26 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThExamRecordService.java | 14 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThBatch.java | 45 ruoyi-system/src/main/resources/mapper/system/InstitutionManagerMapper.xml | 19 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThCourseRespDTO.java | 35 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/utils/ConvertTimeUtils.java | 38 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThBatchCourseMapper.java | 20 exam-system/src/main/resources/mapper/institutionaccess/ThStudentCourseMapper.xml | 47 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudyVO.java | 10 ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java | 2 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentServiceImpl.java | 40 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java | 6 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThCourseMapper.java | 16 exam-system/src/main/resources/mapper/institutionaccess/ThCourseChapterMapper.xml | 42 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThQuestionBank.java | 46 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThExamRecordReqDTO.java | 28 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchCourseServiceImpl.java | 69 ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java | 7 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchEndReqDTO.java | 9 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchReqDTO.java | 18 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThStudentReqDTO.java | 19 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseChapterServiceImpl.java | 41 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThExamRecordManagerService.java | 10 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/InstitutionalManagerServiceImpl.java | 110 + exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThStudytAuthReqDTO.java | 17 ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java | 3 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseManagerServiceImpl.java | 109 + exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyDetailServiceImpl.java | 48 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThCourseManagerController.java | 32 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyTrackServiceImpl.java | 29 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThExamRecord.java | 56 ruoyi-common/src/main/java/com/ruoyi/common/enums/coalmineEnums/DeleteStatusEnum.java | 9 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThStudentManagerController.java | 23 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThStudentStudyRespDTO.java | 16 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudyDetailVO.java | 64 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseService.java | 19 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/InstitutionalManagerController.java | 61 ruoyi-common/src/main/java/com/ruoyi/common/enums/InstitutionStatus.java | 32 ruoyi-common/src/main/java/com/ruoyi/common/constant/ResultConstants.java | 18 /dev/null | 121 - exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudentCourse.java | 40 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudyTrack.java | 25 ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/ThreeInstitutionService.java | 85 ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java | 6 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/TripartiteInterfaceService.java | 25 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseServiceImpl.java | 48 exam-system/src/main/resources/mapper/institutionaccess/ThStudentMapper.xml | 52 156 files changed, 5,865 insertions(+), 129 deletions(-) diff --git a/exam-system/pom.xml b/exam-system/pom.xml index 76f6c69..6b53c53 100644 --- a/exam-system/pom.xml +++ b/exam-system/pom.xml @@ -17,7 +17,7 @@ <dependencies> <dependency> <groupId>com.ruoyi</groupId> - <artifactId>ruoyi-system</artifactId> + <artifactId>ruoyi-framework</artifactId> </dependency> <!--附件依赖--> <dependency> diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/InstitutionalManagerController.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/InstitutionalManagerController.java new file mode 100644 index 0000000..2539945 --- /dev/null +++ b/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)); + } + + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThBatchManagerController.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThBatchManagerController.java new file mode 100644 index 0000000..01d6c7a --- /dev/null +++ b/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)); + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThCourseManagerController.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThCourseManagerController.java new file mode 100644 index 0000000..a248fe9 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThCourseManagerController.java @@ -0,0 +1,32 @@ +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)); + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThExamRecordManagerController.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThExamRecordManagerController.java new file mode 100644 index 0000000..9717014 --- /dev/null +++ b/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)); + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThQuestionBankController.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThQuestionBankController.java new file mode 100644 index 0000000..3505f8e --- /dev/null +++ b/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)); + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThStudentManagerController.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThStudentManagerController.java new file mode 100644 index 0000000..34828b7 --- /dev/null +++ b/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)); + } + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThStudyRecordManagerController.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/ThStudyRecordManagerController.java new file mode 100644 index 0000000..d5d0da0 --- /dev/null +++ b/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)); + } + + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/TripartiteInterfaceController.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/TripartiteInterfaceController.java new file mode 100644 index 0000000..901a875 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/TripartiteInterfaceController.java @@ -0,0 +1,316 @@ +package com.gkhy.exam.institutionalaccess.controller; + +import com.alibaba.fastjson2.JSONObject; +import com.alibaba.fastjson2.TypeReference; +import com.gkhy.exam.institutionalaccess.enums.*; +import com.gkhy.exam.institutionalaccess.model.req.*; +import com.gkhy.exam.institutionalaccess.service.TripartiteInterfaceService; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.signature.AESUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + + +@RequestMapping("/gov-server/receive") +@RestController +public class TripartiteInterfaceController extends BaseController { + @Autowired + private TripartiteInterfaceService tripartiteInterfaceService; + + @PostMapping("/question/bank") + public AjaxResult receiveQuestionBank(@RequestBody JSONObject jsonObject){ + return success(tripartiteInterfaceService.receiveQuestionBank(jsonObject)); + } + @PostMapping("/course") + public AjaxResult receiveCourse(@RequestBody JSONObject jsonObject){ + return tripartiteInterfaceService.receiveCourse(jsonObject); + } + @PostMapping("/course/delete") + public AjaxResult receiveCourseDelete(@RequestBody JSONObject jsonObject){ + return tripartiteInterfaceService.receiveCourseDelete(jsonObject); + } + + @PostMapping("/batch") + public AjaxResult receiveBatch(@RequestBody JSONObject jsonObject){ + return tripartiteInterfaceService.receiveBatch(jsonObject); + } + @PostMapping("/batch/open") + public AjaxResult receiveBatchOpen(@RequestBody JSONObject jsonObject){ + return tripartiteInterfaceService.receiveBatchOpen(jsonObject); + } + @PostMapping("/student") + public AjaxResult receiveStudent(@RequestBody JSONObject jsonObject){ + return tripartiteInterfaceService.receiveStudent(jsonObject); + } + @PostMapping("/study/detail") + public AjaxResult receiveStudyDetail(@RequestBody JSONObject jsonObject){ + return tripartiteInterfaceService.receiveStudyDetail(jsonObject); + } + @PostMapping("/exam/record") + public AjaxResult receiveExamRecord(@RequestBody JSONObject jsonObject){ + return tripartiteInterfaceService.receiveExamRecord(jsonObject); + } + @PostMapping("/batch/end") + public AjaxResult receiveBarchEnd(@RequestBody JSONObject jsonObject){ + return tripartiteInterfaceService.receiveBarchEnd(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) { + 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)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)20); + 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)20); + child12.setLessonNum(new BigDecimal(1.5)); + child12.setDuration(4500l); + child12.setResourceType((byte)0); + ThCourseChapterReqDTO child13= new ThCourseChapterReqDTO(); + child13.setUuid(UUID.randomUUID().toString()); + child13.setUrl("https://www.baidu.com3333"); + //child13.setDelFlag((byte)0); + child13.setChapterCode("1.3"); + child13.setChapterName("1.3多态"); + child13.setHaveResource((byte)20); + child13.setLessonNum(new BigDecimal(1.5)); + child13.setDuration(1800l); + child13.setResourceType((byte)0); + childList.add(child11); + childList.add(child12); + childList.add(child13); + chapterReqDTO1.setChildren(childList); + chapterList.add(chapterReqDTO1); + thCourseReqDTO.setChapters(chapterList); + + String jsonString = JSONObject.toJSONString(thCourseReqDTO); + String encrypt = AESUtils.encrypt(jsonString); + System.out.println(encrypt); + String decrypt = AESUtils.decrypt("3G5/kr4d9CCjK6/q8LWZ1TZK6SF/GINWmeKzfmtvPZo0W/4Ydd7qti1VaOO4LQcKNNN67kvSfjCx3xUS1iAiUcWaVllWpVeNW8FWHt/1OQ+coFyslHVXDdCbQIVYpzF/0Q4jdBXpydtEmVsxifazo3l5/a2NBG319hhCXFNJmY5DgF2SUq7t6niKaEom6QbcFTENqV1KNZ87QeI7dl18UveADgxP91XpaRb+4M0JGIYpiXnr/LEDNAYM13eU6LSK+mBc38QQ+WcxijYGFvk1U6rlMYui3aLisyPLaFEwlhZ9Mscsrdw3t+XNJNp6SKiTG4HCOvSBYOGHp2PHhFQBNHzluOlcA5L8a4nogDpThwcl47O474VXnp0WG2+9DYVUTXW/UddZSc/aCCIhe/DTfA7WoZkOnMO8k8fHlXQ0exHnfPxBTxozG3UKyQ6hGHyjWqrfk/oVRcfOcPCQavIwwu9YLQeUpqL88VntE2+sBUPJtGOQrvq6A5No2RHgEGqptrUboMuL/OimEGjTAPdnRKQL+8JqqZf9HSPTCnoSYpTxKAfFf8hKEyMvW8SZzr3BS1MOL11HOTKeaD7kVuCYxEugfrdIzcAFsX9lxHSO2ubHadXektkdpLdMPd8WuLDzUknJqvYPDHBxcIzMea0XAQ=="); + System.out.println(decrypt); + ThCourseReqDTO questionBankReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThCourseReqDTO>() {}); + System.out.println(questionBankReqDTO); + }*/ + + /** + * 课程删除 + */ + /*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(UUID.randomUUID().toString()); + thBatchReqDTO.setBatchName("第一期2024"); + thBatchReqDTO.setTrainOrgName("测试机构"); + thBatchReqDTO.setHaveExam(HaveExam.YES.getStatus()); + thBatchReqDTO.setOpenStatus(OpenStatus.NO.getStatus()); + List<String> courseList = new ArrayList<>(); + courseList.add(new String("20bded7f-660c-4380-b7f9-00f3976e1875")); + thBatchReqDTO.setCourseUuidList(courseList); + 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.setName("李四"); + thStudentReqDTO.setIdcard("11111"); + thStudentReqDTO.setIndustry("ceshj"); + thStudentReqDTO.setPost("post"); + thStudentReqDTO.setPhone("111111"); + thStudentReqDTO.setSex(StudentSex.BOY.getStatus()); + thStudentReqDTO.setTrainOrgName("测试机构"); + thStudentReqDTO.setAuthPhoto("http://baidu.om"); + thStudentReqDTO.setBatchUuid("cc90070e-8d30-4c55-b696-7af25fd98900"); + 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("b1b70bce-06dc-40b0-a3a1-dd595572eaa1"); + 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("cc90070e-8d30-4c55-b696-7af25fd98900"); + thBatchOpenReqDTO.setIdcard("11111"); + String jsonString = JSONObject.toJSONString(thBatchOpenReqDTO); + String encrypt = AESUtils.encrypt(jsonString); + System.out.println(encrypt); + + }*/ + + /** + * 考试记录 + */ + /*public static void main(String[] args) { + ThExamRecordReqDTO thExamRecordReqDTO = new ThExamRecordReqDTO(); + thExamRecordReqDTO.setUuid(UUID.randomUUID().toString()); + thExamRecordReqDTO.setIdcard("1111"); + thExamRecordReqDTO.setExamName("考试1"); + thExamRecordReqDTO.setExamNum(1); + thExamRecordReqDTO.setCourseUuid("20bded7f-660c-4380-b7f9-00f3976e1875"); + thExamRecordReqDTO.setBatchUuid("cc90070e-8d30-4c55-b696-7af25fd98900"); + 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)); + String jsonString = JSONObject.toJSONString(thExamRecordReqDTO); + String encrypt = AESUtils.encrypt(jsonString); + System.out.println(encrypt); + + }*/ + /** + * + */ + /* public static void main(String[] args) { + ThStudyDetailReqDTO thStudyDetailReqDTO = new ThStudyDetailReqDTO(); + thStudyDetailReqDTO.setUuid(UUID.randomUUID().toString()); + thStudyDetailReqDTO.setIdcard("11111"); + thStudyDetailReqDTO.setBatchUuid("cc90070e-8d30-4c55-b696-7af25fd98900"); + 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(UUID.randomUUID().toString()); + 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.setAuthPostion(0l); + thStudytAuthReqDTO.setAuthTime(LocalDateTime.now()); + thStudytAuthReqDTO.setApprovePhoto("454l"); + thStudytAuthReqDTO.setFaceType(FaceType.AUTH.getType()); + thStudytAuthReqDTOList.add(thStudytAuthReqDTO); + thStudyDetailReqDTO.setTrackList(thStudyTrackReqDTOList); + thStudyDetailReqDTO.setStudentAuthList(thStudytAuthReqDTOList); + String jsonString = JSONObject.toJSONString(thStudyDetailReqDTO); + String encrypt = AESUtils.encrypt(jsonString); + System.out.println(encrypt); + + }*/ + public static void main(String[] args) { + String decrypt = AESUtils.decrypt("PmvIbOPyVJ2pYqmGer1YBAij35Tfdk8lufUv+Y2CyqAds/iyh6PwS4dsnUzNO3El4Sk/WXXwbPGQ7UdaV8jznT/3YPqTeLdkxQ/1/6r9pvxuD2tyds8jo9DIBZYVxHpX3/9Z5Byp1UvszWeTWeaiDN+paKNO5v/TcXrosdce2dMGXLwY0i3GYA1JIbWWTTrvoWKJK+k5VW+5NnnDo+2Gj5CNSNv4c2wT7f3hTRy6B66RrRN3xkucCw4VRJZ+r+RK"); + System.out.println(decrypt); + } +} + diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThBatch.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThBatch.java new file mode 100644 index 0000000..c349e25 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThBatch.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; + +/** + * 班次 + */ +@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 openStatus; + private String trainOrgName; + // 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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThBatchCourse.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThBatchCourse.java new file mode 100644 index 0000000..194aabd --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThBatchCourse.java @@ -0,0 +1,20 @@ +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 lombok.Data; +import nonapi.io.github.classgraph.json.Id; + +@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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThCourse.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThCourse.java new file mode 100644 index 0000000..a99f46c --- /dev/null +++ b/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; + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThCourseChapter.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThCourseChapter.java new file mode 100644 index 0000000..ec6ec8a --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThCourseChapter.java @@ -0,0 +1,50 @@ +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; + + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThExamRecord.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThExamRecord.java new file mode 100644 index 0000000..d3fc2ad --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThExamRecord.java @@ -0,0 +1,56 @@ +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 courseUuid; + 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; + private Integer examNum; + //删除标志(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; + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThQuestionBank.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThQuestionBank.java new file mode 100644 index 0000000..11e0eab --- /dev/null +++ b/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; + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudent.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudent.java new file mode 100644 index 0000000..6df820f --- /dev/null +++ b/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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudentCourse.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudentCourse.java new file mode 100644 index 0000000..6bafe27 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudentCourse.java @@ -0,0 +1,40 @@ +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_course") +@Data +public class ThStudentCourse { + @Id + @TableId(type = IdType.AUTO) + private Long id; + private String idcard; + private String courseUuid; + 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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudyAuth.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudyAuth.java new file mode 100644 index 0000000..4a53bba --- /dev/null +++ b/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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudyDetail.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudyDetail.java new file mode 100644 index 0000000..5bed643 --- /dev/null +++ b/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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudyTrack.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThStudyTrack.java new file mode 100644 index 0000000..f56d49a --- /dev/null +++ b/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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/CourseHaveResourse.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/CourseHaveResourse.java new file mode 100644 index 0000000..93787e6 --- /dev/null +++ b/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; + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/CourseResourceType.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/CourseResourceType.java new file mode 100644 index 0000000..86c4da5 --- /dev/null +++ b/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; + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/ExamIsPass.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/ExamIsPass.java new file mode 100644 index 0000000..0dc6e87 --- /dev/null +++ b/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; + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/FaceType.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/FaceType.java new file mode 100644 index 0000000..aefde5a --- /dev/null +++ b/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; + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/FinishStatus.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/FinishStatus.java new file mode 100644 index 0000000..48ccf66 --- /dev/null +++ b/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; + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/HaveExam.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/HaveExam.java new file mode 100644 index 0000000..59415cf --- /dev/null +++ b/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; + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/OpenStatus.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/OpenStatus.java new file mode 100644 index 0000000..f15043e --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/OpenStatus.java @@ -0,0 +1,42 @@ +package com.gkhy.exam.institutionalaccess.enums; + + +public enum OpenStatus { + //开班(0否,1是) + NO((byte)0,"否"), + YES((byte)1,"是"), + ; + + 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; + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/StudentSex.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/StudentSex.java new file mode 100644 index 0000000..3f304c4 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/enums/StudentSex.java @@ -0,0 +1,43 @@ +package com.gkhy.exam.institutionalaccess.enums; + + +public enum StudentSex { + + BOY((byte)0,"男"), + GIRL((byte)1,"女"), + ; + + 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; + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThBatchCourseMapper.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThBatchCourseMapper.java new file mode 100644 index 0000000..a51ae88 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThBatchCourseMapper.java @@ -0,0 +1,20 @@ +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> getListByBatchUuids(@Param("batchUuids")List<String> batchUuids); + + List<ThBatchCourseVO> getListByBatchUuid(@Param("batchUuid")String batchUuid); +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThBatchMapper.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThBatchMapper.java new file mode 100644 index 0000000..b53dae0 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThBatchMapper.java @@ -0,0 +1,17 @@ +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); +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThCourseChapterMapper.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThCourseChapterMapper.java new file mode 100644 index 0000000..846c2a8 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThCourseChapterMapper.java @@ -0,0 +1,18 @@ +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); +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThCourseMapper.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThCourseMapper.java new file mode 100644 index 0000000..bc8ae80 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThCourseMapper.java @@ -0,0 +1,16 @@ +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 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<ThCourse> listByPage(@Param("query") ThCourseQuery query); +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThExamRecordMapper.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThExamRecordMapper.java new file mode 100644 index 0000000..67f10f4 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThExamRecordMapper.java @@ -0,0 +1,18 @@ +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); +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThQuestionBankMapper.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThQuestionBankMapper.java new file mode 100644 index 0000000..8af4b31 --- /dev/null +++ b/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> { +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudentCourseMapper.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudentCourseMapper.java new file mode 100644 index 0000000..c454a74 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudentCourseMapper.java @@ -0,0 +1,24 @@ +package com.gkhy.exam.institutionalaccess.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.gkhy.exam.institutionalaccess.entity.ThStudentCourse; +import com.gkhy.exam.institutionalaccess.model.vo.ThStatisticStudentVO; +import com.gkhy.exam.institutionalaccess.model.vo.ThStudentCourseVO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Mapper +@Repository +public interface ThStudentCourseMapper extends BaseMapper<ThStudentCourse> { + + List<ThStatisticStudentVO> statisticByBatchUuid(); + + List<ThStatisticStudentVO> statisticByCourseUuid(); + + List<ThStudentCourseVO> getListByBatchUuid(@Param("batchUuid") String batchUuid); + + void updateByBatchUuid(@Param("batchUuid")String batchUuid); +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudentMapper.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudentMapper.java new file mode 100644 index 0000000..5d91a2a --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudentMapper.java @@ -0,0 +1,17 @@ +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> { + int updateByIdcard(@Param("list") List<ThStudent> list); + + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyAuthMapper.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyAuthMapper.java new file mode 100644 index 0000000..c5530f5 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyAuthMapper.java @@ -0,0 +1,15 @@ +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); +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyDetailMapper.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyDetailMapper.java new file mode 100644 index 0000000..c6b938a --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyDetailMapper.java @@ -0,0 +1,23 @@ +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); +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyTrackMapper.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyTrackMapper.java new file mode 100644 index 0000000..955c656 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/mapper/ThStudyTrackMapper.java @@ -0,0 +1,16 @@ +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); +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThBatchQuery.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThBatchQuery.java new file mode 100644 index 0000000..9321e8d --- /dev/null +++ b/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; + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThCourseQuery.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThCourseQuery.java new file mode 100644 index 0000000..5629883 --- /dev/null +++ b/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; + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThExamRecordQuery.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThExamRecordQuery.java new file mode 100644 index 0000000..597d7ca --- /dev/null +++ b/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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThQuestionBankQuery.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThQuestionBankQuery.java new file mode 100644 index 0000000..c6262a0 --- /dev/null +++ b/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; + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThStudentQuery.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThStudentQuery.java new file mode 100644 index 0000000..59d3456 --- /dev/null +++ b/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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThStudyDetailQuery.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThStudyDetailQuery.java new file mode 100644 index 0000000..7bf5a34 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThStudyDetailQuery.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 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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/StudentCourseReqDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/StudentCourseReqDTO.java new file mode 100644 index 0000000..611821d --- /dev/null +++ b/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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchEndReqDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchEndReqDTO.java new file mode 100644 index 0000000..937d808 --- /dev/null +++ b/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; + private String idcard; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchOpenReqDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchOpenReqDTO.java new file mode 100644 index 0000000..e6351d0 --- /dev/null +++ b/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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchReqDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchReqDTO.java new file mode 100644 index 0000000..26c2eea --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThBatchReqDTO.java @@ -0,0 +1,18 @@ +package com.gkhy.exam.institutionalaccess.model.req; + +import lombok.Data; + +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 openStatus; + //private Byte delFlag; + private List<String> courseUuidList; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThCourseChapterReqDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThCourseChapterReqDTO.java new file mode 100644 index 0000000..dbb783b --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThCourseChapterReqDTO.java @@ -0,0 +1,29 @@ +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 List<ThCourseChapterReqDTO> children; + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThCourseDeleteReqDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThCourseDeleteReqDTO.java new file mode 100644 index 0000000..014487f --- /dev/null +++ b/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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThCourseReqDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThCourseReqDTO.java new file mode 100644 index 0000000..a5f743b --- /dev/null +++ b/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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThExamRecordReqDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThExamRecordReqDTO.java new file mode 100644 index 0000000..968d18b --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThExamRecordReqDTO.java @@ -0,0 +1,28 @@ +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 courseUuid; + 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; + private Integer examNum; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThQuestionBankReqDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThQuestionBankReqDTO.java new file mode 100644 index 0000000..1197183 --- /dev/null +++ b/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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThStudentReqDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThStudentReqDTO.java new file mode 100644 index 0000000..ee17906 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThStudentReqDTO.java @@ -0,0 +1,19 @@ +package com.gkhy.exam.institutionalaccess.model.req; + +import lombok.Data; + +import java.util.List; + +@Data +public class ThStudentReqDTO { + 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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThStudyDetailReqDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThStudyDetailReqDTO.java new file mode 100644 index 0000000..10854f8 --- /dev/null +++ b/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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThStudyTrackReqDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThStudyTrackReqDTO.java new file mode 100644 index 0000000..49283b7 --- /dev/null +++ b/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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThStudytAuthReqDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThStudytAuthReqDTO.java new file mode 100644 index 0000000..3e0595a --- /dev/null +++ b/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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThBatchCourseRespDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThBatchCourseRespDTO.java new file mode 100644 index 0000000..59c379b --- /dev/null +++ b/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; + + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThCourseChapterRespDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThCourseChapterRespDTO.java new file mode 100644 index 0000000..e50cb8c --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThCourseChapterRespDTO.java @@ -0,0 +1,25 @@ +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 List<ThCourseChapterRespDTO> children; + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThCourseRespDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThCourseRespDTO.java new file mode 100644 index 0000000..9c55cc0 --- /dev/null +++ b/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; + + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThErrorDataRespDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThErrorDataRespDTO.java new file mode 100644 index 0000000..98a9a15 --- /dev/null +++ b/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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThReturnRespDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThReturnRespDTO.java new file mode 100644 index 0000000..fc79533 --- /dev/null +++ b/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 { + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThStudentCourseRespDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThStudentCourseRespDTO.java new file mode 100644 index 0000000..3eba2e3 --- /dev/null +++ b/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; + + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThStudentRespDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThStudentRespDTO.java new file mode 100644 index 0000000..4fb15cf --- /dev/null +++ b/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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThStudentStudyRespDTO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThStudentStudyRespDTO.java new file mode 100644 index 0000000..80b4078 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/resp/ThStudentStudyRespDTO.java @@ -0,0 +1,16 @@ +package com.gkhy.exam.institutionalaccess.model.resp; + +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class ThStudentStudyRespDTO { + private String idcard; + private String name; + private BigDecimal lessonNum; + private BigDecimal lessonTocal; + private Byte finishStatus; + private String url; + private String courseName; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThBatchCourseVO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThBatchCourseVO.java new file mode 100644 index 0000000..dbc5db8 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThBatchCourseVO.java @@ -0,0 +1,20 @@ +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 lombok.Data; +import nonapi.io.github.classgraph.json.Id; + +@TableName("th_batch_course") +@Data +public class ThBatchCourseVO { + + private Long id; + private String courseUuid; + private String batchUuid; + private String courseName; + //视频时长 + private Long duration; + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThBatchVO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThBatchVO.java new file mode 100644 index 0000000..16d4aef --- /dev/null +++ b/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 openStatus; + 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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThCourseChapterVO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThCourseChapterVO.java new file mode 100644 index 0000000..3eafa27 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThCourseChapterVO.java @@ -0,0 +1,24 @@ +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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThExamRecordVO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThExamRecordVO.java new file mode 100644 index 0000000..a8ccf02 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThExamRecordVO.java @@ -0,0 +1,48 @@ +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; + private Integer examNum; + //删除标志(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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStatisticStudentVO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStatisticStudentVO.java new file mode 100644 index 0000000..dadcbb5 --- /dev/null +++ b/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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudentCourseVO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudentCourseVO.java new file mode 100644 index 0000000..fb5b287 --- /dev/null +++ b/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; + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudyAuthVO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudyAuthVO.java new file mode 100644 index 0000000..258c5b2 --- /dev/null +++ b/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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudyDetailVO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudyDetailVO.java new file mode 100644 index 0000000..b7000a8 --- /dev/null +++ b/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 catalogName; + 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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudyTrackVO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudyTrackVO.java new file mode 100644 index 0000000..88de81b --- /dev/null +++ b/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; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudyVO.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudyVO.java new file mode 100644 index 0000000..5f3982d --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/vo/ThStudyVO.java @@ -0,0 +1,10 @@ +package com.gkhy.exam.institutionalaccess.model.vo; + +import lombok.Data; + +@Data +public class ThStudyVO { + private String idcard; + private String name; + private Long duration; +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchCourseService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchCourseService.java new file mode 100644 index 0000000..770f3d8 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchCourseService.java @@ -0,0 +1,26 @@ +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.entity.ThStudentCourse; +import com.gkhy.exam.institutionalaccess.model.vo.ThBatchCourseVO; +import com.gkhy.exam.institutionalaccess.model.vo.ThBatchVO; + +import java.util.List; + +public interface ThBatchCourseService extends IService<ThBatchCourse> { + List<ThBatchCourse> getByBatchUuid(String uuid); + List<String> getCourseUuisByBatchUuid(String batchUuid); + + void deleteByBatchUuidAndCourseUuid(List<ThBatchCourse> deleteBatchCourseList); + + + List<ThBatchCourseVO> getListByBatchUuids(List<String> batchUuids); + + List<ThBatchCourseVO> getListByBatchUuid(String batchUuid); + + boolean isExsit(String courseUuid); + + List<ThBatchCourse> listByInstitutionId(Long InstitutionId); +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchManagerService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchManagerService.java new file mode 100644 index 0000000..abcb8de --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchManagerService.java @@ -0,0 +1,17 @@ +package com.gkhy.exam.institutionalaccess.service; + +import com.gkhy.exam.institutionalaccess.entity.ThBatch; +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.ThBatchVO; + +import java.util.List; + +public interface ThBatchManagerService { + List<ThBatchVO> listByPage(ThBatchQuery query); + + List<ThBatchCourseRespDTO> period(String batchUuid); + + List<ThStudentStudyRespDTO> getStudent(String batchUuid); +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchService.java new file mode 100644 index 0000000..1dad1fc --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThBatchService.java @@ -0,0 +1,16 @@ +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 java.util.List; + +public interface ThBatchService extends IService<ThBatch> { + ThBatch getByUuid(String uuid); + + List<ThBatch> listByInstitutionId(Long institutionId); + + List<ThBatchVO> listByPage(ThBatchQuery query); +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseChapterService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseChapterService.java new file mode 100644 index 0000000..edfe1ec --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseChapterService.java @@ -0,0 +1,17 @@ +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 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); + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseManagerService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseManagerService.java new file mode 100644 index 0000000..7404b00 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseManagerService.java @@ -0,0 +1,12 @@ +package com.gkhy.exam.institutionalaccess.service; + +import com.gkhy.exam.institutionalaccess.model.query.ThCourseQuery; +import com.gkhy.exam.institutionalaccess.model.resp.ThCourseRespDTO; + +import java.util.List; + +public interface ThCourseManagerService { + List<ThCourseRespDTO> listByPage(ThCourseQuery query); + + ThCourseRespDTO findById(Long id); +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseService.java new file mode 100644 index 0000000..98e1b76 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThCourseService.java @@ -0,0 +1,19 @@ +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 org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface ThCourseService extends IService<ThCourse> { + List<ThCourse> listByPage(@Param("query") ThCourseQuery query); + + ThCourse getByUuid(String uuid); + + List<ThCourse> selectByUuid(List<String> courseUuidList); + + List<ThCourse> listByInstitutionId(Long institutionId); + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThExamRecordManagerService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThExamRecordManagerService.java new file mode 100644 index 0000000..20aef72 --- /dev/null +++ b/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); +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThExamRecordService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThExamRecordService.java new file mode 100644 index 0000000..244b538 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThExamRecordService.java @@ -0,0 +1,14 @@ +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 java.util.List; + +public interface ThExamRecordService extends IService<ThExamRecord> { + List<ThExamRecord> listByInstitutionId(Long institutionId); + + List<ThExamRecordVO> listByPage(ThExamRecordQuery query); +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThQuestionBankService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThQuestionBankService.java new file mode 100644 index 0000000..b248c74 --- /dev/null +++ b/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); +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudentCourseService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudentCourseService.java new file mode 100644 index 0000000..6421100 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudentCourseService.java @@ -0,0 +1,24 @@ +package com.gkhy.exam.institutionalaccess.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gkhy.exam.institutionalaccess.entity.ThCourse; +import com.gkhy.exam.institutionalaccess.entity.ThStudentCourse; +import com.gkhy.exam.institutionalaccess.model.vo.ThStatisticStudentVO; +import com.gkhy.exam.institutionalaccess.model.vo.ThStudentCourseVO; + +import java.util.List; + +public interface ThStudentCourseService extends IService<ThStudentCourse> { + List<ThStudentCourse> getByIdCards(List<String> idcards); + List<ThStatisticStudentVO> statisticByBatchUuid(); + + List<ThStudentCourse> listByInstitutionId(Long id); + + List<ThStatisticStudentVO> statisticByCourseUuid(); + + List<ThStudentCourseVO> getListByBatchUuid(String batchUuid); + + void updateByBatchUuid(String batchUuid); + + List<ThStudentCourse> getByIdcardAndBatchUuid(String idcard, String batchUuid); +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudentManagerService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudentManagerService.java new file mode 100644 index 0000000..3543e91 --- /dev/null +++ b/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); +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudentService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudentService.java new file mode 100644 index 0000000..1bc0f2b --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudentService.java @@ -0,0 +1,18 @@ +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 java.util.List; + +public interface ThStudentService extends IService<ThStudent> { + ThStudent getByIdcard(String idcard); + + List<ThStudent> getByIdcards(List<String> idcards); + + int updateByIdcard(List<ThStudent> updateStudentList); + + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyAuthService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyAuthService.java new file mode 100644 index 0000000..6f43457 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyAuthService.java @@ -0,0 +1,14 @@ +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 java.util.List; + +public interface ThStudyAuthService extends IService<ThStudyAuth> { + + List<String> getUuidByStudyDetaiId(String studyDetaiId); + + List<ThStudyAuth> getListByStudyDetaiIds(List<String> detailUuids); +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyDetailService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyDetailService.java new file mode 100644 index 0000000..60f236e --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyDetailService.java @@ -0,0 +1,21 @@ +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); +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyRecordManagerService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyRecordManagerService.java new file mode 100644 index 0000000..0bf3156 --- /dev/null +++ b/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); +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyTrackService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyTrackService.java new file mode 100644 index 0000000..353bc2a --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/ThStudyTrackService.java @@ -0,0 +1,12 @@ +package com.gkhy.exam.institutionalaccess.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gkhy.exam.institutionalaccess.entity.ThStudyTrack; + +import java.util.List; + +public interface ThStudyTrackService extends IService<ThStudyTrack> { + List<String> getUuidByStudyDetaiId(String studyDetaiId); + + List<ThStudyTrack> getListByStudyDetaiIds(List<String> detailUuids); +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/TripartiteInterfaceService.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/TripartiteInterfaceService.java new file mode 100644 index 0000000..982d587 --- /dev/null +++ b/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 receiveBarchEnd(JSONObject jsonObject); +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchCourseServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchCourseServiceImpl.java new file mode 100644 index 0000000..257ca7b --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchCourseServiceImpl.java @@ -0,0 +1,69 @@ +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.ThBatchCourse; +import com.gkhy.exam.institutionalaccess.entity.ThStudentCourse; +import com.gkhy.exam.institutionalaccess.mapper.ThBatchCourseMapper; +import com.gkhy.exam.institutionalaccess.model.vo.ThBatchCourseVO; +import com.gkhy.exam.institutionalaccess.service.ThBatchCourseService; +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<ThBatchCourseVO> getListByBatchUuids(List<String> batchUuids) { + return batchCourseMapper.getListByBatchUuids(batchUuids); + } + @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())); + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchManagerServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchManagerServiceImpl.java new file mode 100644 index 0000000..6cc4a93 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchManagerServiceImpl.java @@ -0,0 +1,142 @@ +package com.gkhy.exam.institutionalaccess.service.serviceImpl; + + +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.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 ThStudentCourseService thStudentCourseService; + @Autowired + private ThStudyDetailService thStudyDetailService; + + @Override + public List<ThBatchVO> listByPage(ThBatchQuery query) { + List<ThBatchVO> thBatchVOS = thBatchService.listByPage(query); + //统计学员 + List<ThStatisticStudentVO> thStatisticStudentVOS = thStudentCourseService.statisticByBatchUuid(); + if (!CollectionUtils.isEmpty(thBatchVOS)) { + List<String> batchUuids = thBatchVOS.stream().map(ThBatchVO::getUuid).collect(Collectors.toList()); + List<ThBatchCourseVO> batchCourseVOS = thBatchCourseService.getListByBatchUuids(batchUuids); + for (ThBatchVO thBatchVO : thBatchVOS) { + //课程 + List<ThBatchCourseVO> collect = batchCourseVOS.stream().filter(bc -> bc.getBatchUuid().equals(thBatchVO.getUuid())).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; + } + + @Override + public List<ThBatchCourseRespDTO> period(String batchUuid) { + //获取批次关联课程 + List<ThBatchCourseVO> batchCourseVOS = thBatchCourseService.getListByBatchUuid(batchUuid); + //获取关联学生 + List<ThStudentCourseVO> thStudentCourseVOS = thStudentCourseService.getListByBatchUuid(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.getBatchUuid().equals(VO.getBatchUuid())) + .map(sc -> { + ThStudentCourseRespDTO thStudentCourseRespDTO = new ThStudentCourseRespDTO(); + BeanUtils.copyProperties(sc, thStudentCourseRespDTO); + List<ThStudyVO> collect = studyVOS.stream().filter(s -> s.getIdcard().equals(sc.getIdcard())).collect(Collectors.toList()); + 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<ThStudentCourseVO> thStudentCourseVOS = thStudentCourseService.getListByBatchUuid(batchUuid); + //获取学生学习记录 + List<ThStudyDetailVO> studyDetails = thStudyDetailService.listByBatchUuid(batchUuid); + List<ThStudentStudyRespDTO> respDTOS = new ArrayList<>(); + if (!CollectionUtils.isEmpty(thStudentCourseVOS)) { + for (ThStudentCourseVO VO : thStudentCourseVOS) { + ThStudentStudyRespDTO thStudentStudyRespDTO = new ThStudentStudyRespDTO(); + thStudentStudyRespDTO.setIdcard(VO.getIdcard()); + thStudentStudyRespDTO.setName(VO.getName()); + thStudentStudyRespDTO.setCourseName(VO.getCourseName()); + thStudentStudyRespDTO.setLessonTocal(VO.getLessTotal()); + 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.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.setFinishStatus(VO.getFinishStatus()); + thStudentStudyRespDTO.setLessonNum(lessNum); + respDTOS.add(thStudentStudyRespDTO); + } + } + return respDTOS; + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchServiceImpl.java new file mode 100644 index 0000000..6306e7f --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchServiceImpl.java @@ -0,0 +1,35 @@ +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.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.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); + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseChapterServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseChapterServiceImpl.java new file mode 100644 index 0000000..f6038b2 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseChapterServiceImpl.java @@ -0,0 +1,41 @@ +package com.gkhy.exam.institutionalaccess.service.serviceImpl; + +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.ThCourseChapter; +import com.gkhy.exam.institutionalaccess.mapper.ThCourseChapterMapper; +import com.gkhy.exam.institutionalaccess.model.vo.ThCourseChapterVO; +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.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())); + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseManagerServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseManagerServiceImpl.java new file mode 100644 index 0000000..4593d20 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseManagerServiceImpl.java @@ -0,0 +1,109 @@ +package com.gkhy.exam.institutionalaccess.service.serviceImpl; + +import com.gkhy.exam.institutionalaccess.entity.ThCourse; +import com.gkhy.exam.institutionalaccess.entity.ThCourseChapter; +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.vo.ThCourseChapterVO; +import com.gkhy.exam.institutionalaccess.model.vo.ThStatisticStudentVO; +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 java.util.ArrayList; +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 ThStudentCourseService studentCourseService; + + + @Override + public List<ThCourseRespDTO> listByPage(ThCourseQuery query) { + + List<ThCourse> courseList = courseService.listByPage(query); + //分许获取数据 + List<ThStatisticStudentVO> thStatisticStudentVOS = studentCourseService.statisticByCourseUuid(); + + List<ThCourseRespDTO> courseRespDTOList = new ArrayList<>(); + if(!CollectionUtils.isEmpty(courseList)){ + //根据courseids获取所有章节 + List<ThCourseChapterVO> courseChapterVOS = new ArrayList<>(); + List<String> courseUuids = courseList.stream().map(ThCourse::getUuid).collect(Collectors.toList()); + if(!CollectionUtils.isEmpty(courseUuids)){ + courseChapterVOS = courseChapterService.listByCourseUuids(courseUuids); + } + for (ThCourse course : courseList) { + ThCourseRespDTO courseRespDTO = new ThCourseRespDTO(); + BeanUtils.copyProperties(course, courseRespDTO); + //获取章 + List<ThCourseChapterVO> finalCourseChapterVOS = courseChapterVOS; + List<ThCourseChapterRespDTO> chapterList = courseChapterVOS + .stream() + .filter(cc -> course.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(course.getUuid())).collect(Collectors.toList()); + if(statisticList.size()>0){ + ThStatisticStudentVO thStatisticStudentVO = statisticList.get(0); + courseRespDTO.setStudentCount(thStatisticStudentVO.getCount()); + }else { + courseRespDTO.setStudentCount(0); + } + courseRespDTOList.add(courseRespDTO); + } + } + return courseRespDTOList; + } + + //获取单条课程 + @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; + } + + //获取章节 + 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; + } + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseServiceImpl.java new file mode 100644 index 0000000..c24ebd1 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThCourseServiceImpl.java @@ -0,0 +1,48 @@ +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.ThCourse; +import com.gkhy.exam.institutionalaccess.mapper.ThCourseMapper; +import com.gkhy.exam.institutionalaccess.model.query.ThCourseQuery; +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.List; + + +@Service("ThCourseService") +public class ThCourseServiceImpl extends ServiceImpl<ThCourseMapper, ThCourse> implements ThCourseService { + @Autowired + private ThCourseMapper courseMapper; + + @Override + public List<ThCourse> 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; + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThExamRecordManagerServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThExamRecordManagerServiceImpl.java new file mode 100644 index 0000000..ae4ca27 --- /dev/null +++ b/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); + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThExamRecordServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThExamRecordServiceImpl.java new file mode 100644 index 0000000..857ea0f --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThExamRecordServiceImpl.java @@ -0,0 +1,28 @@ +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.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.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); + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThQuestionBankServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThQuestionBankServiceImpl.java new file mode 100644 index 0000000..ee42518 --- /dev/null +++ b/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; + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentCourseServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentCourseServiceImpl.java new file mode 100644 index 0000000..f88d80e --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentCourseServiceImpl.java @@ -0,0 +1,60 @@ +package com.gkhy.exam.institutionalaccess.service.serviceImpl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gkhy.exam.institutionalaccess.entity.ThStudentCourse; +import com.gkhy.exam.institutionalaccess.mapper.ThStudentCourseMapper; +import com.gkhy.exam.institutionalaccess.model.vo.ThStatisticStudentVO; +import com.gkhy.exam.institutionalaccess.model.vo.ThStudentCourseVO; +import com.gkhy.exam.institutionalaccess.service.ThStudentCourseService; +import com.ruoyi.common.enums.coalmineEnums.DeleteStatusEnum; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Collections; +import java.util.List; + + +@Service("ThStudentCourseService") +public class ThStudentCourseServiceImpl extends ServiceImpl<ThStudentCourseMapper, ThStudentCourse> implements ThStudentCourseService { + @Autowired + private ThStudentCourseMapper studentCourseMapper; + @Override + public List<ThStudentCourse> getByIdCards(List<String> idcards) { + + return studentCourseMapper.selectList(new LambdaQueryWrapper<ThStudentCourse>().in(ThStudentCourse::getIdcard, idcards)); + } + + @Override + public List<ThStatisticStudentVO> statisticByBatchUuid() { + return studentCourseMapper.statisticByBatchUuid(); + } + + + @Override + public List<ThStudentCourse> listByInstitutionId(Long institutionId) { + return studentCourseMapper.selectList(new LambdaQueryWrapper<ThStudentCourse>().eq(ThStudentCourse::getInstitutionId, institutionId)); + } + + @Override + public List<ThStatisticStudentVO> statisticByCourseUuid() { + return studentCourseMapper.statisticByCourseUuid(); + } + + @Override + public List<ThStudentCourseVO> getListByBatchUuid(String batchUuid) { + return studentCourseMapper.getListByBatchUuid(batchUuid); + } + + @Override + public void updateByBatchUuid(String batchUuid) { + studentCourseMapper.updateByBatchUuid(batchUuid); + } + + @Override + public List<ThStudentCourse> getByIdcardAndBatchUuid(String idcard, String batchUuid) { + List<ThStudentCourse> thStudentCourse = studentCourseMapper.selectList(new LambdaQueryWrapper<ThStudentCourse>().eq(ThStudentCourse::getIdcard, idcard) + .eq(ThStudentCourse::getBatchUuid, batchUuid).eq(ThStudentCourse::getDelFlag, DeleteStatusEnum.NO.getStatus())); + return thStudentCourse; + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentManagerServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentManagerServiceImpl.java new file mode 100644 index 0000000..53bda1c --- /dev/null +++ b/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())); + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentServiceImpl.java new file mode 100644 index 0000000..3aa5f6f --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudentServiceImpl.java @@ -0,0 +1,40 @@ +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.ThStudent; +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.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> students = studentMapper.selectList(new LambdaQueryWrapper<ThStudent>().in(ThStudent::getIdcard, idcards).eq(ThStudent::getDelFlag, DeleteStatusEnum.NO.getStatus())); + return students; + } + + @Override + public int updateByIdcard(List<ThStudent> updateStudentList) { + return studentMapper.updateByIdcard(updateStudentList); + } + + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyAuthServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyAuthServiceImpl.java new file mode 100644 index 0000000..f221f5c --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyAuthServiceImpl.java @@ -0,0 +1,29 @@ +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.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.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> getListByStudyDetaiIds(List<String> detailUuids) { + return thStudyAuthMapper.selectList(new LambdaQueryWrapper<ThStudyAuth>().in(ThStudyAuth::getStudyDetailUuid, detailUuids)); + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyDetailServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyDetailServiceImpl.java new file mode 100644 index 0000000..b4018d1 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyDetailServiceImpl.java @@ -0,0 +1,48 @@ +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.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.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); + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyRecordManagerServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyRecordManagerServiceImpl.java new file mode 100644 index 0000000..30729bb --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyRecordManagerServiceImpl.java @@ -0,0 +1,70 @@ +package com.gkhy.exam.institutionalaccess.service.serviceImpl; + +import com.gkhy.exam.institutionalaccess.entity.ThStudyAuth; +import com.gkhy.exam.institutionalaccess.entity.ThStudyTrack; +import com.gkhy.exam.institutionalaccess.model.query.ThStudyDetailQuery; +import com.gkhy.exam.institutionalaccess.model.vo.ThStudyAuthVO; +import com.gkhy.exam.institutionalaccess.model.vo.ThStudyDetailVO; +import com.gkhy.exam.institutionalaccess.model.vo.ThStudyTrackVO; +import com.gkhy.exam.institutionalaccess.service.ThStudyAuthService; +import com.gkhy.exam.institutionalaccess.service.ThStudyDetailService; +import com.gkhy.exam.institutionalaccess.service.ThStudyRecordManagerService; +import com.gkhy.exam.institutionalaccess.service.ThStudyTrackService; +import com.gkhy.exam.institutionalaccess.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; + + @Override + public List<ThStudyDetailVO> listByPage(ThStudyDetailQuery query) { + List<ThStudyDetailVO> thStudyDetailVOS = thStudyDetailService.listByPage(query); + + if(!CollectionUtils.isEmpty(thStudyDetailVOS)){ + List<String> detailUuids = thStudyDetailVOS.stream().map(ThStudyDetailVO::getUuid).collect(Collectors.toList()); + //获取认证记录 + List<ThStudyAuth> authList = thStudyAuthService.getListByStudyDetaiIds(detailUuids); + //获取轨迹 + List<ThStudyTrack> trackList = thStudyTrackService.getListByStudyDetaiIds(detailUuids); + + 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); + } + } + return thStudyDetailVOS; + } + + +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyTrackServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyTrackServiceImpl.java new file mode 100644 index 0000000..bc46b90 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyTrackServiceImpl.java @@ -0,0 +1,29 @@ +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)); + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/TripartiteInterfaceServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/TripartiteInterfaceServiceImpl.java new file mode 100644 index 0000000..05577ae --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/TripartiteInterfaceServiceImpl.java @@ -0,0 +1,1146 @@ +package com.gkhy.exam.institutionalaccess.service.serviceImpl; + + +import cn.hutool.core.util.IdUtil; +import com.alibaba.fastjson2.JSONObject; +import com.alibaba.fastjson2.TypeReference; +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.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 { + @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 ThStudentCourseService studentCourseService; + @Autowired + private ThStudyAuthService studyAuthService; + @Autowired + private ThStudyTrackService studyTrackService; + @Autowired + private ThStudyDetailService studyDetailService; + @Autowired + private ThExamRecordService examRecordService; + + @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 = JSONObject.parseObject(decrypt, new TypeReference<ThQuestionBankReqDTO>() {}); + //参数校验 + 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); + } + //反序列化 + ThCourseReqDTO courseReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThCourseReqDTO>() {}); + //校验 + validateCourse(courseReqDTO); + //获取数据 + ThCourse course= courseService.getByUuid(courseReqDTO.getUuid()); + if(course == null){ + //新增 + //课程 + course = new ThCourse(); + BeanUtils.copyProperties(courseReqDTO, course); + course.setId(IdUtil.getSnowflake(0,0).nextId()); + course.setCreateTime(LocalDateTime.now()); + course.setUpdateTime(LocalDateTime.now()); + course.setCreateBy(institutionUser.getInstitutionalName()); + course.setUpdateBy(institutionUser.getInstitutionalName()); + course.setInstitutionId(institutionUser.getId()); + course.setDelFlag(DeleteStatusEnum.NO.getStatus()); + course.setInstitutionName(institutionUser.getInstitutionalName()); + + //章节(章) + List<ThCourseChapter> chapterList = new ArrayList<>(); + for (ThCourseChapterReqDTO chapterReqDTO : courseReqDTO.getChapters()) { + ThCourseChapter chapter = new ThCourseChapter(); + BeanUtils.copyProperties(chapterReqDTO, chapter); + chapter.setCourseUuid(course.getUuid()); + chapter.setId(IdUtil.getSnowflake(0,0).nextId()); + chapter.setParentUuid("0"); + chapter.setInstitutionId(institutionUser.getId()); + chapter.setCreateTime(LocalDateTime.now()); + chapter.setUpdateTime(LocalDateTime.now()); + chapter.setDelFlag(DeleteStatusEnum.NO.getStatus()); + chapter.setCreateBy(institutionUser.getInstitutionalName()); + chapter.setUpdateBy(institutionUser.getInstitutionalName()); + chapterList.add(chapter); + //章节(节) + for (ThCourseChapterReqDTO child : chapterReqDTO.getChildren()) { + ThCourseChapter section = new ThCourseChapter(); + BeanUtils.copyProperties(child, section); + section.setCourseUuid(course.getUuid()); + section.setId(IdUtil.getSnowflake(0,0).nextId()); + section.setParentUuid(chapter.getUuid()); + section.setInstitutionId(institutionUser.getId()); + section.setCreateTime(LocalDateTime.now()); + section.setUpdateTime(LocalDateTime.now()); + section.setDelFlag(DeleteStatusEnum.NO.getStatus()); + section.setCreateBy(institutionUser.getInstitutionalName()); + section.setUpdateBy(institutionUser.getInstitutionalName()); + chapterList.add(section); + } + + } + courseService.save(course); + if(chapterList.size() > 0){ + courseChapterService.saveBatch(chapterList); + } + + }else { + + //获取所有章节 + List<ThCourseChapterVO> courseChapterVOS = courseChapterService.listByCourseUuid(course.getUuid()); + //修改 + //章 + List<ThCourseChapter> saveChapterList = new ArrayList<>(); + List<ThCourseChapter> updateChapterList = new ArrayList<>(); + //章 + for (ThCourseChapterReqDTO chapterReqDTO : courseReqDTO.getChapters()) { + List<ThCourseChapterVO> chapterSelectList = courseChapterVOS.stream().filter(cc -> cc.getUuid().equals(chapterReqDTO.getUuid())).collect(Collectors.toList()); + if(chapterSelectList.size() > 0){ + ThCourseChapterVO courseChapterVO = chapterSelectList.get(0); + //修改 + ThCourseChapter chapter = new ThCourseChapter(); + BeanUtils.copyProperties(chapterReqDTO, chapter); + chapter.setId(courseChapterVO.getId()); + chapter.setUpdateBy(institutionUser.getInstitutionalName()); + chapter.setUpdateTime(LocalDateTime.now()); + updateChapterList.add(chapter); + + for (ThCourseChapterReqDTO child : chapterReqDTO.getChildren()) { + List<ThCourseChapterVO> sectionSelectList = courseChapterVOS.stream().filter(cc -> cc.getUuid().equals(child.getUuid()) && cc.getParentUuid().equals(courseChapterVO.getUuid())).collect(Collectors.toList()); + if(sectionSelectList.size() > 0){ + //修改 + ThCourseChapterVO sectionChapterVO = sectionSelectList.get(0); + ThCourseChapter section = new ThCourseChapter(); + BeanUtils.copyProperties(child, section); + section.setId(sectionChapterVO.getId()); + section.setUpdateBy(institutionUser.getInstitutionalName()); + section.setUpdateTime(LocalDateTime.now()); + updateChapterList.add(section); + }else { + //新增 + ThCourseChapter sectionChapter= new ThCourseChapter(); + BeanUtils.copyProperties(child, sectionChapter); + sectionChapter.setId(IdUtil.getSnowflake(0,0).nextId()); + sectionChapter.setCourseUuid(course.getUuid()); + sectionChapter.setParentUuid(courseChapterVO.getUuid()); + sectionChapter.setInstitutionId(institutionUser.getId()); + sectionChapter.setDelFlag(DeleteStatusEnum.NO.getStatus()); + sectionChapter.setUpdateBy(institutionUser.getInstitutionalName()); + sectionChapter.setUpdateTime(LocalDateTime.now()); + sectionChapter.setCreateBy(institutionUser.getInstitutionalName()); + sectionChapter.setCreateTime(LocalDateTime.now()); + saveChapterList.add(sectionChapter); + } + } + }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(DeleteStatusEnum.NO.getStatus()); + chapter.setCreateTime(LocalDateTime.now()); + chapter.setUpdateTime(LocalDateTime.now()); + chapter.setCreateBy(institutionUser.getInstitutionalName()); + chapter.setUpdateBy(institutionUser.getInstitutionalName()); + saveChapterList.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(DeleteStatusEnum.NO.getStatus()); + section.setInstitutionId(institutionUser.getId()); + section.setCreateTime(LocalDateTime.now()); + section.setUpdateTime(LocalDateTime.now()); + section.setCreateBy(institutionUser.getInstitutionalName()); + section.setUpdateBy(institutionUser.getInstitutionalName()); + saveChapterList.add(section); + } + } + } + + //课程 + course.setCourseCode(courseReqDTO.getCourseCode()); + course.setCourseName(courseReqDTO.getCourseName()); + course.setLessonNum(courseReqDTO.getLessonNum()); + course.setDelFlag(DeleteStatusEnum.NO.getStatus()); + course.setUpdateBy(institutionUser.getInstitutionalName()); + course.setUpdateTime(LocalDateTime.now()); + courseService.updateById(course); + //新增章节 + if(saveChapterList.size() > 0){ + courseChapterService.saveBatch(saveChapterList); + } + //修改章节 + if(updateChapterList.size() > 0){ + courseChapterService.updateBatchById(updateChapterList); + } + + } + return AjaxResult.success(); + } + + @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 = JSONObject.parseObject(decrypt, new TypeReference<List<ThStudentReqDTO>>() {}); + //获取批次课程 + List<ThBatchCourse> batchCourseList = batchCourseService.listByInstitutionId(institutionUser.getId()); + //获取批次学生 + List<ThStudentCourse> studentCourseList = studentCourseService.listByInstitutionId(institutionUser.getId()); + //参数校验 + if(CollectionUtils.isEmpty(studentReqDTOs)){ + throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"学生信息不可为空"); + } + //错误 + List<ThErrorDataRespDTO> errorDataRespDTOS = new ArrayList<>(); + List<ThStudentReqDTO> studentReqDTOList = new ArrayList<>(); + for (ThStudentReqDTO studentReqDTO : studentReqDTOs) { + + if(StringUtils.isEmpty(studentReqDTO.getIdcard())){ + errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getIdcard(),"身份证不可为空")); + continue; + } + if(StringUtils.isEmpty(studentReqDTO.getName())){ + errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getIdcard(),"姓名不可为空")); + continue; + } + if(StringUtils.isEmpty(studentReqDTO.getPhone())){ + errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getIdcard(),"手机号不可为空")); + continue; + } + if(studentReqDTO.getSex() == null || StudentSex.get(studentReqDTO.getSex()) == null){ + errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getIdcard(),"性别不可为空")); + continue; + } + if(StringUtils.isEmpty(studentReqDTO.getAuthPhoto())){ + errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getIdcard(),"实名认证照不可为空")); + continue; + } + if (StringUtils.isEmpty(studentReqDTO.getTrainOrgName())){ + errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getIdcard(),"培训机构名称不可为空")); + continue; + } + if(StringUtils.isEmpty(studentReqDTO.getBatchUuid())){ + errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getIdcard(),"关联批次(班级)不可为空")); + continue; + } + List<ThBatchCourse> collect = batchCourseList.stream().filter(batchCourse -> batchCourse.getBatchUuid().equals(studentReqDTO.getBatchUuid())).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(collect)) { + errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getIdcard(), "批次(班级)不存在,请先添加批次(班级)")); + continue; + } + List<ThStudentCourse> collect1 = studentCourseList.stream().filter(student -> student.getBatchUuid().equals(studentReqDTO.getBatchUuid()) && student.getIdcard().equals(studentReqDTO.getIdcard())).collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(collect1)) { + errorDataRespDTOS.add(new ThErrorDataRespDTO(studentReqDTO.getIdcard(), "学生不可重复加入批次(班级)")); + continue; + } + studentReqDTOList.add(studentReqDTO); + } + if(CollectionUtils.isEmpty(studentReqDTOList)){ + return AjaxResult.success(errorDataRespDTOS); + } + //根据idcards查询 + List<String> idcards = studentReqDTOList.stream().map(ThStudentReqDTO::getIdcard).collect(Collectors.toList()); + List<ThStudent> students = studentService.getByIdcards(idcards); + //List<ThStudentCourse> thStudentCourseList = studentCourseService.getByIdCards(idcards); + + List<ThStudent> saveSudentList = new ArrayList<>(); + List<ThStudentCourse> saveThStudentCourseList = new ArrayList<>(); + List<ThStudent> updateStudentList = new ArrayList<>(); + for (ThStudentReqDTO studentReqDTO : studentReqDTOList) { + List<ThStudent> collect = students.stream().filter(s -> s.getIdcard().equals(studentReqDTO.getIdcard())).collect(Collectors.toList()); + if(collect.size() > 0){ + + //修改 + ThStudent student = collect.get(0); + BeanUtils.copyProperties(studentReqDTO, student); + student.setUpdateBy(institutionUser.getInstitutionalName()); + student.setUpdateTime(LocalDateTime.now()); + student.setInstitutionId(institutionUser.getId()); + student.setInstitutionName(institutionUser.getInstitutionalName()); + updateStudentList.add(student); + + List<ThBatchCourse> scSelectList = batchCourseList.stream().filter(batchCourse -> batchCourse.getBatchUuid().equals(studentReqDTO.getBatchUuid())).collect(Collectors.toList()); + for (ThBatchCourse thStudentCourse : scSelectList) { + //新增 + ThStudentCourse sc = new ThStudentCourse(); + BeanUtils.copyProperties(student, sc); + sc.setId(IdUtil.getSnowflake(0,0).nextId()); + sc.setCourseUuid(thStudentCourse.getCourseUuid()); + sc.setBatchUuid(thStudentCourse.getBatchUuid()); + sc.setFinishStatus(FinishStatus.NO.getStatus()); + saveThStudentCourseList.add(sc); + } + }else { + //新增 + ThStudent student = new ThStudent(); + 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<ThBatchCourse> scSelectList = batchCourseList.stream().filter(batchCourse -> batchCourse.getBatchUuid().equals(studentReqDTO.getBatchUuid())).collect(Collectors.toList()); + for (ThBatchCourse batchCourse : scSelectList) { + ThStudentCourse thStudentCourse = new ThStudentCourse(); + BeanUtils.copyProperties(student, thStudentCourse); + thStudentCourse.setId(IdUtil.getSnowflake(0,0).nextId()); + thStudentCourse.setCourseUuid(batchCourse.getCourseUuid()); + thStudentCourse.setBatchUuid(batchCourse.getBatchUuid()); + thStudentCourse.setFinishStatus(FinishStatus.NO.getStatus()); + saveThStudentCourseList.add(thStudentCourse); + } + } + } + if(saveSudentList.size() > 0){ + studentService.saveBatch(saveSudentList); + } + if(updateStudentList.size() > 0){ + studentService.updateByIdcard(updateStudentList); + } + if(saveThStudentCourseList.size() > 0){ + studentCourseService.saveBatch(saveThStudentCourseList); + } + 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); + } + //反序列化 + ThBatchReqDTO batchReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThBatchReqDTO>() {}); + //参数校验 + validateBatch(batchReqDTO); + //获取数据 + ThBatch batch = batchService.getByUuid(batchReqDTO.getUuid()); + if(batch != null){ + //修改 + List<String> oldCourseUuids = batchCourseService.getCourseUuisByBatchUuid(batch.getUuid()); + BeanUtils.copyProperties(batchReqDTO, batch); + batch.setUpdateBy(institutionUser.getInstitutionalName()); + batch.setUpdateTime(LocalDateTime.now()); + batch.setInstitutionId(institutionUser.getId()); + batch.setInstitutionName(institutionUser.getInstitutionalName()); + batchService.updateById(batch); + //关联课程 + //差集(old-new)| 删除 + List<ThBatchCourse> deleteBatchCourseList = oldCourseUuids + .stream() + .filter(item -> !batchReqDTO.getCourseUuidList().contains(item)) + .map(item -> { + ThBatchCourse batchCourse = new ThBatchCourse(); + batchCourse.setBatchUuid(batchReqDTO.getUuid()); + batchCourse.setCourseUuid(item); + batchCourse.setDelFlag(DeleteStatusEnum.YES.getStatus()); + return batchCourse; + }) + .collect(Collectors.toList()); + //差集(new-old) | 新增 + List<ThBatchCourse> saveBatchCourseList = batchReqDTO.getCourseUuidList().stream() + .filter(item -> !oldCourseUuids.contains(item)) + .map(item -> { + ThBatchCourse batchCourse = new ThBatchCourse(); + batchCourse.setBatchUuid(batchReqDTO.getUuid()); + batchCourse.setCourseUuid(item); + batchCourse.setDelFlag(DeleteStatusEnum.NO.getStatus()); + batchCourse.setInstitutionId(institutionUser.getId()); + return batchCourse; + }).collect(Collectors.toList()); + if(saveBatchCourseList.size() > 0){ + batchCourseService.saveBatch(saveBatchCourseList); + } + if (deleteBatchCourseList.size() > 0){ + batchCourseService.deleteByBatchUuidAndCourseUuid(deleteBatchCourseList); + } + }else { + //新增 + //班次新增 + batch = new ThBatch(); + BeanUtils.copyProperties(batchReqDTO, batch); + batch.setUpdateBy(institutionUser.getInstitutionalName()); + batch.setUpdateTime(LocalDateTime.now()); + batch.setDelFlag(DeleteStatusEnum.NO.getStatus()); + batch.setCreateBy(institutionUser.getInstitutionalName()); + batch.setCreateTime(LocalDateTime.now()); + batch.setInstitutionId(institutionUser.getId()); + batch.setInstitutionName(institutionUser.getInstitutionalName()); + //batch.setFinishStatus(FinishStatus.NO.getStatus()); + batchService.save(batch); + //关联课程 + List<ThBatchCourse> batchCourseList = new ArrayList<>(); + for (String uuid : batchReqDTO.getCourseUuidList()) { + ThBatchCourse batchCourse = new ThBatchCourse(); + batchCourse.setBatchUuid(batch.getUuid()); + batchCourse.setCourseUuid(uuid); + batchCourse.setDelFlag(DeleteStatusEnum.NO.getStatus()); + batchCourse.setInstitutionId(institutionUser.getId()); + batchCourseList.add(batchCourse); + } + if(batchCourseList.size() > 0){ + batchCourseService.saveBatch(batchCourseList); + } + + } + + return AjaxResult.success(); + } + + @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); + } + //反序列化 + ThStudyDetailReqDTO studyDetailReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThStudyDetailReqDTO>() {}); + //参数校验 + validateStudyDetail(studyDetailReqDTO); + + ThStudyDetail thStudyDetail = studyDetailService.getByUuid(studyDetailReqDTO.getUuid()); + if(thStudyDetail == null){ + //新增学习清单 + thStudyDetail = new ThStudyDetail(); + BeanUtils.copyProperties(studyDetailReqDTO, thStudyDetail); + thStudyDetail.setUpdateBy(institutionUser.getInstitutionalName()); + thStudyDetail.setUpdateTime(LocalDateTime.now()); + thStudyDetail.setCreateBy(institutionUser.getInstitutionalName()); + thStudyDetail.setCreateTime(LocalDateTime.now()); + thStudyDetail.setInstitutionId(institutionUser.getId()); + thStudyDetail.setInstitutionName(institutionUser.getInstitutionalName()); + thStudyDetail.setDelFlag(DeleteStatusEnum.NO.getStatus()); + thStudyDetail.setSerialNum(generateSerialNum()); + + //新增认证记录 + List<ThStudyAuth> thStudyAuthList = studyDetailReqDTO.getAuthList().stream().map(sa -> { + ThStudyAuth thStudyAuth = new ThStudyAuth(); + BeanUtils.copyProperties(sa, thStudyAuth); + thStudyAuth.setStudyDetailUuid(studyDetailReqDTO.getUuid()); + return thStudyAuth; + }).collect(Collectors.toList()); + + //新增学习轨迹 + List<ThStudyTrack> thStudyTrackList = studyDetailReqDTO.getTrackList().stream().map(track -> { + ThStudyTrack thStudyTrack = new ThStudyTrack(); + BeanUtils.copyProperties(track, thStudyTrack); + thStudyTrack.setStudyDetailUuid(studyDetailReqDTO.getUuid()); + return thStudyTrack; + }).collect(Collectors.toList()); + + studyDetailService.save(thStudyDetail); + if(thStudyAuthList.size() > 0){ + studyAuthService.saveBatch(thStudyAuthList); + } + if(thStudyTrackList.size() > 0){ + studyTrackService.saveBatch(thStudyTrackList); + } + }else { + //获取轨迹数据 + + //获取认证数据 + List<String> oldAuthIdList = studyAuthService.getUuidByStudyDetaiId(thStudyDetail.getUuid()); + List<String> oldTrackIdList = studyTrackService.getUuidByStudyDetaiId(thStudyDetail.getUuid()); + //修改 + BeanUtils.copyProperties(studyDetailReqDTO, thStudyDetail); + thStudyDetail.setUpdateBy(institutionUser.getInstitutionalName()); + thStudyDetail.setUpdateTime(LocalDateTime.now()); + + List<ThStudyAuth> saveAuthList = studyDetailReqDTO.getAuthList().stream() + .filter(a -> oldAuthIdList.contains(a.getUuid())) + .map(a -> { + ThStudyAuth thStudyAuth = new ThStudyAuth(); + BeanUtils.copyProperties(a, thStudyAuth); + thStudyAuth.setStudyDetailUuid(studyDetailReqDTO.getUuid()); + return thStudyAuth; + }) + .collect(Collectors.toList()); + + List<ThStudyTrack> saveTrackList = studyDetailReqDTO.getTrackList().stream() + .filter(t -> oldTrackIdList.contains(t.getUuid())) + .map(t -> { + ThStudyTrack thStudyTrack = new ThStudyTrack(); + BeanUtils.copyProperties(t, thStudyTrack); + thStudyTrack.setStudyDetailUuid(studyDetailReqDTO.getUuid()); + return thStudyTrack; + }).collect(Collectors.toList()); + + studyDetailService.updateById(thStudyDetail); + studyAuthService.saveBatch(saveAuthList); + studyTrackService.saveBatch(saveTrackList); + } + return AjaxResult.success(); + } + + @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 = JSONObject.parseObject(decrypt, new TypeReference<List<ThExamRecordReqDTO>>() {}); + //参数校验 + //获取该平台课程 + List<ThStudentCourse> studentCourseList = studentCourseService.listByInstitutionId(institutionUser.getId()); + List<ThExamRecord> oldExamRecordList = examRecordService.listByInstitutionId(institutionUser.getId()); + List<ThErrorDataRespDTO> errorDataRespDTOS = new ArrayList<>(); + List<ThExamRecord> saveExamRecordList = new ArrayList<>(); + List<ThExamRecord> updateExamRecordList = new ArrayList<>(); + if (CollectionUtils.isEmpty(examRecordReqDTOS)) { + throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"考试记录不可为空"); + } + 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.getCourseUuid())){ + errorDataRespDTOS.add(new ThErrorDataRespDTO(examRecordReqDTO.getUuid(),"课程不可为空")); + continue; + } + if(StringUtils.isEmpty(examRecordReqDTO.getBatchUuid())){ + errorDataRespDTOS.add(new ThErrorDataRespDTO(examRecordReqDTO.getUuid(),"批次不可为空")); + continue; + } + + List<ThStudentCourse> thStudentCourses = studentCourseList.stream().filter(sc -> sc.getCourseUuid().equals(examRecordReqDTO.getCourseUuid()) + && sc.getBatchUuid().equals(examRecordReqDTO.getBatchUuid()) + && sc.getIdcard().equals(examRecordReqDTO.getIdcard())).collect(Collectors.toList()); + if(thStudentCourses.size() == 0){ + errorDataRespDTOS.add(new ThErrorDataRespDTO(examRecordReqDTO.getUuid(),"无该学生培训信息")); + 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; + } + if(examRecordReqDTO.getExamNum() == null){ + errorDataRespDTOS.add(new ThErrorDataRespDTO(examRecordReqDTO.getUuid(),"考试次数不可为空")); + continue; + } + List<ThExamRecord> examRecordSelectList = oldExamRecordList.stream().filter(e -> e.getUuid().equals(examRecordReqDTO.getUuid())).collect(Collectors.toList()); + if(examRecordSelectList.size() > 0){ + ThExamRecord thExamRecord = examRecordSelectList.get(0); + BeanUtils.copyProperties(examRecordReqDTO,thExamRecord); + thExamRecord.setUpdateTime(LocalDateTime.now()); + thExamRecord.setUpdateBy(institutionUser.getInstitutionalName()); + updateExamRecordList.add(thExamRecord); + }else { + //新增 + 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); + } + } + if(saveExamRecordList.size() > 0){ + examRecordService.saveBatch(saveExamRecordList); + } + if(updateExamRecordList.size() > 0){ + examRecordService.updateBatchById(updateExamRecordList); + } + 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 = JSONObject.parseObject(decrypt, new TypeReference<ThCourseDeleteReqDTO>() {}); + 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()); + //删除章节 + 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 = JSONObject.parseObject(decrypt, new TypeReference<ThBatchOpenReqDTO>() {}); + 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); + } + thBatch.setOpenStatus(OpenStatus.YES.getStatus()); + thBatch.setUpdateTime(LocalDateTime.now()); + thBatch.setUpdateBy(institutionUser.getInstitutionalName()); + batchService.updateById(thBatch); + return AjaxResult.success(); + } + @Transactional + @Override + public AjaxResult receiveBarchEnd(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 = JSONObject.parseObject(decrypt, new TypeReference<ThBatchEndReqDTO>() {}); + if(StringUtils.isEmpty(thBatchEndReqDTO.getBatchUuid())){ + throw new BusinessException(this.getClass(),ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"批次(班级)不可为空"); + } + if(StringUtils.isEmpty(thBatchEndReqDTO.getIdcard())){ + throw new BusinessException(this.getClass(),ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"学生身份证不可为空"); + } + List<ThStudentCourse> thStudentCourses = studentCourseService.getByIdcardAndBatchUuid(thBatchEndReqDTO.getIdcard(), thBatchEndReqDTO.getBatchUuid()); + if(CollectionUtils.isEmpty(thStudentCourses)){ + throw new BusinessException(ResultConstants.BATCH_STUDENT_IS_NOT_EXIST); + } + thStudentCourses.stream().forEach(sc -> { + sc.setFinishStatus(FinishStatus.YES.getStatus()); + }); + + studentCourseService.updateBatchById(thStudentCourses); + return AjaxResult.success(); + } + + + private void validateStudyDetail(ThStudyDetailReqDTO studentDetailReqDTO) { + //获取该平台课程 + ThCourse course = courseService.getByUuid(studentDetailReqDTO.getCourseUuid()); + ThBatch batch = batchService.getByUuid(studentDetailReqDTO.getBatchUuid()); + ThCourseChapter chapter = courseChapterService.getByUuid(studentDetailReqDTO.getChapterUuid()); + + if (studentDetailReqDTO == null) { + throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"学习记录清单不可为空"); + } + 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(course == null){ + throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"课程不存在"); + } + if(StringUtils.isEmpty(studentDetailReqDTO.getBatchUuid())){ + throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"批次不可为空"); + } + if(batch == null){ + throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"批次不存在"); + } + if(StringUtils.isEmpty(studentDetailReqDTO.getChapterUuid())){ + throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"章节不可为空"); + } + 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) { + if(StringUtils.isEmpty(batchReqDTO.getUuid()) || !UUID.checkIsUuid(batchReqDTO.getUuid())){ + throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"uuid不符合规范"); + } + if(StringUtils.isEmpty(batchReqDTO.getBatchName())){ + throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"班次名称不可为空"); + } + if(StringUtils.isEmpty(batchReqDTO.getTrainOrgName())){ + throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"培训机构名称不可为空"); + } + if(batchReqDTO.getHaveExam() == null || HaveExam.get(batchReqDTO.getHaveExam()) == null){ + throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"有无考试不规范"); + } + if(batchReqDTO.getOpenStatus() == null || OpenStatus.get(batchReqDTO.getOpenStatus()) == null ){ + throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"开班标识不符合规范"); + } +// if(batchReqDTO.getDelFlag() == null || DeleteStatusEnum.getDeleteStatusEnum(batchReqDTO.getDelFlag()) == null ){ +// throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"删除标识不符合规范"); +// } + if(CollectionUtils.isEmpty(batchReqDTO.getCourseUuidList())){ + throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"关联课程不可为空"); + } + List<ThCourse> courseList = courseService.selectByUuid(batchReqDTO.getCourseUuidList()); + if(courseList.size() != batchReqDTO.getCourseUuidList().size()){ + throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"关联课程不存在,请先上报课程"); + + } + } + + /** + * 校验学生信息 + * @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; + } +} diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/utils/ConvertTimeUtils.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/utils/ConvertTimeUtils.java new file mode 100644 index 0000000..417f8e6 --- /dev/null +++ b/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)); + } +} diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThBatchCourseMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThBatchCourseMapper.xml new file mode 100644 index 0000000..a96188b --- /dev/null +++ b/exam-system/src/main/resources/mapper/institutionaccess/ThBatchCourseMapper.xml @@ -0,0 +1,41 @@ +<?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 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> + + <select id="getListByBatchUuids" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThBatchCourseVO"> + select bc.*,c.course_name from th_batch_course bc + left join th_course c on c.uuid = bc.course_uuid + where bc.del_flag = 0 + and bc.batch_uuid in + <foreach collection="batchUuids" item="batchUuid" open="(" close=")" separator=","> + #{batchUuid} + </foreach> + </select> + + <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> +</mapper> + diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThBatchMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThBatchMapper.xml new file mode 100644 index 0000000..4f79451 --- /dev/null +++ b/exam-system/src/main/resources/mapper/institutionaccess/ThBatchMapper.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.ThBatchMapper"> + <select id="listByPage" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThBatchVO"> + select * 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> + + </select> + +</mapper> + diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThCourseChapterMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThCourseChapterMapper.xml new file mode 100644 index 0000000..91a2d06 --- /dev/null +++ b/exam-system/src/main/resources/mapper/institutionaccess/ThCourseChapterMapper.xml @@ -0,0 +1,42 @@ +<?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.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> + </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.url + from th_course_chapter cc + where cc.del_flag = 0 and cc.course_uuid = #{courseUuid} + </select> +</mapper> + diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThCourseMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThCourseMapper.xml new file mode 100644 index 0000000..cf8d52a --- /dev/null +++ b/exam-system/src/main/resources/mapper/institutionaccess/ThCourseMapper.xml @@ -0,0 +1,13 @@ +<?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.entity.ThCourse"> + 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> +</mapper> + diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThExamRecordMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThExamRecordMapper.xml new file mode 100644 index 0000000..2bfb2fd --- /dev/null +++ b/exam-system/src/main/resources/mapper/institutionaccess/ThExamRecordMapper.xml @@ -0,0 +1,32 @@ +<?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`, + c.course_name, + b.batch_name + FROM + th_exam_record e + LEFT JOIN th_student s ON s.idcard = e.idcard + LEFT JOIN th_course c ON c.uuid = e.course_uuid + LEFT JOIN th_batch b ON b.uuid = e.batch_uuid + WHERE e.del_flag = 0 + <if test="query.idcard != null and query.idcard != ''"> + and e.idcard = #{query.idcard} + </if> + <if test="query.name != null and query.name != ''"> + and s.name like concat('%', #{query.name}, '%') + </if> + <if test="query.startTime != null"><!-- 开始时间检索 --> + and date_format(e.exam_start_time,'%y-%m-%d') >= date_format(#{query.startTime},'%y-%m-%d') + </if> + <if test="query.endTime != null"><!-- 结束时间检索 --> + and date_format(e.exam_start_time,'%y-%m-%d') <= date_format(#{query.endTime},'%y-%m-%d') + </if> + order by e.create_time desc +</select> + +</mapper> + diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThQuestionBankMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThQuestionBankMapper.xml new file mode 100644 index 0000000..9f68671 --- /dev/null +++ b/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> + diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThStudentCourseMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThStudentCourseMapper.xml new file mode 100644 index 0000000..339f748 --- /dev/null +++ b/exam-system/src/main/resources/mapper/institutionaccess/ThStudentCourseMapper.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.gkhy.exam.institutionalaccess.mapper.ThStudentCourseMapper"> + + <select id="statisticByCourseUuid" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThStatisticStudentVO"> + select course_uuid, count(id) as count from th_student_course where del_flag = 0 group by course_uuid + </select> + + <select id="statisticByBatchUuid" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThStatisticStudentVO"> + SELECT + sc.batch_uuid, + count( sc.id ) AS count + FROM + ( SELECT DISTINCT id, create_by, course_uuid, create_time, batch_uuid, del_flag FROM th_student_course ) sc + GROUP BY + sc.batch_uuid + </select> + + <select id="getListByBatchUuid" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThStudentCourseVO"> + SELECT + sc.idcard, + sc.course_uuid, + sc.batch_uuid, + sc.NAME, + sc.finish_status, + c.course_name, + (( + SELECT + sum( cc.lesson_num ) + FROM + th_course_chapter cc + WHERE + cc.course_uuid = sc.course_uuid + )) less_total + FROM + th_student_course sc + LEFT JOIN th_course c ON c.uuid = sc.course_uuid + WHERE + sc.del_flag = 0 + AND sc.batch_uuid = #{batchUuid} + </select> + + <update id="updateByBatchUuid"> + update th_student_course set finish_status = 1 where batch_uuid = #{batchUuid} + </update> +</mapper> + diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThStudentMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThStudentMapper.xml new file mode 100644 index 0000000..26c98cf --- /dev/null +++ b/exam-system/src/main/resources/mapper/institutionaccess/ThStudentMapper.xml @@ -0,0 +1,52 @@ +<?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"> + + <update id="updateByIdcard" 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.phone}, + </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.updateBy != null and item.updateBy != ''" > + update_by = #{item.updateBy}, + </if> + <if test="item.updateTime != null" > + update_time = #{item.updateTime} + </if> + </set> + where idcard = #{item.idcard} + </foreach> + </update> + + +</mapper> + diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThStudyAuthMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThStudyAuthMapper.xml new file mode 100644 index 0000000..35507b5 --- /dev/null +++ b/exam-system/src/main/resources/mapper/institutionaccess/ThStudyAuthMapper.xml @@ -0,0 +1,9 @@ +<?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> + +</mapper> + diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThStudyDetailMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThStudyDetailMapper.xml new file mode 100644 index 0000000..47ec001 --- /dev/null +++ b/exam-system/src/main/resources/mapper/institutionaccess/ThStudyDetailMapper.xml @@ -0,0 +1,62 @@ +<?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.*, + s.name, + b.batch_name, + c.course_name, + cc.chapter_name + FROM + th_study_detail d + LEFT JOIN th_student s ON s.idcard = d.idcard + LEFT JOIN th_batch b ON b.uuid = d.batch_uuid + LEFT JOIN th_course c ON c.uuid = d.course_uuid + LEFT JOIN th_course_chapter cc ON cc.uuid = d.chapter_uuid + where d.del_flag = 0 + <if test="query.idcard != null and query.idcard != ''"> + and d.idcard = #{query.idcard} + </if> + <if test="query.courseUuid != null and query.courseUuid != ''"> + and d.course_uuid = #{query.courseUuid} + </if> + <if test="query.name != null and query.name != ''"> + and s.name like concat('%', #{query.name}, '%') + </if> + <if test="query.startTime != null"><!-- 开始时间检索 --> + and date_format(d.create_time,'%y-%m-%d') >= date_format(#{query.startTime},'%y-%m-%d') + </if> + <if test="query.endTime != null"><!-- 结束时间检索 --> + and date_format(d.create_time,'%y-%m-%d') <= date_format(#{query.endTime},'%y-%m-%d') + </if> + order by d.create_time desc + </select> + + <select id="statisticDurationByIdcard" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThStudyVO"> + SELECT + d.idcard, + sum( d.duration ) duration + FROM + th_study_detail d + WHERE + d.del_flag = 0 + AND d.batch_uuid = #{batchUuid} + GROUP BY + d.idcard + </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> + +</mapper> + diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThStudyTrackMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThStudyTrackMapper.xml new file mode 100644 index 0000000..5364362 --- /dev/null +++ b/exam-system/src/main/resources/mapper/institutionaccess/ThStudyTrackMapper.xml @@ -0,0 +1,9 @@ +<?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> + +</mapper> + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ThreeAccessController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ThreeAccessController.java new file mode 100644 index 0000000..e3dc57b --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ThreeAccessController.java @@ -0,0 +1,36 @@ +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"); + String jsonString = JSONObject.toJSONString(accessReqDTO); + String encrypt = AESUtils.encrypt(jsonString); + System.out.println(encrypt); + String decrypt = AESUtils.decrypt("ASg/NElcGyKiKSUu334t5DXcYjgpxb11mFr5YSf6sHICkQCrZ++NSQ55ZoMw1p+hKgFiuNEPXsDLp2lOtR52zDGaFLFKSQIqEgSJ7IL6YBCExaF3fQSqIFZFX62KygHb"); + System.out.println(decrypt); + } +} diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 14b57bf..51689f6 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -36,7 +36,7 @@ # 国际化资源文件路径 basename: i18n/messages profiles: - active: dev + active: pro # 文件上传 servlet: multipart: @@ -57,6 +57,14 @@ secret: abcdefghijklmnopqrstuvwxyz # 令牌有效期(默认30分钟) expireTime: 30 +threeToken: + # 令牌自定义标识 + header: accessToken + # 令牌密钥 + secret: Q5mn+yLZHyI7gp=+ffbPgjq2UL + # 令牌有效期(默认7天) + expireTime: 7 + # MyBatis-plus配置 mybatis-plus: diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java index 126b36f..dd9207c 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java +++ b/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:"; } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java index ca64f5d..4750475 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java +++ b/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"; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/ResultConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/ResultConstants.java index bb680d9..7c2c0d4 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/ResultConstants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/ResultConstants.java @@ -45,6 +45,24 @@ 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,"该学生培训信息不存在"), + ; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java index a685e06..8eb0f87 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java +++ b/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); + } /** * 返回成功消息 diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java index a7abfe4..14d90cd 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java +++ b/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); + } + /** * 是否为成功消息 * diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/InstitutionUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/InstitutionUser.java new file mode 100644 index 0000000..1a0a9ce --- /dev/null +++ b/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; + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/InstitutionStatus.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/InstitutionStatus.java new file mode 100644 index 0000000..dc54d82 --- /dev/null +++ b/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; + } +} + diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/coalmineEnums/DeleteStatusEnum.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/coalmineEnums/DeleteStatusEnum.java index c4ec7f3..366304b 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/coalmineEnums/DeleteStatusEnum.java +++ b/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; + } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/BusinessException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/BusinessException.java index 6b46590..69dfcec 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/BusinessException.java +++ b/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()); diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/signature/AESUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/signature/AESUtils.java new file mode 100644 index 0000000..8b4f559 --- /dev/null +++ b/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("****************************************");*/ + } + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/signature/Signature.java b/ruoyi-common/src/main/java/com/ruoyi/common/signature/Signature.java deleted file mode 100644 index 6a3d6c8..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/signature/Signature.java +++ /dev/null @@ -1,166 +0,0 @@ -package com.ruoyi.common.signature; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URLEncoder; -import java.util.Calendar; -import java.util.HashMap; -import java.util.Map; -import org.apache.commons.lang3.RandomStringUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.http.HttpStatus; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPut; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.util.EntityUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import com.google.gson.Gson; - -/** - * @email 1603559716@qq.com - * @author: zf - * @date: 2023/9/7 - * @time: 11:06 - */ -public class Signature { - private static final Logger logger = LoggerFactory.getLogger(Signature.class); - // 接口服务地址 - static String restSever = "https://inspurtestcx.saws.org.cn/sjjh/api/v1/exam/plan/enroll/download"; - // 应用标识 - static String appKey = "hj92qe"; - // 加密算法 - static String signMethod = "SHA-256"; - // 身份系统签发给应用对接的密钥 - static String appPwd = "dxep6j"; - - public static void main(String[] args) { - // 时间戳 - Long ts = Calendar.getInstance().getTime().getTime(); - // 随机数 - String once = RandomStringUtils.randomAlphanumeric(32); - // 接口header 中的公共参数 - String commonParamUrl = String.format("appKey=%s" + "&" + "ts=%s" + "&" + "once=%s" + "&" + "signMethod=%s", appKey, ts, once, signMethod); - // 创建HttpClient 对象 - CloseableHttpClient httpclient = (CloseableHttpClient) SkipHttpsUtils.wrapClient(); - /** - * GET 查询接口演示代码 - */ - String startTime = "2023-05-25 00:00:00"; - String endTime = "2023-06-01 21:00:00"; - try { - startTime = URLEncoder.encode(startTime, "UTF-8"); - endTime = URLEncoder.encode(endTime, "UTF-8"); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException(e.getCause()); - } - String getQueryParam = "startTime=" + startTime + "&endTime=" + endTime; - System.out.println(getQueryParam); - String getFullUrl = restSever + "?" + getQueryParam; - HttpGet httpGet = new HttpGet(getFullUrl); - // get 请求查询参数, 用在 URL 上的, 这里若是通过 ID 查询的, 接口中 ID 是作为路径存在的, 所以需要将 ID 组合成 - String getAllParamUrl = commonParamUrl + "&" + getQueryParam; - // 对参数签名, 并放入请求 header 中的 signData 参数中 - try { - // 签名数据 - String signData = TokenUtils.getSignature(appPwd, getAllParamUrl); - // 添加 header 参数 appCode、timestamp、signatureNonce、signature - httpGet.addHeader("appKey", appKey); - httpGet.addHeader("ts", ts.toString()); - httpGet.addHeader("once", once); - httpGet.addHeader("signMethod", signMethod); - System.out.println("once:" + once); - httpGet.addHeader("signData", signData); - System.out.println("headers:" + httpGet.getAllHeaders()); - String urlStr = httpGet.getURI().toString(); - // 公共参数 URL - System.out.println("commonParamter:" + urlStr); - if (StringUtils.endsWith(urlStr, "/")) { - urlStr = StringUtils.removeEnd(urlStr, "/"); - } - httpGet.setURI(new URI(urlStr)); - RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(3000).setConnectionRequestTimeout(3000).setSocketTimeout(3000).build(); - httpGet.setConfig(requestConfig); - System.out.println("urlStr in request:" + httpGet.getURI().toString()); - // 执行请求 - CloseableHttpResponse response = httpclient.execute(httpGet); - // 取响应的结果 - int statusCode = response.getStatusLine().getStatusCode(); - // 打印响应结果 - if (statusCode == HttpStatus.SC_OK) { - String resp = EntityUtils.toString(response.getEntity(), "utf-8"); - System.out.println("status:" + statusCode); - System.out.println("result:" + resp); - } - } catch (URISyntaxException e) { - logger.error("签名失败: ", e); - } catch (ClientProtocolException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - /** - * PUT 修改接口的演示代码,POST 与 PUT 类似 - */ - String ID = "aa03a5c692cf480b87887e0ff8cfe566"; - // 这里若是通过 ID 查询的, 接口中 ID 是作为路径存在的, 所以需要将 ID 组合成 - String putQueryParam = "ID=" + ID; - - String putFullUrl = restSever + "/" + ID; - // 访问用户接口 - HttpPut httpPut = new HttpPut(putFullUrl); - // 模拟 POST/PUT 的 body 中数据, 需转为 JSON 进行签名。GET 则没有这部分内容。 - Map<String, Object> dataMap = new HashMap<String, Object>(); - dataMap.put("USER_NAME", "张三"); - String bodyParam = new Gson().toJson(dataMap); - String postAllParamUrl = commonParamUrl + "&" + putQueryParam + "&bodyData=" + bodyParam; - StringEntity bodyData = new StringEntity(bodyParam.toString(), "UTF-8"); - httpPut.setEntity(bodyData); - // 对参数签名, 并放入请求 header 中的 signData 参数中 - try { - // 签名数据 - String signData = TokenUtils.getSignature(appPwd, postAllParamUrl); - // 添加 header 参数 appCode、timestamp、signatureNonce、signature - httpPut.addHeader("appKey", appKey); - httpPut.addHeader("ts", ts.toString()); - httpPut.addHeader("once", once); - System.out.println("once:" + once); - httpPut.addHeader("signData", signData); - System.out.println("headers:" + httpPut.getAllHeaders()); - String urlStr = httpPut.getURI().toString(); - // 公共参数 URL - System.out.println("commonParamter:" + urlStr); - if (StringUtils.endsWith(urlStr, "/")) { - urlStr = StringUtils.removeEnd(urlStr, "/"); - } - httpPut.setURI(new URI(urlStr)); - RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(3000).setConnectionRequestTimeout(3000).setSocketTimeout(3000).build(); - httpPut.setConfig(requestConfig); - System.out.println("urlStr in request:" + httpPut.getURI().toString()); - // 执行请求 - CloseableHttpResponse response = httpclient.execute(httpPut); - // 取响应的结果 - int statusCode = response.getStatusLine().getStatusCode(); - // 打印响应结果 - if (statusCode == HttpStatus.SC_OK) { - String resp = EntityUtils.toString(response.getEntity(), "utf-8"); - System.out.println("status:" + statusCode); - System.out.println("result:" + resp); - } - } catch (URISyntaxException e) { - logger.error("签名失败: ", e); - - } catch (ClientProtocolException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - } -} - diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/signature/Signature11.java b/ruoyi-common/src/main/java/com/ruoyi/common/signature/Signature11.java deleted file mode 100644 index bd6f9de..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/signature/Signature11.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.ruoyi.common.signature; - -import com.alibaba.fastjson2.JSON; -import com.google.gson.Gson; -import org.apache.commons.lang3.RandomStringUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.http.HttpStatus; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPut; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.util.EntityUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URLEncoder; -import java.util.Calendar; -import java.util.HashMap; -import java.util.Map; - -/** - * @email 1603559716@qq.com - * @author: zf - * @date: 2023/9/7 - * @time: 11:06 - */ -public class Signature11 { - private static final Logger logger = LoggerFactory.getLogger(Signature11.class); - // 接口服务地址 考生信息下载 - static String restSever = "https://inspurtestcx.saws.org.cn/sjjh/api/v1/exam/plan/enroll/download"; - // 应用标识 - static String appKey = "hj92qe"; - // 加密算法 - static String signMethod = "SHA-256"; - // 身份系统签发给应用对接的密钥 - static String appPwd = "dxep6j"; - - public static void main(String[] args) { - // 时间戳 - Long ts = Calendar.getInstance().getTime().getTime(); - // 随机数 - String once = RandomStringUtils.randomAlphanumeric(32); - // 接口 header 中的公共参数 - String commonParamUrl = String.format("appKey=%s" + "&" + "ts=%s" + "&" + "once=%s" + "&" - + "signMethod=%s", appKey, ts, once, signMethod); - // 创建 HttpClient 对象 - CloseableHttpClient httpclient = (CloseableHttpClient) SkipHttpsUtils.wrapClient(); - /** - * GET 查询接口演示代码 - */ - String startTime = "2018-05-25 00:00:00"; - String endTime = "2023-06-01 21:00:00"; - try { - startTime = URLEncoder.encode(startTime, "UTF-8"); - endTime = URLEncoder.encode(endTime, "UTF-8"); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException(e.getCause()); - } - String getQueryParam = "startTime=" + startTime + "&endTime=" + endTime; - System.out.println(getQueryParam); - - String getFullUrl = restSever + "?" + getQueryParam; - HttpGet httpGet = new HttpGet(getFullUrl); - // get 请求查询参数, 用在 URL 上的, 这里若是通过 ID 查询的, 接口中 ID 是作为路径存在的, 所以需要将 ID 组成 - String getAllParamUrl = commonParamUrl + "&" + getQueryParam; - - // 对参数签名, 并放入请求 header 中的 signData 参数中 - try { - // 签名数据 - String signData = TokenUtils.getSignature(appPwd, getAllParamUrl); - // 添加 header 参数 appCode、 timestamp、 signatureNonce、 signature - httpGet.addHeader("appKey", appKey); - httpGet.addHeader("ts", ts.toString()); - httpGet.addHeader("once", once); - httpGet.addHeader("signMethod", signMethod); - System.out.println("once:" + once); - httpGet.addHeader("signData", signData); - System.out.println("headers:" + httpGet.getAllHeaders()); - String urlStr = httpGet.getURI().toString(); - // 公共参数 URL - System.out.println("commonParamter:" + urlStr); - if (StringUtils.endsWith(urlStr, "/")) { - urlStr = StringUtils.removeEnd(urlStr, "/"); - } - httpGet.setURI(new URI(urlStr)); - RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(6000) - .setConnectionRequestTimeout(6000).setSocketTimeout(6000).build(); - httpGet.setConfig(requestConfig); - System.out.println("urlStr in request:" + httpGet.getURI().toString()); - // 执行请求 - CloseableHttpResponse response = httpclient.execute(httpGet); - // 取响应的结果 - int statusCode = response.getStatusLine().getStatusCode(); - // 打印响应结果 - if (statusCode == HttpStatus.SC_OK) { - String resp = EntityUtils.toString(response.getEntity(), "utf-8"); - System.out.println("status:" + statusCode); - Object object = JSON.parse(resp); - System.out.println("result:" + resp); - } else { - System.out.println(statusCode); - } - } catch (URISyntaxException e) { - logger.error("签名失败: ", e); - } catch (ClientProtocolException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - - } -} - diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/RandomUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/RandomUtil.java new file mode 100644 index 0000000..1ef77b8 --- /dev/null +++ b/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); + + } + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/UUID.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/UUID.java index a5585d6..dd141d3 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/UUID.java +++ b/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; + } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java index 35bc1e5..915e327 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java +++ b/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/**"); } /** diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java index 18e7ed3..fff16b4 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ b/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() diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/ThreeInstitutionInterceptor.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/ThreeInstitutionInterceptor.java new file mode 100644 index 0000000..e9f965a --- /dev/null +++ b/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(); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/context/ThreeInContextHolder.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/context/ThreeInContextHolder.java new file mode 100644 index 0000000..03b728e --- /dev/null +++ b/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(); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/threeAccess/req/AccessReqDTO.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/threeAccess/req/AccessReqDTO.java new file mode 100644 index 0000000..935829c --- /dev/null +++ b/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; +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/threeAccess/resp/AccessRespDTO.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/threeAccess/resp/AccessRespDTO.java new file mode 100644 index 0000000..f50db9d --- /dev/null +++ b/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; +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java index 32f1903..2664098 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java +++ b/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); + } + + /** * 通用异常 */ diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java index 1f07b3e..0aab5e0 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java +++ b/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; } + } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/ThreeInstitutionService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/ThreeInstitutionService.java new file mode 100644 index 0000000..f2b4374 --- /dev/null +++ b/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); + } + +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java index aa112da..fe63d12 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java +++ b/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); + } + } + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/InstitutionalManager.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/InstitutionalManager.java new file mode 100644 index 0000000..b00232d --- /dev/null +++ b/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; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/query/InstitutionManagerQuery.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/query/InstitutionManagerQuery.java new file mode 100644 index 0000000..241ce74 --- /dev/null +++ b/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; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/InstitutionModStatusReqDTO.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/InstitutionModStatusReqDTO.java new file mode 100644 index 0000000..0b1259c --- /dev/null +++ b/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; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/InstitutionalManagerAddReqDTO.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/InstitutionalManagerAddReqDTO.java new file mode 100644 index 0000000..810fe02 --- /dev/null +++ b/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; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/InstitutionalManagerModReqDTO.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/InstitutionalManagerModReqDTO.java new file mode 100644 index 0000000..f4ec89d --- /dev/null +++ b/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;*/ +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/InstitutionalManagerMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/InstitutionalManagerMapper.java new file mode 100644 index 0000000..a2ee2ed --- /dev/null +++ b/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> { + + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/InstitutionalManagerService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/InstitutionalManagerService.java new file mode 100644 index 0000000..bd3f1f5 --- /dev/null +++ b/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(); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/InstitutionalManagerServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/InstitutionalManagerServiceImpl.java new file mode 100644 index 0000000..5bdccdc --- /dev/null +++ b/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; + } +} diff --git a/ruoyi-system/src/main/resources/mapper/system/InstitutionManagerMapper.xml b/ruoyi-system/src/main/resources/mapper/system/InstitutionManagerMapper.xml new file mode 100644 index 0000000..5226629 --- /dev/null +++ b/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> \ No newline at end of file -- Gitblit v1.9.2