deason 6 年之前
父節點
當前提交
59571f8e4d

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

@@ -61,15 +61,18 @@ public class PrintingProjectController extends ControllerSupport {
     @PostMapping("/org/list")
     @ApiOperation(value = "获取印刷学校列表")
     public List<OrgInfo> getOrgList() {
-        //根据登录用户的不同角色取不同的学校数据
+        //根据登录用户的不同角色取不同的学校数据
         UserInfo user = new UserInfo(getAccessUser());
+
+        if (user.isSchoolLeader()) {
+            //学校印刷管理员直接返回当前用户的学校机构信息
+            return Lists.newArrayList(user.getOrgInfo());
+        }
+
         if (user.isPM()) {
             return printingProjectService.getOrgList(user.getUserId(), null);
         } else if (user.isSupplier()) {
             return printingProjectService.getOrgList(null, user.getUserId());
-        } else if (user.isSchoolLeader()) {
-            //直接返回当前用户的学校机构信息
-            return Lists.newArrayList(user.getOrgInfo());
         } else {
             return printingProjectService.getOrgList(null, null);
         }
@@ -77,8 +80,20 @@ public class PrintingProjectController extends ControllerSupport {
 
     @PostMapping("/exam/list")
     @ApiOperation(value = "获取印刷考试列表")
-    public List<ExamInfo> getExamList(@RequestParam Long orgId) {
-        return printingProjectService.getExamList(orgId);
+    public List<ExamInfo> getExamList(@RequestParam Long orgId, @RequestParam(required = false, defaultValue = "true") Boolean needAll) {
+        if (needAll) {
+            return printingProjectService.getExamList(orgId, null, null);
+        }
+
+        //根据登录用户的不同角色获取不同的考试数据
+        UserInfo user = new UserInfo(getAccessUser());
+        if (user.isPM()) {
+            return printingProjectService.getExamList(orgId, user.getUserId(), null);
+        } else if (user.isSupplier()) {
+            return printingProjectService.getExamList(orgId, null, user.getUserId());
+        } else {
+            return printingProjectService.getExamList(orgId, null, null);
+        }
     }
 
 }

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

@@ -84,7 +84,7 @@ public interface PrintingProjectService {
     /**
      * 获取印刷考试列表
      */
-    List<ExamInfo> getExamList(Long orgId);
+    List<ExamInfo> getExamList(Long orgId, Long pmId, Long supplierId);
 
     /**
      * 获取印刷项目的(简要)信息列表

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

@@ -138,7 +138,7 @@ public class CourseStatisticServiceImpl implements CourseStatisticService {
         log.debug("initAllCourseStatistic...");
 
         //只处理印刷项目中已有的考试
-        List<ExamInfo> exams = printingProjectService.getExamList(null);
+        List<ExamInfo> exams = printingProjectService.getExamList(null, null, null);
         if (exams == null || exams.isEmpty()) {
             return;
         }

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

@@ -227,11 +227,17 @@ public class PrintingProjectServiceImpl implements PrintingProjectService {
     }
 
     @Override
-    public List<ExamInfo> getExamList(Long orgId) {
+    public List<ExamInfo> getExamList(Long orgId, Long pmId, Long supplierId) {
         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);
         }
+        if (pmId != null) {
+            sql.and().eq("pm_id", pmId);
+        }
+        if (supplierId != null) {
+            sql.and().eq("supplier_id", supplierId);
+        }
         sql.groupBy("exam_id");
         return jdbcTemplate.query(sql.build(), new BeanPropertyRowMapper(ExamInfo.class));
     }

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

@@ -23,7 +23,7 @@
 [${$rmp.ctrl.print}/printing/project][/{id}][POST]
 [${$rmp.ctrl.print}/printing/project][/update][POST]
 #[${$rmp.ctrl.print}/printing/project][/org/list][POST]
-[${$rmp.ctrl.print}/printing/project][/exam/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][/refresh/{orgId}/{examId}][POST]
 [${$rmp.ctrl.print}/course/statistic][/list][POST]

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

@@ -70,7 +70,7 @@ public class PrintingProjectServiceTest extends BaseTest {
         System.out.println(jsonMapper.toJson(orgList));
 
         Long orgId = null;
-        List<ExamInfo> examList = printingProjectService.getExamList(orgId);
+        List<ExamInfo> examList = printingProjectService.getExamList(orgId, pmId, supplierId);
         System.out.println(jsonMapper.toJson(examList));
     }