deason 6 年之前
父节点
当前提交
b310b90de6

+ 3 - 3
examcloud-core-print-provider/src/main/java/cn/com/qmth/examcloud/core/print/api/controller/CoursePaperController.java

@@ -60,7 +60,7 @@ public class CoursePaperController extends ControllerSupport {
     public void exportAll(@PathVariable Long orgId, @PathVariable Long examId) throws Exception {
     public void exportAll(@PathVariable Long orgId, @PathVariable Long examId) throws Exception {
         File file = coursePaperService.exportAllByOrgIdAndExamId(orgId, examId);
         File file = coursePaperService.exportAllByOrgIdAndExamId(orgId, examId);
         final String fileName = "structures.zip";
         final String fileName = "structures.zip";
-        //super.exportFile(fileName, file);
+        //super.exportFile(fileName, file);//todo
         super.exportFile(fileName, new byte[]{});
         super.exportFile(fileName, new byte[]{});
     }
     }
 
 
@@ -69,7 +69,7 @@ public class CoursePaperController extends ControllerSupport {
     public void exportBatch(@PathVariable Long[] ids) throws Exception {
     public void exportBatch(@PathVariable Long[] ids) throws Exception {
         File file = coursePaperService.exportBatchByIds(ids);
         File file = coursePaperService.exportBatchByIds(ids);
         final String fileName = "papers.zip";
         final String fileName = "papers.zip";
-        //super.exportFile(fileName, file);
+        //super.exportFile(fileName, file);//todo
         super.exportFile(fileName, new byte[]{});
         super.exportFile(fileName, new byte[]{});
     }
     }
 
 
@@ -81,7 +81,7 @@ public class CoursePaperController extends ControllerSupport {
     public void downloadPaperStructure(@PathVariable Long examId, @PathVariable Long paperId) throws Exception {
     public void downloadPaperStructure(@PathVariable Long examId, @PathVariable Long paperId) throws Exception {
         File file = coursePaperService.downloadPaperStructure(examId, paperId);
         File file = coursePaperService.downloadPaperStructure(examId, paperId);
         final String fileName = "paper.zip";
         final String fileName = "paper.zip";
-        //super.exportFile(fileName, file);
+        //super.exportFile(fileName, file);//todo
         super.exportFile(fileName, new byte[]{});
         super.exportFile(fileName, new byte[]{});
     }
     }
 
 

+ 16 - 0
examcloud-core-print-provider/src/main/java/cn/com/qmth/examcloud/core/print/api/controller/PrintingProjectController.java

@@ -10,6 +10,8 @@ package cn.com.qmth.examcloud.core.print.api.controller;
 import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
 import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
 import cn.com.qmth.examcloud.core.print.common.Result;
 import cn.com.qmth.examcloud.core.print.common.Result;
 import cn.com.qmth.examcloud.core.print.service.PrintingProjectService;
 import cn.com.qmth.examcloud.core.print.service.PrintingProjectService;
+import cn.com.qmth.examcloud.core.print.service.bean.common.ExamInfo;
+import cn.com.qmth.examcloud.core.print.service.bean.common.OrgInfo;
 import cn.com.qmth.examcloud.core.print.service.bean.printingproject.PrintingProjectInfo;
 import cn.com.qmth.examcloud.core.print.service.bean.printingproject.PrintingProjectInfo;
 import cn.com.qmth.examcloud.core.print.service.bean.printingproject.PrintingProjectQuery;
 import cn.com.qmth.examcloud.core.print.service.bean.printingproject.PrintingProjectQuery;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
@@ -18,6 +20,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Page;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
+import java.util.List;
+
 import static cn.com.qmth.examcloud.core.print.common.Result.success;
 import static cn.com.qmth.examcloud.core.print.common.Result.success;
 
 
 /**
 /**
@@ -58,4 +62,16 @@ public class PrintingProjectController extends ControllerSupport {
         return success();
         return success();
     }
     }
 
 
+    @PostMapping("/org/list")
+    @ApiOperation(value = "获取印刷学校列表")
+    public List<OrgInfo> getOrgList(@RequestParam(required = false) Long pmId, @RequestParam(required = false) Long supplierId) {
+        return printingProjectService.getOrgList(pmId, supplierId);
+    }
+
+    @PostMapping("/exam/list")
+    @ApiOperation(value = "获取印刷考试列表")
+    public List<ExamInfo> getExamList(@RequestParam Long orgId) {
+        return printingProjectService.getExamList(orgId);
+    }
+
 }
 }

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

@@ -40,7 +40,7 @@ public class CommonService {
                 .select("em.id examId,em.name examName,em.root_org_id orgId,org.name orgName").from("ec_e_exam em")
                 .select("em.id examId,em.name examName,em.root_org_id orgId,org.name orgName").from("ec_e_exam em")
                 .innerJoin("ec_b_org org").on("org.id", "em.root_org_id");
                 .innerJoin("ec_b_org org").on("org.id", "em.root_org_id");
         if (StringUtils.isNotBlank(examType)) {
         if (StringUtils.isNotBlank(examType)) {
-            sql.where().eq("em.exam_type", examType);
+            //sql.where().eq("em.exam_type", examType); todo 临时注释
         }
         }
         sql.orderBy("em.id", false);
         sql.orderBy("em.id", false);
         return jdbcTemplate.query(sql.build(), new BeanPropertyRowMapper(ExamInfo.class));
         return jdbcTemplate.query(sql.build(), new BeanPropertyRowMapper(ExamInfo.class));
@@ -54,7 +54,7 @@ public class CommonService {
         //todo 暂时直接查库,待“考务”接口提供后改为通过接口获取数据
         //todo 暂时直接查库,待“考务”接口提供后改为通过接口获取数据
         SqlWrapper sql = new SqlWrapper()
         SqlWrapper sql = new SqlWrapper()
                 .select("root_org_id orgId,exam_id,course_id,course_code,course_name,paper_type,count(course_code) totalStudent")
                 .select("root_org_id orgId,exam_id,course_id,course_code,course_name,paper_type,count(course_code) totalStudent")
-                .from("ecs_exam_student") // ec_e_exam_student
+                .from("ec_e_exam_student") //old ecs_exam_student
                 .where()
                 .where()
                 .eq("root_org_id", orgId)
                 .eq("root_org_id", orgId)
                 .and().eq("exam_id", examId);
                 .and().eq("exam_id", examId);

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

@@ -9,10 +9,13 @@ package cn.com.qmth.examcloud.core.print.service;
 
 
 import cn.com.qmth.examcloud.core.print.entity.PrintingProject;
 import cn.com.qmth.examcloud.core.print.entity.PrintingProject;
 import cn.com.qmth.examcloud.core.print.service.bean.common.ExamInfo;
 import cn.com.qmth.examcloud.core.print.service.bean.common.ExamInfo;
+import cn.com.qmth.examcloud.core.print.service.bean.common.OrgInfo;
 import cn.com.qmth.examcloud.core.print.service.bean.printingproject.PrintingProjectInfo;
 import cn.com.qmth.examcloud.core.print.service.bean.printingproject.PrintingProjectInfo;
 import cn.com.qmth.examcloud.core.print.service.bean.printingproject.PrintingProjectQuery;
 import cn.com.qmth.examcloud.core.print.service.bean.printingproject.PrintingProjectQuery;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Page;
 
 
+import java.util.List;
+
 /**
 /**
  * 印刷项目相关接口
  * 印刷项目相关接口
  *
  *
@@ -72,4 +75,14 @@ public interface PrintingProjectService {
      */
      */
     void syncSupplierNameBySupplierId(Long supplierId, String supplierName);
     void syncSupplierNameBySupplierId(Long supplierId, String supplierName);
 
 
+    /**
+     * 获取印刷学校列表
+     */
+    List<OrgInfo> getOrgList(Long pmId, Long supplierId);
+
+    /**
+     * 获取印刷考试列表
+     */
+    List<ExamInfo> getExamList(Long orgId);
+
 }
 }

+ 45 - 0
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/bean/common/OrgInfo.java

@@ -0,0 +1,45 @@
+/*
+ * *************************************************
+ * Copyright (c) 2018 QMTH. All Rights Reserved.
+ * Created by Deason on 2018-11-14 13:53:52.
+ * *************************************************
+ */
+
+package cn.com.qmth.examcloud.core.print.service.bean.common;
+
+import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
+
+/**
+ * 学校信息
+ *
+ * @author: fengdesheng
+ * @since: 2018/10/26
+ */
+public class OrgInfo implements JsonSerializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 学校机构ID
+     */
+    private Long orgId;
+    /**
+     * 学校机构名称
+     */
+    private String orgName;
+
+    public Long getOrgId() {
+        return orgId;
+    }
+
+    public void setOrgId(Long orgId) {
+        this.orgId = orgId;
+    }
+
+    public String getOrgName() {
+        return orgName;
+    }
+
+    public void setOrgName(String orgName) {
+        this.orgName = orgName;
+    }
+
+}

