From 790c2ba4a0b46edf191e3bac84931f796bd42b8f Mon Sep 17 00:00:00 2001 From: zhangf <1603559716@qq.com> Date: 星期三, 24 七月 2024 09:02:49 +0800 Subject: [PATCH] 三方对接接口优化 --- exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/TripartiteInterfaceController.java | 354 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 354 insertions(+), 0 deletions(-) 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..bdbaf50 --- /dev/null +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/TripartiteInterfaceController.java @@ -0,0 +1,354 @@ +package com.gkhy.exam.institutionalaccess.controller; + +import com.alibaba.fastjson2.JSONObject; +import com.gkhy.exam.institutionalaccess.service.TripartiteInterfaceService; +import com.ruoyi.common.annotation.RepeatedClick; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + + + + +@RequestMapping("/gov-server/receive") +@RestController +public class TripartiteInterfaceController extends BaseController { + @Autowired + private TripartiteInterfaceService tripartiteInterfaceService; + + @PostMapping("/question/bank") + @RepeatedClick + public AjaxResult receiveQuestionBank(@RequestBody JSONObject jsonObject){ + return success(tripartiteInterfaceService.receiveQuestionBank(jsonObject)); + } + @PostMapping("/course") + @RepeatedClick + public AjaxResult receiveCourse(@RequestBody JSONObject jsonObject){ + return tripartiteInterfaceService.receiveCourse(jsonObject); + } + @PostMapping("/course/delete") + @RepeatedClick + public AjaxResult receiveCourseDelete(@RequestBody JSONObject jsonObject){ + return tripartiteInterfaceService.receiveCourseDelete(jsonObject); + } + + @PostMapping("/batch") + @RepeatedClick + public AjaxResult receiveBatch(@RequestBody JSONObject jsonObject){ + return tripartiteInterfaceService.receiveBatch(jsonObject); + } + @PostMapping("/batch/open") + @RepeatedClick + public AjaxResult receiveBatchOpen(@RequestBody JSONObject jsonObject){ + return tripartiteInterfaceService.receiveBatchOpen(jsonObject); + } + @PostMapping("/student") + @RepeatedClick + public AjaxResult receiveStudent(@RequestBody JSONObject jsonObject){ + return tripartiteInterfaceService.receiveStudent(jsonObject); + } + @PostMapping("/study/detail") + @RepeatedClick + public AjaxResult receiveStudyDetail(@RequestBody JSONObject jsonObject){ + return tripartiteInterfaceService.receiveStudyDetail(jsonObject); + } + + @RepeatedClick + @PostMapping("/exam/record") + public AjaxResult receiveExamRecord(@RequestBody JSONObject jsonObject){ + return tripartiteInterfaceService.receiveExamRecord(jsonObject); + } + @RepeatedClick + @PostMapping("/batch/end") + public AjaxResult receiveBatchEnd(@RequestBody JSONObject jsonObject){ + return tripartiteInterfaceService.receiveBatchEnd(jsonObject); + } + + /** + * 题库组卷 + * @param args + */ + /*public static void main(String[] args) { + ThQuestionBankReqDTO thQuestionBankReqDTO = new ThQuestionBankReqDTO(); + thQuestionBankReqDTO.setUuid(UUID.randomUUID().toString()); + thQuestionBankReqDTO.setMonth("2024年6月"); + thQuestionBankReqDTO.setDelFlag((byte)0); + thQuestionBankReqDTO.setUrl("http://www.baidu.com"); + thQuestionBankReqDTO.setAddCount(2); + thQuestionBankReqDTO.setAssemblyRate(new BigDecimal(80)); + thQuestionBankReqDTO.setBrushRate(new BigDecimal(89)); + thQuestionBankReqDTO.setReduceCount(4); + thQuestionBankReqDTO.setLastMonthCount(450); + String jsonString = JSONObject.toJSONString(thQuestionBankReqDTO); + String encrypt = AESUtils.encrypt(jsonString); + System.out.println(encrypt); + String decrypt = AESUtils.decrypt("PmvIbOPyVJ2pYqmGer1YBAij35Tfdk8lufUv+Y2CyqAds/iyh6PwS4dsnUzNO3El4kNaaSbqKO4dpSYLkHZiB41zB6OvNFcfSQr5uguBInWZHVGeWC7FljJkk/z8GB0ydvHSwsy+FGVkA6nMcOJGU31sf4JjO2hL10h6YeVEKtiEW2wOtuYWs067t4aP0q0zTnBWlnfO9i2WT3v0FjNhCXgPKR65HRAqrf+jrzRveLLFGL3be6qBOBwc8QqowMRS+6oUFMXTpzSfU6/QJrmbQw=="); + System.out.println(decrypt); + ThQuestionBankReqDTO questionBankReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThQuestionBankReqDTO>() {}); + System.out.println(questionBankReqDTO); + }*/ + + /** + * 课程 + * @param args + */ + /*public static void main(String[] args) { + List<ThCourseReqDTO> list = new ArrayList<>(); + ThCourseReqDTO thCourseReqDTO = new ThCourseReqDTO(); + thCourseReqDTO.setUuid("20bded7f-660c-4380-b7f9-00f3976e1875"); + thCourseReqDTO.setCourseCode("java001111"); + thCourseReqDTO.setCourseName("java课程"); + //thCourseReqDTO.setDelFlag((byte)0); + thCourseReqDTO.setLessonNum(new BigDecimal(40)); + thCourseReqDTO.setTrainOrgName("机构111"); + List<ThCourseChapterReqDTO> chapterList = new ArrayList<>(); + //章 + ThCourseChapterReqDTO chapterReqDTO1 = new ThCourseChapterReqDTO(); + chapterReqDTO1.setUuid("9d470732-6233-4820-82f7-37c80fe8ae68"); + chapterReqDTO1.setDelFlag((byte)0); + chapterReqDTO1.setChapterCode("001"); + chapterReqDTO1.setChapterName("第一章节 基础理论"); + chapterReqDTO1.setHaveResource((byte)0); + chapterReqDTO1.setSerialno(1); + chapterReqDTO1.setLessonNum(new BigDecimal(10)); + List<ThCourseChapterReqDTO> childList = new ArrayList<>(); + //节 + ThCourseChapterReqDTO child11 = new ThCourseChapterReqDTO(); + child11.setUuid("d5cd3b26-be11-4ffe-8a34-283c49c85253"); + child11.setUrl("https://www.baidu.com"); + child11.setDelFlag((byte)2); + child11.setChapterCode("1.1"); + child11.setChapterName("1.1类"); + child11.setHaveResource((byte)1); + child11.setSerialno(1); + child11.setDuration(1800l); + child11.setResourceType((byte)0); + child11.setLessonNum(new BigDecimal(1)); + ThCourseChapterReqDTO child12= new ThCourseChapterReqDTO(); + child12.setUuid("eb7167be-5716-43d0-8e27-12bb43d1dded"); + child12.setUrl("https://www.baidu.com1213231"); + child12.setDelFlag((byte)0); + child12.setChapterCode("1.2"); + child12.setChapterName("1.2接口"); + child12.setHaveResource((byte)1); + child12.setLessonNum(new BigDecimal(1.5)); + child12.setDuration(4500l); + child12.setResourceType((byte)0); + child12.setSerialno(2); + ThCourseChapterReqDTO child13= new ThCourseChapterReqDTO(); + child13.setUuid("d684081a-6a09-42ce-86b1-58df94d18f6b"); + child13.setUrl("https://www.baidu.com3333"); + child13.setDelFlag((byte)2); + child13.setChapterCode("1.3"); + child13.setChapterName("1.3多态"); + child13.setHaveResource((byte)1); + child13.setLessonNum(new BigDecimal(1.5)); + child13.setDuration(1800l); + child13.setSerialno(3); + child13.setResourceType((byte)0); + childList.add(child11); + childList.add(child12); + childList.add(child13); + chapterReqDTO1.setChildren(childList); + chapterList.add(chapterReqDTO1); + thCourseReqDTO.setChapters(chapterList); + list.add(thCourseReqDTO); + String jsonString = JSONObject.toJSONString(list); + String encrypt = AESUtils.encrypt(jsonString); + System.out.println(encrypt); + String decrypt = AESUtils.decrypt("lE7/ryHW69pxuwuttBk8edBc7j30BwVoO3j0hl0933QQGMEYUgfVRhD0KlSGJcZoXh5NLQC6k08lJEsRSi8N59ydUG4qPdvk40Txc+O6xaudXHuMBzSePAKqYxQmG7hENVx8+Oarp+Nd4YsUxgcD9pE8RywRd7etZfowZapsbV1azNXjX7e2A0lhfkF1q5cmeQGB+YI0G9zoBeAXPAH+izmdtAnHr8GlB5dnwH7y0ObCWhpxa0o4gAlEn5zw8UNqYHnVpvgjFE15N7XSJqIauSVcmxMK6OMEEwfrzJ4kzDz8WHLoOWz1vXzUYFhb2yR/rp33cOYfTNOSVGWD14BKd2pLNleHp7TUFo4sG4+IwN4nMSYQstROI21BaSrBNQz2EjsB56BCbyc9nSxCBRA2MTxPRxKkjx/pVXUa7IG7wG8lxp7M+noeXygBBfoVFG5pwk0ux73+xZtKQiHi7yFW3kAbeMT16G9J0MzsWd3T3XJt1rDCO192SPNf9x/DFNp/xmMa1hnc18hguoeooTZPiGnkMze29Bp4P0Xn/XYrR1rlpZwkkcwWaw2/XXOiU5cWbzg6VKay6bj8IgKF7iKXcrM1UbgNkHnkb5XMrFG6lBcfI8KsBLPtaNOLWyMfJc+Wk7nSy50W5TkVLcNBDzpEgODNorl/70wYifupz+IRDQWgYw8IEQzUV6iy1RocFwg9SePvQgKsEYdEKYbPTv/wXpN+HgsGRXVb0K0gUl1BvPoXkwejXDIfuCw+6tdihFJdGFJZf4/26PCGkjBbfcMoLRW4chhvjbnFhXO7Kqz2Ah5e5GkXrCMuYWhMLtbP3W+q70Vrk+8CQSr3Q0cWt0vxYPQZjEYkpMLkAdA5x17AIrTvt/CrYTBwHTIKpKaBjv6CmEI9pHWUKERQEuSpuP75JG9cRX8UIQLFtA+tvh4jU/m1X5hqaudRQnIZL5FUJrMoPkBBfZ5LManiMk5jC/UDbozihOuxIgb+tvMONbhejgBk7tGfvqFz53PZNp7dx6VWI4RsYCDcKduCnjKQuOdmSClPbaCphZXu8qObvareOV4pwDD3gyBNn+nkzVgdxU+dy/wdK5HQWrqvelGSUx1SkRyRPh2fbB+33esmaJDUPL3mKQxIaQ06ZK5N9OJeiJcPuv+NPxgcQi/rxUkGNA+yA5luwNm7IMqya9LOyiG1kELwNNHGdcsvB4hsr4C44zMlT9hmHtk/2p/h1LO6A3KSqR+02VSU7+4CCC6lxHEkrufE4FpQN1dofIlkYD9KGjey"); + System.out.println(decrypt); + }*/ + + /** + * 课程删除 + */ + /* public static void main(String[] args) { + ThCourseDeleteReqDTO thQuestionBankReqDTO = new ThCourseDeleteReqDTO(); + thQuestionBankReqDTO.setCourseUuid("20bded7f-660c-4380-b7f9-00f3976e1875"); + String jsonString = JSONObject.toJSONString(thQuestionBankReqDTO); + String encrypt = AESUtils.encrypt(jsonString); + System.out.println(encrypt); + String decrypt = AESUtils.decrypt("PmvIbOPyVJ2pYqmGer1YBAij35Tfdk8lufUv+Y2CyqAds/iyh6PwS4dsnUzNO3El4kNaaSbqKO4dpSYLkHZiB41zB6OvNFcfSQr5uguBInWZHVGeWC7FljJkk/z8GB0ydvHSwsy+FGVkA6nMcOJGU31sf4JjO2hL10h6YeVEKtiEW2wOtuYWs067t4aP0q0zTnBWlnfO9i2WT3v0FjNhCXgPKR65HRAqrf+jrzRveLLFGL3be6qBOBwc8QqowMRS+6oUFMXTpzSfU6/QJrmbQw=="); + System.out.println(decrypt); + ThQuestionBankReqDTO questionBankReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThQuestionBankReqDTO>() {}); + System.out.println(questionBankReqDTO); + }*/ + + /** + * 批次上报 + * @param args + */ + /*public static void main(String[] args) { + ThBatchReqDTO thBatchReqDTO = new ThBatchReqDTO(); + thBatchReqDTO.setUuid("5096d539-9ec4-499e-a7ef-3fc1c688ba55"); + thBatchReqDTO.setBatchName("第一期2024"); + thBatchReqDTO.setTrainOrgName("测试机构"); + thBatchReqDTO.setHaveExam(HaveExam.YES.getStatus()); + thBatchReqDTO.setStatus(OpenStatus.NO.getStatus()); + thBatchReqDTO.setDelFlag((byte)0); + thBatchReqDTO.setBatchLessonNum(new BigDecimal(40)); + List<ThBatchCourseReqDTO> courseList = new ArrayList<>(); + ThBatchCourseReqDTO courseReqDTO = new ThBatchCourseReqDTO(); + courseReqDTO.setCourseUuid("20bded7f-660c-4380-b7f9-00f3976e1875"); + courseReqDTO.setDelFlag((byte) 0); + courseReqDTO.setCourseLessonNum(new BigDecimal(20)); + //章 + List<ThBatchCourseChapterReqDTO> chapterList = new ArrayList<>(); + ThBatchCourseChapterReqDTO chapterReqDTO = new ThBatchCourseChapterReqDTO(); + chapterReqDTO.setChapterUuid("9d470732-6233-4820-82f7-37c80fe8ae68"); + chapterReqDTO.setDelFlag((byte) 0); + chapterReqDTO.setChapterLessonNum(new BigDecimal(2)); + + //节 + List<ThBatchCourseChapterReqDTO> sectionList = new ArrayList<>(); + ThBatchCourseChapterReqDTO sectionReqDTO1 = new ThBatchCourseChapterReqDTO(); + sectionReqDTO1.setChapterUuid("d5cd3b26-be11-4ffe-8a34-283c49c85253"); + sectionReqDTO1.setDelFlag((byte) 0); + sectionReqDTO1.setChapterLessonNum(new BigDecimal(1)); + ThBatchCourseChapterReqDTO sectionReqDTO2 = new ThBatchCourseChapterReqDTO(); + sectionReqDTO2.setChapterUuid("eb7167be-5716-43d0-8e27-12bb43d1dded"); + sectionReqDTO2.setDelFlag((byte) 0); + sectionReqDTO2.setChapterLessonNum(new BigDecimal(1)); + sectionList.add(sectionReqDTO2); + sectionList.add(sectionReqDTO1); + chapterReqDTO.setChildren(sectionList); + chapterList.add(chapterReqDTO); + courseReqDTO.setChapterList(chapterList); + courseList.add(courseReqDTO); + thBatchReqDTO.setCourseList(courseList); + String jsonString = JSONObject.toJSONString(thBatchReqDTO); + + String encrypt = AESUtils.encrypt(jsonString); + System.out.println(encrypt); + String decrypt = AESUtils.decrypt("PmvIbOPyVJ2pYqmGer1YBAij35Tfdk8lufUv+Y2CyqAds/iyh6PwS4dsnUzNO3El4kNaaSbqKO4dpSYLkHZiB41zB6OvNFcfSQr5uguBInWZHVGeWC7FljJkk/z8GB0ydvHSwsy+FGVkA6nMcOJGU31sf4JjO2hL10h6YeVEKtiEW2wOtuYWs067t4aP0q0zTnBWlnfO9i2WT3v0FjNhCXgPKR65HRAqrf+jrzRveLLFGL3be6qBOBwc8QqowMRS+6oUFMXTpzSfU6/QJrmbQw=="); + System.out.println(decrypt); + ThQuestionBankReqDTO questionBankReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThQuestionBankReqDTO>() {}); + System.out.println(questionBankReqDTO); + }*/ + /** + * 学生信息上报 + */ + /* public static void main(String[] args) { + ThStudentReqDTO thStudentReqDTO = new ThStudentReqDTO(); + thStudentReqDTO.setUuid("5096d539-9ec4-499e-a7ef-3fc1c688ba51"); + thStudentReqDTO.setName("李四fafas"); + thStudentReqDTO.setIdcard("11112"); + thStudentReqDTO.setIndustry("ceshj"); + thStudentReqDTO.setPost("post"); + thStudentReqDTO.setPhone("111111fafdsafa"); + thStudentReqDTO.setSex(StudentSex.BOY.getStatus()); + thStudentReqDTO.setTrainOrgName("测试机构"); + thStudentReqDTO.setAuthPhoto("http://baidu.om"); + thStudentReqDTO.setBatchUuid("5096d539-9ec4-499e-a7ef-3fc1c688ba55"); + thStudentReqDTO.setDelFlag((byte) 0); + List<ThStudentReqDTO> studentList = new ArrayList<>(); + studentList.add(thStudentReqDTO); + String jsonString = JSONObject.toJSONString(studentList); + + String encrypt = AESUtils.encrypt(jsonString); + System.out.println(encrypt); + String decrypt = AESUtils.decrypt("PmvIbOPyVJ2pYqmGer1YBAij35Tfdk8lufUv+Y2CyqAds/iyh6PwS4dsnUzNO3El4kNaaSbqKO4dpSYLkHZiB41zB6OvNFcfSQr5uguBInWZHVGeWC7FljJkk/z8GB0ydvHSwsy+FGVkA6nMcOJGU31sf4JjO2hL10h6YeVEKtiEW2wOtuYWs067t4aP0q0zTnBWlnfO9i2WT3v0FjNhCXgPKR65HRAqrf+jrzRveLLFGL3be6qBOBwc8QqowMRS+6oUFMXTpzSfU6/QJrmbQw=="); + System.out.println(decrypt); + ThQuestionBankReqDTO questionBankReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThQuestionBankReqDTO>() {}); + System.out.println(questionBankReqDTO); + }*/ + /** + * 开班 + * */ +/* public static void main(String[] args) { + ThBatchOpenReqDTO thBatchOpenReqDTO = new ThBatchOpenReqDTO(); + thBatchOpenReqDTO.setBatchUuid("5096d539-9ec4-499e-a7ef-3fc1c688bad1"); + String jsonString = JSONObject.toJSONString(thBatchOpenReqDTO); + String encrypt = AESUtils.encrypt(jsonString); + System.out.println(encrypt); + + }*/ + /** + * 结束培训 + * */ + /* public static void main(String[] args) { + ThBatchEndReqDTO thBatchOpenReqDTO = new ThBatchEndReqDTO(); + thBatchOpenReqDTO.setBatchUuid("5096d539-9ec4-499e-a7ef-3fc1c688bad1"); + String jsonString = JSONObject.toJSONString(thBatchOpenReqDTO); + String encrypt = AESUtils.encrypt(jsonString); + System.out.println(encrypt); + + }*/ + + /** + * 考试记录 + */ + /*public static void main(String[] args) { + List<ThExamRecordReqDTO> list = new ArrayList<>(); + ThExamRecordReqDTO thExamRecordReqDTO = new ThExamRecordReqDTO(); + thExamRecordReqDTO.setUuid(UUID.randomUUID().toString()); + thExamRecordReqDTO.setIdcard("11111"); + thExamRecordReqDTO.setExamName("考试1"); + thExamRecordReqDTO.setBatchUuid("5096d539-9ec4-499e-a7ef-3fc1c688ba55"); + thExamRecordReqDTO.setExamPassScore(new BigDecimal(80)); + thExamRecordReqDTO.setExamIsPass(ExamIsPass.YES.getStatus()); + thExamRecordReqDTO.setExamUserScore(new BigDecimal(90)); + thExamRecordReqDTO.setExamStartTime(LocalDateTime.now()); + thExamRecordReqDTO.setExamSubmitTime(LocalDateTime.now()); + thExamRecordReqDTO.setTrainOrgName("测试"); + thExamRecordReqDTO.setExamTotalScore(new BigDecimal(100)); + list.add(thExamRecordReqDTO); + String jsonString = JSONObject.toJSONString(list); + String encrypt = AESUtils.encrypt(jsonString); + System.out.println(encrypt); + + }*/ + /** + * + */ + /*public static void main(String[] args) { + List<ThStudyDetailReqDTO> list = new ArrayList<>(); + ThStudyDetailReqDTO thStudyDetailReqDTO = new ThStudyDetailReqDTO(); + thStudyDetailReqDTO.setUuid("8c061cb1-8560-43b8-abe4-04ae8e763f59"); + thStudyDetailReqDTO.setIdcard("11111"); + thStudyDetailReqDTO.setBatchUuid("5096d539-9ec4-499e-a7ef-3fc1c688ba55"); + thStudyDetailReqDTO.setCourseUuid("20bded7f-660c-4380-b7f9-00f3976e1875"); + thStudyDetailReqDTO.setFinishStatus((byte)0); + thStudyDetailReqDTO.setStartPosition(0l); + thStudyDetailReqDTO.setFinishPosition(4567l); + thStudyDetailReqDTO.setChapterUuid("d5cd3b26-be11-4ffe-8a34-283c49c85253"); + thStudyDetailReqDTO.setDuration(4567l); + thStudyDetailReqDTO.setTrainOrgName("测试"); + thStudyDetailReqDTO.setStartTime(LocalDateTime.now()); + thStudyDetailReqDTO.setFinishTime(LocalDateTime.now()); + thStudyDetailReqDTO.setVideoUrl("hhtht"); + thStudyDetailReqDTO.setLessonReportUrl("hht"); + List<ThStudyTrackReqDTO> thStudyTrackReqDTOList = new ArrayList<>(); + ThStudyTrackReqDTO thStudyTrackReqDTO = new ThStudyTrackReqDTO(); + thStudyTrackReqDTO.setUuid("3162d570-9099-4dfb-b2fa-ec705f53758c"); + thStudyTrackReqDTO.setStartTime(LocalDateTime.now()); + thStudyTrackReqDTO.setEndTime(LocalDateTime.now()); + thStudyTrackReqDTO.setTimeInterval(789878l); + thStudyTrackReqDTOList.add(thStudyTrackReqDTO); + List<ThStudytAuthReqDTO> thStudytAuthReqDTOList = new ArrayList<>(); + ThStudytAuthReqDTO thStudytAuthReqDTO = new ThStudytAuthReqDTO(); + thStudytAuthReqDTO.setUuid(UUID.randomUUID().toString()); + thStudytAuthReqDTO.setAuthPosition(0l); + thStudytAuthReqDTO.setAuthTime(LocalDateTime.now()); + thStudytAuthReqDTO.setApprovePhoto("454l"); + thStudytAuthReqDTO.setFaceType(FaceType.AUTH.getType()); + thStudytAuthReqDTOList.add(thStudytAuthReqDTO); + thStudyDetailReqDTO.setTrackList(thStudyTrackReqDTOList); + thStudyDetailReqDTO.setAuthList(thStudytAuthReqDTOList); + list.add(thStudyDetailReqDTO); + String jsonString = JSONObject.toJSONString(list); + String encrypt = AESUtils.encrypt(jsonString); + System.out.println(encrypt); + + }*/ + /* public static void main(String[] args) { + String decrypt = AESUtils.decrypt(""); + System.out.println(decrypt); + }*/ +} + -- Gitblit v1.9.2