Pārlūkot izejas kodu

merge from release_v4.1.1

deason 3 gadi atpakaļ
vecāks
revīzija
349b017338

+ 1 - 1
examcloud-core-examwork-dao/src/main/java/cn/com/qmth/examcloud/core/examwork/dao/entity/UserNoticeEntity.java

@@ -60,7 +60,7 @@ public class UserNoticeEntity extends WithIdJpaEntity {
 	/**
 	 * 是否已撤销
 	 */
-	@Column(nullable = false)
+	@Column(nullable = true)
 	private Boolean hasRecalled;
 
 	public Long getRootOrgId() {

+ 2 - 14
examcloud-core-examwork-service/src/main/java/cn/com/qmth/examcloud/core/examwork/service/impl/ExamStudentServiceImpl.java

@@ -32,7 +32,6 @@ import cn.com.qmth.examcloud.core.oe.admin.api.request.CheckExamIsStartedReq;
 import cn.com.qmth.examcloud.core.oe.admin.api.response.CheckExamIsStartedResp;
 import cn.com.qmth.examcloud.task.api.DataSyncCloudService;
 import cn.com.qmth.examcloud.task.api.request.SyncExamStudentReq;
-import cn.com.qmth.examcloud.web.bootstrap.PropertyHolder;
 import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -79,17 +78,6 @@ public class ExamStudentServiceImpl implements ExamStudentService {
     @Autowired
     ExamPaperTypeRelationRepo examPaperTypeRelationRepo;
 
-    /**
-     * 是否强制删除考生
-     *
-     * @return
-     * @author WANGWEI
-     */
-    private boolean forceDeleteExamStudent() {
-        boolean b = PropertyHolder.getBoolean("$deleteExamStudent.force", false);
-        return b;
-    }
-
     /**
      * 是否开考
      *
@@ -121,7 +109,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
 
         for (ExamStudentEntity examStudent : examStudents) {
             // 网考判断
-            if ((!forceDeleteExamStudent()) && isStarted(examStudent.getExamId(), null, null)) {
+            if (isStarted(examStudent.getExamId(), null, null)) {
                 throw new StatusException("150112", examStudent.getName() + "已开始考试,不能删除");
             }
             examStudentRepo.delete(examStudent);
@@ -170,7 +158,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
     public void deleteExamStudentsByExamId(Long examId) {
         ExamEntity exam = GlobalHelper.getEntity(examRepo, examId, ExamEntity.class);
         // 已经开考
-        if ((!forceDeleteExamStudent()) && isStarted(exam.getId(), null, null)) {
+        if (isStarted(exam.getId(), null, null)) {
             throw new StatusException("150113", "该考试已开始,不能删除");
         }
 

+ 4 - 4
examcloud-core-examwork-starter/shell/start.sh

@@ -1,13 +1,13 @@
 #!/bin/bash
 
-PROJECT_JAR="examcloud-core-examwork-starter-v4.1.0-RELEASE.jar"
-
-PROJECT_JVM_ARGS=`cat start.vmoptions`
+PROJECT_JAR=`find . -name "examcloud-core-examwork-starter*.jar"`
+PROJECT_JAR=${PROJECT_JAR:6}
 
 PROJECT_ARGS=`cat start.args`
-
 PROJECT_ARGS=$PROJECT_ARGS" --sys.config.center.secretKey="$1
 
+PROJECT_JVM_ARGS=`cat start.vmoptions`
+
 PID_LIST=`ps -ef | grep $PROJECT_JAR | grep java | awk '{print $2}'`
 if [ ! -z "$PID_LIST" ]; then
     echo "$PROJECT_JAR is already running..."

+ 2 - 1
examcloud-core-examwork-starter/shell/stop.sh

@@ -1,6 +1,7 @@
 #!/bin/bash
 
-PROJECT_JAR="examcloud-core-examwork-starter-v4.1.0-RELEASE.jar"
+PROJECT_JAR=`find . -name "examcloud-core-examwork-starter*.jar"`
+PROJECT_JAR=${PROJECT_JAR:6}
 
 ps -ef | grep $PROJECT_JAR | grep java | awk '{printf("kill -15 %s\n",$2)}' | sh
 BUILD_ID=DONTKILLME

+ 30 - 15
examcloud-core-examwork-starter/src/main/java/cn/com/qmth/examcloud/core/examwork/starter/config/Swagger2.java

@@ -2,32 +2,47 @@ package cn.com.qmth.examcloud.core.examwork.starter.config;
 
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
-
 import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.builders.ParameterBuilder;
 import springfox.documentation.builders.PathSelectors;
 import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.schema.ModelRef;
 import springfox.documentation.service.ApiInfo;
-import springfox.documentation.service.Contact;
+import springfox.documentation.service.Parameter;
 import springfox.documentation.spi.DocumentationType;
 import springfox.documentation.spring.web.plugins.Docket;
 import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
 
+import java.util.ArrayList;
+import java.util.List;
+
 @Configuration
 @EnableSwagger2WebMvc
 public class Swagger2 {
 
-	@Bean
-	public Docket createRestApi() {
-		return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select()
-				.apis(RequestHandlerSelectors
-						.basePackage("cn.com.qmth.examcloud.core.examwork.api"))
-				.paths(PathSelectors.any()).build();
-	}
+    @Bean
+    public Docket buildDocket() {
+        List<Parameter> parameters = new ArrayList<>();
+        parameters.add(new ParameterBuilder().name("key").modelRef(new ModelRef("String")).parameterType("header").required(false).build());
+        parameters.add(new ParameterBuilder().name("token").modelRef(new ModelRef("String")).parameterType("header").required(false).build());
+
+        return new Docket(DocumentationType.SWAGGER_2)
+                .groupName("default")
+                .apiInfo(buildApiInfo())
+                .globalOperationParameters(parameters)
+                .useDefaultResponseMessages(false)
+                .select()
+                // .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
+                .apis(RequestHandlerSelectors.basePackage("cn.com.qmth.examcloud.core.examwork.api.controller"))
+                .paths(PathSelectors.any())
+                .build();
+    }
 
-	private ApiInfo apiInfo() {
-		return new ApiInfoBuilder().title("API doc")
-				.contact(new Contact("qmth", "http://xxxxx/", "")).version("xxx")
-				.description("API文档").build();
-	}
+    public ApiInfo buildApiInfo() {
+        return new ApiInfoBuilder()
+                .title("考试云平台接口文档")
+                .version("v4.x.x")
+                .build();
+    }
 
-}
+}

+ 6 - 0
examcloud-core-examwork-starter/src/main/resources/exam-properties.xml

@@ -312,4 +312,10 @@
 		<desc>显示设置-考生承诺书</desc>
 		<valueType>STRING</valueType>
 	</enum>
+	<enum>
+		<id>53</id>
+		<name>MAX_SWITCH_SCREEN_COUNT</name>
+		<desc>控制设置-切屏次数限制</desc>
+		<valueType>INTEGER</valueType>
+	</enum>
 </enums>