exam-system/src/main/java/com/gkhy/exam/institutionalaccess/entity/ThCert.java
@@ -39,7 +39,7 @@ @ApiModelProperty("证书生成时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalTime certTime; private LocalDateTime certTime; @ApiModelProperty("证书链接") private String certUrl; exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/query/ThCertQuery.java
@@ -6,6 +6,7 @@ @Data public class ThCertQuery { //机构名称 private String institutionName; //证书生成开始时间 exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThCertReqDTO.java
@@ -7,7 +7,9 @@ import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import java.time.LocalDateTime; import java.time.LocalTime; @@ -38,8 +40,8 @@ private String trainOrgName; @ApiModelProperty("证书生成时间") @NotEmpty(message = "证书生成时间不能为空") private LocalTime certTime; @NotNull(message = "证书生成时间不能为空") private LocalDateTime certTime; @ApiModelProperty("证书链接") @NotBlank(message = "证书链接不能为空") exam-system/src/main/java/com/gkhy/exam/institutionalaccess/model/req/ThQuestionBankReqDTO.java
@@ -4,10 +4,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.Min; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.Pattern; import javax.validation.constraints.*; import java.math.BigDecimal; @Data @@ -21,27 +18,27 @@ @ApiModelProperty("题库名称") private String name; @NotEmpty(message = "题库题目总数不能为空") @NotNull(message = "题库题目总数不能为空") @Min(value = 0,message = "题库题目总数格式不正确") @ApiModelProperty("题库题目总数") private Integer totalCount; @NotEmpty(message = "单选题数量不能为空") @NotNull(message = "单选题数量不能为空") @Min(value = 0,message = "单选题数量格式不正确") @ApiModelProperty("单选题数量") private Integer singleCount; @NotEmpty(message = "多选题数量不能为空") @NotNull(message = "多选题数量不能为空") @Min(value = 0,message = "多选题数量格式不正确") @ApiModelProperty("多选题数量") private Integer multiCount; @NotEmpty(message = "判断题数量不能为空") @NotNull(message = "判断题数量不能为空") @Min(value = 0,message = "判读题数量格式不正确") @ApiModelProperty("判断题数量") private Integer judgeCount; @NotEmpty(message = "简答题数量不能为空") @NotNull(message = "简答题数量不能为空") @Min(value = 0,message = "简答题数量格式不正确") @ApiModelProperty("简答题数量") private Integer easyCount; pom.xml
@@ -206,9 +206,30 @@ <artifactId>gson</artifactId> <version>2.8.5</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>8.0.29</version> </dependency> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.5.1</version> </dependency> </dependencies> </dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies> <modules> <module>ruoyi-admin</module> <module>ruoyi-framework</module> ruoyi-admin/pom.xml
@@ -70,6 +70,20 @@ <groupId>com.ruoyi</groupId> <artifactId>exam-system</artifactId> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-test</artifactId> <scope>test</scope> </dependency> </dependencies> <build> ruoyi-admin/ruoyi-admin.iml
对比新文件 @@ -0,0 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <module version="4"> <component name="AdditionalModuleElements"> <content url="file://$MODULE_DIR$" dumb="true"> <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> </content> </component> </module> ruoyi-admin/src/main/resources/application-dev.yml
@@ -81,13 +81,13 @@ # redis 配置 redis: # 地址 host: 127.0.0.1 host: 192.168.2.16 # 端口,默认为6379 port: 6379 # 数据库索引 database: 5 # 密码 password: root password: wioowr23923sd3*& # 连接超时时间 timeout: 10s lettuce: @@ -122,4 +122,11 @@ queueCapacity: 10000 scheduling: #控制线程是否执行 true:执行;false:不执行 enabled: true enabled: true # 七牛云相关信息 safecheckqiniuymes: accesskey: 5YprpjY0BJiyjII2VqlHed7UhBEvvkPZicbwd8Kl secretkey: m3gGQNQ9cLmVBBZwPXZ5-Wzr0duzyAPPmJUx4_ay templateid: 1844221365930962944 ruoyi-admin/src/test/java/com/ruoyi/CertTest.java
对比新文件 @@ -0,0 +1,49 @@ package com.ruoyi; import com.alibaba.fastjson2.JSONObject; import com.gkhy.exam.institutionalaccess.model.req.ThCertReqDTO; import com.gkhy.exam.institutionalaccess.service.TripartiteInterfaceService; import com.ruoyi.common.core.domain.model.InstitutionUser; import com.ruoyi.common.signature.AESUtils; import com.ruoyi.framework.security.context.ThreeInContextHolder; import lombok.extern.slf4j.Slf4j; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import java.time.LocalDateTime; import java.util.*; @RunWith(SpringRunner.class) @SpringBootTest(classes = RuoYiApplication.class) @ActiveProfiles("dev") @Slf4j public class CertTest { @Autowired private TripartiteInterfaceService tripartiteInterfaceService; @Test public void testCertInsert() throws Exception { ThreeInContextHolder.setContext(new InstitutionUser().setId(1L).setInstitutionalName("test")); List<ThCertReqDTO>thCertDTOs=new ArrayList<>(); ThCertReqDTO thCertDTO = new ThCertReqDTO(); thCertDTO.setUuid(UUID.randomUUID().toString()); thCertDTO.setName("张三"); thCertDTO.setIdcard("123456789012345678"); thCertDTO.setBatchUuid("1ef0b81f-dcb7-62a9-ad8f-63e252089bc8"); thCertDTO.setTrainOrgName("1234567890123"); thCertDTO.setCertTime(LocalDateTime.now()); thCertDTO.setCertUrl("https://p26.toutiaoimg.com/origin/tos-cn-i-qvj2lq49k0/22f10850c5234b5285350743cfa16357"); thCertDTOs.add(thCertDTO); String jsonString = JSONObject.toJSONString(thCertDTOs); JSONObject object=new JSONObject(); object.put("data", AESUtils.encrypt(jsonString)); tripartiteInterfaceService.receiveCerts(object); } } ruoyi-admin/src/test/java/com/ruoyi/QuestionBankTest.java
对比新文件 @@ -0,0 +1,49 @@ package com.ruoyi; import com.alibaba.fastjson2.JSONObject; import com.gkhy.exam.institutionalaccess.entity.ThQuestionBank; import com.gkhy.exam.institutionalaccess.model.req.ThCertReqDTO; import com.gkhy.exam.institutionalaccess.service.TripartiteInterfaceService; import com.ruoyi.common.core.domain.model.InstitutionUser; import com.ruoyi.common.signature.AESUtils; import com.ruoyi.framework.security.context.ThreeInContextHolder; import lombok.extern.slf4j.Slf4j; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import java.time.LocalDateTime; import java.util.*; @RunWith(SpringRunner.class) @SpringBootTest(classes = RuoYiApplication.class) @ActiveProfiles("dev") @Slf4j public class QuestionBankTest { @Autowired private TripartiteInterfaceService tripartiteInterfaceService; @Test public void testQuestionBankInsert() throws Exception { ThreeInContextHolder.setContext(new InstitutionUser().setId(1L).setInstitutionalName("test")); ThQuestionBank questionBank=new ThQuestionBank(); questionBank.setUuid(UUID.randomUUID().toString()); questionBank.setName("题库1"); questionBank.setTotalCount(100); questionBank.setSingleCount(10); questionBank.setMultiCount(10); questionBank.setJudgeCount(10); questionBank.setEasyCount(10); questionBank.setMixCount(10); questionBank.setOtherCount(10); String jsonString = JSONObject.toJSONString(questionBank); JSONObject object=new JSONObject(); object.put("data", AESUtils.encrypt(jsonString)); tripartiteInterfaceService.receiveQuestionBank(object); } } ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/InstitutionUser.java
@@ -1,9 +1,11 @@ package com.ruoyi.common.core.domain.model; import lombok.Data; import lombok.experimental.Accessors; import java.util.Map; @Accessors(chain = true) @Data public class InstitutionUser { private Long id; update.sql
@@ -4,12 +4,12 @@ CREATE TABLE `swspkmas`.`tr_cert` ( `id` bigint NOT NULL AUTO_INCREMENT, `uuid` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `uuid` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `idcard` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `institution_id` bigint NOT NULL, `institution_name` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `batch_uuid` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `batch_uuid` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `del_flag` tinyint NOT NULL DEFAULT 0, `train_org_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `cert_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, @@ -32,7 +32,7 @@ drop table if exists `swspkmas`.`th_question_bank`; CREATE TABLE `swspkmas`.`th_question_bank` ( `id` bigint NOT NULL AUTO_INCREMENT, `uuid` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `uuid` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `institution_id` bigint NOT NULL, `institution_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `total_count` int NOT NULL COMMENT '题库题目总数量',