瀏覽代碼

bug修改

xiaof 4 年之前
父節點
當前提交
d55364ad4d

+ 125 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/ClientPrintStatisticsDto.java

@@ -0,0 +1,125 @@
+package com.qmth.distributed.print.business.bean.dto;
+
+/**
+ * @Date: 2021/3/29.
+ */
+public class ClientPrintStatisticsDto {
+
+    private String printPlanId;
+    private String printPlanName;
+    private Long examStartTime;
+    private Long examEndTime;
+    private String courseNameCode;
+    private String paperNumber;
+    private String examPlace;
+    private Integer packageCount;
+    private Integer totalSubjects;
+    private Integer totalSubjectsLeft;
+    private Integer pagesA3Left;
+    private Integer pagesA4Left;
+    private Integer progress;
+
+    public String getPrintPlanId() {
+        return printPlanId;
+    }
+
+    public void setPrintPlanId(String printPlanId) {
+        this.printPlanId = printPlanId;
+    }
+
+    public String getPrintPlanName() {
+        return printPlanName;
+    }
+
+    public void setPrintPlanName(String printPlanName) {
+        this.printPlanName = printPlanName;
+    }
+
+    public Long getExamStartTime() {
+        return examStartTime;
+    }
+
+    public void setExamStartTime(Long examStartTime) {
+        this.examStartTime = examStartTime;
+    }
+
+    public Long getExamEndTime() {
+        return examEndTime;
+    }
+
+    public void setExamEndTime(Long examEndTime) {
+        this.examEndTime = examEndTime;
+    }
+
+    public String getCourseNameCode() {
+        return courseNameCode;
+    }
+
+    public void setCourseNameCode(String courseNameCode) {
+        this.courseNameCode = courseNameCode;
+    }
+
+    public String getPaperNumber() {
+        return paperNumber;
+    }
+
+    public void setPaperNumber(String paperNumber) {
+        this.paperNumber = paperNumber;
+    }
+
+    public String getExamPlace() {
+        return examPlace;
+    }
+
+    public void setExamPlace(String examPlace) {
+        this.examPlace = examPlace;
+    }
+
+    public Integer getPackageCount() {
+        return packageCount;
+    }
+
+    public void setPackageCount(Integer packageCount) {
+        this.packageCount = packageCount;
+    }
+
+    public Integer getTotalSubjects() {
+        return totalSubjects;
+    }
+
+    public void setTotalSubjects(Integer totalSubjects) {
+        this.totalSubjects = totalSubjects;
+    }
+
+    public Integer getTotalSubjectsLeft() {
+        return totalSubjectsLeft;
+    }
+
+    public void setTotalSubjectsLeft(Integer totalSubjectsLeft) {
+        this.totalSubjectsLeft = totalSubjectsLeft;
+    }
+
+    public Integer getPagesA3Left() {
+        return pagesA3Left;
+    }
+
+    public void setPagesA3Left(Integer pagesA3Left) {
+        this.pagesA3Left = pagesA3Left;
+    }
+
+    public Integer getPagesA4Left() {
+        return pagesA4Left;
+    }
+
+    public void setPagesA4Left(Integer pagesA4Left) {
+        this.pagesA4Left = pagesA4Left;
+    }
+
+    public Integer getProgress() {
+        return progress;
+    }
+
+    public void setProgress(Integer progress) {
+        this.progress = progress;
+    }
+}

+ 81 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/ClientPrintStatisticsTotalDto.java

