deason 6 жил өмнө
parent
commit
cc3fe766dd

+ 2 - 2
examcloud-core-print-provider/src/main/java/cn/com/qmth/examcloud/core/print/api/provider/PrintingSyncCloudServiceProvider.java

@@ -13,7 +13,7 @@ import cn.com.qmth.examcloud.commons.api.response.*;
 import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
 import cn.com.qmth.examcloud.core.print.enums.ExamType;
 import cn.com.qmth.examcloud.core.print.service.PrintingProjectService;
-import cn.com.qmth.examcloud.core.print.service.bean.printingproject.OrgExamInfo;
+import cn.com.qmth.examcloud.core.print.service.bean.common.ExamInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -48,7 +48,7 @@ public class PrintingSyncCloudServiceProvider extends ControllerSupport implemen
     public SyncExamResp syncExam(@RequestBody SyncExamReq req) {
         printingProjectService.syncPrintingProjectOrgName(req.getId(), req.getName());
         if (ExamType.isTradition(req.getExamType())) {
-            OrgExamInfo info = new OrgExamInfo(req.getRootOrgId(), req.getRootOrgName(), req.getId(), req.getName());
+            ExamInfo info = new ExamInfo(req.getRootOrgId(), req.getRootOrgName(), req.getId(), req.getName());
             printingProjectService.syncPrintingProject(info);
         }
         return new SyncExamResp();

+ 9 - 5
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/CommonService.java

@@ -7,7 +7,8 @@
 
 package cn.com.qmth.examcloud.core.print.service;
 
-import cn.com.qmth.examcloud.core.print.service.bean.printingproject.OrgExamInfo;
+import cn.com.qmth.examcloud.core.print.service.bean.common.ExamInfo;
+import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -31,13 +32,16 @@ public class CommonService {
      * 获取所有"传统"考试列表
      * (正式场景数据极少,一次获取全部)
      */
-    public List<OrgExamInfo> getTraditionExamList() {
+    public List<ExamInfo> getExamList(String examType) {
         StringBuilder sql = new StringBuilder()
                 .append("SELECT em.id AS examId,em.name AS examName,em.root_org_id AS orgId,org.name AS orgName FROM ec_e_exam em")
-                .append(" INNER JOIN ec_b_org org ON org.id = em.root_org_id")
-                .append(" WHERE em.exam_type = 'TRADITION' ORDER BY em.id ASC");
+                .append(" INNER JOIN ec_b_org org ON org.id = em.root_org_id");
+        if (StringUtils.isNotBlank(examType)) {
+            sql.append(" WHERE em.exam_type = '").append(examType).append("'");
+        }
+        sql.append(" ORDER BY em.id ASC");
         //log.debug(sql.toString());
-        return jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper(OrgExamInfo.class));
+        return jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper(ExamInfo.class));
     }
 
 }

+ 2 - 2
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/PrintingProjectService.java

@@ -8,7 +8,7 @@
 package cn.com.qmth.examcloud.core.print.service;
 
 import cn.com.qmth.examcloud.core.print.entity.PrintingProject;
-import cn.com.qmth.examcloud.core.print.service.bean.printingproject.OrgExamInfo;
+import cn.com.qmth.examcloud.core.print.service.bean.common.ExamInfo;
 import cn.com.qmth.examcloud.core.print.service.bean.printingproject.PrintingProjectInfo;
 import cn.com.qmth.examcloud.core.print.service.bean.printingproject.PrintingProjectQuery;
 import org.springframework.data.domain.Page;
