deason 6 年之前
父節點
當前提交
6dc6730387

+ 8 - 3
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/ExamStructureServiceImpl.java

@@ -97,11 +97,16 @@ public class ExamStructureServiceImpl implements ExamStructureService {
 
         ExamStructure structure = ExamStructureConvert.of(info);
         ExamStructure oldEntity = examStructureRepository.findByOrgIdAndExamId(info.getOrgId(), info.getExamId());
-        if (structure != null) {
+        if (oldEntity != null) {
             //已存在则修改
-            structure.setId(oldEntity.getId());
+            oldEntity.setStruct(structure.getStruct());
+            oldEntity.setOrgName(structure.getOrgName());
+            oldEntity.setExamName(structure.getExamName());
+            examStructureRepository.save(oldEntity);
+            return;
         }
-        //默认为"传统考试"类型
+
+        //否则新增,默认为"传统考试"类型
         structure.setExamType(ExamType.TRADITION.name());
         examStructureRepository.save(structure);
     }

+ 1 - 1
examcloud-core-print-starter/src/main/resources/application-dev.properties

@@ -1,5 +1,5 @@
 # datasource config
-spring.datasource.url=jdbc:mysql://db-host:3306/exam_cloud_kf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC&rewriteBatchedStatements=true
+spring.datasource.url=jdbc:mysql://db-host:3306/exam_cloud_kf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2b8&rewriteBatchedStatements=true
 spring.datasource.username=root
 spring.datasource.password=root
 spring.jpa.hibernate.ddl-auto=update

+ 1 - 1
examcloud-core-print-starter/src/main/resources/application-prod.properties

@@ -1,5 +1,5 @@
 # datasource config
-spring.datasource.url=jdbc:mysql://db-host:3306/exam_cloud_kf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC&rewriteBatchedStatements=true
+spring.datasource.url=jdbc:mysql://db-host:3306/exam_cloud_kf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2b8&rewriteBatchedStatements=true
 spring.datasource.username=root
 spring.datasource.password=root
 spring.jpa.hibernate.ddl-auto=update

+ 1 - 1
examcloud-core-print-starter/src/main/resources/application-test.properties

@@ -1,5 +1,5 @@
 # datasource config
-spring.datasource.url=jdbc:mysql://db-host:3306/exam_cloud_kf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC&rewriteBatchedStatements=true
+spring.datasource.url=jdbc:mysql://db-host:3306/exam_cloud_kf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2b8&rewriteBatchedStatements=true
 spring.datasource.username=root
 spring.datasource.password=root
 spring.jpa.hibernate.ddl-auto=update