+ 1 - 0
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/CourseStatisticServiceImpl.java

@@ -97,6 +97,7 @@ public class CourseStatisticServiceImpl implements CourseStatisticService {
     @Override
     @Override
     public void initAllCourseStatistic() {
     public void initAllCourseStatistic() {
         log.debug("initAllCourseStatistic...");
         log.debug("initAllCourseStatistic...");
+        //todo
         List<ExamInfo> exams = commonService.getExamList(ExamType.TRADITION.name());
         List<ExamInfo> exams = commonService.getExamList(ExamType.TRADITION.name());
         if (exams != null && !exams.isEmpty()) {
         if (exams != null && !exams.isEmpty()) {
             for (ExamInfo info : exams) {
             for (ExamInfo info : exams) {

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

@@ -11,6 +11,7 @@ import cn.com.qmth.examcloud.commons.base.exception.StatusException;
 import cn.com.qmth.examcloud.core.print.common.jpa.OrderBuilder;
 import cn.com.qmth.examcloud.core.print.common.jpa.OrderBuilder;
 import cn.com.qmth.examcloud.core.print.common.jpa.SearchBuilder;
 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.jpa.SpecUtils;
+import cn.com.qmth.examcloud.core.print.common.jpa.SqlWrapper;
 import cn.com.qmth.examcloud.core.print.common.utils.Check;
 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.entity.PrintingProject;
 import cn.com.qmth.examcloud.core.print.enums.ExamType;
 import cn.com.qmth.examcloud.core.print.enums.ExamType;
@@ -18,6 +19,7 @@ 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.CommonService;
 import cn.com.qmth.examcloud.core.print.service.PrintingProjectService;
 import cn.com.qmth.examcloud.core.print.service.PrintingProjectService;
 import cn.com.qmth.examcloud.core.print.service.bean.common.ExamInfo;
 import cn.com.qmth.examcloud.core.print.service.bean.common.ExamInfo;
+import cn.com.qmth.examcloud.core.print.service.bean.common.OrgInfo;
 import cn.com.qmth.examcloud.core.print.service.bean.printingproject.PrintingProjectConvert;
 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.PrintingProjectInfo;
 import cn.com.qmth.examcloud.core.print.service.bean.printingproject.PrintingProjectQuery;
 import cn.com.qmth.examcloud.core.print.service.bean.printingproject.PrintingProjectQuery;
@@ -29,6 +31,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
 import org.springframework.data.domain.Pageable;
 import org.springframework.data.jpa.domain.Specification;
 import org.springframework.data.jpa.domain.Specification;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import java.util.List;
 import java.util.List;
@@ -48,6 +52,8 @@ public class PrintingProjectServiceImpl implements PrintingProjectService {
     private PrintingProjectRepository printingProjectRepository;
     private PrintingProjectRepository printingProjectRepository;
     @Autowired
     @Autowired
     private CommonService commonService;
     private CommonService commonService;
+    @Autowired
+    private JdbcTemplate jdbcTemplate;
 
 
     @Override
     @Override
     public Page<PrintingProjectInfo> getPrintingProjectList(PrintingProjectQuery query) {
     public Page<PrintingProjectInfo> getPrintingProjectList(PrintingProjectQuery query) {
@@ -199,4 +205,33 @@ public class PrintingProjectServiceImpl implements PrintingProjectService {
         printingProjectRepository.updateSupplierNameBySupplierId(supplierId, supplierName);
         printingProjectRepository.updateSupplierNameBySupplierId(supplierId, supplierName);
     }
     }
 
 
+    @Override
+    public List<OrgInfo> getOrgList(Long pmId, Long supplierId) {
+        SqlWrapper sql = new SqlWrapper()
+                .select("org_id,org_name")
+                .from("ec_prt_project")
+                .where().append("1=1");
+        if (pmId != null) {
+            sql.and().eq("pm_id", pmId);
+        }
+        if (supplierId != null) {
+            sql.and().eq("supplier_id", supplierId);
+        }
+        sql.groupBy("org_id");
+        return jdbcTemplate.query(sql.build(), new BeanPropertyRowMapper(OrgInfo.class));
+    }
+
+    @Override
+    public List<ExamInfo> getExamList(Long orgId) {
+        SqlWrapper sql = new SqlWrapper()
+                .select("org_id,org_name,exam_id,exam_name")
+                .from("ec_prt_project")
+                .where().append("1=1");
+        if (orgId != null) {
+            sql.and().eq("org_id", orgId);
+        }
+        sql.groupBy("exam_id");
+        return jdbcTemplate.query(sql.build(), new BeanPropertyRowMapper(ExamInfo.class));
+    }
+
 }
 }

+ 10 - 0
examcloud-core-print-starter/src/main/resources/security-exclusions.conf

@@ -8,23 +8,31 @@
 
 
 [${$rmp.ctrl.print}/upload][][POST]
 [${$rmp.ctrl.print}/upload][][POST]
 [${$rmp.ctrl.print}/upload][/upyun/info][POST]
 [${$rmp.ctrl.print}/upload][/upyun/info][POST]
+
 [${$rmp.ctrl.print}/printing/project][/list][POST]
 [${$rmp.ctrl.print}/printing/project][/list][POST]
 [${$rmp.ctrl.print}/printing/project][/{id}][POST]
 [${$rmp.ctrl.print}/printing/project][/{id}][POST]
 [${$rmp.ctrl.print}/printing/project][/update][POST]
 [${$rmp.ctrl.print}/printing/project][/update][POST]
 [${$rmp.ctrl.print}/printing/project][/all/init][GET]
 [${$rmp.ctrl.print}/printing/project][/all/init][GET]
+[${$rmp.ctrl.print}/printing/project][/org/list][POST]
+[${$rmp.ctrl.print}/printing/project][/exam/list][POST]
+
 [${$rmp.ctrl.print}/printing/project/statistic][/{orgId}/{examId}][POST]
 [${$rmp.ctrl.print}/printing/project/statistic][/{orgId}/{examId}][POST]
 [${$rmp.ctrl.print}/printing/project/statistic][/init/{orgId}/{examId}][POST]
 [${$rmp.ctrl.print}/printing/project/statistic][/init/{orgId}/{examId}][POST]
 [${$rmp.ctrl.print}/printing/project/statistic][/all/init][GET]
 [${$rmp.ctrl.print}/printing/project/statistic][/all/init][GET]
+
 [${$rmp.ctrl.print}/project/backup/setting][/{projectId}][POST]
 [${$rmp.ctrl.print}/project/backup/setting][/{projectId}][POST]
 [${$rmp.ctrl.print}/project/backup/setting][/save][POST]
 [${$rmp.ctrl.print}/project/backup/setting][/save][POST]
 [${$rmp.ctrl.print}/project/backup/setting][/delete/{projectId}][POST]
 [${$rmp.ctrl.print}/project/backup/setting][/delete/{projectId}][POST]
+
 [${$rmp.ctrl.print}/project/other/setting][/list][POST]
 [${$rmp.ctrl.print}/project/other/setting][/list][POST]
 [${$rmp.ctrl.print}/project/other/setting][/{id}][POST]
 [${$rmp.ctrl.print}/project/other/setting][/{id}][POST]
 [${$rmp.ctrl.print}/project/other/setting][/save][POST]
 [${$rmp.ctrl.print}/project/other/setting][/save][POST]
 [${$rmp.ctrl.print}/project/other/setting][/delete/{id}][POST]
 [${$rmp.ctrl.print}/project/other/setting][/delete/{id}][POST]
+
 [${$rmp.ctrl.print}/course/statistic][/list][POST]
 [${$rmp.ctrl.print}/course/statistic][/list][POST]
 [${$rmp.ctrl.print}/course/statistic][/init][POST]
 [${$rmp.ctrl.print}/course/statistic][/init][POST]
 [${$rmp.ctrl.print}/course/statistic][/all/init][GET]
 [${$rmp.ctrl.print}/course/statistic][/all/init][GET]
+
 [${$rmp.ctrl.print}/course/paper][/list][POST]
 [${$rmp.ctrl.print}/course/paper][/list][POST]
 [${$rmp.ctrl.print}/course/paper][/allot/{orgId}/{examId}][POST]
 [${$rmp.ctrl.print}/course/paper][/allot/{orgId}/{examId}][POST]
 [${$rmp.ctrl.print}/course/paper][/total/{orgId}/{examId}][POST]
 [${$rmp.ctrl.print}/course/paper][/total/{orgId}/{examId}][POST]
@@ -32,9 +40,11 @@
 [${$rmp.ctrl.print}/course/paper][/export/batch/{ids}][GET]
 [${$rmp.ctrl.print}/course/paper][/export/batch/{ids}][GET]
 [${$rmp.ctrl.print}/course/paper][/download/structure/{examId}/{paperId}][GET]
 [${$rmp.ctrl.print}/course/paper][/download/structure/{examId}/{paperId}][GET]
 [${$rmp.ctrl.print}/course/paper][/check/structure/{examId}/{paperId}][POST]
 [${$rmp.ctrl.print}/course/paper][/check/structure/{examId}/{paperId}][POST]
+
 [${$rmp.ctrl.print}/project/template][/{orgId}/{examId}][POST]
 [${$rmp.ctrl.print}/project/template][/{orgId}/{examId}][POST]
 [${$rmp.ctrl.print}/project/template][/save][POST]
 [${$rmp.ctrl.print}/project/template][/save][POST]
 [${$rmp.ctrl.print}/project/template][/{id}][POST]
 [${$rmp.ctrl.print}/project/template][/{id}][POST]
+
 [${$rmp.ctrl.print}/examStructure][/list][POST]
 [${$rmp.ctrl.print}/examStructure][/list][POST]
 [${$rmp.ctrl.print}/examStructure][/save][POST]
 [${$rmp.ctrl.print}/examStructure][/save][POST]
 [${$rmp.ctrl.print}/examStructure][/findOne][POST]
 [${$rmp.ctrl.print}/examStructure][/findOne][POST]

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

@@ -15,6 +15,7 @@ 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.repository.PrintingProjectRepository;
 import cn.com.qmth.examcloud.core.print.service.PrintingProjectService;
 import cn.com.qmth.examcloud.core.print.service.PrintingProjectService;
 import cn.com.qmth.examcloud.core.print.service.bean.common.ExamInfo;
 import cn.com.qmth.examcloud.core.print.service.bean.common.ExamInfo;
+import cn.com.qmth.examcloud.core.print.service.bean.common.OrgInfo;
 import cn.com.qmth.examcloud.core.print.service.bean.printingproject.PrintingProjectInfo;
 import cn.com.qmth.examcloud.core.print.service.bean.printingproject.PrintingProjectInfo;
 import cn.com.qmth.examcloud.core.print.service.bean.printingproject.PrintingProjectQuery;
 import cn.com.qmth.examcloud.core.print.service.bean.printingproject.PrintingProjectQuery;
 import org.junit.Test;
 import org.junit.Test;
@@ -67,6 +68,17 @@ public class PrintingProjectServiceTest extends BaseTest {
         printingProjectService.updatePrintingProject(info);
         printingProjectService.updatePrintingProject(info);
     }
     }
 
 
+    @Test
+    public void getOrgExamTest() throws Exception {
+        Long pmId = null, supplierId = null;
+        List<OrgInfo> orgList = printingProjectService.getOrgList(pmId, supplierId);
+        System.out.println(jsonMapper.toJson(orgList));
+
+        Long orgId = null;
+        List<ExamInfo> examList = printingProjectService.getExamList(orgId);
+        System.out.println(jsonMapper.toJson(examList));
+    }
+
     @Test
     @Test
     public void syncPrintingProjectTest() throws Exception {
     public void syncPrintingProjectTest() throws Exception {
         ExamInfo examInfo = new ExamInfo(1L, "武汉大学", 1L, "计算机考试");
         ExamInfo examInfo = new ExamInfo(1L, "武汉大学", 1L, "计算机考试");