@@ -45,7 +45,7 @@ public interface PrintingProjectService {
      * 同步(新增或更新)某个印刷项目的基本信息
      * 仅同步学校、考试等信息
      */
-    void syncPrintingProject(OrgExamInfo examInfo);
+    void syncPrintingProject(ExamInfo examInfo);
 
     /**
      * 同步所有印刷项目的基本信息

+ 5 - 5
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/bean/printingproject/OrgExamInfo.java → examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/bean/common/ExamInfo.java

@@ -1,11 +1,11 @@
 /*
  * *************************************************
  * Copyright (c) 2018 QMTH. All Rights Reserved.
- * Created by Deason on 2018-11-01 10:06:56.
+ * Created by Deason on 2018-11-07 13:38:08.
  * *************************************************
  */
 
-package cn.com.qmth.examcloud.core.print.service.bean.printingproject;
+package cn.com.qmth.examcloud.core.print.service.bean.common;
 
 import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
 
@@ -15,7 +15,7 @@ import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
  * @author: fengdesheng
  * @since: 2018/10/26
  */
-public class OrgExamInfo implements JsonSerializable {
+public class ExamInfo implements JsonSerializable {
     private static final long serialVersionUID = 1L;
     /**
      * 学校机构ID
@@ -34,14 +34,14 @@ public class OrgExamInfo implements JsonSerializable {
      */
     private String examName;
 
-    public OrgExamInfo(Long orgId, String orgName, Long examId, String examName) {
+    public ExamInfo(Long orgId, String orgName, Long examId, String examName) {
         this.orgId = orgId;
         this.orgName = orgName;
         this.examId = examId;
         this.examName = examName;
     }
 
-    public OrgExamInfo() {
+    public ExamInfo() {
 
     }
 

+ 5 - 4
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/PrintingProjectServiceImpl.java

@@ -13,10 +13,11 @@ import cn.com.qmth.examcloud.core.print.common.jpa.SearchBuilder;
 import cn.com.qmth.examcloud.core.print.common.jpa.SpecUtils;
 import cn.com.qmth.examcloud.core.print.common.utils.Check;
 import cn.com.qmth.examcloud.core.print.entity.PrintingProject;
+import cn.com.qmth.examcloud.core.print.enums.ExamType;
 import cn.com.qmth.examcloud.core.print.repository.PrintingProjectRepository;
 import cn.com.qmth.examcloud.core.print.service.CommonService;
 import cn.com.qmth.examcloud.core.print.service.PrintingProjectService;
-import cn.com.qmth.examcloud.core.print.service.bean.printingproject.OrgExamInfo;
+import cn.com.qmth.examcloud.core.print.service.bean.common.ExamInfo;
 import cn.com.qmth.examcloud.core.print.service.bean.printingproject.PrintingProjectConvert;
 import cn.com.qmth.examcloud.core.print.service.bean.printingproject.PrintingProjectInfo;
 import cn.com.qmth.examcloud.core.print.service.bean.printingproject.PrintingProjectQuery;
@@ -129,7 +130,7 @@ public class PrintingProjectServiceImpl implements PrintingProjectService {
     }
 
     @Override
-    public void syncPrintingProject(OrgExamInfo examInfo) {
+    public void syncPrintingProject(ExamInfo examInfo) {
         Check.isNull(examInfo.getOrgId(), "学校ID不能为空!");
         Check.isBlank(examInfo.getOrgName(), "学校名称不能为空!");
         Check.isNull(examInfo.getExamId(), "考试ID不能为空!");
@@ -161,9 +162,9 @@ public class PrintingProjectServiceImpl implements PrintingProjectService {
     public void syncAllPrintingProject() {
         //获取所有"传统"考试列表
         log.debug("syncAllPrintingProject...");
-        List<OrgExamInfo> list = commonService.getTraditionExamList();
+        List<ExamInfo> list = commonService.getExamList(ExamType.TRADITION.name());
         if (list != null && !list.isEmpty()) {
-            for (OrgExamInfo info : list) {
+            for (ExamInfo info : list) {
                 syncPrintingProject(info);
             }
         }

+ 2 - 2
examcloud-core-print-starter/src/test/java/cn/com/qmth/examcloud/core/print/test/PrintingProjectServiceTest.java

@@ -14,7 +14,7 @@ import cn.com.qmth.examcloud.core.print.common.jpa.SqlWrapper;
 import cn.com.qmth.examcloud.core.print.entity.PrintingProject;
 import cn.com.qmth.examcloud.core.print.repository.PrintingProjectRepository;
 import cn.com.qmth.examcloud.core.print.service.PrintingProjectService;
-import cn.com.qmth.examcloud.core.print.service.bean.printingproject.OrgExamInfo;
+import cn.com.qmth.examcloud.core.print.service.bean.common.ExamInfo;
 import cn.com.qmth.examcloud.core.print.service.bean.printingproject.PrintingProjectInfo;
 import cn.com.qmth.examcloud.core.print.service.bean.printingproject.PrintingProjectQuery;
 import org.junit.Test;
@@ -69,7 +69,7 @@ public class PrintingProjectServiceTest extends BaseTest {
 
     @Test
     public void syncPrintingProjectTest() throws Exception {
-        OrgExamInfo examInfo = new OrgExamInfo(1L, "武汉大学", 1L, "计算机考试");
+        ExamInfo examInfo = new ExamInfo(1L, "武汉大学", 1L, "计算机考试");
         printingProjectService.syncPrintingProject(examInfo);
         printingProjectService.syncPrintingProjectOrgName(1L, "武汉大学1");
         printingProjectService.syncPrintingProjectExamName(1L, "计算机考试1");