@@ -0,0 +1,81 @@
+package com.qmth.distributed.print.business.bean.dto;
+
+/**
+ * @Date: 2021/3/29.
+ */
+public class ClientPrintStatisticsTotalDto {
+
+    private Integer totalSubjects;
+    private Integer packageCount;
+    private Integer paperCount;
+    private String paperNumberAndType;
+    private Integer pagesA3;
+    private Integer pagesA4;
+    private Integer pagesA3Left;
+    private Integer pagesA4Left;
+
+    public Integer getTotalSubjects() {
+        return totalSubjects;
+    }
+
+    public void setTotalSubjects(Integer totalSubjects) {
+        this.totalSubjects = totalSubjects;
+    }
+
+    public Integer getPackageCount() {
+        return packageCount;
+    }
+
+    public void setPackageCount(Integer packageCount) {
+        this.packageCount = packageCount;
+    }
+
+    public Integer getPaperCount() {
+        return paperCount;
+    }
+
+    public void setPaperCount(Integer paperCount) {
+        this.paperCount = paperCount;
+    }
+
+    public String getPaperNumberAndType() {
+        return paperNumberAndType;
+    }
+
+    public void setPaperNumberAndType(String paperNumberAndType) {
+        this.paperNumberAndType = paperNumberAndType;
+    }
+
+    public Integer getPagesA3() {
+        return pagesA3;
+    }
+
+    public void setPagesA3(Integer pagesA3) {
+        this.pagesA3 = pagesA3;
+    }
+
+    public Integer getPagesA4() {
+        return pagesA4;
+    }
+
+    public void setPagesA4(Integer pagesA4) {
+        this.pagesA4 = pagesA4;
+    }
+
+    public Integer getPagesA3Left() {
+        return pagesA3Left;
+    }
+
+    public void setPagesA3Left(Integer pagesA3Left) {
+        this.pagesA3Left = pagesA3Left;
+    }
+
+    public Integer getPagesA4Left() {
+        return pagesA4Left;
+    }
+
+    public void setPagesA4Left(Integer pagesA4Left) {
+        this.pagesA4Left = pagesA4Left;
+    }
+
+}

+ 0 - 9
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/ClientPrintTaskTotalDto.java

