Răsfoiți Sursa

新增命题统计

wangliang 3 ani în urmă
părinte
comite
5a1b861b56
14 a modificat fișierele cu 471 adăugiri și 364 ștergeri
  1. 57 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/TCStatisticsDto.java
  2. 0 86
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/TCStatisticsImportTempDto.java
  3. 165 31
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TCStatistics.java
  4. 0 179
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TCStatisticsImportTemp.java
  5. 0 16
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TCStatisticsImportTempMapper.java
  6. 34 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TCStatisticsMapper.java
  7. 0 16
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TCStatisticsImportTempService.java
  8. 34 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TCStatisticsService.java
  9. 0 20
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TCStatisticsImportTempServiceImpl.java
  10. 39 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TCStatisticsServiceImpl.java
  11. 17 9
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/TaskLogicServiceImpl.java
  12. 0 5
      distributed-print-business/src/main/resources/mapper/TCStatisticsImportTempMapper.xml
  13. 119 0
      distributed-print-business/src/main/resources/mapper/TCStatisticsMapper.xml
  14. 6 2
      distributed-print/src/main/java/com/qmth/distributed/print/api/TCStatisticsController.java

+ 57 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/TCStatisticsDto.java

@@ -0,0 +1,57 @@
+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;
+import java.util.Objects;
+
+/**
+ * @Description: 命题统计导入 dto
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2021/9/10
+ */
+@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;
+
+    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 String getStatusStr() {
+        if (Objects.nonNull(status)) {
+            return status.getTitle();
+        } else {
+            return statusStr;
+        }
+    }
+
+    public void setStatusStr(String statusStr) {
+        this.statusStr = statusStr;
+    }
+}

+ 0 - 86
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/TCStatisticsImportTempDto.java

@@ -1,86 +0,0 @@
-package com.qmth.distributed.print.business.bean.dto;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import com.qmth.distributed.print.business.entity.TCStatisticsImportTemp;
-import io.swagger.annotations.ApiModelProperty;
-
-/**
- * @Description: 命题统计导入 dto
- * @Param:
- * @return:
- * @Author: wangliang
- * @Date: 2021/9/10
- */
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class TCStatisticsImportTempDto extends TCStatisticsImportTemp {
-
-    @ApiModelProperty(name = "试卷编号")
-    String paperNumber;
-
-    @ApiModelProperty(name = "单次抽卷数量")
-    Integer drawCount;
-
-    @ApiModelProperty(name = "备份数量")
-    Integer backupCount;
-
-    @ApiModelProperty(name = "印刷计划名称")
-    String printPlanName;
-
-    @ApiModelProperty(name = "印刷计划id")
-    @JsonSerialize(using = ToStringSerializer.class)
-    Long printPlanId;
-
-    @ApiModelProperty(name = "考务数据明细id")
-    @JsonSerialize(using = ToStringSerializer.class)
-    Long examDetailCourseId;
-
-    public String getPaperNumber() {
-        return paperNumber;
-    }
-
-    public void setPaperNumber(String paperNumber) {
-        this.paperNumber = paperNumber;
-    }
-
-    public Integer getDrawCount() {
-        return drawCount;
-    }
-
-    public void setDrawCount(Integer drawCount) {
-        this.drawCount = drawCount;
-    }
-
-    public Integer getBackupCount() {
-        return backupCount;
-    }
-
-    public void setBackupCount(Integer backupCount) {
-        this.backupCount = backupCount;
-    }
-
-    public String getPrintPlanName() {
-        return printPlanName;
-    }
-
-    public void setPrintPlanName(String printPlanName) {
-        this.printPlanName = printPlanName;
-    }
-
-    public Long getPrintPlanId() {
-        return printPlanId;
-    }
-
-    public void setPrintPlanId(Long printPlanId) {
-        this.printPlanId = printPlanId;
-    }
-
-    public Long getExamDetailCourseId() {
-        return examDetailCourseId;
-    }
-
-    public void setExamDetailCourseId(Long examDetailCourseId) {
-        this.examDetailCourseId = examDetailCourseId;
-    }
-}

+ 165 - 31
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TCStatistics.java

