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 | 148 +++++++++++++++++++++++++++++++------------------ 1 files changed, 93 insertions(+), 55 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 index 901a875..bdbaf50 100644 --- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/TripartiteInterfaceController.java +++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/controller/TripartiteInterfaceController.java @@ -1,24 +1,17 @@ package com.gkhy.exam.institutionalaccess.controller; import com.alibaba.fastjson2.JSONObject; -import com.alibaba.fastjson2.TypeReference; -import com.gkhy.exam.institutionalaccess.enums.*; -import com.gkhy.exam.institutionalaccess.model.req.*; import com.gkhy.exam.institutionalaccess.service.TripartiteInterfaceService; +import com.ruoyi.common.annotation.RepeatedClick; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.signature.AESUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; + @RequestMapping("/gov-server/receive") @@ -28,41 +21,51 @@ private TripartiteInterfaceService tripartiteInterfaceService; @PostMapping("/question/bank") + @RepeatedClick public AjaxResult receiveQuestionBank(@RequestBody JSONObject jsonObject){ return success(tripartiteInterfaceService.receiveQuestionBank(jsonObject)); } @PostMapping("/course") + @RepeatedClick public AjaxResult receiveCourse(@RequestBody JSONObject jsonObject){ return tripartiteInterfaceService.receiveCourse(jsonObject); } @PostMapping("/course/delete") + @RepeatedClick public AjaxResult receiveCourseDelete(@RequestBody JSONObject jsonObject){ return tripartiteInterfaceService.receiveCourseDelete(jsonObject); } @PostMapping("/batch") + @RepeatedClick public AjaxResult receiveBatch(@RequestBody JSONObject jsonObject){ return tripartiteInterfaceService.receiveBatch(jsonObject); } @PostMapping("/batch/open") + @RepeatedClick public AjaxResult receiveBatchOpen(@RequestBody JSONObject jsonObject){ return tripartiteInterfaceService.receiveBatchOpen(jsonObject); } @PostMapping("/student") + @RepeatedClick public AjaxResult receiveStudent(@RequestBody JSONObject jsonObject){ return tripartiteInterfaceService.receiveStudent(jsonObject); } @PostMapping("/study/detail") + @RepeatedClick public AjaxResult receiveStudyDetail(@RequestBody JSONObject jsonObject){ return tripartiteInterfaceService.receiveStudyDetail(jsonObject); } + + @RepeatedClick @PostMapping("/exam/record") public AjaxResult receiveExamRecord(@RequestBody JSONObject jsonObject){ return tripartiteInterfaceService.receiveExamRecord(jsonObject); } + @RepeatedClick @PostMapping("/batch/end") - public AjaxResult receiveBarchEnd(@RequestBody JSONObject jsonObject){ - return tripartiteInterfaceService.receiveBarchEnd(jsonObject); + public AjaxResult receiveBatchEnd(@RequestBody JSONObject jsonObject){ + return tripartiteInterfaceService.receiveBatchEnd(jsonObject); } /** @@ -94,6 +97,7 @@ * @param args */ /*public static void main(String[] args) { + List<ThCourseReqDTO> list = new ArrayList<>(); ThCourseReqDTO thCourseReqDTO = new ThCourseReqDTO(); thCourseReqDTO.setUuid("20bded7f-660c-4380-b7f9-00f3976e1875"); thCourseReqDTO.setCourseCode("java001111"); @@ -105,41 +109,46 @@ //章 ThCourseChapterReqDTO chapterReqDTO1 = new ThCourseChapterReqDTO(); chapterReqDTO1.setUuid("9d470732-6233-4820-82f7-37c80fe8ae68"); - //chapterReqDTO1.setDelFlag((byte)0); + chapterReqDTO1.setDelFlag((byte)0); chapterReqDTO1.setChapterCode("001"); chapterReqDTO1.setChapterName("第一章节 基础理论"); - chapterReqDTO1.setHaveResource((byte)10); + chapterReqDTO1.setHaveResource((byte)0); + chapterReqDTO1.setSerialno(1); + chapterReqDTO1.setLessonNum(new BigDecimal(10)); List<ThCourseChapterReqDTO> childList = new ArrayList<>(); //节 ThCourseChapterReqDTO child11 = new ThCourseChapterReqDTO(); child11.setUuid("d5cd3b26-be11-4ffe-8a34-283c49c85253"); child11.setUrl("https://www.baidu.com"); - //child11.setDelFlag((byte)2); + child11.setDelFlag((byte)2); child11.setChapterCode("1.1"); child11.setChapterName("1.1类"); - child11.setHaveResource((byte)20); + child11.setHaveResource((byte)1); + child11.setSerialno(1); child11.setDuration(1800l); child11.setResourceType((byte)0); child11.setLessonNum(new BigDecimal(1)); ThCourseChapterReqDTO child12= new ThCourseChapterReqDTO(); child12.setUuid("eb7167be-5716-43d0-8e27-12bb43d1dded"); child12.setUrl("https://www.baidu.com1213231"); - //child12.setDelFlag((byte)0); + child12.setDelFlag((byte)0); child12.setChapterCode("1.2"); child12.setChapterName("1.2接口"); - child12.setHaveResource((byte)20); + child12.setHaveResource((byte)1); child12.setLessonNum(new BigDecimal(1.5)); child12.setDuration(4500l); child12.setResourceType((byte)0); + child12.setSerialno(2); ThCourseChapterReqDTO child13= new ThCourseChapterReqDTO(); - child13.setUuid(UUID.randomUUID().toString()); + child13.setUuid("d684081a-6a09-42ce-86b1-58df94d18f6b"); child13.setUrl("https://www.baidu.com3333"); - //child13.setDelFlag((byte)0); + child13.setDelFlag((byte)2); child13.setChapterCode("1.3"); child13.setChapterName("1.3多态"); - child13.setHaveResource((byte)20); + child13.setHaveResource((byte)1); child13.setLessonNum(new BigDecimal(1.5)); child13.setDuration(1800l); + child13.setSerialno(3); child13.setResourceType((byte)0); childList.add(child11); childList.add(child12); @@ -147,20 +156,18 @@ chapterReqDTO1.setChildren(childList); chapterList.add(chapterReqDTO1); thCourseReqDTO.setChapters(chapterList); - - String jsonString = JSONObject.toJSONString(thCourseReqDTO); + list.add(thCourseReqDTO); + String jsonString = JSONObject.toJSONString(list); String encrypt = AESUtils.encrypt(jsonString); System.out.println(encrypt); - String decrypt = AESUtils.decrypt("3G5/kr4d9CCjK6/q8LWZ1TZK6SF/GINWmeKzfmtvPZo0W/4Ydd7qti1VaOO4LQcKNNN67kvSfjCx3xUS1iAiUcWaVllWpVeNW8FWHt/1OQ+coFyslHVXDdCbQIVYpzF/0Q4jdBXpydtEmVsxifazo3l5/a2NBG319hhCXFNJmY5DgF2SUq7t6niKaEom6QbcFTENqV1KNZ87QeI7dl18UveADgxP91XpaRb+4M0JGIYpiXnr/LEDNAYM13eU6LSK+mBc38QQ+WcxijYGFvk1U6rlMYui3aLisyPLaFEwlhZ9Mscsrdw3t+XNJNp6SKiTG4HCOvSBYOGHp2PHhFQBNHzluOlcA5L8a4nogDpThwcl47O474VXnp0WG2+9DYVUTXW/UddZSc/aCCIhe/DTfA7WoZkOnMO8k8fHlXQ0exHnfPxBTxozG3UKyQ6hGHyjWqrfk/oVRcfOcPCQavIwwu9YLQeUpqL88VntE2+sBUPJtGOQrvq6A5No2RHgEGqptrUboMuL/OimEGjTAPdnRKQL+8JqqZf9HSPTCnoSYpTxKAfFf8hKEyMvW8SZzr3BS1MOL11HOTKeaD7kVuCYxEugfrdIzcAFsX9lxHSO2ubHadXektkdpLdMPd8WuLDzUknJqvYPDHBxcIzMea0XAQ=="); + String decrypt = AESUtils.decrypt("lE7/ryHW69pxuwuttBk8edBc7j30BwVoO3j0hl0933QQGMEYUgfVRhD0KlSGJcZoXh5NLQC6k08lJEsRSi8N59ydUG4qPdvk40Txc+O6xaudXHuMBzSePAKqYxQmG7hENVx8+Oarp+Nd4YsUxgcD9pE8RywRd7etZfowZapsbV1azNXjX7e2A0lhfkF1q5cmeQGB+YI0G9zoBeAXPAH+izmdtAnHr8GlB5dnwH7y0ObCWhpxa0o4gAlEn5zw8UNqYHnVpvgjFE15N7XSJqIauSVcmxMK6OMEEwfrzJ4kzDz8WHLoOWz1vXzUYFhb2yR/rp33cOYfTNOSVGWD14BKd2pLNleHp7TUFo4sG4+IwN4nMSYQstROI21BaSrBNQz2EjsB56BCbyc9nSxCBRA2MTxPRxKkjx/pVXUa7IG7wG8lxp7M+noeXygBBfoVFG5pwk0ux73+xZtKQiHi7yFW3kAbeMT16G9J0MzsWd3T3XJt1rDCO192SPNf9x/DFNp/xmMa1hnc18hguoeooTZPiGnkMze29Bp4P0Xn/XYrR1rlpZwkkcwWaw2/XXOiU5cWbzg6VKay6bj8IgKF7iKXcrM1UbgNkHnkb5XMrFG6lBcfI8KsBLPtaNOLWyMfJc+Wk7nSy50W5TkVLcNBDzpEgODNorl/70wYifupz+IRDQWgYw8IEQzUV6iy1RocFwg9SePvQgKsEYdEKYbPTv/wXpN+HgsGRXVb0K0gUl1BvPoXkwejXDIfuCw+6tdihFJdGFJZf4/26PCGkjBbfcMoLRW4chhvjbnFhXO7Kqz2Ah5e5GkXrCMuYWhMLtbP3W+q70Vrk+8CQSr3Q0cWt0vxYPQZjEYkpMLkAdA5x17AIrTvt/CrYTBwHTIKpKaBjv6CmEI9pHWUKERQEuSpuP75JG9cRX8UIQLFtA+tvh4jU/m1X5hqaudRQnIZL5FUJrMoPkBBfZ5LManiMk5jC/UDbozihOuxIgb+tvMONbhejgBk7tGfvqFz53PZNp7dx6VWI4RsYCDcKduCnjKQuOdmSClPbaCphZXu8qObvareOV4pwDD3gyBNn+nkzVgdxU+dy/wdK5HQWrqvelGSUx1SkRyRPh2fbB+33esmaJDUPL3mKQxIaQ06ZK5N9OJeiJcPuv+NPxgcQi/rxUkGNA+yA5luwNm7IMqya9LOyiG1kELwNNHGdcsvB4hsr4C44zMlT9hmHtk/2p/h1LO6A3KSqR+02VSU7+4CCC6lxHEkrufE4FpQN1dofIlkYD9KGjey"); System.out.println(decrypt); - ThCourseReqDTO questionBankReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThCourseReqDTO>() {}); - System.out.println(questionBankReqDTO); }*/ /** * 课程删除 */ - /*public static void main(String[] args) { + /* public static void main(String[] args) { ThCourseDeleteReqDTO thQuestionBankReqDTO = new ThCourseDeleteReqDTO(); thQuestionBankReqDTO.setCourseUuid("20bded7f-660c-4380-b7f9-00f3976e1875"); String jsonString = JSONObject.toJSONString(thQuestionBankReqDTO); @@ -178,14 +185,42 @@ */ /*public static void main(String[] args) { ThBatchReqDTO thBatchReqDTO = new ThBatchReqDTO(); - thBatchReqDTO.setUuid(UUID.randomUUID().toString()); + thBatchReqDTO.setUuid("5096d539-9ec4-499e-a7ef-3fc1c688ba55"); thBatchReqDTO.setBatchName("第一期2024"); thBatchReqDTO.setTrainOrgName("测试机构"); thBatchReqDTO.setHaveExam(HaveExam.YES.getStatus()); - thBatchReqDTO.setOpenStatus(OpenStatus.NO.getStatus()); - List<String> courseList = new ArrayList<>(); - courseList.add(new String("20bded7f-660c-4380-b7f9-00f3976e1875")); - thBatchReqDTO.setCourseUuidList(courseList); + thBatchReqDTO.setStatus(OpenStatus.NO.getStatus()); + thBatchReqDTO.setDelFlag((byte)0); + thBatchReqDTO.setBatchLessonNum(new BigDecimal(40)); + List<ThBatchCourseReqDTO> courseList = new ArrayList<>(); + ThBatchCourseReqDTO courseReqDTO = new ThBatchCourseReqDTO(); + courseReqDTO.setCourseUuid("20bded7f-660c-4380-b7f9-00f3976e1875"); + courseReqDTO.setDelFlag((byte) 0); + courseReqDTO.setCourseLessonNum(new BigDecimal(20)); + //章 + List<ThBatchCourseChapterReqDTO> chapterList = new ArrayList<>(); + ThBatchCourseChapterReqDTO chapterReqDTO = new ThBatchCourseChapterReqDTO(); + chapterReqDTO.setChapterUuid("9d470732-6233-4820-82f7-37c80fe8ae68"); + chapterReqDTO.setDelFlag((byte) 0); + chapterReqDTO.setChapterLessonNum(new BigDecimal(2)); + + //节 + List<ThBatchCourseChapterReqDTO> sectionList = new ArrayList<>(); + ThBatchCourseChapterReqDTO sectionReqDTO1 = new ThBatchCourseChapterReqDTO(); + sectionReqDTO1.setChapterUuid("d5cd3b26-be11-4ffe-8a34-283c49c85253"); + sectionReqDTO1.setDelFlag((byte) 0); + sectionReqDTO1.setChapterLessonNum(new BigDecimal(1)); + ThBatchCourseChapterReqDTO sectionReqDTO2 = new ThBatchCourseChapterReqDTO(); + sectionReqDTO2.setChapterUuid("eb7167be-5716-43d0-8e27-12bb43d1dded"); + sectionReqDTO2.setDelFlag((byte) 0); + sectionReqDTO2.setChapterLessonNum(new BigDecimal(1)); + sectionList.add(sectionReqDTO2); + sectionList.add(sectionReqDTO1); + chapterReqDTO.setChildren(sectionList); + chapterList.add(chapterReqDTO); + courseReqDTO.setChapterList(chapterList); + courseList.add(courseReqDTO); + thBatchReqDTO.setCourseList(courseList); String jsonString = JSONObject.toJSONString(thBatchReqDTO); String encrypt = AESUtils.encrypt(jsonString); @@ -198,17 +233,19 @@ /** * 学生信息上报 */ - /* public static void main(String[] args) { + /* public static void main(String[] args) { ThStudentReqDTO thStudentReqDTO = new ThStudentReqDTO(); - thStudentReqDTO.setName("李四"); - thStudentReqDTO.setIdcard("11111"); + thStudentReqDTO.setUuid("5096d539-9ec4-499e-a7ef-3fc1c688ba51"); + thStudentReqDTO.setName("李四fafas"); + thStudentReqDTO.setIdcard("11112"); thStudentReqDTO.setIndustry("ceshj"); thStudentReqDTO.setPost("post"); - thStudentReqDTO.setPhone("111111"); + thStudentReqDTO.setPhone("111111fafdsafa"); thStudentReqDTO.setSex(StudentSex.BOY.getStatus()); thStudentReqDTO.setTrainOrgName("测试机构"); thStudentReqDTO.setAuthPhoto("http://baidu.om"); - thStudentReqDTO.setBatchUuid("cc90070e-8d30-4c55-b696-7af25fd98900"); + thStudentReqDTO.setBatchUuid("5096d539-9ec4-499e-a7ef-3fc1c688ba55"); + thStudentReqDTO.setDelFlag((byte) 0); List<ThStudentReqDTO> studentList = new ArrayList<>(); studentList.add(thStudentReqDTO); String jsonString = JSONObject.toJSONString(studentList); @@ -223,9 +260,9 @@ /** * 开班 * */ - /*public static void main(String[] args) { +/* public static void main(String[] args) { ThBatchOpenReqDTO thBatchOpenReqDTO = new ThBatchOpenReqDTO(); - thBatchOpenReqDTO.setBatchUuid("b1b70bce-06dc-40b0-a3a1-dd595572eaa1"); + thBatchOpenReqDTO.setBatchUuid("5096d539-9ec4-499e-a7ef-3fc1c688bad1"); String jsonString = JSONObject.toJSONString(thBatchOpenReqDTO); String encrypt = AESUtils.encrypt(jsonString); System.out.println(encrypt); @@ -236,8 +273,7 @@ * */ /* public static void main(String[] args) { ThBatchEndReqDTO thBatchOpenReqDTO = new ThBatchEndReqDTO(); - thBatchOpenReqDTO.setBatchUuid("cc90070e-8d30-4c55-b696-7af25fd98900"); - thBatchOpenReqDTO.setIdcard("11111"); + thBatchOpenReqDTO.setBatchUuid("5096d539-9ec4-499e-a7ef-3fc1c688bad1"); String jsonString = JSONObject.toJSONString(thBatchOpenReqDTO); String encrypt = AESUtils.encrypt(jsonString); System.out.println(encrypt); @@ -248,13 +284,12 @@ * 考试记录 */ /*public static void main(String[] args) { + List<ThExamRecordReqDTO> list = new ArrayList<>(); ThExamRecordReqDTO thExamRecordReqDTO = new ThExamRecordReqDTO(); thExamRecordReqDTO.setUuid(UUID.randomUUID().toString()); - thExamRecordReqDTO.setIdcard("1111"); + thExamRecordReqDTO.setIdcard("11111"); thExamRecordReqDTO.setExamName("考试1"); - thExamRecordReqDTO.setExamNum(1); - thExamRecordReqDTO.setCourseUuid("20bded7f-660c-4380-b7f9-00f3976e1875"); - thExamRecordReqDTO.setBatchUuid("cc90070e-8d30-4c55-b696-7af25fd98900"); + thExamRecordReqDTO.setBatchUuid("5096d539-9ec4-499e-a7ef-3fc1c688ba55"); thExamRecordReqDTO.setExamPassScore(new BigDecimal(80)); thExamRecordReqDTO.setExamIsPass(ExamIsPass.YES.getStatus()); thExamRecordReqDTO.setExamUserScore(new BigDecimal(90)); @@ -262,7 +297,8 @@ thExamRecordReqDTO.setExamSubmitTime(LocalDateTime.now()); thExamRecordReqDTO.setTrainOrgName("测试"); thExamRecordReqDTO.setExamTotalScore(new BigDecimal(100)); - String jsonString = JSONObject.toJSONString(thExamRecordReqDTO); + list.add(thExamRecordReqDTO); + String jsonString = JSONObject.toJSONString(list); String encrypt = AESUtils.encrypt(jsonString); System.out.println(encrypt); @@ -270,11 +306,12 @@ /** * */ - /* public static void main(String[] args) { + /*public static void main(String[] args) { + List<ThStudyDetailReqDTO> list = new ArrayList<>(); ThStudyDetailReqDTO thStudyDetailReqDTO = new ThStudyDetailReqDTO(); - thStudyDetailReqDTO.setUuid(UUID.randomUUID().toString()); + thStudyDetailReqDTO.setUuid("8c061cb1-8560-43b8-abe4-04ae8e763f59"); thStudyDetailReqDTO.setIdcard("11111"); - thStudyDetailReqDTO.setBatchUuid("cc90070e-8d30-4c55-b696-7af25fd98900"); + thStudyDetailReqDTO.setBatchUuid("5096d539-9ec4-499e-a7ef-3fc1c688ba55"); thStudyDetailReqDTO.setCourseUuid("20bded7f-660c-4380-b7f9-00f3976e1875"); thStudyDetailReqDTO.setFinishStatus((byte)0); thStudyDetailReqDTO.setStartPosition(0l); @@ -288,7 +325,7 @@ thStudyDetailReqDTO.setLessonReportUrl("hht"); List<ThStudyTrackReqDTO> thStudyTrackReqDTOList = new ArrayList<>(); ThStudyTrackReqDTO thStudyTrackReqDTO = new ThStudyTrackReqDTO(); - thStudyTrackReqDTO.setUuid(UUID.randomUUID().toString()); + thStudyTrackReqDTO.setUuid("3162d570-9099-4dfb-b2fa-ec705f53758c"); thStudyTrackReqDTO.setStartTime(LocalDateTime.now()); thStudyTrackReqDTO.setEndTime(LocalDateTime.now()); thStudyTrackReqDTO.setTimeInterval(789878l); @@ -296,21 +333,22 @@ List<ThStudytAuthReqDTO> thStudytAuthReqDTOList = new ArrayList<>(); ThStudytAuthReqDTO thStudytAuthReqDTO = new ThStudytAuthReqDTO(); thStudytAuthReqDTO.setUuid(UUID.randomUUID().toString()); - thStudytAuthReqDTO.setAuthPostion(0l); + thStudytAuthReqDTO.setAuthPosition(0l); thStudytAuthReqDTO.setAuthTime(LocalDateTime.now()); thStudytAuthReqDTO.setApprovePhoto("454l"); thStudytAuthReqDTO.setFaceType(FaceType.AUTH.getType()); thStudytAuthReqDTOList.add(thStudytAuthReqDTO); thStudyDetailReqDTO.setTrackList(thStudyTrackReqDTOList); - thStudyDetailReqDTO.setStudentAuthList(thStudytAuthReqDTOList); - String jsonString = JSONObject.toJSONString(thStudyDetailReqDTO); + thStudyDetailReqDTO.setAuthList(thStudytAuthReqDTOList); + list.add(thStudyDetailReqDTO); + String jsonString = JSONObject.toJSONString(list); String encrypt = AESUtils.encrypt(jsonString); System.out.println(encrypt); }*/ - public static void main(String[] args) { - String decrypt = AESUtils.decrypt("PmvIbOPyVJ2pYqmGer1YBAij35Tfdk8lufUv+Y2CyqAds/iyh6PwS4dsnUzNO3El4Sk/WXXwbPGQ7UdaV8jznT/3YPqTeLdkxQ/1/6r9pvxuD2tyds8jo9DIBZYVxHpX3/9Z5Byp1UvszWeTWeaiDN+paKNO5v/TcXrosdce2dMGXLwY0i3GYA1JIbWWTTrvoWKJK+k5VW+5NnnDo+2Gj5CNSNv4c2wT7f3hTRy6B66RrRN3xkucCw4VRJZ+r+RK"); + /* public static void main(String[] args) { + String decrypt = AESUtils.decrypt(""); System.out.println(decrypt); - } + }*/ } -- Gitblit v1.9.2