@@ -7,7 +7,6 @@ public class ClientPrintTaskTotalDto {
 
     private Integer totalSubjects;
     private Integer packageCount;
-    private Integer paperCount;
     private Integer pagesA3;
     private Integer pagesA4;
     private Integer pagesA3Left;
@@ -31,14 +30,6 @@ public class ClientPrintTaskTotalDto {
         this.packageCount = packageCount;
     }
 
-    public Integer getPaperCount() {
-        return paperCount;
-    }
-
-    public void setPaperCount(Integer paperCount) {
-        this.paperCount = paperCount;
-    }
-
     public Integer getPagesA3() {
         return pagesA3;
     }

+ 6 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamPrintPlanMapper.java

@@ -3,6 +3,8 @@ package com.qmth.distributed.print.business.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.qmth.distributed.print.business.bean.dto.ClientPrintStatisticsDto;
+import com.qmth.distributed.print.business.bean.dto.ClientPrintStatisticsTotalDto;
 import com.qmth.distributed.print.business.bean.dto.ClientPrintTaskDto;
 import com.qmth.distributed.print.business.bean.dto.ClientPrintTaskTotalDto;
 import com.qmth.distributed.print.business.bean.result.PrintPlanBrief;
@@ -38,4 +40,8 @@ public interface ExamPrintPlanMapper extends BaseMapper<ExamPrintPlan> {
     List<ClientPrintTaskDto> listClientPrintTask(@Param("schoolId") Long schoolId, @Param("machineCode") Long machineCode, @Param("printPlanId") String printPlanId, @Param("status") String status, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("examPlace") String examPlace, @Param("examRoom") String examRoom, @Param("examStartTime") Long examStartTime, @Param("examEndTime") Long examEndTime, @Param("isDownload") Boolean isDownload, @Param("validate") Boolean validate, @Param("orgIds") Set<Long> orgIds, @Param("examDetailStatus") String[] examDetailStatus);
 
     ClientPrintTaskTotalDto clientTaskTotalData(@Param("schoolId") Long schoolId, @Param("printPlanId") String printPlanId, @Param("status") String status, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("examPlace") String examPlace, @Param("examRoom") String examRoom, @Param("examStartTime") Long examStartTime, @Param("examEndTime") Long examEndTime, @Param("isDownload") Boolean isDownload, @Param("validate") Boolean validate, @Param("machineCode") Long machineCode, @Param("orgIds") Set<Long> orgIds, @Param("examDetailStatus") String[] examDetailStatus);
+
+    IPage<ClientPrintStatisticsDto> listClientPrintStatistics(Page<ClientPrintStatisticsDto> page, @Param("schoolId") Long schoolId, @Param("printPlanId") String printPlanId, @Param("examPlace") String examPlace, @Param("examStartTime") Long examStartTime, @Param("examEndTime") Long examEndTime, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("orgIds") Set<Long> orgIds, @Param("examDetailStatus") String[] examDetailStatus);
+
+    ClientPrintStatisticsTotalDto clientStatisticsTotalData(@Param("schoolId") Long schoolId, @Param("printPlanId") String printPlanId, @Param("examPlace") String examPlace, @Param("examStartTime") Long examStartTime, @Param("examEndTime") Long examEndTime, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("orgIds") Set<Long> orgIds, @Param("examDetailStatus") String[] examDetailStatus);
 }

+ 5 - 4
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ClientService.java

@@ -1,10 +1,7 @@
 package com.qmth.distributed.print.business.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.qmth.distributed.print.business.bean.dto.ClientExamStudentDto;
-import com.qmth.distributed.print.business.bean.dto.ClientExamTaskDto;
-import com.qmth.distributed.print.business.bean.dto.ClientPrintTaskDto;
-import com.qmth.distributed.print.business.bean.dto.ClientPrintTaskTotalDto;
+import com.qmth.distributed.print.business.bean.dto.*;
 
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;
@@ -43,4 +40,8 @@ public interface ClientService {
     void exportClientPrintTask(HttpServletResponse response, Long machineCode, String orgId, String printPlanId, String status, String courseCode, String paperNumber, String examPlace, String examRoom, Long examStartTime, Long examEndTime, Boolean isDownload, Boolean validate) throws Exception;
 
     ClientPrintTaskTotalDto taskTotalData(String printPlanId, String status, String courseCode, String paperNumber, String examPlace, String examRoom, Long examStartTime, Long examEndTime, Boolean isDownload, Boolean validate, Long machineCode);
+
+    IPage<ClientPrintStatisticsDto> listClientPrintStatistics(String orgId, String printPlanId, String examPlace, Long examStartTime, Long examEndTime, String courseCode, String paperNumber, Integer pageNumber, Integer pageSize);
+
+    ClientPrintStatisticsTotalDto clientStatisticsTotalData(String orgId, String printPlanId, String examPlace, Long examStartTime, Long examEndTime, String courseCode, String paperNumber);
 }

+ 6 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamPrintPlanService.java

@@ -3,6 +3,8 @@ package com.qmth.distributed.print.business.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.distributed.print.business.bean.dto.ClientPrintStatisticsDto;
+import com.qmth.distributed.print.business.bean.dto.ClientPrintStatisticsTotalDto;
 import com.qmth.distributed.print.business.bean.dto.ClientPrintTaskDto;
 import com.qmth.distributed.print.business.bean.dto.ClientPrintTaskTotalDto;
 import com.qmth.distributed.print.business.bean.params.DeleteParams;
@@ -81,4 +83,8 @@ public interface ExamPrintPlanService extends IService<ExamPrintPlan> {
     List<ClientPrintTaskDto> listClientPrintTask(Long schoolId, Long machineCode, String printPlanId, String status, String courseCode, String paperNumber, String examPlace, String examRoom, Long examStartTime, Long examEndTime, Boolean isDownload, Boolean validate, Set<Long> orgIds);
 
     ClientPrintTaskTotalDto clientTaskTotalData(String printPlanId, String status, String courseCode, String paperNumber, String examPlace, String examRoom, Long examStartTime, Long examEndTime, Boolean isDownload, Boolean validate, Long machineCode);
+
+    IPage<ClientPrintStatisticsDto> listClientPrintStatistics(Page<ClientPrintStatisticsDto> page, Long schoolId, String printPlanId, String examPlace, Long examStartTime, Long examEndTime, String courseCode, String paperNumber, Set<Long> orgIds);
+
+    ClientPrintStatisticsTotalDto clientStatisticsTotalData(String printPlanId, String examPlace, Long examStartTime, Long examEndTime, String courseCode, String paperNumber);
 }

+ 14 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ClientServiceImpl.java

@@ -447,6 +447,20 @@ public class ClientServiceImpl implements ClientService {
         return examPrintPlanService.clientTaskTotalData(printPlanId, status, courseCode, paperNumber, examPlace, examRoom, examStartTime, examEndTime, isDownload, validate, machineCode);
     }
 
+    @Override
+    public IPage<ClientPrintStatisticsDto> listClientPrintStatistics(String orgId, String printPlanId, String examPlace, Long examStartTime, Long examEndTime, String courseCode, String paperNumber, Integer pageNumber, Integer pageSize) {
+        Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
+        Set<Long> orgIds = commonService.listSubOrgIds(null);
+        Page<ClientPrintStatisticsDto> page = new Page<>(pageNumber, pageSize);
+        IPage<ClientPrintStatisticsDto> statisticsDtoIPage = examPrintPlanService.listClientPrintStatistics(page, schoolId, printPlanId, examPlace, examStartTime, examEndTime, courseCode, paperNumber, orgIds);
+        return statisticsDtoIPage;
+    }
+
+    @Override
+    public ClientPrintStatisticsTotalDto clientStatisticsTotalData(String orgId, String printPlanId, String examPlace, Long examStartTime, Long examEndTime, String courseCode, String paperNumber) {
+        return examPrintPlanService.clientStatisticsTotalData(printPlanId, examPlace, examStartTime, examEndTime, courseCode, paperNumber);
+    }
+
     /**
      * 根据考场生成试卷map
      *

+ 38 - 10
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamPrintPlanServiceImpl.java

@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.distributed.print.business.bean.dto.ClientPrintStatisticsDto;
+import com.qmth.distributed.print.business.bean.dto.ClientPrintStatisticsTotalDto;
 import com.qmth.distributed.print.business.bean.dto.ClientPrintTaskDto;
 import com.qmth.distributed.print.business.bean.dto.ClientPrintTaskTotalDto;
 import com.qmth.distributed.print.business.bean.params.DeleteParams;
@@ -300,21 +302,47 @@ public class ExamPrintPlanServiceImpl extends ServiceImpl<ExamPrintPlanMapper, E
         String[] examDetailStatus = new String[]{ExamDetailStatusEnum.NEW.name(), PrintPlanStatusEnum.READY.name()};
         ClientPrintTaskTotalDto clientPrintTaskTotalDto = this.baseMapper.clientTaskTotalData(schoolId, printPlanId, status, courseCode, paperNumber, examPlace, examRoom, examStartTime, examEndTime, isDownload, validate, machineCode, orgIds, examDetailStatus);
 
-        if (clientPrintTaskTotalDto == null) {
-            clientPrintTaskTotalDto = new ClientPrintTaskTotalDto();
-        }
-        // 累计a3,a4
-        List<ClientPrintData> list = clientPrintDataService.listBySchoolIdAndMachineCode(schoolId, machineCode);
-        if (!list.isEmpty()) {
-            int pagesA3 = list.stream().mapToInt(m -> m.getPagesA3()).sum();
-            clientPrintTaskTotalDto.setHostPagesA3(pagesA3 / 2);
-            int pagesA4 = list.stream().mapToInt(m -> m.getPagesA4()).sum();
-            clientPrintTaskTotalDto.setHostPagesA4(pagesA4 / 2);
+        if (clientPrintTaskTotalDto != null) {
+            // 累计a3,a4
+            List<ClientPrintData> list = clientPrintDataService.listBySchoolIdAndMachineCode(schoolId, machineCode);
+            if (!list.isEmpty()) {
+                int pagesA3 = list.stream().mapToInt(m -> m.getPagesA3()).sum();
+                clientPrintTaskTotalDto.setHostPagesA3(pagesA3 / 2);
+                int pagesA4 = list.stream().mapToInt(m -> m.getPagesA4()).sum();
+                clientPrintTaskTotalDto.setHostPagesA4(pagesA4 / 2);
+            }
         }
 
         return clientPrintTaskTotalDto;
     }
 
+    @Override
+    public IPage<ClientPrintStatisticsDto> listClientPrintStatistics(Page<ClientPrintStatisticsDto> page, Long schoolId, String printPlanId, String examPlace, Long examStartTime, Long examEndTime, String courseCode, String paperNumber, Set<Long> orgIds) {
+        // 以下状态考场状态不可查询
+        String[] examDetailStatus = new String[]{ExamDetailStatusEnum.NEW.name(), PrintPlanStatusEnum.READY.name()};
+        return this.baseMapper.listClientPrintStatistics(page, schoolId, printPlanId, examPlace, examStartTime, examEndTime, courseCode, paperNumber, orgIds, examDetailStatus);
+    }
+
+    @Override
+    public ClientPrintStatisticsTotalDto clientStatisticsTotalData(String printPlanId, String examPlace, Long examStartTime, Long examEndTime, String courseCode, String paperNumber) {
+        Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
+        Set<Long> orgIds = commonService.listSubOrgIds(null);
+        // 以下状态考场状态不可查询
+        String[] examDetailStatus = new String[]{ExamDetailStatusEnum.NEW.name(), PrintPlanStatusEnum.READY.name()};
+        ClientPrintStatisticsTotalDto clientPrintStatisticsTotalDto = this.baseMapper.clientStatisticsTotalData(schoolId, printPlanId, examPlace, examStartTime, examEndTime, courseCode, paperNumber, orgIds, examDetailStatus);
+
+        if (clientPrintStatisticsTotalDto != null) {
+            String paperNumberStrs = clientPrintStatisticsTotalDto.getPaperNumberAndType();
+            if(StringUtils.isNotBlank(paperNumberStrs)){
+                String[] paperNumbers = paperNumberStrs.split(",");
+                Set<String> paperNumberSet = new HashSet<>(Arrays.asList(paperNumbers));
+                clientPrintStatisticsTotalDto.setPaperCount(paperNumberSet.size());
+            }
+        }
+
+        return clientPrintStatisticsTotalDto;
+    }
+
 
     /**
      * 查找子机构

+ 20 - 0
distributed-print-business/src/main/resources/db/init-table.sql

@@ -188,6 +188,22 @@ CREATE TABLE `basic_verify_code`  (
   PRIMARY KEY (`id`) USING BTREE
 ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '短信验证码记录表' ROW_FORMAT = Dynamic;
 
+-- ----------------------------
+-- Table structure for client_print_data
+-- ----------------------------
+DROP TABLE IF EXISTS `client_print_data`;
+CREATE TABLE `client_print_data`  (
+  `id` bigint(20) NOT NULL,
+  `school_id` bigint(20) NULL DEFAULT NULL,
+  `exam_detail_id` bigint(20) NULL DEFAULT NULL COMMENT '考场ID',
+  `machine_code` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '机器唯一码',
+  `pages_a4` int(11) NULL DEFAULT NULL,
+  `pages_a3` int(11) NULL DEFAULT NULL,
+  `create_id` bigint(20) NULL DEFAULT NULL,
+  `create_time` bigint(20) NULL DEFAULT NULL,
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '各机器打印数量' ROW_FORMAT = Dynamic;
+
 -- ----------------------------
 -- Table structure for client_status
 -- ----------------------------
@@ -896,6 +912,8 @@ INSERT INTO `sys_privilege` VALUES (211,'印刷管理-校验','/api/admin/client
 INSERT INTO `sys_privilege` VALUES (212,'印刷管理-更新打印进度','/api/admin/client/print/update_progress','URL',199,14,'AUTH',NULL,NULL,1);
 INSERT INTO `sys_privilege` VALUES (213,'重打-查询考生列表','/api/admin/client/print/list_student','URL',199,15,'AUTH',NULL,NULL,1);
 INSERT INTO `sys_privilege` VALUES (214,'重打-内容查询','/api/admin/client/print/get_reprint_data','URL',199,16,'AUTH',NULL,NULL,1);
+INSERT INTO `sys_privilege` VALUES (215,'统计查询-查询列表','/api/admin/client/print/statistics_list','URL',199,16,'AUTH',NULL,NULL,1);
+INSERT INTO `sys_privilege` VALUES (216,'统计查询-汇总数据查询','/api/admin/client/print/statistics_total_data','URL',199,16,'AUTH',NULL,NULL,1);
 -- ----------------------------
 -- Table structure for sys_role
 -- ----------------------------
@@ -1212,6 +1230,8 @@ INSERT INTO `sys_role_privilege` VALUES (1384755205368247211, 6, 211, 1);
 INSERT INTO `sys_role_privilege` VALUES (1384755205368247212, 6, 212, 1);
 INSERT INTO `sys_role_privilege` VALUES (1384755205368247213, 6, 213, 1);
 INSERT INTO `sys_role_privilege` VALUES (1384755205368247214, 6, 214, 1);
+INSERT INTO `sys_role_privilege` VALUES (1384755205368247215, 6, 215, 1);
+INSERT INTO `sys_role_privilege` VALUES (1384755205368247216, 6, 216, 1);
 
 -- ----------------------------
 -- Table structure for sys_user

+ 2 - 1
distributed-print-business/src/main/resources/mapper/ExamDetailMapper.xml

@@ -352,7 +352,7 @@
     </select>
     <select id="selectPaperCount" resultType="java.lang.Integer">
         SELECT
-            COUNT(distinct c.paper_number)
+            COUNT(distinct c.paper_number, c.paper_type)
         FROM
             exam_print_plan a
             JOIN
@@ -362,6 +362,7 @@
             JOIN
         sys_user d ON a.create_id = d.id
         <where>
+            and c.paper_type is not null
             <if test="schoolId != null and schoolId != ''">
                 and a.school_id = #{schoolId}
             </if>

+ 140 - 3
distributed-print-business/src/main/resources/mapper/ExamPrintPlanMapper.xml

@@ -213,8 +213,7 @@
             ifnull(sum(ifnull(b.pages_a3, 0)), 0)/2 pagesA3,
             ifnull(sum(ifnull(b.pages_a4, 0)), 0) /2 pagesA4,
             ifnull(sum(case b.status when 'FINISH' then 0 else ifnull(b.pages_a3, 0) end),0)/2 pagesA3Left,
-            ifnull(sum(case b.status when 'FINISH' then 0 else ifnull(b.pages_a4, 0) end),0)/2 pagesA4Left,
-            ifnull(c.paperCount, 0) paperCount
+            ifnull(sum(case b.status when 'FINISH' then 0 else ifnull(b.pages_a4, 0) end),0)/2 pagesA4Left
         FROM
             exam_print_plan a
         JOIN
@@ -222,7 +221,6 @@
         JOIN
             (SELECT
                 exam_detail_id,
-                count(distinct a.paper_number) paperCount,
                 GROUP_CONCAT(CONCAT(a.course_name, '(', a.course_code, ')')) courseNameCode,
                 GROUP_CONCAT(a.paper_number) paperNumber,
                 GROUP_CONCAT(IFNULL(a.paper_pages_a3, 0) + IFNULL(a.card_pages_a3, 0)) singlePagesA3,
@@ -300,5 +298,144 @@
             </if>
         </where>
     </select>
+    <select id="listClientPrintStatistics"
+            resultType="com.qmth.distributed.print.business.bean.dto.ClientPrintStatisticsDto">
+        SELECT
+            a.id printPlanId,
+            a.name printPlanName,
+            b.exam_start_time examStartTime,
+            b.exam_end_time examEndTime,
+            b.exam_place examPlace,
+            COUNT(b.package_code) packageCount,
+            GROUP_CONCAT(c.course_name_code) courseNameCode,
+            GROUP_CONCAT(c.paper_number) paperNumber,
+            SUM(b.total_subjects) totalSubjects,
+            SUM(CASE b.status
+                WHEN 'FINISH' THEN 0
+                ELSE b.total_subjects
+            END) totalSubjectsLeft,
+            SUM(CASE b.status
+                WHEN 'FINISH' THEN 0
+                ELSE b.pages_a3
+            END) pagesA3Left,
+            SUM(CASE b.status
+                WHEN 'FINISH' THEN 0
+                ELSE b.pages_a4
+            END) pagesA4Left,
+            ROUND(AVG(IFNULL(b.print_progress, 0)), 0) progress
+        FROM
+            exam_print_plan a
+                JOIN
+            exam_detail b ON a.id = b.print_plan_id
+                JOIN
+            (SELECT
+                exam_detail_id,
+                    GROUP_CONCAT(CONCAT(a.course_name, '(', a.course_code, ')')) course_name_code,
+                    GROUP_CONCAT(a.paper_number) paper_number
+                FROM
+                    exam_detail_course a
+                    <where>
+                        <if test="courseCode != null and courseCode != ''">
+                            and a.course_code = #{courseCode}
+                        </if>
+                        <if test="paperNumber != null and paperNumber != ''">
+                            and a.paper_number = #{paperNumber}
+                        </if>
+                    </where>
+                GROUP BY exam_detail_id) c ON b.id = c.exam_detail_id
+            LEFT JOIN
+            sys_user d ON a.create_id = d.id
+        <where>
+            and a.school_id = #{schoolId}
+            AND b.status not IN
+            <foreach collection="examDetailStatus" item="item" index="index" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+            <if test="printPlanId != null and printPlanId != ''">
+                and a.id = #{printPlanId}
+            </if>
+            <if test="examPlace != null and examPlace != ''">
+                and b.exam_place = #{examPlace}
+            </if>
+            <if test="examStartTime != null and examStartTime != ''">
+                and b.exam_start_time &gt; #{examStartTime}
+            </if>
+            <if test="examEndTime != null and examEndTime != ''">
+                and b.exam_end_time &lt; #{examEndTime}
+            </if>
+            <if test="orgIds != null">
+                AND d.org_id IN
+                <foreach collection="orgIds" item="item" index="index" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            </where>
+        GROUP BY a.id , a.name , b.exam_start_time , b.exam_end_time , b.exam_place
+    </select>
+    <select id="clientStatisticsTotalData"
+            resultType="com.qmth.distributed.print.business.bean.dto.ClientPrintStatisticsTotalDto">
+        SELECT
+            COUNT(b.package_code) packageCount,
+            GROUP_CONCAT(c.paper_type) paperNumberAndType,
+            SUM(b.total_subjects) totalSubjects,
+            SUM(ifnull(b.pages_a3,0))/2 pagesA3,
+            SUM(ifnull(b.pages_a4,0))/2 pagesA4,
+            SUM(CASE b.status
+                WHEN 'FINISH' THEN 0
+                ELSE ifnull(b.pages_a3, 0)
+            END)/2 pagesA3Left,
+            SUM(CASE b.status
+                WHEN 'FINISH' THEN 0
+                ELSE ifnull(b.pages_a4,0)
+            END)/2 pagesA4Left
+        FROM
+            exam_print_plan a
+        JOIN
+            exam_detail b ON a.id = b.print_plan_id
+        JOIN
+        (SELECT
+            exam_detail_id,
+                GROUP_CONCAT(CONCAT(a.paper_number, ':', a.paper_type)) paper_type,
+                GROUP_CONCAT(CONCAT(a.course_name, '(', a.course_code, ')')) course_name_code,
+                GROUP_CONCAT(a.paper_number) paper_number
+        FROM
+            exam_detail_course a
+        <where>
+            <if test="courseCode != null and courseCode != ''">
+                and a.course_code = #{courseCode}
+            </if>
+            <if test="paperNumber != null and paperNumber != ''">
+                and a.paper_number = #{paperNumber}
+            </if>
+        </where>
+        GROUP BY exam_detail_id) c ON b.id = c.exam_detail_id
+        LEFT JOIN
+        sys_user d ON a.create_id = d.id
+        <where>
+            and a.school_id = #{schoolId}
+            AND b.status not IN
+            <foreach collection="examDetailStatus" item="item" index="index" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+            <if test="printPlanId != null and printPlanId != ''">
+                and a.id = #{printPlanId}
+            </if>
+            <if test="examPlace != null and examPlace != ''">
+                and b.exam_place = #{examPlace}
+            </if>
+            <if test="examStartTime != null and examStartTime != ''">
+                and b.exam_start_time &gt; #{examStartTime}
+            </if>
+            <if test="examEndTime != null and examEndTime != ''">
+                and b.exam_end_time &lt; #{examEndTime}
+            </if>
+            <if test="orgIds != null">
+                AND d.org_id IN
+                <foreach collection="orgIds" item="item" index="index" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+    </select>
 
 </mapper>

+ 53 - 4
distributed-print/src/main/java/com/qmth/distributed/print/api/ClientController.java

@@ -6,10 +6,7 @@ import com.qmth.boot.api.annotation.Aac;
 import com.qmth.boot.api.annotation.BOOL;
 import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.distributed.print.business.bean.auth.AuthBean;
-import com.qmth.distributed.print.business.bean.dto.ClientExamStudentDto;
-import com.qmth.distributed.print.business.bean.dto.ClientExamTaskDto;
-import com.qmth.distributed.print.business.bean.dto.ClientPrintTaskDto;
-import com.qmth.distributed.print.business.bean.dto.ClientPrintTaskTotalDto;
+import com.qmth.distributed.print.business.bean.dto.*;
 import com.qmth.distributed.print.business.bean.params.ClientLoginParam;
 import com.qmth.distributed.print.business.bean.result.LoginResult;
 import com.qmth.distributed.print.business.entity.SysUser;
@@ -424,4 +421,56 @@ public class ClientController {
         Map<String, Object> map = clientService.getReprintData(examDetailId, ticketNumber, type);
         return ResultUtil.ok(map);
     }
+
+    /**
+     * 统计查询-查询列表
+     * @param orgId
+     * @param printPlanId
+     * @param examPlace
+     * @param examStartTime
+     * @param examEndTime
+     * @param courseCode
+     * @param paperNumber
+     * @param pageNumber
+     * @param pageSize
+     * @return
+     */
+    @ApiOperation(value = "统计查询-查询列表")
+    @RequestMapping(value = "/print/statistics_list", method = RequestMethod.POST)
+    public Result printStatisticsList(@RequestParam("orgId") String orgId,
+                                      @RequestParam(value = "printPlanId", required = false) String printPlanId,
+                                      @RequestParam(value = "examPlace", required = false) String examPlace,
+                                      @RequestParam(value = "examStartTime", required = false) Long examStartTime,
+                                      @RequestParam(value = "examEndTime", required = false) Long examEndTime,
+                                      @RequestParam(value = "courseCode", required = false) String courseCode,
+                                      @RequestParam(value = "paperNumber", required = false) String paperNumber,
+                                      @RequestParam("pageNumber") Integer pageNumber,
+                                      @RequestParam("pageSize") Integer pageSize) {
+        IPage<ClientPrintStatisticsDto> statisticsDtoIPage = clientService.listClientPrintStatistics(orgId, printPlanId, examPlace, examStartTime, examEndTime, courseCode, paperNumber, pageNumber, pageSize);
+        return ResultUtil.ok(statisticsDtoIPage);
+    }
+
+    /**
+     * 统计查询-汇总数据查询
+     * @param orgId
+     * @param printPlanId
+     * @param examPlace
+     * @param examStartTime
+     * @param examEndTime
+     * @param courseCode
+     * @param paperNumber
+     * @return
+     */
+    @ApiOperation(value = "统计查询-汇总数据查询")
+    @RequestMapping(value = "/print/statistics_total_data", method = RequestMethod.POST)
+    public Result printStatisticsTotalData(@RequestParam("orgId") String orgId,
+                                           @RequestParam(value = "printPlanId", required = false) String printPlanId,
+                                           @RequestParam(value = "examPlace", required = false) String examPlace,
+                                           @RequestParam(value = "examStartTime", required = false) Long examStartTime,
+                                           @RequestParam(value = "examEndTime", required = false) Long examEndTime,
+                                           @RequestParam(value = "courseCode", required = false) String courseCode,
+                                           @RequestParam(value = "paperNumber", required = false) String paperNumber) {
+        ClientPrintStatisticsTotalDto statisticsTotalDto = clientService.clientStatisticsTotalData(orgId, printPlanId, examPlace, examStartTime, examEndTime, courseCode, paperNumber);
+        return ResultUtil.ok(statisticsTotalDto);
+    }
 }