@@ -2,7 +2,6 @@ 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;
@@ -22,9 +21,22 @@ public class TCStatistics extends BaseEntity implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
-    @ApiModelProperty(value = "主键")
+    @ApiModelProperty(value = "开课学院id")
     @JsonSerialize(using = ToStringSerializer.class)
-    private Long id;
+    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;
@@ -36,6 +48,9 @@ public class TCStatistics extends BaseEntity implements Serializable {
     @JsonSerialize(using = ToStringSerializer.class)
     private Long clazzId;
 
+    @ApiModelProperty(value = "班级名称")
+    private String clazzName;
+
     @ApiModelProperty(value = "试卷编号")
     private String paperNumber;
 
@@ -43,24 +58,159 @@ public class TCStatistics extends BaseEntity implements Serializable {
     @JsonSerialize(using = ToStringSerializer.class)
     private Long printPlanId;
 
-    @ApiModelProperty(value = "总印份数")
-    private Integer printSum;
+    @ApiModelProperty(name = "考务数据明细id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    Long examDetailCourseId;
+
+    @ApiModelProperty(name = "命题任务明细id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    Long examTaskDetailId;
+
+    @ApiModelProperty(value = "批次号")
+    private String batchNo;
+
+    public TCStatistics() {
+
+    }
+
+    public TCStatistics(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 TCStatistics(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, TCStatistics t) {
+        this.paperNumber = t.getPaperNumber();
+        this.printPlanId = t.getPrintPlanId();
+        this.examDetailCourseId = t.getExamDetailCourseId();
+        this.examTaskDetailId = t.getExamTaskDetailId();
+        updateInfo(userId);
+    }
 
-    @ApiModelProperty(value = "完成状态,FINISH:已完成,UN_FINISH:未完成")
-    private StatisticsStatusEnum status;
+    public Long getCollegeId() {
+        return collegeId;
+    }
 
-    public static long getSerialVersionUID() {
-        return serialVersionUID;
+    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;
     }
 
-    @Override
-    public Long getId() {
-        return id;
+    public String getTeachingRoomName() {
+        return teachingRoomName;
     }
 
-    @Override
-    public void setId(Long id) {
-        this.id = id;
+    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() {
@@ -102,20 +252,4 @@ public class TCStatistics extends BaseEntity implements Serializable {
     public void setPrintPlanId(Long printPlanId) {
         this.printPlanId = printPlanId;
     }
-
-    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;
-    }
 }

+ 0 - 179
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TCStatisticsImportTemp.java

@@ -1,179 +0,0 @@
-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.contant.SystemConstant;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-
-import java.io.Serializable;
-
-/**
- * <p>
- * 命题导入临时数据表
- * </p>
- *
- * @author wangliang
- * @since 2021-09-10
- */
-@ApiModel(value = "TCStatisticsImportTemp对象", description = "命题导入临时数据表")
-public class TCStatisticsImportTemp implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    @ApiModelProperty(value = "主键")
-    @JsonSerialize(using = ToStringSerializer.class)
-    private Long id;
-
-    @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 batchNo;
-
-    public TCStatisticsImportTemp() {
-
-    }
-
-    public TCStatisticsImportTemp(Long collegeId,
-                                  String collegeName,
-                                  Long teachingRoomId,
-                                  String teachingRoomName,
-                                  String courseName,
-                                  String courseCode,
-                                  String teacherName,
-                                  Long clazzId,
-                                  String clazzName,
-                                  String batchNo) {
-        this.id = SystemConstant.getDbUuid();
-        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 static long getSerialVersionUID() {
-        return serialVersionUID;
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    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 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 getClazzName() {
-        return clazzName;
-    }
-
-    public void setClazzName(String clazzName) {
-        this.clazzName = clazzName;
-    }
-
-    public String getBatchNo() {
-        return batchNo;
-    }
-
-    public void setBatchNo(String batchNo) {
-        this.batchNo = batchNo;
-    }
-}

+ 0 - 16
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TCStatisticsImportTempMapper.java

@@ -1,16 +0,0 @@
-package com.qmth.distributed.print.business.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.qmth.distributed.print.business.entity.TCStatisticsImportTemp;
-
-/**
- * <p>
- * 命题导入临时数据表 Mapper 接口
- * </p>
- *
- * @author wangliang
- * @since 2021-09-10
- */
-public interface TCStatisticsImportTempMapper extends BaseMapper<TCStatisticsImportTemp> {
-
-}

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

@@ -1,7 +1,13 @@
 package com.qmth.distributed.print.business.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.qmth.distributed.print.business.bean.dto.TCStatisticsDto;
 import com.qmth.distributed.print.business.entity.TCStatistics;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -13,4 +19,32 @@ import com.qmth.distributed.print.business.entity.TCStatistics;
  */
 public interface TCStatisticsMapper extends BaseMapper<TCStatistics> {
 
+    /**
+     * 根据批次号查找印刷计划信息
+     *
+     * @param schoolId
+     * @param batchNo
+     * @return
+     */
+    public List<TCStatistics> findByBatchNo(@Param("schoolId") Long schoolId, @Param("batchNo") String batchNo);
+
+    /**
+     * 查找印刷计划信息
+     *
+     * @param iPage
+     * @param collegeName
+     * @param teachingRoomName
+     * @param status
+     * @param courseName
+     * @param teacherName
+     * @param schoolId
+     * @return
+     */
+    public IPage<TCStatisticsDto> list(IPage<Map> iPage,
+                                       @Param("collegeName") String collegeName,
+                                       @Param("teachingRoomName") String teachingRoomName,
+                                       @Param("status") String status,
+                                       @Param("courseName") String courseName,
+                                       @Param("teacherName") String teacherName,
+                                       @Param("schoolId") Long schoolId);
 }

+ 0 - 16
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TCStatisticsImportTempService.java

@@ -1,16 +0,0 @@
-package com.qmth.distributed.print.business.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.qmth.distributed.print.business.entity.TCStatisticsImportTemp;
-
-/**
- * <p>
- * 命题导入临时数据表 服务类
- * </p>
- *
- * @author wangliang
- * @since 2021-09-10
- */
-public interface TCStatisticsImportTempService extends IService<TCStatisticsImportTemp> {
-
-}

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

@@ -1,7 +1,13 @@
 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.enums.StatisticsStatusEnum;
+
+import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -13,4 +19,32 @@ import com.qmth.distributed.print.business.entity.TCStatistics;
  */
 public interface TCStatisticsService extends IService<TCStatistics> {
 
+    /**
+     * 根据批次号查找印刷计划信息
+     *
+     * @param schoolId
+     * @param batchNo
+     * @return
+     */
+    public List<TCStatistics> findByBatchNo(Long schoolId, String batchNo);
+
+    /**
+     * 查找印刷计划信息
+     *
+     * @param iPage
+     * @param collegeName
+     * @param teachingRoomName
+     * @param status
+     * @param courseName
+     * @param teacherName
+     * @param schoolId
+     * @return
+     */
+    public IPage<TCStatisticsDto> list(IPage<Map> iPage,
+                                             String collegeName,
+                                             String teachingRoomName,
+                                             StatisticsStatusEnum status,
+                                             String courseName,
+                                             String teacherName,
+                                             Long schoolId);
 }

+ 0 - 20
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TCStatisticsImportTempServiceImpl.java

@@ -1,20 +0,0 @@
-package com.qmth.distributed.print.business.service.impl;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.qmth.distributed.print.business.entity.TCStatisticsImportTemp;
-import com.qmth.distributed.print.business.mapper.TCStatisticsImportTempMapper;
-import com.qmth.distributed.print.business.service.TCStatisticsImportTempService;
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- * 命题导入临时数据表 服务实现类
- * </p>
- *
- * @author wangliang
- * @since 2021-09-10
- */
-@Service
-public class TCStatisticsImportTempServiceImpl extends ServiceImpl<TCStatisticsImportTempMapper, TCStatisticsImportTemp> implements TCStatisticsImportTempService {
-
-}

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

@@ -1,11 +1,19 @@
 package com.qmth.distributed.print.business.service.impl;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.distributed.print.business.bean.dto.TCStatisticsDto;
 import com.qmth.distributed.print.business.entity.TCStatistics;
+import com.qmth.distributed.print.business.enums.StatisticsStatusEnum;
 import com.qmth.distributed.print.business.mapper.TCStatisticsMapper;
 import com.qmth.distributed.print.business.service.TCStatisticsService;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
 /**
  * <p>
  * 命题统计表 服务实现类
@@ -17,4 +25,35 @@ import org.springframework.stereotype.Service;
 @Service
 public class TCStatisticsServiceImpl extends ServiceImpl<TCStatisticsMapper, TCStatistics> implements TCStatisticsService {
 
+    @Resource
+    TCStatisticsMapper tcStatisticsMapper;
+
+    /**
+     * 根据批次号查找印刷计划信息
+     *
+     * @param schoolId
+     * @param batchNo
+     * @return
+     */
+    @Override
+    public List<TCStatistics> findByBatchNo(Long schoolId, String batchNo) {
+        return tcStatisticsMapper.findByBatchNo(schoolId, batchNo);
+    }
+
+    /**
+     * 查找印刷计划信息
+     *
+     * @param iPage
+     * @param collegeName
+     * @param teachingRoomName
+     * @param status
+     * @param courseName
+     * @param teacherName
+     * @param schoolId
+     * @return
+     */
+    @Override
+    public IPage<TCStatisticsDto> list(IPage<Map> iPage, String collegeName, String teachingRoomName, StatisticsStatusEnum status, String courseName, String teacherName, Long schoolId) {
+        return tcStatisticsMapper.list(iPage, collegeName, teachingRoomName, Objects.nonNull(status) ? status.name() : null, courseName, teacherName, schoolId);
+    }
 }

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

@@ -37,7 +37,6 @@ import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-import org.checkerframework.checker.units.qual.K;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -152,9 +151,6 @@ public class TaskLogicServiceImpl implements TaskLogicService {
     @Resource
     SysOrgService sysOrgService;
 
-    @Resource
-    TCStatisticsImportTempService tcStatisticsImportTempService;
-
     @Resource
     TCStatisticsService tcStatisticsService;
 
@@ -1336,7 +1332,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
             Map<String, SysUser> userMap = new HashMap<>();//用户
             Map<String, BasicClazz> clazzMap = new HashMap<>();//班级
             String batchNo = SystemConstant.getUuid();
-            List<TCStatisticsImportTemp> tcStatisticsImportTempList = new ArrayList<>();
+            List<TCStatistics> tcStatisticsList = new ArrayList<>();
             for (int i = 0; i < finalExcelList.size(); i++) {
                 LinkedMultiValueMap<Integer, Object> excelMap = finalExcelList.get(i);
                 List<Object> statisticsTempList = excelMap.get(i);
@@ -1356,7 +1352,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                     }
                     BasicClazz basicClazz = this.validBasicClazzExists(clazzMap, statisticsImportDto.getClazzName(), sysUser.getSchoolId(), excelErrorTemp, (y + 1), (i + 1), "班级名称");
 
-                    TCStatisticsImportTemp tcStatisticsImportTemp = new TCStatisticsImportTemp(collegeOrg.getId(),
+                    TCStatistics tcStatistics = new TCStatistics(collegeOrg.getId(),
                             collegeOrg.getName(),
                             teachingRoomOrg.getId(),
                             teachingRoomOrg.getName(),
@@ -1365,15 +1361,27 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                             teacherName,
                             basicClazz.getId(),
                             basicClazz.getClazzName(),
-                            batchNo);
-                    tcStatisticsImportTempList.add(tcStatisticsImportTemp);
+                            batchNo,
+                            sysUser.getId());
+                    tcStatisticsList.add(tcStatistics);
                 }
             }
             if (excelErrorTemp.size() > 0) {
                 List<String> errors = excelErrorTemp.stream().map(m -> m.getExcelErrorType()).collect(Collectors.toList());
                 throw ExceptionResultEnum.ERROR.exception(JSONObject.toJSONString(errors));
             }
-            tcStatisticsImportTempService.saveBatch(tcStatisticsImportTempList);
+            tcStatisticsService.saveBatch(tcStatisticsList);
+            map.put("dataCount", tcStatisticsList.size());
+
+            List<TCStatistics> tcStatisticsTempList = tcStatisticsService.findByBatchNo(sysUser.getSchoolId(), batchNo);
+            for (TCStatistics tcStatistics : tcStatisticsTempList) {
+                for (TCStatistics t : tcStatisticsList) {
+                    if (t.getId().longValue() == tcStatistics.getId().longValue()) {
+                        t.updateInfo(sysUser.getId(), tcStatistics);
+                    }
+                }
+            }
+            tcStatisticsService.saveOrUpdateBatch(tcStatisticsList);
             return finalExcelList;
         });
         return map;

+ 0 - 5
distributed-print-business/src/main/resources/mapper/TCStatisticsImportTempMapper.xml

@@ -1,5 +0,0 @@
-<?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.TCStatisticsImportTempMapper">
-
-</mapper>

+ 119 - 0
distributed-print-business/src/main/resources/mapper/TCStatisticsMapper.xml

@@ -2,4 +2,123 @@
 <!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
+        tcs.id,
+        epp.id as printPlanId,
+        edc.id as examDetailCourseId,
+        etd.id as examTaskDetailId,
+        et.paper_number as paperNumber
+        from
+        t_c_statistics tcs
+        join exam_task et on
+        et.course_code = tcs.course_code
+        and et.course_name = tcs.course_name
+        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.course_name = tcs.course_name
+        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 tcs.batch_no = #{batchNo}
+            </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
+        from
+            (
+            select
+                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,
+                et.paper_number as paperNumber,
+                tcs.print_plan_id as printPlanId,
+                epp.name as printPlanName,
+                IFNULL(etd.draw_count,0) as drawCount,
+                IFNULL(epp.backup_count,0) as backupCount,
+                (
+                select
+                    count(1)
+                from
+                    exam_student es
+                where
+                    es.exam_detail_course_id = edc.id
+                    and es.clazz_id = tcs.clazz_id
+                    and es.school_id = 2) 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.course_name = tcs.course_name
+                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.course_name = tcs.course_name
+                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
+                et.enable = true
+                and etd.enable = true
+                and et.school_id = #{schoolId}) t
+                <where>
+                    <if test="collegeName != null and collegeName != ''">
+                        and t.collegeName like concat('%',#{collegeName},'%')
+                    </if>
+                    <if test="teachingRoomName != null and teachingRoomName != ''">
+                        and t.teachingRoomName like concat('%',#{teachingRoomName},'%')
+                    </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>
+    </select>
 </mapper>

+ 6 - 2
distributed-print/src/main/java/com/qmth/distributed/print/api/TCStatisticsController.java

@@ -1,5 +1,6 @@
 package com.qmth.distributed.print.api;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.qmth.boot.api.annotation.Aac;
 import com.qmth.boot.api.annotation.BOOL;
 import com.qmth.boot.api.constant.ApiConstant;
@@ -10,10 +11,12 @@ import com.qmth.distributed.print.business.service.PrintCommonService;
 import com.qmth.distributed.print.business.service.TCStatisticsService;
 import com.qmth.distributed.print.business.templete.execute.AsyncStatisticsDataImportService;
 import com.qmth.teachcloud.common.contant.SystemConstant;
+import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.entity.TBTask;
 import com.qmth.teachcloud.common.enums.TaskTypeEnum;
 import com.qmth.teachcloud.common.util.Result;
 import com.qmth.teachcloud.common.util.ResultUtil;
+import com.qmth.teachcloud.common.util.ServletUtil;
 import io.swagger.annotations.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -38,7 +41,7 @@ import java.util.Objects;
 @Api(tags = "命题统计Controller")
 @RestController
 @RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/${prefix.url.statistics}")
-@Aac(auth = BOOL.FALSE, strict = BOOL.FALSE)
+//@Aac(auth = BOOL.FALSE, strict = BOOL.FALSE)
 public class TCStatisticsController {
     private final static Logger log = LoggerFactory.getLogger(TCStatisticsController.class);
 
@@ -71,6 +74,7 @@ public class TCStatisticsController {
                        @ApiParam(value = "任课老师名称", required = false) @RequestParam(required = false) String teacherName,
                        @ApiParam(value = "页码", required = true) @RequestParam Integer pageNumber,
                        @ApiParam(value = "数量", required = true) @RequestParam Integer pageSize) {
-        return ResultUtil.ok();
+        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+        return ResultUtil.ok(tcStatisticsService.list(new Page<>(pageNumber, pageSize), collegeName, teachingRoomName, status, courseName, teacherName, sysUser.getSchoolId()));
     }
 }