Prechádzať zdrojové kódy

Merge branch 'dev_v2.2.0' of http://git.qmth.com.cn/wangliang/distributed-print-service into dev_v2.2.0

xiaof 3 rokov pred
rodič
commit
9dd0ccbe4f
12 zmenil súbory, kde vykonal 657 pridanie a 168 odobranie
  1. 31 21
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/TCStatisticsDto.java
  2. 39 16
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TCStatistics.java
  3. 255 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TCStatisticsTemp.java
  4. 9 9
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TCStatisticsMapper.java
  5. 29 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TCStatisticsTempMapper.java
  6. 15 15
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TCStatisticsService.java
  7. 31 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TCStatisticsTempService.java
  8. 12 12
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TCStatisticsServiceImpl.java
  9. 37 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TCStatisticsServiceTempImpl.java
  10. 28 17
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/TaskLogicServiceImpl.java
  11. 125 78
      distributed-print-business/src/main/resources/mapper/TCStatisticsMapper.xml
  12. 46 0
      distributed-print-business/src/main/resources/mapper/TCStatisticsTempMapper.xml

+ 31 - 21
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/TCStatisticsDto.java

@@ -2,7 +2,6 @@ package com.qmth.distributed.print.business.bean.dto;
 
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.qmth.distributed.print.business.entity.TCStatistics;
-import com.qmth.distributed.print.business.enums.StatisticsStatusEnum;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.io.Serializable;
@@ -18,45 +17,56 @@ import java.util.Objects;
 @JsonInclude(JsonInclude.Include.NON_NULL)
 public class TCStatisticsDto extends TCStatistics implements Serializable {
 
-    @ApiModelProperty(value = "总印份数")
-    private Integer printSum;
-
-    @ApiModelProperty(value = "完成状态,FINISH:已完成,UN_FINISH:未完成")
-    private StatisticsStatusEnum status;
-
     @ApiModelProperty(value = "完成状态,FINISH:已完成,UN_FINISH:未完成")
     private String statusStr;
 
     @ApiModelProperty(value = "印刷计划名称")
     private String printPlanName;
 
-    public String getPrintPlanName() {
-        return printPlanName;
+    @ApiModelProperty(value = "学生数量")
+    int examStudentCount;
+
+    @ApiModelProperty(value = "抽卷数")
+    int drawCount;
+
+    @ApiModelProperty(value = "备份数")
+    int backupCount;
+
+    public int getExamStudentCount() {
+        return examStudentCount;
     }
 
-    public void setPrintPlanName(String printPlanName) {
-        this.printPlanName = printPlanName;
+    public void setExamStudentCount(int examStudentCount) {
+        this.examStudentCount = examStudentCount;
+    }
+
+    public int getDrawCount() {
+        return drawCount;
     }
 
-    public Integer getPrintSum() {
-        return printSum;
+    public void setDrawCount(int drawCount) {
+        this.drawCount = drawCount;
     }
 
-    public void setPrintSum(Integer printSum) {
-        this.printSum = printSum;
+    public int getBackupCount() {
+        return backupCount;
     }
 
-    public StatisticsStatusEnum getStatus() {
-        return status;
+    public void setBackupCount(int backupCount) {
+        this.backupCount = backupCount;
     }
 
-    public void setStatus(StatisticsStatusEnum status) {
-        this.status = status;
+    public String getPrintPlanName() {
+        return printPlanName;
+    }
+
+    public void setPrintPlanName(String printPlanName) {
+        this.printPlanName = printPlanName;
     }
 
     public String getStatusStr() {
-        if (Objects.nonNull(status)) {
-            return status.getTitle();
+        if (Objects.nonNull(this.getStatus())) {
+            return this.getStatus().getTitle();
         } else {
             return statusStr;
         }

+ 39 - 16
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TCStatistics.java

@@ -2,6 +2,7 @@ package com.qmth.distributed.print.business.entity;
 
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.distributed.print.business.enums.StatisticsStatusEnum;
 import com.qmth.teachcloud.common.base.BaseEntity;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -60,15 +61,21 @@ public class TCStatistics extends BaseEntity implements Serializable {
 
     @ApiModelProperty(name = "考务数据明细id")
     @JsonSerialize(using = ToStringSerializer.class)
-    Long examDetailCourseId;
+    String examDetailCourseIds;
 
     @ApiModelProperty(name = "命题任务明细id")
     @JsonSerialize(using = ToStringSerializer.class)
-    Long examTaskDetailId;
+    String examTaskDetailIds;
 
     @ApiModelProperty(value = "批次号")
     private String batchNo;
 
+    @ApiModelProperty(value = "总印份数")
+    private Integer printSum;
+
+    @ApiModelProperty(value = "完成状态,FINISH:已完成,UN_FINISH:未完成")
+    private StatisticsStatusEnum status;
+
     public TCStatistics() {
 
     }
@@ -109,8 +116,8 @@ public class TCStatistics extends BaseEntity implements Serializable {
                         String batchNo,
                         String paperNumber,
                         Long printPlanId,
-                        Long examDetailCourseId,
-                        Long examTaskDetailId,
+                        String examDetailCourseIds,
+                        String examTaskDetailIds,
                         Long userId) {
         insertInfo(userId);
         this.collegeId = collegeId;
@@ -125,18 +132,34 @@ public class TCStatistics extends BaseEntity implements Serializable {
         this.batchNo = batchNo;
         this.paperNumber = paperNumber;
         this.printPlanId = printPlanId;
-        this.examDetailCourseId = examDetailCourseId;
-        this.examTaskDetailId = examTaskDetailId;
+        this.examDetailCourseIds = examDetailCourseIds;
+        this.examTaskDetailIds = examTaskDetailIds;
     }
 
     public void updateInfo(Long userId, TCStatistics t) {
         this.paperNumber = t.getPaperNumber();
         this.printPlanId = t.getPrintPlanId();
-        this.examDetailCourseId = t.getExamDetailCourseId();
-        this.examTaskDetailId = t.getExamTaskDetailId();
+        this.examDetailCourseIds = t.getExamDetailCourseIds();
+        this.examTaskDetailIds = t.getExamTaskDetailIds();
         updateInfo(userId);
     }
 
+    public Integer getPrintSum() {
+        return printSum;
+    }
+
+    public void setPrintSum(Integer printSum) {
+        this.printSum = printSum;
+    }
+
+    public StatisticsStatusEnum getStatus() {
+        return status;
+    }
+
+    public void setStatus(StatisticsStatusEnum status) {
+        this.status = status;
+    }
+
     public Long getCollegeId() {
         return collegeId;
     }
@@ -185,20 +208,20 @@ public class TCStatistics extends BaseEntity implements Serializable {
         this.clazzName = clazzName;
     }
 
-    public Long getExamDetailCourseId() {
-        return examDetailCourseId;
+    public String getExamDetailCourseIds() {
+        return examDetailCourseIds;
     }
 
-    public void setExamDetailCourseId(Long examDetailCourseId) {
-        this.examDetailCourseId = examDetailCourseId;
+    public void setExamDetailCourseIds(String examDetailCourseIds) {
+        this.examDetailCourseIds = examDetailCourseIds;
     }
 
-    public Long getExamTaskDetailId() {
-        return examTaskDetailId;
+    public String getExamTaskDetailIds() {
+        return examTaskDetailIds;
     }
 
-    public void setExamTaskDetailId(Long examTaskDetailId) {
-        this.examTaskDetailId = examTaskDetailId;
+    public void setExamTaskDetailIds(String examTaskDetailIds) {
+        this.examTaskDetailIds = examTaskDetailIds;
     }
 
     public String getBatchNo() {

+ 255 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TCStatisticsTemp.java

@@ -0,0 +1,255 @@
+package com.qmth.distributed.print.business.entity;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.teachcloud.common.base.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 命题统计临时表
+ * </p>
+ *
+ * @author wangliang
+ * @since 2021-09-09
+ */
+@ApiModel(value = "TCStatisticsTemp对象", description = "命题统计临时表")
+public class TCStatisticsTemp extends BaseEntity implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "开课学院id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long collegeId;
+
+    @ApiModelProperty(value = "开课学院名称")
+    private String collegeName;
+
+    @ApiModelProperty(value = "开课部门id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long teachingRoomId;
+
+    @ApiModelProperty(value = "开课部门名称")
+    private String teachingRoomName;
+
+    @ApiModelProperty(value = "课程名称")
+    private String courseName;
+
+    @ApiModelProperty(value = "课程代码")
+    private String courseCode;
+
+    @ApiModelProperty(value = "任课老师名称")
+    private String teacherName;
+
+    @ApiModelProperty(value = "班级id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long clazzId;
+
+    @ApiModelProperty(value = "班级名称")
+    private String clazzName;
+
+    @ApiModelProperty(value = "试卷编号")
+    private String paperNumber;
+
+    @ApiModelProperty(value = "印刷计划id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long printPlanId;
+
+    @ApiModelProperty(name = "考务数据明细id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    Long examDetailCourseId;
+
+    @ApiModelProperty(name = "命题任务明细id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    Long examTaskDetailId;
+
+    @ApiModelProperty(value = "批次号")
+    private String batchNo;
+
+    public TCStatisticsTemp() {
+
+    }
+
+    public TCStatisticsTemp(Long collegeId,
+                            String collegeName,
+                            Long teachingRoomId,
+                            String teachingRoomName,
+                            String courseName,
+                            String courseCode,
+                            String teacherName,
+                            Long clazzId,
+                            String clazzName,
+                            String batchNo,
+                            Long userId) {
+        insertInfo(userId);
+        this.collegeId = collegeId;
+        this.collegeName = collegeName;
+        this.teachingRoomId = teachingRoomId;
+        this.teachingRoomName = teachingRoomName;
+        this.courseName = courseName;
+        this.courseCode = courseCode;
+        this.teacherName = teacherName;
+        this.clazzId = clazzId;
+        this.clazzName = clazzName;
+        this.batchNo = batchNo;
+    }
+
+    public TCStatisticsTemp(Long collegeId,
+                            String collegeName,
+                            Long teachingRoomId,
+                            String teachingRoomName,
+                            String courseName,
+                            String courseCode,
+                            String teacherName,
+                            Long clazzId,
+                            String clazzName,
+                            String batchNo,
+                            String paperNumber,
+                            Long printPlanId,
+                            Long examDetailCourseId,
+                            Long examTaskDetailId,
+                            Long userId) {
+        insertInfo(userId);
+        this.collegeId = collegeId;
+        this.collegeName = collegeName;
+        this.teachingRoomId = teachingRoomId;
+        this.teachingRoomName = teachingRoomName;
+        this.courseName = courseName;
+        this.courseCode = courseCode;
+        this.teacherName = teacherName;
+        this.clazzId = clazzId;
+        this.clazzName = clazzName;
+        this.batchNo = batchNo;
+        this.paperNumber = paperNumber;
+        this.printPlanId = printPlanId;
+        this.examDetailCourseId = examDetailCourseId;
+        this.examTaskDetailId = examTaskDetailId;
+    }
+
+    public void updateInfo(Long userId, TCStatisticsTemp t) {
+        this.paperNumber = t.getPaperNumber();
+        this.printPlanId = t.getPrintPlanId();
+        this.examDetailCourseId = t.getExamDetailCourseId();
+        this.examTaskDetailId = t.getExamTaskDetailId();
+        updateInfo(userId);
+    }
+
+    public Long getCollegeId() {
+        return collegeId;
+    }
+
+    public void setCollegeId(Long collegeId) {
+        this.collegeId = collegeId;
+    }
+
+    public String getCollegeName() {
+        return collegeName;
+    }
+
+    public void setCollegeName(String collegeName) {
+        this.collegeName = collegeName;
+    }
+
+    public Long getTeachingRoomId() {
+        return teachingRoomId;
+    }
+
+    public void setTeachingRoomId(Long teachingRoomId) {
+        this.teachingRoomId = teachingRoomId;
+    }
+
+    public String getTeachingRoomName() {
+        return teachingRoomName;
+    }
+
+    public void setTeachingRoomName(String teachingRoomName) {
+        this.teachingRoomName = teachingRoomName;
+    }
+
+    public String getCourseName() {
+        return courseName;
+    }
+
+    public void setCourseName(String courseName) {
+        this.courseName = courseName;
+    }
+
+    public String getClazzName() {
+        return clazzName;
+    }
+
+    public void setClazzName(String clazzName) {
+        this.clazzName = clazzName;
+    }
+
+    public Long getExamDetailCourseId() {
+        return examDetailCourseId;
+    }
+
+    public void setExamDetailCourseId(Long examDetailCourseId) {
+        this.examDetailCourseId = examDetailCourseId;
+    }
+
+    public Long getExamTaskDetailId() {
+        return examTaskDetailId;
+    }
+
+    public void setExamTaskDetailId(Long examTaskDetailId) {
+        this.examTaskDetailId = examTaskDetailId;
+    }
+
+    public String getBatchNo() {
+        return batchNo;
+    }
+
+    public void setBatchNo(String batchNo) {
+        this.batchNo = batchNo;
+    }
+
+    public static long getSerialVersionUID() {
+        return serialVersionUID;
+    }
+
+    public String getCourseCode() {
+        return courseCode;
+    }
+
+    public void setCourseCode(String courseCode) {
+        this.courseCode = courseCode;
+    }
+
+    public String getTeacherName() {
+        return teacherName;
+    }
+
+    public void setTeacherName(String teacherName) {
+        this.teacherName = teacherName;
+    }
+
+    public Long getClazzId() {
+        return clazzId;
+    }
+
+    public void setClazzId(Long clazzId) {
+        this.clazzId = clazzId;
+    }
+
+    public String getPaperNumber() {
+        return paperNumber;
+    }
+
+    public void setPaperNumber(String paperNumber) {
+        this.paperNumber = paperNumber;
+    }
+
+    public Long getPrintPlanId() {
+        return printPlanId;
+    }
+
+    public void setPrintPlanId(Long printPlanId) {
+        this.printPlanId = printPlanId;
+    }
+}

+ 9 - 9
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TCStatisticsMapper.java

@@ -19,15 +19,6 @@ import java.util.Map;
  */
 public interface TCStatisticsMapper extends BaseMapper<TCStatistics> {
 
-    /**
-     * 根据批次号查找印刷计划信息
-     *
-     * @param schoolId
-     * @param batchNo
-     * @return
-     */
-    public List<TCStatistics> findByBatchNo(@Param("schoolId") Long schoolId, @Param("batchNo") String batchNo);
-
     /**
      * 查找印刷计划信息
      *
@@ -47,4 +38,13 @@ public interface TCStatisticsMapper extends BaseMapper<TCStatistics> {
                                        @Param("courseName") String courseName,
                                        @Param("teacherName") String teacherName,
                                        @Param("schoolId") Long schoolId);
+
+    /**
+     * 根据batchNo统计信息
+     *
+     * @param schoolId
+     * @param batchNo
+     * @return
+     */
+    public List<TCStatisticsDto> findByBatchNoCount(@Param("schoolId") Long schoolId, @Param("batchNo") String batchNo);
 }

+ 29 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TCStatisticsTempMapper.java

@@ -0,0 +1,29 @@
+package com.qmth.distributed.print.business.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.qmth.distributed.print.business.entity.TCStatistics;
+import com.qmth.distributed.print.business.entity.TCStatisticsTemp;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 命题统计临时表 Mapper 接口
+ * </p>
+ *
+ * @author wangliang
+ * @since 2021-09-09
+ */
+public interface TCStatisticsTempMapper extends BaseMapper<TCStatisticsTemp> {
+
+    /**
+     * 根据批次号查找印刷计划信息
+     *
+     * @param schoolId
+     * @param batchNo
+     * @return
+     */
+    public List<TCStatisticsTemp> findByBatchNo(@Param("schoolId") Long schoolId, @Param("batchNo") String batchNo);
+
+}

+ 15 - 15
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TCStatisticsService.java

@@ -19,15 +19,6 @@ import java.util.Map;
  */
 public interface TCStatisticsService extends IService<TCStatistics> {
 
-    /**
-     * 根据批次号查找印刷计划信息
-     *
-     * @param schoolId
-     * @param batchNo
-     * @return
-     */
-    public List<TCStatistics> findByBatchNo(Long schoolId, String batchNo);
-
     /**
      * 查找印刷计划信息
      *
@@ -41,10 +32,19 @@ public interface TCStatisticsService extends IService<TCStatistics> {
      * @return
      */
     public IPage<TCStatisticsDto> list(IPage<Map> iPage,
-                                             Long collegeId,
-                                             Long teachingRoomId,
-                                             StatisticsStatusEnum status,
-                                             String courseName,
-                                             String teacherName,
-                                             Long schoolId);
+                                       Long collegeId,
+                                       Long teachingRoomId,
+                                       StatisticsStatusEnum status,
+                                       String courseName,
+                                       String teacherName,
+                                       Long schoolId);
+
+    /**
+     * 根据batchNo统计信息
+     *
+     * @param schoolId
+     * @param batchNo
+     * @return
+     */
+    public List<TCStatisticsDto> findByBatchNoCount(Long schoolId, String batchNo);
 }

+ 31 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TCStatisticsTempService.java

@@ -0,0 +1,31 @@
+package com.qmth.distributed.print.business.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.distributed.print.business.bean.dto.TCStatisticsDto;
+import com.qmth.distributed.print.business.entity.TCStatistics;
+import com.qmth.distributed.print.business.entity.TCStatisticsTemp;
+import com.qmth.distributed.print.business.enums.StatisticsStatusEnum;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 命题统计临时表 服务类
+ * </p>
+ *
+ * @author wangliang
+ * @since 2021-09-09
+ */
+public interface TCStatisticsTempService extends IService<TCStatisticsTemp> {
+
+    /**
+     * 根据批次号查找印刷计划信息
+     *
+     * @param schoolId
+     * @param batchNo
+     * @return
+     */
+    public List<TCStatisticsTemp> findByBatchNo(Long schoolId, String batchNo);
+}

+ 12 - 12
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TCStatisticsServiceImpl.java

@@ -28,18 +28,6 @@ public class TCStatisticsServiceImpl extends ServiceImpl<TCStatisticsMapper, TCS
     @Resource
     TCStatisticsMapper tcStatisticsMapper;
 
-    /**
-     * 根据批次号查找印刷计划信息
-     *
-     * @param schoolId
-     * @param batchNo
-     * @return
-     */
-    @Override
-    public List<TCStatistics> findByBatchNo(Long schoolId, String batchNo) {
-        return tcStatisticsMapper.findByBatchNo(schoolId, batchNo);
-    }
-
     /**
      * 查找印刷计划信息
      *
@@ -56,4 +44,16 @@ public class TCStatisticsServiceImpl extends ServiceImpl<TCStatisticsMapper, TCS
     public IPage<TCStatisticsDto> list(IPage<Map> iPage, Long collegeId, Long teachingRoomId, StatisticsStatusEnum status, String courseName, String teacherName, Long schoolId) {
         return tcStatisticsMapper.list(iPage, collegeId, teachingRoomId, Objects.nonNull(status) ? status.name() : null, courseName, teacherName, schoolId);
     }
+
+    /**
+     * 根据batchNo统计信息
+     *
+     * @param schoolId
+     * @param batchNo
+     * @return
+     */
+    @Override
+    public List<TCStatisticsDto> findByBatchNoCount(Long schoolId, String batchNo) {
+        return tcStatisticsMapper.findByBatchNoCount(schoolId, batchNo);
+    }
 }

+ 37 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TCStatisticsServiceTempImpl.java

@@ -0,0 +1,37 @@
+package com.qmth.distributed.print.business.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.distributed.print.business.entity.TCStatisticsTemp;
+import com.qmth.distributed.print.business.mapper.TCStatisticsTempMapper;
+import com.qmth.distributed.print.business.service.TCStatisticsTempService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * <p>
+ * 命题统计临时表 服务实现类
+ * </p>
+ *
+ * @author wangliang
+ * @since 2021-09-09
+ */
+@Service
+public class TCStatisticsServiceTempImpl extends ServiceImpl<TCStatisticsTempMapper, TCStatisticsTemp> implements TCStatisticsTempService {
+
+    @Resource
+    TCStatisticsTempMapper tcStatisticsTempMapper;
+
+    /**
+     * 根据批次号查找印刷计划信息
+     *
+     * @param schoolId
+     * @param batchNo
+     * @return
+     */
+    @Override
+    public List<TCStatisticsTemp> findByBatchNo(Long schoolId, String batchNo) {
+        return tcStatisticsTempMapper.findByBatchNo(schoolId, batchNo);
+    }
+}

+ 28 - 17
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/TaskLogicServiceImpl.java

@@ -9,6 +9,8 @@ import com.aliyun.oss.common.utils.BinaryUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.google.common.collect.Lists;
+import com.google.common.reflect.TypeToken;
+import com.google.gson.Gson;
 import com.itextpdf.text.DocumentException;
 import com.qmth.boot.api.exception.ApiException;
 import com.qmth.distributed.print.business.bean.dto.*;
@@ -154,6 +156,9 @@ public class TaskLogicServiceImpl implements TaskLogicService {
     @Resource
     TCStatisticsService tcStatisticsService;
 
+    @Resource
+    TCStatisticsTempService tcStatisticsTempService;
+
     /**
      * 创建pdf前置条件
      *
@@ -1337,10 +1342,9 @@ public class TaskLogicServiceImpl implements TaskLogicService {
             List<ExcelError> excelErrorTemp = new ArrayList<>();
             Map<String, SysOrg> collegeOrgMap = new HashMap<>(), teachingRoomMap = new HashMap<>();//学院,部门
             Map<String, BasicCourse> courseMap = new HashMap<>();//课程
-            Map<String, SysUser> userMap = new HashMap<>();//用户
             Map<String, BasicClazz> clazzMap = new HashMap<>();//班级
             String batchNo = SystemConstant.getUuid();
-            List<TCStatistics> tcStatisticsList = new ArrayList<>();
+            List<TCStatisticsTemp> tcStatisticsImportTempList = new ArrayList<>();
             for (int i = 0; i < finalExcelList.size(); i++) {
                 LinkedMultiValueMap<Integer, Object> excelMap = finalExcelList.get(i);
                 List<Object> statisticsTempList = excelMap.get(i);
@@ -1350,18 +1354,10 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                     SysOrg teachingRoomOrg = this.validSysOrgExists(teachingRoomMap, statisticsImportDto.getTeachingRoomName(), sysUser.getSchoolId(), OrgTypeEnum.TEACHING_ROOM, excelErrorTemp, (y + 1), (i + 1), "开课部门");
                     BasicCourse basicCourse = this.validBasicCourseExists(courseMap, statisticsImportDto.getCourseName(), sysUser.getSchoolId(), statisticsImportDto.getCourseCode(), excelErrorTemp, (y + 1), (i + 1), "课程代码");
                     String teacherName = statisticsImportDto.getTeacherName();
-//                    if (teacherName.indexOf(",") == -1) {
-//                        SysUser dbUser = this.validSysUserExists(userMap, teacherName, sysUser.getSchoolId(), excelErrorTemp, (y + 1), (i + 1), "任课老师");
-//                    } else {
-//                        String[] teacherNames = teacherName.split(",");
-//                        for (int k = 0; k < teacherNames.length; k++) {
-//                            SysUser dbUser = this.validSysUserExists(userMap, teacherNames[k], sysUser.getSchoolId(), excelErrorTemp, (y + 1), (i + 1), "任课老师" + teacherNames[k]);
-//                        }
-//                    }
                     BasicClazz basicClazz = this.validBasicClazzExists(clazzMap, statisticsImportDto.getClazzName(), sysUser.getSchoolId(), excelErrorTemp, (y + 1), (i + 1), "班级名称");
 
                     if (excelErrorTemp.size() == 0) {
-                        TCStatistics tcStatistics = new TCStatistics(collegeOrg.getId(),
+                        TCStatisticsTemp tcStatistics = new TCStatisticsTemp(collegeOrg.getId(),
                                 collegeOrg.getName(),
                                 teachingRoomOrg.getId(),
                                 teachingRoomOrg.getName(),
@@ -1372,7 +1368,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                                 basicClazz.getClazzName(),
                                 batchNo,
                                 sysUser.getId());
-                        tcStatisticsList.add(tcStatistics);
+                        tcStatisticsImportTempList.add(tcStatistics);
                     }
                 }
             }
@@ -1380,13 +1376,28 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                 List<String> errors = excelErrorTemp.stream().map(m -> m.getExcelErrorType()).collect(Collectors.toList());
                 throw ExceptionResultEnum.ERROR.exception(JSONObject.toJSONString(errors));
             }
-            tcStatisticsService.saveBatch(tcStatisticsList);
-            map.put("dataCount", tcStatisticsList.size());
+            tcStatisticsTempService.saveBatch(tcStatisticsImportTempList);
+            map.put("dataCount", tcStatisticsImportTempList.size());
 
-            List<TCStatistics> tcStatisticsTempList = tcStatisticsService.findByBatchNo(sysUser.getSchoolId(), batchNo);
+            List<TCStatisticsTemp> tcStatisticsTempList = tcStatisticsTempService.findByBatchNo(sysUser.getSchoolId(), batchNo);
             if (Objects.nonNull(tcStatisticsTempList) && tcStatisticsTempList.size() > 0) {
-                tcStatisticsService.removeByIds(tcStatisticsList);
-                tcStatisticsService.saveBatch(tcStatisticsTempList);
+                batchNo = SystemConstant.getUuid();
+                for (TCStatisticsTemp t : tcStatisticsTempList) {
+                    t.insertInfo(sysUser.getId());
+                    t.setBatchNo(batchNo);
+                }
+                tcStatisticsTempService.saveBatch(tcStatisticsTempList);
+
+                List<TCStatisticsDto> tcStatisticsDtoList = tcStatisticsService.findByBatchNoCount(sysUser.getSchoolId(), batchNo);
+                if (Objects.nonNull(tcStatisticsDtoList) && tcStatisticsDtoList.size() > 0) {
+                    Gson gson = new Gson();
+                    List<TCStatistics> tcStatisticsList = gson.fromJson(JacksonUtil.parseJson(tcStatisticsDtoList), new TypeToken<List<TCStatistics>>() {
+                    }.getType());
+                    for (TCStatistics t : tcStatisticsList) {
+                        t.insertInfo(sysUser.getId());
+                    }
+                    tcStatisticsService.saveBatch(tcStatisticsList);
+                }
             }
             return finalExcelList;
         });

+ 125 - 78
distributed-print-business/src/main/resources/mapper/TCStatisticsMapper.xml

@@ -2,7 +2,22 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.qmth.distributed.print.business.mapper.TCStatisticsMapper">
 
-    <select id="findByBatchNo" resultType="com.qmth.distributed.print.business.entity.TCStatistics">
+    <select id="list" resultType="com.qmth.distributed.print.business.bean.dto.TCStatisticsDto">
+        select
+        t.id,
+        t.courseName,
+        t.courseCode,
+        t.teacherName,
+        t.clazzId,
+        t.clazzName,
+        t.paperNumber,
+        t.printPlanId,
+        t.printPlanName,
+        t.examStudentCount,
+        IFNULL(t.examStudentCount, 0) + (t.drawCount * t.backupCount) as printSum,
+        t.status
+        from
+        (
         select
         distinct tcs.id,
         tcs.college_id as collegeId,
@@ -14,69 +29,96 @@
         tcs.teacher_name as teacherName,
         tcs.clazz_id as clazzId,
         tcs.clazz_name as clazzName,
-        tcs.paper_number as paperNumber,
         tcs.batch_no as batchNo,
+        tcs.paper_number as paperNumber,
         epp.id as printPlanId,
-        edc.id as examDetailCourseId,
-        etd.id as examTaskDetailId
+        epp.name as printPlanName,
+        (
+        select
+        etd.draw_count
+        from
+        exam_task_detail etd
+        where
+        FIND_IN_SET(etd.id, tcs.exam_task_detail_ids)) as drawCount,
+        IFNULL(epp.backup_count, 0) as backupCount,
+        (
+        select
+        count(1)
+        from
+        exam_student es
+        where
+        FIND_IN_SET(es.exam_detail_course_id, tcs.exam_detail_course_ids)
+        and es.clazz_id = tcs.clazz_id
+        and es.school_id = 137) as examStudentCount,
+        case
+        when epp.status = 'PRINT_FINISH'
+        or epp.status = 'END' then 'FINISH'
+        else 'UN_FINISH'
+        end status
         from
         t_c_statistics tcs
-        join exam_task et on
-        et.course_code = tcs.course_code
-        and et.teaching_room_id = tcs.teaching_room_id
-        join exam_task_detail etd on
-        etd.exam_task_id = et.id
-        join exam_detail_course edc on
-        edc.course_code = tcs.course_code
-        and edc.paper_number = et.paper_number
-        and edc.school_id = et.school_id
-        join exam_detail ed on
-        ed.id = edc.exam_detail_id
         join exam_print_plan epp on
-        epp.id = ed.print_plan_id
+        epp.id = tcs.print_plan_id
+        where
+        epp.school_id = #{schoolId}) t
         <where>
-            and et.enable = true
-            and etd.enable = true
-            <if test="schoolId != null and schoolId != ''">
-                and et.school_id = #{schoolId}
+            <if test="collegeId != null and collegeId != ''">
+                and t.collegeId = #{collegeId}
+            </if>
+            <if test="teachingRoomId != null and teachingRoomId != ''">
+                and t.teachingRoomId = #{teachingRoomId}
+            </if>
+            <if test="status != null and status != ''">
+                and t.status = #{status}
+            </if>
+            <if test="courseName != null and courseName != ''">
+                and t.courseName like concat('%',#{courseName},'%')
             </if>
-            <if test="batchNo != null and batchNo != ''">
-                and tcs.batch_no = #{batchNo}
+            <if test="teacherName != null and teacherName != ''">
+                and t.teacherName like concat('%',#{teacherName},'%')
             </if>
         </where>
     </select>
 
-    <select id="list" resultType="com.qmth.distributed.print.business.bean.dto.TCStatisticsDto">
-            select
-                t.id,
-                t.courseName,
-                t.courseCode,
-                t.teacherName,
-                t.clazzId,
-                t.clazzName,
-                t.paperNumber,
-                t.printPlanId,
-                t.printPlanName,
-                IFNULL(t.examStudentCount,0) + (t.drawCount * t.backupCount) as printSum,
-                t.status
+    <select id="findByBatchNoCount" resultType="com.qmth.distributed.print.business.bean.dto.TCStatisticsDto">
+        select
+            t.collegeId,
+            t.collegeName,
+            t.courseName,
+            t.courseCode,
+            t.teachingRoomId,
+            t.teachingRoomName,
+            t.teacherName,
+            t.clazzId,
+            t.clazzName,
+            t.paperNumber,
+            t.printPlanId,
+            t.printPlanName,
+            t.batchNo,
+            t.status,
+            IFNULL(sum(t.examStudentCount),0) + (t.drawCount * t.backupCount) as printSum,
+            GROUP_CONCAT(distinct t.examDetailCourseId) as examDetailCourseIds,
+            GROUP_CONCAT(distinct t.examTaskDetailId) as examTaskDetailIds
         from
             (
             select
-                distinct tcs.id,
-                tcs.college_id as collegeId,
-                tcs.college_name as collegeName,
-                tcs.course_name as courseName,
-                tcs.course_code as courseCode,
-                tcs.teaching_room_id as teachingRoomId,
-                tcs.teaching_room_name as teachingRoomName,
-                tcs.teacher_name as teacherName,
-                tcs.clazz_id as clazzId,
-                tcs.clazz_name as clazzName,
+                distinct
+                tcst.college_id as collegeId,
+                tcst.college_name as collegeName,
+                tcst.course_name as courseName,
+                et.course_code as courseCode,
+                et.teaching_room_id as teachingRoomId,
+                tcst.teaching_room_name as teachingRoomName,
+                tcst.teacher_name as teacherName,
+                tcst.clazz_id as clazzId,
+                tcst.clazz_name as clazzName,
+                tcst.batch_no as batchNo,
                 et.paper_number as paperNumber,
-                tcs.print_plan_id as printPlanId,
+                edc.id as examDetailCourseId,
+                etd.id as examTaskDetailId,
+                epp.id as printPlanId,
                 epp.name as printPlanName,
-                IFNULL(etd.draw_count,0) as drawCount,
-                IFNULL(epp.backup_count,0) as backupCount,
+                IFNULL(etd.draw_count, 0) as drawCount,
                 (
                 select
                     count(1)
@@ -84,47 +126,52 @@
                     exam_student es
                 where
                     es.exam_detail_course_id = edc.id
-                    and es.clazz_id = tcs.clazz_id
+                    and es.clazz_id = tcst.clazz_id
                     and es.school_id = #{schoolId}) as examStudentCount,
+                IFNULL(epp.backup_count, 0) as backupCount,
                     case
-                        when epp.status = 'PRINT_FINISH' or epp.status = 'END' then 'FINISH'
-                        else 'UN_FINISH'
-                    end status
+                        when epp.status = 'PRINT_FINISH'
+                    or epp.status = 'END' then 'FINISH'
+                    else 'UN_FINISH'
+                end status
             from
-                t_c_statistics tcs
+                    t_c_statistics_temp tcst
             join exam_task et on
-                et.course_code = tcs.course_code
-                and et.teaching_room_id = tcs.teaching_room_id
+                    et.course_code = tcst.course_code
+                and et.teaching_room_id = tcst.teaching_room_id
             join exam_task_detail etd on
-                etd.exam_task_id = et.id
+                    etd.exam_task_id = et.id
             join exam_detail_course edc on
-                edc.course_code = tcs.course_code
+                    edc.course_code = tcst.course_code
                 and edc.paper_number = et.paper_number
                 and edc.school_id = et.school_id
             join exam_detail ed on
-                ed.id = edc.exam_detail_id
+                    ed.id = edc.exam_detail_id
             join exam_print_plan epp on
-                epp.id = ed.print_plan_id
+                    epp.id = ed.print_plan_id
             where
-                et.enable = true
+                    et.enable = true
                 and etd.enable = true
-                and et.school_id = #{schoolId}) t
-                <where>
-                    <if test="collegeId != null and collegeId != ''">
-                        and t.collegeId = #{collegeId}
-                    </if>
-                    <if test="teachingRoomId != null and teachingRoomId != ''">
-                        and t.teachingRoomId = #{teachingRoomId}
-                    </if>
-                    <if test="status != null and status != ''">
-                        and t.status = #{status}
-                    </if>
-                    <if test="courseName != null and courseName != ''">
-                        and t.courseName like concat('%',#{courseName},'%')
-                    </if>
-                    <if test="teacherName != null and teacherName != ''">
-                        and t.teacherName like concat('%',#{teacherName},'%')
-                    </if>
-                </where>
+                and et.school_id = #{schoolId}
+                and tcst.batch_no = #{batchNo}) t
+        group by
+            t.collegeId,
+            t.collegeName,
+            t.courseName,
+            t.courseCode,
+            t.teachingRoomId,
+            t.teachingRoomName,
+            t.teacherName,
+            t.clazzId,
+            t.clazzName,
+            t.paperNumber,
+            t.printPlanId,
+            t.printPlanName,
+            t.status,
+            t.drawCount,
+            t.batchNo
+        order by
+            t.printPlanId,
+            t.clazzId
     </select>
 </mapper>

+ 46 - 0
distributed-print-business/src/main/resources/mapper/TCStatisticsTempMapper.xml

@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.qmth.distributed.print.business.mapper.TCStatisticsTempMapper">
+
+    <select id="findByBatchNo" resultType="com.qmth.distributed.print.business.entity.TCStatisticsTemp">
+        select distinct
+        tcst.college_id as collegeId,
+        tcst.college_name as collegeName,
+        tcst.course_name as courseName,
+        tcst.course_code as courseCode,
+        tcst.teaching_room_id as teachingRoomId,
+        tcst.teaching_room_name as teachingRoomName,
+        tcst.teacher_name as teacherName,
+        tcst.clazz_id as clazzId,
+        tcst.clazz_name as clazzName,
+        et.paper_number as paperNumber,
+        epp.id as printPlanId,
+        edc.id as examDetailCourseId,
+        etd.id as examTaskDetailId
+        from
+        t_c_statistics_temp tcst
+        join exam_task et on
+        et.course_code = tcst.course_code
+        and et.teaching_room_id = tcst.teaching_room_id
+        join exam_task_detail etd on
+        etd.exam_task_id = et.id
+        join exam_detail_course edc on
+        edc.course_code = tcst.course_code
+        and edc.paper_number = et.paper_number
+        and edc.school_id = et.school_id
+        join exam_detail ed on
+        ed.id = edc.exam_detail_id
+        join exam_print_plan epp on
+        epp.id = ed.print_plan_id
+        <where>
+            and et.enable = true
+            and etd.enable = true
+            <if test="schoolId != null and schoolId != ''">
+                and et.school_id = #{schoolId}
+            </if>
+            <if test="batchNo != null and batchNo != ''">
+                and tcst.batch_no = #{batchNo}
+            </if>
+        </where>
+    </select>
+</mapper>