浏览代码

Merge remote-tracking branch 'origin/dev_v3.3.1' into dev_v3.3.1

xiaofei 1 年之前
父节点
当前提交
bc9e3a42be
共有 34 个文件被更改,包括 1164 次插入957 次删除
  1. 11 11
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TCFinalScore.java
  2. 2 2
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TCPaperStruct.java
  3. 17 17
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TCUsualScore.java
  4. 30 30
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TRBasicInfo.java
  5. 10 10
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TRExamStudent.java
  6. 30 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TCFinalScoreMapper.java
  7. 2 2
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TCPaperStructMapper.java
  8. 0 16
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TCScoreEndExamMapper.java
  9. 0 31
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TCScoreNormalMapper.java
  10. 43 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TCUsualScoreMapper.java
  11. 35 2
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/PrintCommonService.java
  12. 44 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TCFinalScoreService.java
  13. 2 2
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TCPaperStructService.java
  14. 0 16
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TCScoreEndExamService.java
  15. 0 56
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TCScoreNormalService.java
  16. 43 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TCUsualScoreService.java
  17. 158 13
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/PrintCommonServiceImpl.java
  18. 169 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TCFinalScoreServiceImpl.java
  19. 0 20
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TCPaperPositiveServiceImpl.java
  20. 20 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TCPaperStructServiceImpl.java
  21. 0 20
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TCScoreEndExamServiceImpl.java
  22. 0 182
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TCScoreNormalServiceImpl.java
  23. 164 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TCUsualScoreServiceImpl.java
  24. 20 0
      distributed-print-business/src/main/resources/mapper/TCFinalScoreMapper.xml
  25. 0 5
      distributed-print-business/src/main/resources/mapper/TCPaperPositiveMapper.xml
  26. 1 1
      distributed-print-business/src/main/resources/mapper/TCPaperStructMapper.xml
  27. 0 30
      distributed-print-business/src/main/resources/mapper/TCScoreNormalMapper.xml
  28. 54 0
      distributed-print-business/src/main/resources/mapper/TCUsualScoreMapper.xml
  29. 29 29
      distributed-print/install/mysql/upgrade/3.3.1.sql
  30. 147 0
      distributed-print/src/main/java/com/qmth/distributed/print/api/TCFinalScoreController.java
  31. 0 234
      distributed-print/src/main/java/com/qmth/distributed/print/api/TCScoreEndExamController.java
  32. 0 223
      distributed-print/src/main/java/com/qmth/distributed/print/api/TCScoreNormalController.java
  33. 129 0
      distributed-print/src/main/java/com/qmth/distributed/print/api/TCUsualScoreController.java
  34. 4 5
      distributed-print/src/main/java/com/qmth/distributed/print/api/TRBasicInfoController.java

+ 11 - 11
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TCScoreEndExam.java → distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TCFinalScore.java

@@ -16,8 +16,8 @@ import java.io.Serializable;
  * @author wangliang
  * @since 2024-02-18
  */
-@ApiModel(value = "TCScoreEndExam对象", description = "期末考试成绩表")
-public class TCScoreEndExam implements Serializable {
+@ApiModel(value = "TCFinalScore对象", description = "期末考试成绩表")
+public class TCFinalScore implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
@@ -42,7 +42,7 @@ public class TCScoreEndExam implements Serializable {
     private String name;
 
     @ApiModelProperty(value = "学号")
-    private String examNumber;
+    private String studentCode;
 
     @ApiModelProperty(value = "分数")
     private Double score;
@@ -67,11 +67,11 @@ public class TCScoreEndExam implements Serializable {
     @ApiModelProperty(value = "更新时间")
     private Long updateTime;
 
-    public TCScoreEndExam() {
+    public TCFinalScore() {
 
     }
 
-    public TCScoreEndExam(Long examId, String courseCode, String courseName, String paperNumber, Long userId) {
+    public TCFinalScore(Long examId, String courseCode, String courseName, String paperNumber, Long userId) {
         this.id = SystemConstant.getDbUuid();
         this.examId = examId;
         this.courseCode = courseCode;
@@ -82,14 +82,14 @@ public class TCScoreEndExam implements Serializable {
         this.createTime = System.currentTimeMillis();
     }
 
-    public TCScoreEndExam(Long examId, String courseCode, String courseName, String paperNumber, String name, String examNumber, Double score, String scoreDetail, Long userId) {
+    public TCFinalScore(Long examId, String courseCode, String courseName, String paperNumber, String name, String studentCode, Double score, String scoreDetail, Long userId) {
         this.id = SystemConstant.getDbUuid();
         this.examId = examId;
         this.courseCode = courseCode;
         this.courseName = courseName;
         this.paperNumber = paperNumber;
         this.name = name;
-        this.examNumber = examNumber;
+        this.studentCode = studentCode;
         this.score = score;
         this.scoreDetail = scoreDetail;
         this.enable = true;
@@ -145,12 +145,12 @@ public class TCScoreEndExam implements Serializable {
         this.name = name;
     }
 
-    public String getExamNumber() {
-        return examNumber;
+    public String getStudentCode() {
+        return studentCode;
     }
 
-    public void setExamNumber(String examNumber) {
-        this.examNumber = examNumber;
+    public void setStudentCode(String studentCode) {
+        this.studentCode = studentCode;
     }
 
     public Double getScore() {

+ 2 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TCPaperPositive.java → distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TCPaperStruct.java

@@ -15,8 +15,8 @@ import java.io.Serializable;
  * @author wangliang
  * @since 2024-02-18
  */
-@ApiModel(value = "TCPaperPositive对象", description = "试卷蓝图表")
-public class TCPaperPositive implements Serializable {
+@ApiModel(value = "TCPaperStruct对象", description = "试卷蓝图表")
+public class TCPaperStruct implements Serializable {
 
     private static final long serialVersionUID = 1L;
 

+ 17 - 17
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TCScoreNormal.java → distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TCUsualScore.java

@@ -16,8 +16,8 @@ import java.io.Serializable;
  * @author wangliang
  * @since 2024-02-18
  */
-@ApiModel(value = "TCScoreNormal对象", description = "平常作业成绩表")
-public class TCScoreNormal implements Serializable {
+@ApiModel(value = "TCUsualScore对象", description = "平常作业成绩表")
+public class TCUsualScore implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
@@ -42,10 +42,10 @@ public class TCScoreNormal implements Serializable {
     private String name;
 
     @ApiModelProperty(value = "学号")
-    private String examNumber;
+    private String studentCode;
 
     @ApiModelProperty(value = "平常作业分数")
-    private String scoreNormal;
+    private String score;
 
     @ApiModelProperty(value = "是否启用,0:停用,1:启用")
     private Boolean enable;
@@ -64,11 +64,11 @@ public class TCScoreNormal implements Serializable {
     @ApiModelProperty(value = "更新时间")
     private Long updateTime;
 
-    public TCScoreNormal() {
+    public TCUsualScore() {
 
     }
 
-    public TCScoreNormal(Long examId, String courseCode, String courseName, String paperNumber, Long userId) {
+    public TCUsualScore(Long examId, String courseCode, String courseName, String paperNumber, Long userId) {
         this.id = SystemConstant.getDbUuid();
         this.examId = examId;
         this.courseCode = courseCode;
@@ -79,15 +79,15 @@ public class TCScoreNormal implements Serializable {
         this.createTime = System.currentTimeMillis();
     }
 
-    public TCScoreNormal(Long examId, String courseCode, String courseName, String paperNumber, String name, String examNumber, String scoreNormal, Long userId) {
+    public TCUsualScore(Long examId, String courseCode, String courseName, String paperNumber, String name, String studentCode, String score, Long userId) {
         this.id = SystemConstant.getDbUuid();
         this.examId = examId;
         this.courseCode = courseCode;
         this.courseName = courseName;
         this.paperNumber = paperNumber;
         this.name = name;
-        this.examNumber = examNumber;
-        this.scoreNormal = scoreNormal;
+        this.studentCode = studentCode;
+        this.score = score;
         this.enable = true;
         this.createId = userId;
         this.createTime = System.currentTimeMillis();
@@ -141,20 +141,20 @@ public class TCScoreNormal implements Serializable {
         this.name = name;
     }
 
-    public String getExamNumber() {
-        return examNumber;
+    public String getStudentCode() {
+        return studentCode;
     }
 
-    public void setExamNumber(String examNumber) {
-        this.examNumber = examNumber;
+    public void setStudentCode(String studentCode) {
+        this.studentCode = studentCode;
     }
 
-    public String getScoreNormal() {
-        return scoreNormal;
+    public String getScore() {
+        return score;
     }
 
-    public void setScoreNormal(String scoreNormal) {
-        this.scoreNormal = scoreNormal;
+    public void setScore(String score) {
+        this.score = score;
     }
 
     public Boolean getEnable() {

+ 30 - 30
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TRBasicInfo.java

@@ -15,7 +15,7 @@ import java.io.Serializable;
  * @author wangliang
  * @since 2024-02-18
  */
-@ApiModel(value="TRBasicInfo对象", description="报告基本情况表")
+@ApiModel(value = "TRBasicInfo对象", description = "报告基本情况表")
 public class TRBasicInfo implements Serializable {
 
     private static final long serialVersionUID = 1L;
@@ -50,22 +50,22 @@ public class TRBasicInfo implements Serializable {
     private String teachingObject;
 
     @ApiModelProperty(value = "选课人数")
-    private Integer numberOfSelect;
+    private Integer selectionCount;
 
     @ApiModelProperty(value = "参评人数")
-    private Integer numberOfParticipants;
+    private Integer participantCount;
 
     @ApiModelProperty(value = "课程目标达成度期望值")
     private Double courseDegree;
 
     @ApiModelProperty(value = "任课老师")
-    private String teach;
+    private String teacher;
 
     @ApiModelProperty(value = "评价责任人")
-    private String appraiseDutyUser;
+    private String director;
 
     @ApiModelProperty(value = "评价参与人")
-    private String appraisePartakeUser;
+    private String participant;
 
     @ApiModelProperty(value = "是否启用,0:停用,1:启用")
     private Boolean enable;
@@ -165,52 +165,52 @@ public class TRBasicInfo implements Serializable {
         this.teachingObject = teachingObject;
     }
 
-    public Integer getNumberOfSelect() {
-        return numberOfSelect;
+    public Double getCourseDegree() {
+        return courseDegree;
     }
 
-    public void setNumberOfSelect(Integer numberOfSelect) {
-        this.numberOfSelect = numberOfSelect;
+    public void setCourseDegree(Double courseDegree) {
+        this.courseDegree = courseDegree;
     }
 
-    public Integer getNumberOfParticipants() {
-        return numberOfParticipants;
+    public Integer getSelectionCount() {
+        return selectionCount;
     }
 
-    public void setNumberOfParticipants(Integer numberOfParticipants) {
-        this.numberOfParticipants = numberOfParticipants;
+    public void setSelectionCount(Integer selectionCount) {
+        this.selectionCount = selectionCount;
     }
 
-    public Double getCourseDegree() {
-        return courseDegree;
+    public Integer getParticipantCount() {
+        return participantCount;
     }
 
-    public void setCourseDegree(Double courseDegree) {
-        this.courseDegree = courseDegree;
+    public void setParticipantCount(Integer participantCount) {
+        this.participantCount = participantCount;
     }
 
-    public String getTeach() {
-        return teach;
+    public String getTeacher() {
+        return teacher;
     }
 
-    public void setTeach(String teach) {
-        this.teach = teach;
+    public void setTeacher(String teacher) {
+        this.teacher = teacher;
     }
 
-    public String getAppraiseDutyUser() {
-        return appraiseDutyUser;
+    public String getDirector() {
+        return director;
     }
 
-    public void setAppraiseDutyUser(String appraiseDutyUser) {
-        this.appraiseDutyUser = appraiseDutyUser;
+    public void setDirector(String director) {
+        this.director = director;
     }
 
-    public String getAppraisePartakeUser() {
-        return appraisePartakeUser;
+    public String getParticipant() {
+        return participant;
     }
 
-    public void setAppraisePartakeUser(String appraisePartakeUser) {
-        this.appraisePartakeUser = appraisePartakeUser;
+    public void setParticipant(String participant) {
+        this.participant = participant;
     }
 
     public Boolean getEnable() {

+ 10 - 10
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TRExamStudent.java

@@ -32,10 +32,10 @@ public class TRExamStudent implements Serializable {
     private String name;
 
     @ApiModelProperty(value = "学号")
-    private String examNumber;
+    private String studentCode;
 
     @ApiModelProperty(value = "行政班级")
-    private String clazz;
+    private String administrativeClass;
 
     @ApiModelProperty(value = "学生成绩")
     private Double score;
@@ -75,20 +75,20 @@ public class TRExamStudent implements Serializable {
         this.name = name;
     }
 
-    public String getExamNumber() {
-        return examNumber;
+    public String getStudentCode() {
+        return studentCode;
     }
 
-    public void setExamNumber(String examNumber) {
-        this.examNumber = examNumber;
+    public void setStudentCode(String studentCode) {
+        this.studentCode = studentCode;
     }
 
-    public String getClazz() {
-        return clazz;
+    public String getAdministrativeClass() {
+        return administrativeClass;
     }
 
-    public void setClazz(String clazz) {
-        this.clazz = clazz;
+    public void setAdministrativeClass(String administrativeClass) {
+        this.administrativeClass = administrativeClass;
     }
 
     public String getResultDetail() {

+ 30 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TCFinalScoreMapper.java

@@ -0,0 +1,30 @@
+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.entity.TCFinalScore;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 期末考试成绩表 Mapper 接口
+ * </p>
+ *
+ * @author wangliang
+ * @since 2024-02-18
+ */
+public interface TCFinalScoreMapper extends BaseMapper<TCFinalScore> {
+
+    /**
+     * 期末成绩列表(分页)
+     *
+     * @param iPage
+     * @param examId
+     * @param courseCode
+     * @param paperNumber
+     * @return
+     */
+    public IPage<TCFinalScore> finalScoreList(IPage<Map> iPage, @Param("examId") Long examId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber);
+}

+ 2 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TCPaperPositiveMapper.java → distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TCPaperStructMapper.java

@@ -1,6 +1,6 @@
 package com.qmth.distributed.print.business.mapper;
 
-import com.qmth.distributed.print.business.entity.TCPaperPositive;
+import com.qmth.distributed.print.business.entity.TCPaperStruct;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
 /**
@@ -11,6 +11,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * @author wangliang
  * @since 2024-02-18
  */
-public interface TCPaperPositiveMapper extends BaseMapper<TCPaperPositive> {
+public interface TCPaperStructMapper extends BaseMapper<TCPaperStruct> {
 
 }

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

@@ -1,16 +0,0 @@
-package com.qmth.distributed.print.business.mapper;
-
-import com.qmth.distributed.print.business.entity.TCScoreEndExam;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-/**
- * <p>
- * 期末考试成绩表 Mapper 接口
- * </p>
- *
- * @author wangliang
- * @since 2024-02-18
- */
-public interface TCScoreEndExamMapper extends BaseMapper<TCScoreEndExam> {
-
-}

+ 0 - 31
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TCScoreNormalMapper.java

@@ -1,31 +0,0 @@
-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.result.ScoreResult;
-import com.qmth.distributed.print.business.entity.TCScoreNormal;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.Map;
-
-/**
- * <p>
- * 平常作业成绩表 Mapper 接口
- * </p>
- *
- * @author wangliang
- * @since 2024-02-18
- */
-public interface TCScoreNormalMapper extends BaseMapper<TCScoreNormal> {
-
-    /**
-     * 成绩管理列表
-     *
-     * @param iPage
-     * @param semesterId
-     * @param examId
-     * @param courseCode
-     * @return
-     */
-    public IPage<ScoreResult> scoreList(IPage<Map> iPage, @Param("semesterId") Long semesterId, @Param("examId") Long examId, @Param("courseCode") String courseCode);
-}

+ 43 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TCUsualScoreMapper.java

@@ -0,0 +1,43 @@
+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.result.ScoreResult;
+import com.qmth.distributed.print.business.entity.TCUsualScore;
+import com.qmth.teachcloud.common.bean.dto.DataPermissionRule;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 平常作业成绩表 Mapper 接口
+ * </p>
+ *
+ * @author wangliang
+ * @since 2024-02-18
+ */
+public interface TCUsualScoreMapper extends BaseMapper<TCUsualScore> {
+
+    /**
+     * 成绩管理列表
+     *
+     * @param iPage
+     * @param examId
+     * @param courseCode
+     * @param dpr
+     * @return
+     */
+    public IPage<ScoreResult> scoreList(IPage<Map> iPage, @Param("examId") Long examId, @Param("courseCode") String courseCode, @Param("dpr") DataPermissionRule dpr);
+
+    /**
+     * 平时成绩列表(分页)
+     *
+     * @param iPage
+     * @param examId
+     * @param courseCode
+     * @param paperNumber
+     * @return
+     */
+    public IPage<TCUsualScore> usualScoreList(IPage<Map> iPage, @Param("examId") Long examId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber);
+}

+ 35 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/PrintCommonService.java

@@ -1,14 +1,14 @@
 package com.qmth.distributed.print.business.service;
 
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.itextpdf.text.DocumentException;
 import com.qmth.distributed.print.business.bean.createPdf.PrintPathVo;
 import com.qmth.distributed.print.business.bean.dto.PdfDto;
 import com.qmth.distributed.print.business.bean.dto.PdfPackageDto;
 import com.qmth.distributed.print.business.bean.dto.PdfSignDto;
+import com.qmth.distributed.print.business.bean.excel.ExcelField;
 import com.qmth.distributed.print.business.bean.params.ExamTaskStudentObjectParam;
-import com.qmth.distributed.print.business.bean.params.SerialNumberParams;
+import com.qmth.distributed.print.business.bean.result.ScoreResult;
 import com.qmth.distributed.print.business.entity.BasicTemplate;
 import com.qmth.distributed.print.business.entity.ExamDetail;
 import com.qmth.distributed.print.business.entity.ExamStudent;
@@ -20,6 +20,7 @@ import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.ClassifyEnum;
 import com.qmth.teachcloud.common.enums.TaskTypeEnum;
 import com.qmth.teachcloud.common.enums.UploadFileEnum;
+import com.qmth.teachcloud.mark.entity.MarkPaper;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -228,6 +229,7 @@ public interface PrintCommonService {
     void checkDataNew(Long schoolId, Long examId, String courseCode, String paperNumber, SysUser user) throws IOException;
 
     void checkDataMakeup(Long schoolId, ExamDetail examDetail, String courseCode, String paperNumber, SysUser user);
+
     /**
      * 根据学生集合创建考生考务数据
      *
@@ -273,4 +275,35 @@ public interface PrintCommonService {
     void saveAttachmentPackagePdf(PdfPackageDto pdfPackageDto, ExamDetail examDetail,Integer printCount);
 
     String parseAttachmentPath(String attachmentPath, PrintPathVo printPathVo);
+
+    /**
+     * 成绩管理导入excel校验
+     *
+     * @param file
+     * @param examId
+     * @param paperNumber
+     * @return
+     */
+    public MarkPaper scoreImportExcelVaild(MultipartFile file, Long examId, String paperNumber) throws IOException;
+
+    /**
+     * 成绩管理动态生成excel
+     *
+     * @param describe
+     * @param sheetName
+     * @param fileName
+     * @param excelFieldList
+     * @throws IOException
+     */
+    public void scoreDownLoadExaminationTemplate(String describe, String sheetName, String fileName, List<ExcelField> excelFieldList) throws IOException;
+
+    /**
+     * 成绩管理列表
+     *
+     * @param iPage
+     * @param examId
+     * @param courseCode
+     * @return
+     */
+    public IPage<ScoreResult> scoreList(IPage<Map> iPage, Long examId, String courseCode);
 }

+ 44 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TCFinalScoreService.java

@@ -0,0 +1,44 @@
+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.entity.TCFinalScore;
+import com.qmth.distributed.print.business.entity.TCUsualScore;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * <p>
+ * 期末考试成绩表 服务类
+ * </p>
+ *
+ * @author wangliang
+ * @since 2024-02-18
+ */
+public interface TCFinalScoreService extends IService<TCFinalScore> {
+
+    /**
+     * 导入期末成绩excel
+     *
+     * @param file
+     * @param examId
+     * @param courseCode
+     * @param paperNumber
+     * @return
+     * @throws IOException
+     */
+    public Map<String, String> finalScoreExcelImport(MultipartFile file, Long examId, String courseCode, String paperNumber) throws IOException;
+
+    /**
+     * 期末成绩列表(分页)
+     *
+     * @param iPage
+     * @param examId
+     * @param courseCode
+     * @param paperNumber
+     * @return
+     */
+    public IPage<TCFinalScore> finalScoreList(IPage<Map> iPage, Long examId, String courseCode, String paperNumber);
+}

+ 2 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TCPaperPositiveService.java → distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TCPaperStructService.java

@@ -1,6 +1,6 @@
 package com.qmth.distributed.print.business.service;
 
-import com.qmth.distributed.print.business.entity.TCPaperPositive;
+import com.qmth.distributed.print.business.entity.TCPaperStruct;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 /**
@@ -11,6 +11,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * @author wangliang
  * @since 2024-02-18
  */
-public interface TCPaperPositiveService extends IService<TCPaperPositive> {
+public interface TCPaperStructService extends IService<TCPaperStruct> {
 
 }

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

@@ -1,16 +0,0 @@
-package com.qmth.distributed.print.business.service;
-
-import com.qmth.distributed.print.business.entity.TCScoreEndExam;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-/**
- * <p>
- * 期末考试成绩表 服务类
- * </p>
- *
- * @author wangliang
- * @since 2024-02-18
- */
-public interface TCScoreEndExamService extends IService<TCScoreEndExam> {
-
-}

+ 0 - 56
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TCScoreNormalService.java

@@ -1,56 +0,0 @@
-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.excel.ExcelField;
-import com.qmth.distributed.print.business.bean.result.ScoreResult;
-import com.qmth.distributed.print.business.entity.TCScoreNormal;
-import com.qmth.teachcloud.mark.entity.MarkPaper;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-
-/**
- * <p>
- * 平常作业成绩表 服务类
- * </p>
- *
- * @author wangliang
- * @since 2024-02-18
- */
-public interface TCScoreNormalService extends IService<TCScoreNormal> {
-
-    /**
-     * 成绩管理列表
-     *
-     * @param iPage
-     * @param semesterId
-     * @param examId
-     * @param courseCode
-     * @return
-     */
-    public IPage<ScoreResult> scoreList(IPage<Map> iPage, Long semesterId, Long examId, String courseCode);
-
-    /**
-     * 动态生成excel
-     *
-     * @param describe
-     * @param sheetName
-     * @param fileName
-     * @param excelFieldList
-     * @throws IOException
-     */
-    void downLoadExaminationTemplate(String describe, String sheetName, String fileName, List<ExcelField> excelFieldList) throws IOException;
-
-    /**
-     * 导入excel校验
-     *
-     * @param file
-     * @param examId
-     * @param paperNumber
-     * @return
-     */
-    public MarkPaper importExcelVaild(MultipartFile file, Long examId, String paperNumber) throws IOException;
-}

+ 43 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TCUsualScoreService.java

@@ -0,0 +1,43 @@
+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.entity.TCUsualScore;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * <p>
+ * 平常作业成绩表 服务类
+ * </p>
+ *
+ * @author wangliang
+ * @since 2024-02-18
+ */
+public interface TCUsualScoreService extends IService<TCUsualScore> {
+
+    /**
+     * 导入平时成绩excel
+     *
+     * @param file
+     * @param examId
+     * @param courseCode
+     * @param paperNumber
+     * @return
+     * @throws IOException
+     */
+    public Map<String, String> usualScoreExcelImport(MultipartFile file, Long examId, String courseCode, String paperNumber) throws IOException;
+
+    /**
+     * 平时成绩列表(分页)
+     *
+     * @param iPage
+     * @param examId
+     * @param courseCode
+     * @param paperNumber
+     * @return
+     */
+    public IPage<TCUsualScore> usualScoreList(IPage<Map> iPage, Long examId, String courseCode, String paperNumber);
+}

+ 158 - 13
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/PrintCommonServiceImpl.java

@@ -15,14 +15,18 @@ import com.qmth.distributed.print.business.bean.createPdf.PrintPathVo;
 import com.qmth.distributed.print.business.bean.dto.PdfDto;
 import com.qmth.distributed.print.business.bean.dto.PdfPackageDto;
 import com.qmth.distributed.print.business.bean.dto.PdfSignDto;
+import com.qmth.distributed.print.business.bean.excel.ExcelField;
 import com.qmth.distributed.print.business.bean.params.ExamTaskStudentObjectParam;
+import com.qmth.distributed.print.business.bean.result.ScoreResult;
 import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.enums.ExamDetailStatusEnum;
 import com.qmth.distributed.print.business.enums.PrintPlanStatusEnum;
 import com.qmth.distributed.print.business.enums.StudentClazzEnum;
+import com.qmth.distributed.print.business.mapper.TCUsualScoreMapper;
 import com.qmth.distributed.print.business.service.*;
 import com.qmth.distributed.print.business.util.CreatePrintPdfUtil;
 import com.qmth.distributed.print.business.util.PdfUtil;
+import com.qmth.teachcloud.common.bean.dto.DataPermissionRule;
 import com.qmth.teachcloud.common.bean.dto.MqDto;
 import com.qmth.teachcloud.common.bean.params.ArraysParams;
 import com.qmth.teachcloud.common.bean.result.BasicStudentResult;
@@ -36,10 +40,18 @@ import com.qmth.teachcloud.common.enums.*;
 import com.qmth.teachcloud.common.mapper.BasicCourseMapper;
 import com.qmth.teachcloud.common.service.*;
 import com.qmth.teachcloud.common.util.*;
+import com.qmth.teachcloud.mark.entity.MarkPaper;
+import com.qmth.teachcloud.mark.service.MarkPaperService;
 import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.io.FilenameUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.usermodel.FillPatternType;
+import org.apache.poi.ss.usermodel.Font;
+import org.apache.poi.ss.usermodel.HorizontalAlignment;
+import org.apache.poi.ss.usermodel.IndexedColors;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.context.annotation.Lazy;
@@ -49,13 +61,14 @@ import org.springframework.util.FileCopyUtils;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
 import java.io.*;
 import java.math.BigDecimal;
+import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
 import java.util.stream.Collectors;
 
 /**
@@ -69,8 +82,6 @@ import java.util.stream.Collectors;
 public class PrintCommonServiceImpl implements PrintCommonService {
     private final static Logger log = LoggerFactory.getLogger(PrintCommonServiceImpl.class);
 
-    Lock lock = new ReentrantLock();
-
     @Resource
     private DictionaryConfig dictionaryConfig;
 
@@ -105,9 +116,6 @@ public class PrintCommonServiceImpl implements PrintCommonService {
     @Lazy
     ExamDetailService examDetailService;
 
-    @Resource
-    private ConvertUtil convertUtil;
-
     @Resource
     @Lazy
     ExamTaskDetailService examTaskDetailService;
@@ -127,15 +135,9 @@ public class PrintCommonServiceImpl implements PrintCommonService {
     @Resource
     TeachcloudCommonService teachcloudCommonService;
 
-    @Resource
-    ExamStudentService examStudentService;
-
     @Resource
     RedisUtil redisUtil;
 
-    @Resource
-    BasicCardRuleService basicCardRuleService;
-
     @Resource
     BasicExamService basicExamService;
 
@@ -163,6 +165,15 @@ public class PrintCommonServiceImpl implements PrintCommonService {
     @Resource
     RedisCounterUtil redisCounterUtil;
 
+    @Resource
+    MarkPaperService markPaperService;
+
+    @Resource
+    TCUsualScoreMapper tcUsualScoreMapper;
+
+    @Resource
+    BasicRoleDataPermissionService basicRoleDataPermissionService;
+
     /**
      * 保存附件
      *
@@ -379,6 +390,140 @@ public class PrintCommonServiceImpl implements PrintCommonService {
         return jsonObject.toJSONString();
     }
 
+    /**
+     * 成绩管理导入excel校验
+     *
+     * @param file
+     * @param examId
+     * @param paperNumber
+     * @return
+     */
+    @Override
+    public MarkPaper scoreImportExcelVaild(MultipartFile file, Long examId, String paperNumber) throws IOException {
+        String reqFileMd5 = ServletUtil.getRequestMd5();
+        String fileMd5 = DigestUtils.md5Hex(file.getBytes());
+        if (!Objects.equals(fileMd5, reqFileMd5)) {
+            throw ExceptionResultEnum.MD5_EQUALS_FALSE.exception();
+        }
+        MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, paperNumber);
+        Objects.requireNonNull(markPaper, "未找到科目信息");
+        return markPaper;
+    }
+
+    /**
+     * 成绩管理动态生成excel
+     *
+     * @param describe
+     * @param sheetName
+     * @param fileName
+     * @param excelFieldList
+     * @throws IOException
+     */
+    @Override
+    public void scoreDownLoadExaminationTemplate(String describe, String sheetName, String fileName, List<ExcelField> excelFieldList) throws IOException {
+        HttpServletResponse response = ServletUtil.getResponse();
+        log.debug("导出Excel开始...");
+        XSSFWorkbook wb = new XSSFWorkbook();
+        response.setHeader("Content-Disposition", "inline;filename=" + URLEncoder.encode(fileName, SystemConstant.CHARSET_NAME) + ExcelUtil.DEFALUT_EXT);
+        response.setContentType(ExcelUtil.DEFALUT_CONTENT_TYPE);
+        XSSFSheet sheet = wb.createSheet(sheetName);
+
+        Font headFont = wb.createFont();
+        headFont.setFontHeightInPoints((short) 12);
+        headFont.setFontName("宋体");
+        headFont.setBold(true);
+
+        Font defaultFont = wb.createFont();
+        defaultFont.setFontHeightInPoints((short) 12);
+        defaultFont.setFontName("宋体");
+
+        Font describeFont = wb.createFont();
+        describeFont.setFontHeightInPoints((short) 12);
+        describeFont.setFontName("宋体");
+        describeFont.setColor(IndexedColors.RED.getIndex());
+
+        int cellCount = excelFieldList.size();
+        // 说明
+        XSSFCellStyle describeStyle = wb.createCellStyle();
+        describeStyle.setAlignment(HorizontalAlignment.LEFT);
+        describeStyle.setFont(describeFont);
+        describe = describe.trim();
+        XSSFRow rowDescribe = sheet.createRow(0);
+        rowDescribe.setHeightInPoints(195); //行高设置成195px
+        for (int i = 0; i < cellCount; i++) {
+            XSSFCell cell = rowDescribe.createCell(i);
+            if (i == 0) {
+                cell.setCellValue(describe);
+                cell.setCellStyle(describeStyle);
+            }
+        }
+        CellRangeAddress region = new CellRangeAddress(0, 0, 0, cellCount - 1);
+        sheet.addMergedRegion(region);
+
+        // 表头行
+        XSSFCellStyle headerStyle = wb.createCellStyle();
+        headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+        headerStyle.setAlignment(HorizontalAlignment.CENTER);
+        headerStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
+        headerStyle.setFont(headFont);
+        XSSFRow rowHead = sheet.createRow(1);
+        for (int i = 0; i < excelFieldList.size(); i++) {
+            XSSFCell cell = rowHead.createCell(i);
+            cell.setCellValue(excelFieldList.get(i).getName());
+            cell.setCellStyle(headerStyle);
+            if (excelFieldList.get(i).getComment()) {
+                // 前四个参数是坐标点,后四个参数是编辑和显示批注时的大小.
+                XSSFDrawing p = sheet.createDrawingPatriarch();
+                XSSFComment comment = p.createCellComment(new XSSFClientAnchor(0, 0, 0, 0, (short) 3, 3, (short) 5, 6));
+                // 输入批注信息
+                comment.setString(new XSSFRichTextString("必填"));
+                cell.setCellComment(comment);
+            }
+        }
+
+        // 样例行
+        XSSFCellStyle exampleStyle = wb.createCellStyle();
+        exampleStyle.setAlignment(HorizontalAlignment.LEFT);
+        exampleStyle.setFont(defaultFont);
+        XSSFRow rowExample = sheet.createRow(2);
+        for (int i = 0; i < excelFieldList.size(); i++) {
+            XSSFCell cell = rowExample.createCell(i);
+            if (excelFieldList.get(i).getCode().startsWith("score")) {
+                cell.setCellValue(new Random().nextInt(100) + 1);
+            } else if (excelFieldList.get(i).getCode().startsWith("key")) {
+                cell.setCellValue(new Random().nextInt(10) + 1);
+            } else {
+                cell.setCellValue(excelFieldList.get(i).getValue());
+            }
+            cell.setCellStyle(exampleStyle);
+        }
+
+        for (int i = 0; i < cellCount; i++) {
+            sheet.autoSizeColumn(i);
+            sheet.setColumnWidth(i, sheet.getColumnWidth(i) * 17 / 10);
+        }
+        ServletOutputStream outputStream = response.getOutputStream();
+        wb.write(outputStream);
+        outputStream.flush();
+        outputStream.close();
+        log.debug("导出Excel结束...");
+    }
+
+    /**
+     * 成绩管理列表
+     *
+     * @param iPage
+     * @param examId
+     * @param courseCode
+     * @return
+     */
+    @Override
+    public IPage<ScoreResult> scoreList(IPage<Map> iPage, Long examId, String courseCode) {
+        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+        DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(sysUser.getSchoolId(), sysUser.getId(), ServletUtil.getRequest().getServletPath());
+        return tcUsualScoreMapper.scoreList(iPage, examId, courseCode, dpr);
+    }
+
     /**
      * 保存html附件
      *

+ 169 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TCFinalScoreServiceImpl.java

@@ -0,0 +1,169 @@
+package com.qmth.distributed.print.business.service.impl;
+
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.boot.api.exception.ApiException;
+import com.qmth.distributed.print.business.entity.TCFinalScore;
+import com.qmth.distributed.print.business.mapper.TCFinalScoreMapper;
+import com.qmth.distributed.print.business.service.PrintCommonService;
+import com.qmth.distributed.print.business.service.TCFinalScoreService;
+import com.qmth.teachcloud.common.contant.SystemConstant;
+import com.qmth.teachcloud.common.entity.SysUser;
+import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
+import com.qmth.teachcloud.common.enums.FieldUniqueEnum;
+import com.qmth.teachcloud.common.util.JacksonUtil;
+import com.qmth.teachcloud.common.util.ResultUtil;
+import com.qmth.teachcloud.common.util.ServletUtil;
+import com.qmth.teachcloud.mark.entity.MarkPaper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.dao.DuplicateKeyException;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import java.io.IOException;
+import java.util.*;
+
+/**
+ * <p>
+ * 期末考试成绩表 服务实现类
+ * </p>
+ *
+ * @author wangliang
+ * @since 2024-02-18
+ */
+@Service
+public class TCFinalScoreServiceImpl extends ServiceImpl<TCFinalScoreMapper, TCFinalScore> implements TCFinalScoreService {
+    private final static Logger log = LoggerFactory.getLogger(TCFinalScoreServiceImpl.class);
+
+    @Resource
+    PrintCommonService printCommonService;
+
+    @Resource
+    TCFinalScoreService tcFinalScoreService;
+
+    /**
+     * 导入期末成绩excel
+     *
+     * @param file
+     * @param examId
+     * @param courseCode
+     * @param paperNumber
+     * @return
+     * @throws IOException
+     */
+    @Override
+    @Transactional
+    public Map<String, String> finalScoreExcelImport(MultipartFile file, Long examId, String courseCode, String paperNumber) throws IOException {
+        log.debug("导入Excel开始...");
+        long start = System.currentTimeMillis();
+        MarkPaper markPaper = printCommonService.scoreImportExcelVaild(file, examId, paperNumber);
+
+        Map<String, String> messageMap = new LinkedHashMap<>();
+        try {
+            StringJoiner errorData = new StringJoiner("");
+            StringJoiner successData = new StringJoiner("");
+            List<Map<String, String>> list = EasyExcel.read(file.getInputStream()).headRowNumber(1).sheet(0).doReadSync();
+            log.info("list:{}", JacksonUtil.parseJson(list));
+
+            SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+            List<TCFinalScore> tcFinalScoreList = new ArrayList<>(list.size());
+            Map<String, String> headMap = list.get(0);
+            for (Map.Entry<String, String> entry : headMap.entrySet()) {
+                if (Objects.equals(entry.getKey(), 0) && Objects.nonNull(entry.getValue()) &&
+                        !Objects.equals(entry.getValue().trim(), "学号")) {
+                    throw ExceptionResultEnum.ERROR.exception("excel表头第一行为学号");
+                } else if (Objects.equals(entry.getKey(), 1) && Objects.nonNull(entry.getValue()) &&
+                        !Objects.equals(entry.getValue().trim(), "姓名")) {
+                    throw ExceptionResultEnum.ERROR.exception("excel表头第二行为姓名");
+                } else if (Objects.equals(entry.getKey(), 2) && Objects.nonNull(entry.getValue()) &&
+                        !Objects.equals(entry.getValue().trim(), "成绩")) {
+                    throw ExceptionResultEnum.ERROR.exception("excel表头第三行为成绩");
+                }
+            }
+
+            for (int i = 1; i < list.size(); i++) {
+                Map<String, String> objectMap = list.get(i);
+                boolean error = false;
+                JSONArray jsonArray = new JSONArray();
+                TCFinalScore tcFinalScore = new TCFinalScore(examId, courseCode, markPaper.getCourseName(), paperNumber, sysUser.getId());
+                for (Map.Entry<String, String> entry : objectMap.entrySet()) {
+                    JSONObject jsonObject = new JSONObject();
+                    if (Objects.isNull(entry.getValue()) || Objects.equals(entry.getValue().trim(), "")) {
+                        errorData.add("excel第" + i + "行[").add(headMap.get(entry.getKey()) + "]为空;").add("\r\n");
+                        error = true;
+                    } else {
+                        String head = headMap.get(entry.getKey());
+                        Objects.requireNonNull(head, "表头信息异常");
+                        if (Objects.equals(head.trim(), "学号")) {
+                            tcFinalScore.setStudentCode(entry.getValue());
+                        } else if (Objects.equals(head.trim(), "姓名")) {
+                            tcFinalScore.setName(entry.getValue());
+                        } else if (Objects.equals(head.trim(), "成绩")) {
+                            tcFinalScore.setScore(Double.valueOf(entry.getValue()));
+                        } else {
+                            jsonObject.put("name", headMap.get(entry.getKey()));
+                            jsonObject.put("score", entry.getValue());
+                            jsonArray.add(jsonObject);
+                        }
+                    }
+                }
+                if (jsonArray.size() > 0) {
+                    tcFinalScore.setScoreDetail(jsonArray.toJSONString());
+                }
+                if (!error) {
+                    tcFinalScoreList.add(tcFinalScore);
+                }
+            }
+            if (!CollectionUtils.isEmpty(tcFinalScoreList)) {
+                successData.add("共导入" + tcFinalScoreList.size() + "条数据");
+
+                QueryWrapper<TCFinalScore> tcScoreEndExamQueryWrapper = new QueryWrapper<>();
+                tcScoreEndExamQueryWrapper.lambda().eq(TCFinalScore::getExamId, examId)
+                        .eq(TCFinalScore::getCourseCode, courseCode)
+                        .eq(TCFinalScore::getCourseName, markPaper.getCourseName())
+                        .eq(TCFinalScore::getPaperNumber, paperNumber);
+                tcFinalScoreService.remove(tcScoreEndExamQueryWrapper);
+                tcFinalScoreService.saveBatch(tcFinalScoreList);
+            }
+            messageMap.put("正确信息", successData.length() > 0 ? successData.toString() : "无");
+            messageMap.put("错误信息", errorData.length() > 0 ? errorData.toString() : "无");
+        } catch (Exception e) {
+            log.error(SystemConstant.LOG_ERROR, e);
+            if (e instanceof DuplicateKeyException) {
+                String errorColumn = e.getCause().toString();
+                String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length()).replaceAll("'", "");
+                throw ExceptionResultEnum.SQL_ERROR.exception("[" + FieldUniqueEnum.convertToTitle(columnStr) + "]数据不允许重复插入");
+            } else if (e instanceof ApiException) {
+                ResultUtil.error((ApiException) e, ((ApiException) e).getCode(), e.getMessage());
+            } else {
+                ResultUtil.error(e.getMessage());
+            }
+        }
+        log.debug("导入Excel结束...");
+        long end = System.currentTimeMillis();
+        log.info("============耗时{}秒============:", (end - start) / 1000);
+        return messageMap;
+    }
+
+    /**
+     * 期末成绩列表(分页)
+     *
+     * @param iPage
+     * @param examId
+     * @param courseCode
+     * @param paperNumber
+     * @return
+     */
+    @Override
+    public IPage<TCFinalScore> finalScoreList(IPage<Map> iPage, Long examId, String courseCode, String paperNumber) {
+        return this.baseMapper.finalScoreList(iPage, examId, courseCode, paperNumber);
+    }
+}

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

@@ -1,20 +0,0 @@
-package com.qmth.distributed.print.business.service.impl;
-
-import com.qmth.distributed.print.business.entity.TCPaperPositive;
-import com.qmth.distributed.print.business.mapper.TCPaperPositiveMapper;
-import com.qmth.distributed.print.business.service.TCPaperPositiveService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- * 试卷蓝图表 服务实现类
- * </p>
- *
- * @author wangliang
- * @since 2024-02-18
- */
-@Service
-public class TCPaperPositiveServiceImpl extends ServiceImpl<TCPaperPositiveMapper, TCPaperPositive> implements TCPaperPositiveService {
-
-}

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

@@ -0,0 +1,20 @@
+package com.qmth.distributed.print.business.service.impl;
+
+import com.qmth.distributed.print.business.entity.TCPaperStruct;
+import com.qmth.distributed.print.business.mapper.TCPaperStructMapper;
+import com.qmth.distributed.print.business.service.TCPaperStructService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 试卷蓝图表 服务实现类
+ * </p>
+ *
+ * @author wangliang
+ * @since 2024-02-18
+ */
+@Service
+public class TCPaperStructServiceImpl extends ServiceImpl<TCPaperStructMapper, TCPaperStruct> implements TCPaperStructService {
+
+}

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

@@ -1,20 +0,0 @@
-package com.qmth.distributed.print.business.service.impl;
-
-import com.qmth.distributed.print.business.entity.TCScoreEndExam;
-import com.qmth.distributed.print.business.mapper.TCScoreEndExamMapper;
-import com.qmth.distributed.print.business.service.TCScoreEndExamService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- * 期末考试成绩表 服务实现类
- * </p>
- *
- * @author wangliang
- * @since 2024-02-18
- */
-@Service
-public class TCScoreEndExamServiceImpl extends ServiceImpl<TCScoreEndExamMapper, TCScoreEndExam> implements TCScoreEndExamService {
-
-}

+ 0 - 182
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TCScoreNormalServiceImpl.java

@@ -1,182 +0,0 @@
-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.excel.ExcelField;
-import com.qmth.distributed.print.business.bean.result.ScoreResult;
-import com.qmth.distributed.print.business.entity.TCScoreNormal;
-import com.qmth.distributed.print.business.mapper.TCScoreNormalMapper;
-import com.qmth.distributed.print.business.service.TCScoreNormalService;
-import com.qmth.teachcloud.common.contant.SystemConstant;
-import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
-import com.qmth.teachcloud.common.util.ExcelUtil;
-import com.qmth.teachcloud.common.util.ServletUtil;
-import com.qmth.teachcloud.mark.entity.MarkPaper;
-import com.qmth.teachcloud.mark.service.MarkPaperService;
-import org.apache.commons.codec.digest.DigestUtils;
-import org.apache.poi.ss.usermodel.FillPatternType;
-import org.apache.poi.ss.usermodel.Font;
-import org.apache.poi.ss.usermodel.HorizontalAlignment;
-import org.apache.poi.ss.usermodel.IndexedColors;
-import org.apache.poi.ss.util.CellRangeAddress;
-import org.apache.poi.xssf.usermodel.*;
-import org.springframework.stereotype.Service;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.annotation.Resource;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.net.URLEncoder;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Random;
-
-/**
- * <p>
- * 平常作业成绩表 服务实现类
- * </p>
- *
- * @author wangliang
- * @since 2024-02-18
- */
-@Service
-public class TCScoreNormalServiceImpl extends ServiceImpl<TCScoreNormalMapper, TCScoreNormal> implements TCScoreNormalService {
-
-    @Resource
-    MarkPaperService markPaperService;
-
-    /**
-     * 成绩管理列表
-     *
-     * @param iPage
-     * @param semesterId
-     * @param examId
-     * @param courseCode
-     * @return
-     */
-    @Override
-    public IPage<ScoreResult> scoreList(IPage<Map> iPage, Long semesterId, Long examId, String courseCode) {
-        return this.baseMapper.scoreList(iPage, semesterId, examId, courseCode);
-    }
-
-    /**
-     * 动态生成excel
-     *
-     * @param describe
-     * @param sheetName
-     * @param fileName
-     * @param excelFieldList
-     * @throws IOException
-     */
-    @Override
-    public void downLoadExaminationTemplate(String describe, String sheetName, String fileName, List<ExcelField> excelFieldList) throws IOException {
-        HttpServletResponse response = ServletUtil.getResponse();
-        log.debug("导出Excel开始...");
-        XSSFWorkbook wb = new XSSFWorkbook();
-        response.setHeader("Content-Disposition", "inline;filename=" + URLEncoder.encode(fileName, SystemConstant.CHARSET_NAME) + ExcelUtil.DEFALUT_EXT);
-        response.setContentType(ExcelUtil.DEFALUT_CONTENT_TYPE);
-        XSSFSheet sheet = wb.createSheet(sheetName);
-
-        Font headFont = wb.createFont();
-        headFont.setFontHeightInPoints((short) 12);
-        headFont.setFontName("宋体");
-        headFont.setBold(true);
-
-        Font defaultFont = wb.createFont();
-        defaultFont.setFontHeightInPoints((short) 12);
-        defaultFont.setFontName("宋体");
-
-        Font describeFont = wb.createFont();
-        describeFont.setFontHeightInPoints((short) 12);
-        describeFont.setFontName("宋体");
-        describeFont.setColor(IndexedColors.RED.getIndex());
-
-        int cellCount = excelFieldList.size();
-        // 说明
-        XSSFCellStyle describeStyle = wb.createCellStyle();
-        describeStyle.setAlignment(HorizontalAlignment.LEFT);
-        describeStyle.setFont(describeFont);
-        describe = describe.trim();
-        XSSFRow rowDescribe = sheet.createRow(0);
-        rowDescribe.setHeightInPoints(195); //行高设置成195px
-        for (int i = 0; i < cellCount; i++) {
-            XSSFCell cell = rowDescribe.createCell(i);
-            if (i == 0) {
-                cell.setCellValue(describe);
-                cell.setCellStyle(describeStyle);
-            }
-        }
-        CellRangeAddress region = new CellRangeAddress(0, 0, 0, cellCount - 1);
-        sheet.addMergedRegion(region);
-
-        // 表头行
-        XSSFCellStyle headerStyle = wb.createCellStyle();
-        headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
-        headerStyle.setAlignment(HorizontalAlignment.CENTER);
-        headerStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
-        headerStyle.setFont(headFont);
-        XSSFRow rowHead = sheet.createRow(1);
-        for (int i = 0; i < excelFieldList.size(); i++) {
-            XSSFCell cell = rowHead.createCell(i);
-            cell.setCellValue(excelFieldList.get(i).getName());
-            cell.setCellStyle(headerStyle);
-            if (excelFieldList.get(i).getComment()) {
-                // 前四个参数是坐标点,后四个参数是编辑和显示批注时的大小.
-                XSSFDrawing p = sheet.createDrawingPatriarch();
-                XSSFComment comment = p.createCellComment(new XSSFClientAnchor(0, 0, 0, 0, (short) 3, 3, (short) 5, 6));
-                // 输入批注信息
-                comment.setString(new XSSFRichTextString("必填"));
-                cell.setCellComment(comment);
-            }
-        }
-
-        // 样例行
-        XSSFCellStyle exampleStyle = wb.createCellStyle();
-        exampleStyle.setAlignment(HorizontalAlignment.LEFT);
-        exampleStyle.setFont(defaultFont);
-        XSSFRow rowExample = sheet.createRow(2);
-        for (int i = 0; i < excelFieldList.size(); i++) {
-            XSSFCell cell = rowExample.createCell(i);
-            if (excelFieldList.get(i).getCode().startsWith("score")) {
-                cell.setCellValue(new Random().nextInt(100) + 1);
-            } else if (excelFieldList.get(i).getCode().startsWith("key")) {
-                cell.setCellValue(new Random().nextInt(10) + 1);
-            } else {
-                cell.setCellValue(excelFieldList.get(i).getValue());
-            }
-            cell.setCellStyle(exampleStyle);
-        }
-
-        for (int i = 0; i < cellCount; i++) {
-            sheet.autoSizeColumn(i);
-            sheet.setColumnWidth(i, sheet.getColumnWidth(i) * 17 / 10);
-        }
-        ServletOutputStream outputStream = response.getOutputStream();
-        wb.write(outputStream);
-        outputStream.flush();
-        outputStream.close();
-        log.debug("导出Excel结束...");
-    }
-
-    /**
-     * 导入excel校验
-     *
-     * @param file
-     * @param examId
-     * @param paperNumber
-     * @return
-     */
-    @Override
-    public MarkPaper importExcelVaild(MultipartFile file, Long examId, String paperNumber) throws IOException {
-        String reqFileMd5 = ServletUtil.getRequestMd5();
-        String fileMd5 = DigestUtils.md5Hex(file.getBytes());
-        if (!Objects.equals(fileMd5, reqFileMd5)) {
-            throw ExceptionResultEnum.MD5_EQUALS_FALSE.exception();
-        }
-        MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, paperNumber);
-        Objects.requireNonNull(markPaper, "未找到科目信息");
-        return markPaper;
-    }
-}

+ 164 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TCUsualScoreServiceImpl.java

@@ -0,0 +1,164 @@
+package com.qmth.distributed.print.business.service.impl;
+
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.boot.api.exception.ApiException;
+import com.qmth.distributed.print.business.entity.TCUsualScore;
+import com.qmth.distributed.print.business.mapper.TCUsualScoreMapper;
+import com.qmth.distributed.print.business.service.PrintCommonService;
+import com.qmth.distributed.print.business.service.TCUsualScoreService;
+import com.qmth.teachcloud.common.contant.SystemConstant;
+import com.qmth.teachcloud.common.entity.SysUser;
+import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
+import com.qmth.teachcloud.common.enums.FieldUniqueEnum;
+import com.qmth.teachcloud.common.util.JacksonUtil;
+import com.qmth.teachcloud.common.util.ResultUtil;
+import com.qmth.teachcloud.common.util.ServletUtil;
+import com.qmth.teachcloud.mark.entity.MarkPaper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.dao.DuplicateKeyException;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import java.io.IOException;
+import java.util.*;
+
+/**
+ * <p>
+ * 平常作业成绩表 服务实现类
+ * </p>
+ *
+ * @author wangliang
+ * @since 2024-02-18
+ */
+@Service
+public class TCUsualScoreServiceImpl extends ServiceImpl<TCUsualScoreMapper, TCUsualScore> implements TCUsualScoreService {
+    private final static Logger log = LoggerFactory.getLogger(TCUsualScoreServiceImpl.class);
+
+    @Resource
+    PrintCommonService printCommonService;
+
+    @Resource
+    TCUsualScoreService tcUsualScoreService;
+
+    /**
+     * 导入平时成绩excel
+     *
+     * @param file
+     * @param examId
+     * @param courseCode
+     * @param paperNumber
+     * @return
+     * @throws IOException
+     */
+    @Override
+    @Transactional
+    public Map<String, String> usualScoreExcelImport(MultipartFile file, Long examId, String courseCode, String paperNumber) throws IOException {
+        log.debug("导入Excel开始...");
+        long start = System.currentTimeMillis();
+        MarkPaper markPaper = printCommonService.scoreImportExcelVaild(file, examId, paperNumber);
+
+        Map<String, String> messageMap = new LinkedHashMap<>();
+        try {
+            StringJoiner errorData = new StringJoiner("");
+            StringJoiner successData = new StringJoiner("");
+            List<Map<String, String>> list = EasyExcel.read(file.getInputStream()).headRowNumber(1).sheet(0).doReadSync();
+            log.info("list:{}", JacksonUtil.parseJson(list));
+
+            SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+            List<TCUsualScore> tcUsualScoreList = new ArrayList<>(list.size());
+            Map<String, String> headMap = list.get(0);
+            for (Map.Entry<String, String> entry : headMap.entrySet()) {
+                if (Objects.equals(entry.getKey(), 0) && Objects.nonNull(entry.getValue()) &&
+                        !Objects.equals(entry.getValue().trim(), "学号")) {
+                    throw ExceptionResultEnum.ERROR.exception("excel表头第一行为学号");
+                } else if (Objects.equals(entry.getKey(), 1) && Objects.nonNull(entry.getValue()) &&
+                        !Objects.equals(entry.getValue().trim(), "姓名")) {
+                    throw ExceptionResultEnum.ERROR.exception("excel表头第二行为姓名");
+                }
+            }
+
+            for (int i = 1; i < list.size(); i++) {
+                Map<String, String> objectMap = list.get(i);
+                boolean error = false;
+                JSONArray jsonArray = new JSONArray();
+                TCUsualScore tcUsualScore = new TCUsualScore(examId, courseCode, markPaper.getCourseName(), paperNumber, sysUser.getId());
+                for (Map.Entry<String, String> entry : objectMap.entrySet()) {
+                    JSONObject jsonObject = new JSONObject();
+                    if (Objects.isNull(entry.getValue()) || Objects.equals(entry.getValue().trim(), "")) {
+                        errorData.add("excel第" + i + "行[").add(headMap.get(entry.getKey()) + "]为空;").add("\r\n");
+                        error = true;
+                    } else {
+                        String head = headMap.get(entry.getKey());
+                        Objects.requireNonNull(head, "表头信息异常");
+                        if (Objects.equals(head.trim(), "学号")) {
+                            tcUsualScore.setStudentCode(entry.getValue());
+                        } else if (Objects.equals(head.trim(), "姓名")) {
+                            tcUsualScore.setName(entry.getValue());
+                        } else {
+                            jsonObject.put("name", headMap.get(entry.getKey()));
+                            jsonObject.put("score", entry.getValue());
+                            jsonArray.add(jsonObject);
+                        }
+                    }
+                }
+                if (jsonArray.size() > 0) {
+                    tcUsualScore.setScore(jsonArray.toJSONString());
+                }
+                if (!error) {
+                    tcUsualScoreList.add(tcUsualScore);
+                }
+            }
+            if (!CollectionUtils.isEmpty(tcUsualScoreList)) {
+                successData.add("共导入" + tcUsualScoreList.size() + "条数据");
+
+                QueryWrapper<TCUsualScore> tcScoreNormalQueryWrapper = new QueryWrapper<>();
+                tcScoreNormalQueryWrapper.lambda().eq(TCUsualScore::getExamId, examId)
+                        .eq(TCUsualScore::getCourseCode, courseCode)
+                        .eq(TCUsualScore::getCourseName, markPaper.getCourseName())
+                        .eq(TCUsualScore::getPaperNumber, paperNumber);
+                tcUsualScoreService.remove(tcScoreNormalQueryWrapper);
+                tcUsualScoreService.saveBatch(tcUsualScoreList);
+            }
+            messageMap.put("正确信息", successData.length() > 0 ? successData.toString() : "无");
+            messageMap.put("错误信息", errorData.length() > 0 ? errorData.toString() : "无");
+        } catch (Exception e) {
+            log.error(SystemConstant.LOG_ERROR, e);
+            if (e instanceof DuplicateKeyException) {
+                String errorColumn = e.getCause().toString();
+                String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length()).replaceAll("'", "");
+                throw ExceptionResultEnum.SQL_ERROR.exception("[" + FieldUniqueEnum.convertToTitle(columnStr) + "]数据不允许重复插入");
+            } else if (e instanceof ApiException) {
+                ResultUtil.error((ApiException) e, ((ApiException) e).getCode(), e.getMessage());
+            } else {
+                ResultUtil.error(e.getMessage());
+            }
+        }
+        log.debug("导入Excel结束...");
+        long end = System.currentTimeMillis();
+        log.info("============耗时{}秒============:", (end - start) / 1000);
+        return messageMap;
+    }
+
+    /**
+     * 平时成绩列表(分页)
+     *
+     * @param iPage
+     * @param examId
+     * @param courseCode
+     * @param paperNumber
+     * @return
+     */
+    @Override
+    public IPage<TCUsualScore> usualScoreList(IPage<Map> iPage, Long examId, String courseCode, String paperNumber) {
+        return this.baseMapper.usualScoreList(iPage, examId, courseCode, paperNumber);
+    }
+}

+ 20 - 0
distributed-print-business/src/main/resources/mapper/TCFinalScoreMapper.xml

@@ -0,0 +1,20 @@
+<?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.TCFinalScoreMapper">
+
+    <select id="finalScoreList" resultType="com.qmth.distributed.print.business.entity.TCFinalScore">
+        select * from t_c_final_score t
+        <where>
+            <if test="examId != null and examId != ''">
+                and t.exam_id = #{examId}
+            </if>
+            <if test="courseCode != null and courseCode != ''">
+                and t.course_code = #{courseCode}
+            </if>
+            <if test="paperNumber != null and paperNumber != ''">
+                and t.paper_number = #{paperNumber}
+            </if>
+        </where>
+    </select>
+
+</mapper>

+ 0 - 5
distributed-print-business/src/main/resources/mapper/TCPaperPositiveMapper.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.TCPaperPositiveMapper">
-
-</mapper>

+ 1 - 1
distributed-print-business/src/main/resources/mapper/TCScoreEndExamMapper.xml → distributed-print-business/src/main/resources/mapper/TCPaperStructMapper.xml

@@ -1,5 +1,5 @@
 <?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.TCScoreEndExamMapper">
+<mapper namespace="com.qmth.distributed.print.business.mapper.TCPaperStructMapper">
 
 </mapper>

+ 0 - 30
distributed-print-business/src/main/resources/mapper/TCScoreNormalMapper.xml

@@ -1,30 +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.TCScoreNormalMapper">
-
-    <select id="scoreList" resultType="com.qmth.distributed.print.business.bean.result.ScoreResult">
-        SELECT distinct t.id,
-                 bs.id as semesterId,
-                 t.exam_id as examId,
-                 t.course_code as courseCode,
-                 t.course_name as courseName,
-                 t.paper_number as paperNumber
-        FROM
-            mark_paper t
-            left join basic_exam be on be.id = t.exam_id
-            left join basic_semester bs on bs.id = be.semester_id
-        <where>
-            <if test="semesterId != null and semesterId != ''">
-                and bs.id = #{semesterId}
-            </if>
-            <if test="examId != null and examId != ''">
-                and t.exam_id = #{examId}
-            </if>
-            <if test="courseCode != null and courseCode != ''">
-                and t.course_code = #{courseCode}
-            </if>
-            AND t.status = 'FINISH'
-        </where>
-        ORDER BY t.course_code
-    </select>
-</mapper>

+ 54 - 0
distributed-print-business/src/main/resources/mapper/TCUsualScoreMapper.xml

@@ -0,0 +1,54 @@
+<?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.TCUsualScoreMapper">
+
+    <select id="scoreList" resultType="com.qmth.distributed.print.business.bean.result.ScoreResult">
+        SELECT distinct t.id,
+                 bs.id as semesterId,
+                 t.exam_id as examId,
+                 t.course_code as courseCode,
+                 t.course_name as courseName,
+                 t.paper_number as paperNumber
+        FROM
+            mark_paper t
+            left join basic_exam be on be.id = t.exam_id
+            left join basic_semester bs on bs.id = be.semester_id
+            left join sys_user su on t.user_id = su.id
+        <where>
+            <if test="examId != null and examId != ''">
+                and t.exam_id = #{examId}
+            </if>
+            <if test="courseCode != null and courseCode != ''">
+                and t.course_code = #{courseCode}
+            </if>
+            AND t.status = 'FINISH'
+            <if test="dpr != null">
+                <if test="dpr.requestUserId != null">
+                    AND t.user_id = #{dpr.requestUserId}
+                </if>
+                <if test="dpr.orgIdSet != null and dpr.orgIdSet != '' and dpr.orgIdSet.size > 0">
+                    AND su.org_id IN
+                    <foreach collection="dpr.orgIdSet" item="item" index="index" open="(" separator="," close=")">
+                        #{item}
+                    </foreach>
+                </if>
+            </if>
+        </where>
+        ORDER BY t.course_code
+    </select>
+
+    <select id="usualScoreList" resultType="com.qmth.distributed.print.business.entity.TCUsualScore">
+        select * from t_c_usual_score t
+        <where>
+            <if test="examId != null and examId != ''">
+                and t.exam_id = #{examId}
+            </if>
+            <if test="courseCode != null and courseCode != ''">
+                and t.course_code = #{courseCode}
+            </if>
+            <if test="paperNumber != null and paperNumber != ''">
+                and t.paper_number = #{paperNumber}
+            </if>
+        </where>
+    </select>
+</mapper>

+ 29 - 29
distributed-print/install/mysql/upgrade/3.3.1.sql

@@ -53,43 +53,43 @@ INSERT INTO sys_privilege
 VALUES(2007, '列表', '/api/admin/course/degree/score/list', 'URL', 2001, 1, 'AUTH', NULL, 1, 1, 1);
 INSERT INTO sys_privilege
 (id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
-VALUES(2008, '平时成绩-下载模版', '/api/admin/course/degree/score/template_download', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
+VALUES(2008, '平时成绩-下载模版', '/api/admin/course/degree/usual_score/template_download', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
 INSERT INTO sys_privilege
 (id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
-VALUES(2009, '平时成绩-导入模版', '/api/admin/course/degree/score/import', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
+VALUES(2009, '平时成绩-导入模版', '/api/admin/course/degree/usual_score/import', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
 INSERT INTO sys_privilege
 (id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
-VALUES(2010, '平时成绩列表', '/api/admin/course/degree/score/normal/list', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
+VALUES(2010, '平时成绩列表', '/api/admin/course/degree/usual_score/list', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
 INSERT INTO sys_privilege
 (id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
-VALUES(2011, '平时成绩编辑', '/api/admin/course/degree/score/normal/edit', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
+VALUES(2011, '平时成绩编辑', '/api/admin/course/degree/usual_score/edit', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
 INSERT INTO sys_privilege
 (id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
-VALUES(2012, '平时成绩保存', '/api/admin/course/degree/score/normal/save', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
+VALUES(2012, '平时成绩保存', '/api/admin/course/degree/usual_score/save', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
 INSERT INTO sys_privilege
 (id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
-VALUES(2013, '平时成绩启用/禁用', '/api/admin/course/degree/score/normal/enable', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
+VALUES(2013, '平时成绩启用/禁用', '/api/admin/course/degree/usual_score/enable', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
 INSERT INTO sys_privilege
 (id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
 VALUES(2014, '期末成绩-下载模版', '/api/admin/course/degree/score/end_exam/template_download', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
 INSERT INTO sys_privilege
 (id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
-VALUES(2015, '期末成绩-导入模版', '/api/admin/course/degree/score/end_exam/import', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
+VALUES(2015, '期末成绩-导入模版', '/api/admin/course/degree/final_score/import', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
 INSERT INTO sys_privilege
 (id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
-VALUES(2016, '期末成绩列表', '/api/admin/course/degree/score/end_exam/list', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
+VALUES(2016, '期末成绩列表', '/api/admin/course/degree/final_score/list', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
 INSERT INTO sys_privilege
 (id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
-VALUES(2017, '期末成绩编辑', '/api/admin/course/degree/score/end_exam/edit', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
+VALUES(2017, '期末成绩编辑', '/api/admin/course/degree/final_score/edit', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
 INSERT INTO sys_privilege
 (id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
-VALUES(2018, '期末成绩保存', '/api/admin/course/degree/score/end_exam/save', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
+VALUES(2018, '期末成绩保存', '/api/admin/course/degree/final_score/save', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
 INSERT INTO sys_privilege
 (id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
-VALUES(2019, '期末成绩启用/禁用', '/api/admin/course/degree/score/end_exam/enable', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
+VALUES(2019, '期末成绩启用/禁用', '/api/admin/course/degree/final_score/enable', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
 INSERT INTO sys_privilege
 (id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
-VALUES(2020, '保存试卷蓝图', '/api/admin/course/degree/score/end_exam/paper_positive/save', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
+VALUES(2020, '保存试卷蓝图', '/api/admin/course/degree/final_score/paper_struct/save', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
 INSERT INTO sys_privilege
 (id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
 VALUES(2021, '列表', 'List', 'LIST', 2002, 1, 'AUTH', '2024', 1, 0, 1);
@@ -116,11 +116,11 @@ INSERT INTO sys_privilege
 VALUES(2028, '保存报告', '/api/admin/course/degree/report/save', 'URL', 2025, 1, 'AUTH', NULL, 1, 1, 1);
 INSERT INTO sys_privilege
 (id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
-VALUES(2029, '获取试卷蓝图信息', '/api/admin/course/degree/score/end_exam/paper_positive/query', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
+VALUES(2029, '获取试卷蓝图信息', '/api/admin/course/degree/final_score/paper_struct/query', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
 
 --2024/2/18
-DROP TABLE IF EXISTS `t_c_paper_positive`;
-CREATE TABLE `t_c_paper_positive` (
+DROP TABLE IF EXISTS `t_c_paper_struct`;
+CREATE TABLE `t_c_paper_struct` (
                                       `id` bigint NOT NULL COMMENT '主键',
                                       `exam_id` bigint NOT NULL COMMENT '考试id',
                                       `course_code` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '课程编码',
@@ -135,15 +135,15 @@ CREATE TABLE `t_c_paper_positive` (
                                       PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='试卷蓝图表';
 
-DROP TABLE IF EXISTS `t_c_score_end_exam`;
-CREATE TABLE `t_c_score_end_exam` (
+DROP TABLE IF EXISTS `t_c_final_score`;
+CREATE TABLE `t_c_final_score` (
                                       `id` bigint NOT NULL COMMENT '主键',
                                       `exam_id` bigint NOT NULL COMMENT '考试id',
                                       `course_code` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '课程编码',
                                       `course_name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '课程名称',
                                       `paper_number` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '试卷编码',
                                       `name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '考生姓名',
-                                      `exam_number` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '学号',
+                                      `student_code` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '学号',
                                       `score` double NOT NULL COMMENT '分数',
                                       `score_detail` mediumtext NOT NULL COMMENT '成绩明细',
                                       `enable` tinyint NOT NULL DEFAULT '1' COMMENT '是否启用,0:停用,1:启用',
@@ -155,16 +155,16 @@ CREATE TABLE `t_c_score_end_exam` (
                                       UNIQUE KEY `t_c_score_end_exam_unique` (`exam_id`,`course_code`,`course_name`,`paper_number`,`name`,`exam_number`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='期末考试成绩表';
 
-DROP TABLE IF EXISTS `t_c_score_normal`;
-CREATE TABLE `t_c_score_normal` (
+DROP TABLE IF EXISTS `t_c_usual_score`;
+CREATE TABLE `t_c_usual_score (
                                     `id` bigint NOT NULL COMMENT '主键',
                                     `exam_id` bigint NOT NULL COMMENT '考试id',
                                     `course_code` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '课程编码',
                                     `course_name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '课程名称',
                                     `paper_number` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '试卷编码',
                                     `name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '考生姓名',
-                                    `exam_number` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '学号',
-                                    `score_normal` mediumtext NOT NULL COMMENT '平常作业分数',
+                                    `student_code` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '学号',
+                                    `score` mediumtext NOT NULL COMMENT '平常作业分数',
                                     `enable` tinyint NOT NULL DEFAULT '1' COMMENT '是否启用,0:停用,1:启用',
                                     `create_id` bigint DEFAULT NULL COMMENT '创建人id',
                                     `create_time` bigint DEFAULT NULL COMMENT '创建时间',
@@ -185,12 +185,12 @@ CREATE TABLE `t_r_basic_info` (
                                   `evaluation_mode` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '考核方式',
                                   `open_time` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '开课时间',
                                   `teaching_object` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '授课对象',
-                                  `number_of_select` int DEFAULT NULL COMMENT '选课人数',
-                                  `number_of_participants` int DEFAULT NULL COMMENT '参评人数',
+                                  `selection_count` int DEFAULT NULL COMMENT '选课人数',
+                                  `participant_count` int DEFAULT NULL COMMENT '参评人数',
                                   `course_degree` double DEFAULT NULL COMMENT '课程目标达成度期望值',
-                                  `teach` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任课老师',
-                                  `appraise_duty_user` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '评价责任人',
-                                  `appraise_partake_user` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '评价参与人',
+                                  `teacher` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任课老师',
+                                  `director` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '评价责任人',
+                                  `participant` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '评价参与人',
                                   `enable` tinyint NOT NULL DEFAULT '1' COMMENT '是否启用,0:停用,1:启用',
                                   `create_id` bigint DEFAULT NULL COMMENT '创建人id',
                                   `create_time` bigint DEFAULT NULL COMMENT '创建时间',
@@ -208,8 +208,8 @@ CREATE TABLE `t_r_exam_student` (
                                     `id` bigint NOT NULL COMMENT '主键',
                                     `r_basic_info_id` bigint NOT NULL COMMENT '报告id',
                                     `name` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '考生姓名',
-                                    `exam_number` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '学号',
-                                    `clazz` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '行政班级',
+                                    `student_code` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '学号',
+                                    `administrative_class` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '行政班级',
                                     `score` double COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '学生成绩',
                                     `result_detail` mediumtext DEFAULT NULL COMMENT '考生课程考核成绩评价明细结果',
                                     PRIMARY KEY (`id`)

+ 147 - 0
distributed-print/src/main/java/com/qmth/distributed/print/api/TCFinalScoreController.java

@@ -0,0 +1,147 @@
+package com.qmth.distributed.print.api;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.distributed.print.business.bean.excel.ExcelField;
+import com.qmth.distributed.print.business.bean.result.EditResult;
+import com.qmth.distributed.print.business.service.PrintCommonService;
+import com.qmth.distributed.print.business.service.TCFinalScoreService;
+import com.qmth.teachcloud.common.annotation.OperationLogDetail;
+import com.qmth.teachcloud.common.contant.SystemConstant;
+import com.qmth.teachcloud.common.entity.MarkQuestion;
+import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
+import com.qmth.teachcloud.common.enums.log.CustomizedOperationTypeEnum;
+import com.qmth.teachcloud.common.util.ResultUtil;
+import com.qmth.teachcloud.mark.service.MarkQuestionService;
+import io.swagger.annotations.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * <p>
+ * 期末考试成绩表 前端控制器
+ * </p>
+ *
+ * @author wangliang
+ * @since 2024-02-18
+ */
+@Api(tags = "课程目标达成度-成绩管理-期末考试成绩Controller")
+@RestController
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + SystemConstant.PREFIX_URL_COURSE_DEGREE)
+public class TCFinalScoreController {
+    private final static Logger log = LoggerFactory.getLogger(TCFinalScoreController.class);
+
+    @Resource
+    PrintCommonService printCommonService;
+
+    @Resource
+    TCFinalScoreService tcFinalScoreService;
+
+    @Resource
+    MarkQuestionService markQuestionService;
+
+    @ApiOperation(value = "导入期末成绩-模板下载")
+    @RequestMapping(value = "/final_score/template_download", method = RequestMethod.POST)
+    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.EXPORT)
+    @ApiResponses({@ApiResponse(code = 200, message = "下载成功", response = Object.class)})
+    public void finalScoreTemplateDownload(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
+                                           @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
+                                           @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
+        List<MarkQuestion> markQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumberAndPaperType(examId, paperNumber, null);
+        if (CollectionUtils.isEmpty(markQuestionList)) {
+            throw ExceptionResultEnum.ERROR.exception("未找到试卷结构");
+        }
+
+        List<ExcelField> excelFieldList = new ArrayList<>();
+        excelFieldList.add(new ExcelField("studentCode", "学号", true));
+        excelFieldList.add(new ExcelField("name", "姓名", true));
+        excelFieldList.add(new ExcelField("score", "成绩", true));
+
+        for (int i = 0; i < markQuestionList.size(); i++) {
+            MarkQuestion markQuestion = markQuestionList.get(i);
+            excelFieldList.add(new ExcelField("key" + (i + 1), markQuestion.getMainNumber() + "-" + markQuestion.getSubNumber(), true));
+        }
+        printCommonService.scoreDownLoadExaminationTemplate("1、所有字段均为必填字段;\n" +
+                "2、期末成绩按总分,和小题分录入,题号按大题号-小题号方式录入,如下,1-1表示第一大题第一小题,2-1表示第二大题第一小题;\n" +
+                "3、请不要删除此行,也不要删除模板中的任何列;\n" +
+                "4、使用前请先删除样例数据。", "sheet1", "期末成绩导入模版", excelFieldList);
+    }
+
+    @ApiOperation(value = "导入期末成绩")
+    @RequestMapping(value = "/final_score/import", method = RequestMethod.POST)
+    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.IMPORT)
+    @ApiResponses({@ApiResponse(code = 200, message = "导入成功", response = EditResult.class)})
+    public Object finalScoreExamImport(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file,
+                                       @ApiParam(value = "考试id", required = true) @RequestParam Long examId,
+                                       @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
+                                       @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
+        return ResultUtil.ok(tcFinalScoreService.finalScoreExcelImport(file, examId, courseCode, paperNumber));
+    }
+
+    @ApiOperation(value = "期末成绩列表")
+    @RequestMapping(value = "/final_score/list", method = RequestMethod.POST)
+    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.SEARCH)
+    @ApiResponses({@ApiResponse(code = 200, message = "分页查询", response = EditResult.class)})
+    public Object finalScoreList(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
+                                 @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
+                                 @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber,
+                                 @ApiParam(value = "分页页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
+                                 @ApiParam(value = "分页数", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) throws IOException {
+        return ResultUtil.ok(tcFinalScoreService.finalScoreList(new Page<>(pageNumber, pageSize), examId, courseCode, paperNumber));
+    }
+
+    @ApiOperation(value = "期末成绩编辑")
+    @RequestMapping(value = "/final_score/edit", method = RequestMethod.POST)
+    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.EDIT)
+    @ApiResponses({@ApiResponse(code = 200, message = "编辑", response = EditResult.class)})
+    public Object finalScoreEdit(@ApiParam(value = "主键", required = true) @RequestParam Long id) throws IOException {
+        return ResultUtil.ok(true);
+    }
+
+    @ApiOperation(value = "期末成绩保存")
+    @RequestMapping(value = "/final_score/save", method = RequestMethod.POST)
+    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.UPDATE)
+    @ApiResponses({@ApiResponse(code = 200, message = "保存", response = EditResult.class)})
+    public Object finalScoreSave(@ApiParam(value = "主键", required = true) @RequestParam Long id,
+                                 @ApiParam(value = "期末成绩", required = true) @RequestParam Double score,
+                                 @ApiParam(value = "期末成绩明细", required = true) @RequestParam String scoreDetail) throws IOException {
+        return ResultUtil.ok(true);
+    }
+
+    @ApiOperation(value = "期末成绩启用/禁用")
+    @RequestMapping(value = "/final_score/enable", method = RequestMethod.POST)
+    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.UPDATE)
+    @ApiResponses({@ApiResponse(code = 200, message = "编辑", response = EditResult.class)})
+    public Object finalScoreEnable(@ApiParam(value = "主键", required = true) @RequestParam Long id,
+                                   @ApiParam(value = "启用/禁用", required = true) @RequestParam Boolean enable) throws IOException {
+        return ResultUtil.ok(true);
+    }
+
+    @ApiOperation(value = "期末成绩试卷蓝图保存")
+    @RequestMapping(value = "/final_score/paper_struct/save", method = RequestMethod.POST)
+    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.UPDATE)
+    @ApiResponses({@ApiResponse(code = 200, message = "试卷蓝图保存", response = Object.class)})
+    public Object finalScorePaperStructSave(@ApiParam(value = "试卷蓝图结构", required = true) @RequestBody Object body) throws IOException {
+        return ResultUtil.ok(true);
+    }
+
+    @ApiOperation(value = "期末成绩试卷蓝图查询")
+    @RequestMapping(value = "/final_score/paper_struct/query", method = RequestMethod.POST)
+    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.SEARCH)
+    @ApiResponses({@ApiResponse(code = 200, message = "试卷蓝图保存", response = Object.class)})
+    public Object finalScorePaperStructQuery(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
+                                             @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
+                                             @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
+        return ResultUtil.ok(true);
+    }
+}

+ 0 - 234
distributed-print/src/main/java/com/qmth/distributed/print/api/TCScoreEndExamController.java

@@ -1,234 +0,0 @@
-package com.qmth.distributed.print.api;
-
-import com.alibaba.excel.EasyExcel;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.qmth.boot.api.constant.ApiConstant;
-import com.qmth.boot.api.exception.ApiException;
-import com.qmth.distributed.print.business.bean.excel.ExcelField;
-import com.qmth.distributed.print.business.bean.result.EditResult;
-import com.qmth.distributed.print.business.entity.TCScoreEndExam;
-import com.qmth.distributed.print.business.service.TCScoreEndExamService;
-import com.qmth.distributed.print.business.service.TCScoreNormalService;
-import com.qmth.teachcloud.common.annotation.OperationLogDetail;
-import com.qmth.teachcloud.common.contant.SystemConstant;
-import com.qmth.teachcloud.common.entity.SysUser;
-import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
-import com.qmth.teachcloud.common.enums.FieldUniqueEnum;
-import com.qmth.teachcloud.common.enums.log.CustomizedOperationTypeEnum;
-import com.qmth.teachcloud.common.util.JacksonUtil;
-import com.qmth.teachcloud.common.util.ResultUtil;
-import com.qmth.teachcloud.common.util.ServletUtil;
-import com.qmth.teachcloud.mark.entity.MarkPaper;
-import io.swagger.annotations.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.dao.DuplicateKeyException;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.annotation.Resource;
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-import java.io.IOException;
-import java.util.*;
-
-/**
- * <p>
- * 期末考试成绩表 前端控制器
- * </p>
- *
- * @author wangliang
- * @since 2024-02-18
- */
-@Api(tags = "课程目标达成度-成绩管理-期末考试成绩Controller")
-@RestController
-@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + SystemConstant.PREFIX_URL_COURSE_DEGREE)
-public class TCScoreEndExamController {
-    private final static Logger log = LoggerFactory.getLogger(TCScoreEndExamController.class);
-
-    @Resource
-    TCScoreNormalService tcScoreNormalService;
-
-    @Resource
-    TCScoreEndExamService tcScoreEndExamService;
-
-    @ApiOperation(value = "导入期末成绩-模板下载")
-    @RequestMapping(value = "/score/end_exam/template_download", method = RequestMethod.POST)
-    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.EXPORT)
-    @ApiResponses({@ApiResponse(code = 200, message = "下载成功", response = Object.class)})
-    public void endExamTemplateDownload(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
-                                        @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
-                                        @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
-        List<ExcelField> excelFieldList = new ArrayList<>();
-        excelFieldList.add(new ExcelField("examNumber", "学号", true));
-        excelFieldList.add(new ExcelField("name", "姓名", true));
-        excelFieldList.add(new ExcelField("score", "成绩", true));
-        excelFieldList.add(new ExcelField("key1", "1-1", true));
-        excelFieldList.add(new ExcelField("key2", "1-2", false));
-        tcScoreNormalService.downLoadExaminationTemplate("1、所有字段均为必填字段;\n" +
-                "2、期末成绩按总分,和小题分录入,题号按大题号-小题号方式录入,如下,1-1表示第一大题第一小题,2-1表示第二大题第一小题;\n" +
-                "3、请不要删除此行,也不要删除模板中的任何列;\n" +
-                "4、使用前请先删除样例数据。", "sheet1", "期末成绩导入模版", excelFieldList);
-    }
-
-    @ApiOperation(value = "导入期末成绩")
-    @RequestMapping(value = "/score/end_exam/import", method = RequestMethod.POST)
-    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.IMPORT)
-    @ApiResponses({@ApiResponse(code = 200, message = "导入成功", response = EditResult.class)})
-    @Transactional
-    public Object scoreEndExamImport(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file,
-                                     @ApiParam(value = "考试id", required = true) @RequestParam Long examId,
-                                     @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
-                                     @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
-        log.debug("导入Excel开始...");
-        long start = System.currentTimeMillis();
-        MarkPaper markPaper = tcScoreNormalService.importExcelVaild(file, examId, paperNumber);
-
-        Map<String, String> messageMap = new LinkedHashMap<>();
-        try {
-            StringJoiner errorData = new StringJoiner("");
-            StringJoiner successData = new StringJoiner("");
-            List<Map<String, String>> list = EasyExcel.read(file.getInputStream()).headRowNumber(1).sheet(0).doReadSync();
-            log.info("list:{}", JacksonUtil.parseJson(list));
-
-            SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-            List<TCScoreEndExam> tcScoreEndExamList = new ArrayList<>(list.size());
-            Map<String, String> headMap = list.get(0);
-            for (Map.Entry<String, String> entry : headMap.entrySet()) {
-                if (Objects.equals(entry.getKey(), 0) && Objects.nonNull(entry.getValue()) &&
-                        !Objects.equals(entry.getValue().trim(), "学号")) {
-                    throw ExceptionResultEnum.ERROR.exception("excel表头第一行为学号");
-                } else if (Objects.equals(entry.getKey(), 1) && Objects.nonNull(entry.getValue()) &&
-                        !Objects.equals(entry.getValue().trim(), "姓名")) {
-                    throw ExceptionResultEnum.ERROR.exception("excel表头第二行为姓名");
-                } else if (Objects.equals(entry.getKey(), 2) && Objects.nonNull(entry.getValue()) &&
-                        !Objects.equals(entry.getValue().trim(), "成绩")) {
-                    throw ExceptionResultEnum.ERROR.exception("excel表头第三行为成绩");
-                }
-            }
-
-            for (int i = 1; i < list.size(); i++) {
-                Map<String, String> objectMap = list.get(i);
-                boolean error = false;
-                JSONArray jsonArray = new JSONArray();
-                TCScoreEndExam tcScoreEndExam = new TCScoreEndExam(examId, courseCode, markPaper.getCourseName(), paperNumber, sysUser.getId());
-                for (Map.Entry<String, String> entry : objectMap.entrySet()) {
-                    JSONObject jsonObject = new JSONObject();
-                    if (Objects.isNull(entry.getValue()) || Objects.equals(entry.getValue().trim(), "")) {
-                        errorData.add("excel第" + i + "行[").add(headMap.get(entry.getKey()) + "]为空;").add("\r\n");
-                        error = true;
-                    } else {
-                        String head = headMap.get(entry.getKey());
-                        Objects.requireNonNull(head, "表头信息异常");
-                        if (Objects.equals(head.trim(), "学号")) {
-                            tcScoreEndExam.setExamNumber(entry.getValue());
-                        } else if (Objects.equals(head.trim(), "姓名")) {
-                            tcScoreEndExam.setName(entry.getValue());
-                        } else if (Objects.equals(head.trim(), "成绩")) {
-                            tcScoreEndExam.setScore(Double.valueOf(entry.getValue()));
-                        } else {
-                            jsonObject.put("name", headMap.get(entry.getKey()));
-                            jsonObject.put("score", entry.getValue());
-                            jsonArray.add(jsonObject);
-                        }
-                    }
-                }
-                if (jsonArray.size() > 0) {
-                    tcScoreEndExam.setScoreDetail(jsonArray.toJSONString());
-                }
-                if (!error) {
-                    tcScoreEndExamList.add(tcScoreEndExam);
-                }
-            }
-            if (!CollectionUtils.isEmpty(tcScoreEndExamList)) {
-                successData.add("共导入" + tcScoreEndExamList.size() + "条数据");
-
-                QueryWrapper<TCScoreEndExam> tcScoreEndExamQueryWrapper = new QueryWrapper<>();
-                tcScoreEndExamQueryWrapper.lambda().eq(TCScoreEndExam::getExamId, examId)
-                        .eq(TCScoreEndExam::getCourseCode, courseCode)
-                        .eq(TCScoreEndExam::getCourseName, markPaper.getCourseName())
-                        .eq(TCScoreEndExam::getPaperNumber, paperNumber);
-                tcScoreEndExamService.remove(tcScoreEndExamQueryWrapper);
-                tcScoreEndExamService.saveBatch(tcScoreEndExamList);
-            }
-            messageMap.put("正确信息", successData.length() > 0 ? successData.toString() : "无");
-            messageMap.put("错误信息", errorData.length() > 0 ? errorData.toString() : "无");
-        } catch (Exception e) {
-            log.error(SystemConstant.LOG_ERROR, e);
-            if (e instanceof DuplicateKeyException) {
-                String errorColumn = e.getCause().toString();
-                String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length()).replaceAll("'", "");
-                throw ExceptionResultEnum.SQL_ERROR.exception("[" + FieldUniqueEnum.convertToTitle(columnStr) + "]数据不允许重复插入");
-            } else if (e instanceof ApiException) {
-                ResultUtil.error((ApiException) e, ((ApiException) e).getCode(), e.getMessage());
-            } else {
-                ResultUtil.error(e.getMessage());
-            }
-        }
-        log.debug("导入Excel结束...");
-        long end = System.currentTimeMillis();
-        log.info("============耗时{}秒============:", (end - start) / 1000);
-        return ResultUtil.ok(messageMap);
-    }
-
-    @ApiOperation(value = "期末成绩列表")
-    @RequestMapping(value = "/score/end_exam/list", method = RequestMethod.POST)
-    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.SEARCH)
-    @ApiResponses({@ApiResponse(code = 200, message = "分页查询", response = EditResult.class)})
-    public Object scoreEndExamList(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
-                                   @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
-                                   @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber,
-                                   @ApiParam(value = "分页页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
-                                   @ApiParam(value = "分页数", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) throws IOException {
-        return ResultUtil.ok(true);
-    }
-
-    @ApiOperation(value = "期末成绩编辑")
-    @RequestMapping(value = "/score/end_exam/edit", method = RequestMethod.POST)
-    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.EDIT)
-    @ApiResponses({@ApiResponse(code = 200, message = "编辑", response = EditResult.class)})
-    public Object scoreEndExamEdit(@ApiParam(value = "主键", required = true) @RequestParam Long id) throws IOException {
-        return ResultUtil.ok(true);
-    }
-
-    @ApiOperation(value = "期末成绩保存")
-    @RequestMapping(value = "/score/end_exam/save", method = RequestMethod.POST)
-    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.UPDATE)
-    @ApiResponses({@ApiResponse(code = 200, message = "保存", response = EditResult.class)})
-    public Object scoreEndExamSave(@ApiParam(value = "主键", required = true) @RequestParam Long id,
-                                   @ApiParam(value = "期末成绩", required = true) @RequestParam Double score,
-                                   @ApiParam(value = "期末成绩明细", required = true) @RequestParam String scoreDetail) throws IOException {
-        return ResultUtil.ok(true);
-    }
-
-    @ApiOperation(value = "期末成绩启用/禁用")
-    @RequestMapping(value = "/score/end_exam/enable", method = RequestMethod.POST)
-    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.UPDATE)
-    @ApiResponses({@ApiResponse(code = 200, message = "编辑", response = EditResult.class)})
-    public Object scoreEndExamEnable(@ApiParam(value = "主键", required = true) @RequestParam Long id,
-                                     @ApiParam(value = "启用/禁用", required = true) @RequestParam Boolean enable) throws IOException {
-        return ResultUtil.ok(true);
-    }
-
-    @ApiOperation(value = "期末成绩试卷蓝图保存")
-    @RequestMapping(value = "/score/end_exam/paper_positive/save", method = RequestMethod.POST)
-    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.UPDATE)
-    @ApiResponses({@ApiResponse(code = 200, message = "试卷蓝图保存", response = Object.class)})
-    public Object scoreEndExamPaperPositiveSave(@ApiParam(value = "试卷蓝图结构", required = true) @RequestBody Object body) throws IOException {
-        return ResultUtil.ok(true);
-    }
-
-    @ApiOperation(value = "期末成绩试卷蓝图查询")
-    @RequestMapping(value = "/score/end_exam/paper_positive/query", method = RequestMethod.POST)
-    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.SEARCH)
-    @ApiResponses({@ApiResponse(code = 200, message = "试卷蓝图保存", response = Object.class)})
-    public Object scoreEndExamPaperPositiveQuery(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
-                                                 @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
-                                                 @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
-        return ResultUtil.ok(true);
-    }
-}

+ 0 - 223
distributed-print/src/main/java/com/qmth/distributed/print/api/TCScoreNormalController.java

@@ -1,223 +0,0 @@
-package com.qmth.distributed.print.api;
-
-import com.alibaba.excel.EasyExcel;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.qmth.boot.api.constant.ApiConstant;
-import com.qmth.boot.api.exception.ApiException;
-import com.qmth.distributed.print.business.bean.excel.ExcelField;
-import com.qmth.distributed.print.business.bean.result.EditResult;
-import com.qmth.distributed.print.business.bean.result.ScoreResult;
-import com.qmth.distributed.print.business.entity.TCScoreNormal;
-import com.qmth.distributed.print.business.service.TCScoreNormalService;
-import com.qmth.teachcloud.common.annotation.OperationLogDetail;
-import com.qmth.teachcloud.common.contant.SystemConstant;
-import com.qmth.teachcloud.common.entity.SysUser;
-import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
-import com.qmth.teachcloud.common.enums.FieldUniqueEnum;
-import com.qmth.teachcloud.common.enums.log.CustomizedOperationTypeEnum;
-import com.qmth.teachcloud.common.util.JacksonUtil;
-import com.qmth.teachcloud.common.util.ResultUtil;
-import com.qmth.teachcloud.common.util.ServletUtil;
-import com.qmth.teachcloud.mark.entity.MarkPaper;
-import io.swagger.annotations.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.dao.DuplicateKeyException;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.annotation.Resource;
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-import java.io.IOException;
-import java.util.*;
-
-/**
- * <p>
- * 平常作业成绩表 前端控制器
- * </p>
- *
- * @author wangliang
- * @since 2024-02-18
- */
-@Api(tags = "课程目标达成度-成绩管理-平常作业成绩Controller")
-@RestController
-@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + SystemConstant.PREFIX_URL_COURSE_DEGREE)
-public class TCScoreNormalController {
-    private final static Logger log = LoggerFactory.getLogger(TCScoreNormalController.class);
-
-    @Resource
-    TCScoreNormalService tcScoreNormalService;
-
-    @ApiOperation(value = "成绩管理列表")
-    @RequestMapping(value = "/score/list", method = RequestMethod.POST)
-    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.SEARCH)
-    @ApiResponses({@ApiResponse(code = 200, message = "分页查询", response = ScoreResult.class)})
-    public Object scoreList(@ApiParam(value = "学期ID", required = true) @RequestParam Long semesterId,
-                            @ApiParam(value = "考试ID", required = true) @RequestParam Long examId,
-                            @ApiParam(value = "课程编码") @RequestParam(required = false) String courseCode,
-                            @ApiParam(value = "分页页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
-                            @ApiParam(value = "分页数", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
-        return ResultUtil.ok(tcScoreNormalService.scoreList(new Page<>(pageNumber, pageSize), semesterId, examId, courseCode));
-    }
-
-    @ApiOperation(value = "导入平时成绩-模板下载")
-    @RequestMapping(value = "/score/template_download", method = RequestMethod.POST)
-    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.EXPORT)
-    @ApiResponses({@ApiResponse(code = 200, message = "下载成功", response = Object.class)})
-    public void templateDownload(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
-                                 @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
-                                 @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
-        List<ExcelField> excelFieldList = new ArrayList<>();
-        excelFieldList.add(new ExcelField("examNumber", "学号", true));
-        excelFieldList.add(new ExcelField("name", "姓名", true));
-        excelFieldList.add(new ExcelField("score1", "作业1", true));
-        excelFieldList.add(new ExcelField("score2", "作业2", true));
-        excelFieldList.add(new ExcelField("score3", "作业3", false));
-        tcScoreNormalService.downLoadExaminationTemplate("1、所有字段均为必填字段;\n" +
-                "2、平时成绩各项数据均需要填写;\n" +
-                "3、请不要删除此行,也不要删除模板中的任何列。\n" +
-                "4、使用前请先删除样例数据。", "sheet1", "平时成绩导入模版", excelFieldList);
-    }
-
-    @ApiOperation(value = "导入平时成绩")
-    @RequestMapping(value = "/score/import", method = RequestMethod.POST)
-    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.IMPORT)
-    @ApiResponses({@ApiResponse(code = 200, message = "导入成功", response = EditResult.class)})
-    @Transactional
-    public Object scoreImport(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file,
-                              @ApiParam(value = "考试id", required = true) @RequestParam Long examId,
-                              @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
-                              @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
-        log.debug("导入Excel开始...");
-        long start = System.currentTimeMillis();
-        MarkPaper markPaper = tcScoreNormalService.importExcelVaild(file, examId, paperNumber);
-
-        Map<String, String> messageMap = new LinkedHashMap<>();
-        try {
-            StringJoiner errorData = new StringJoiner("");
-            StringJoiner successData = new StringJoiner("");
-            List<Map<String, String>> list = EasyExcel.read(file.getInputStream()).headRowNumber(1).sheet(0).doReadSync();
-            log.info("list:{}", JacksonUtil.parseJson(list));
-
-            SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-            List<TCScoreNormal> tcScoreNormalList = new ArrayList<>(list.size());
-            Map<String, String> headMap = list.get(0);
-            for (Map.Entry<String, String> entry : headMap.entrySet()) {
-                if (Objects.equals(entry.getKey(), 0) && Objects.nonNull(entry.getValue()) &&
-                        !Objects.equals(entry.getValue().trim(), "学号")) {
-                    throw ExceptionResultEnum.ERROR.exception("excel表头第一行为学号");
-                } else if (Objects.equals(entry.getKey(), 1) && Objects.nonNull(entry.getValue()) &&
-                        !Objects.equals(entry.getValue().trim(), "姓名")) {
-                    throw ExceptionResultEnum.ERROR.exception("excel表头第二行为姓名");
-                }
-            }
-
-            for (int i = 1; i < list.size(); i++) {
-                Map<String, String> objectMap = list.get(i);
-                boolean error = false;
-                JSONArray jsonArray = new JSONArray();
-                TCScoreNormal tcScoreNormal = new TCScoreNormal(examId, courseCode, markPaper.getCourseName(), paperNumber, sysUser.getId());
-                for (Map.Entry<String, String> entry : objectMap.entrySet()) {
-                    JSONObject jsonObject = new JSONObject();
-                    if (Objects.isNull(entry.getValue()) || Objects.equals(entry.getValue().trim(), "")) {
-                        errorData.add("excel第" + i + "行[").add(headMap.get(entry.getKey()) + "]为空;").add("\r\n");
-                        error = true;
-                    } else {
-                        String head = headMap.get(entry.getKey());
-                        Objects.requireNonNull(head, "表头信息异常");
-                        if (Objects.equals(head.trim(), "学号")) {
-                            tcScoreNormal.setExamNumber(entry.getValue());
-                        } else if (Objects.equals(head.trim(), "姓名")) {
-                            tcScoreNormal.setName(entry.getValue());
-                        } else {
-                            jsonObject.put("name", headMap.get(entry.getKey()));
-                            jsonObject.put("score", entry.getValue());
-                            jsonArray.add(jsonObject);
-                        }
-                    }
-                }
-                if (jsonArray.size() > 0) {
-                    tcScoreNormal.setScoreNormal(jsonArray.toJSONString());
-                }
-                if (!error) {
-                    tcScoreNormalList.add(tcScoreNormal);
-                }
-            }
-            if (!CollectionUtils.isEmpty(tcScoreNormalList)) {
-                successData.add("共导入" + tcScoreNormalList.size() + "条数据");
-
-                QueryWrapper<TCScoreNormal> tcScoreNormalQueryWrapper = new QueryWrapper<>();
-                tcScoreNormalQueryWrapper.lambda().eq(TCScoreNormal::getExamId, examId)
-                        .eq(TCScoreNormal::getCourseCode, courseCode)
-                        .eq(TCScoreNormal::getCourseName, markPaper.getCourseName())
-                        .eq(TCScoreNormal::getPaperNumber, paperNumber);
-                tcScoreNormalService.remove(tcScoreNormalQueryWrapper);
-                tcScoreNormalService.saveBatch(tcScoreNormalList);
-            }
-            messageMap.put("正确信息", successData.length() > 0 ? successData.toString() : "无");
-            messageMap.put("错误信息", errorData.length() > 0 ? errorData.toString() : "无");
-        } catch (Exception e) {
-            log.error(SystemConstant.LOG_ERROR, e);
-            if (e instanceof DuplicateKeyException) {
-                String errorColumn = e.getCause().toString();
-                String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length()).replaceAll("'", "");
-                throw ExceptionResultEnum.SQL_ERROR.exception("[" + FieldUniqueEnum.convertToTitle(columnStr) + "]数据不允许重复插入");
-            } else if (e instanceof ApiException) {
-                ResultUtil.error((ApiException) e, ((ApiException) e).getCode(), e.getMessage());
-            } else {
-                ResultUtil.error(e.getMessage());
-            }
-        }
-        log.debug("导入Excel结束...");
-        long end = System.currentTimeMillis();
-        log.info("============耗时{}秒============:", (end - start) / 1000);
-        return ResultUtil.ok(messageMap);
-    }
-
-    @ApiOperation(value = "平时成绩列表")
-    @RequestMapping(value = "/score/normal/list", method = RequestMethod.POST)
-    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.SEARCH)
-    @ApiResponses({@ApiResponse(code = 200, message = "分页查询", response = EditResult.class)})
-    public Object scoreNormalList(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
-                                  @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
-                                  @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber,
-                                  @ApiParam(value = "分页页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
-                                  @ApiParam(value = "分页数", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) throws IOException {
-        return ResultUtil.ok(true);
-    }
-
-    @ApiOperation(value = "平时成绩编辑")
-    @RequestMapping(value = "/score/normal/edit", method = RequestMethod.POST)
-    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.EDIT)
-    @ApiResponses({@ApiResponse(code = 200, message = "编辑", response = EditResult.class)})
-    public Object scoreNormalEdit(@ApiParam(value = "主键", required = true) @RequestParam Long id) throws IOException {
-        return ResultUtil.ok(true);
-    }
-
-    @ApiOperation(value = "平时成绩保存")
-    @RequestMapping(value = "/score/normal/save", method = RequestMethod.POST)
-    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.UPDATE)
-    @ApiResponses({@ApiResponse(code = 200, message = "保存", response = EditResult.class)})
-    public Object scoreNormalSave(@ApiParam(value = "主键", required = true) @RequestParam Long id,
-                                  @ApiParam(value = "平时成绩json", required = true) @RequestParam String socreNormal) throws IOException {
-        return ResultUtil.ok(true);
-    }
-
-    @ApiOperation(value = "平时成绩启用/禁用")
-    @RequestMapping(value = "/score/normal/enable", method = RequestMethod.POST)
-    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.UPDATE)
-    @ApiResponses({@ApiResponse(code = 200, message = "编辑", response = EditResult.class)})
-    public Object scoreNormalEnable(@ApiParam(value = "主键", required = true) @RequestParam Long id,
-                                    @ApiParam(value = "启用/禁用", required = true) @RequestParam Boolean enable) throws IOException {
-        return ResultUtil.ok(true);
-    }
-}

+ 129 - 0
distributed-print/src/main/java/com/qmth/distributed/print/api/TCUsualScoreController.java

@@ -0,0 +1,129 @@
+package com.qmth.distributed.print.api;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.distributed.print.business.bean.excel.ExcelField;
+import com.qmth.distributed.print.business.bean.result.EditResult;
+import com.qmth.distributed.print.business.bean.result.ScoreResult;
+import com.qmth.distributed.print.business.service.PrintCommonService;
+import com.qmth.distributed.print.business.service.TCUsualScoreService;
+import com.qmth.teachcloud.common.annotation.OperationLogDetail;
+import com.qmth.teachcloud.common.contant.SystemConstant;
+import com.qmth.teachcloud.common.enums.log.CustomizedOperationTypeEnum;
+import com.qmth.teachcloud.common.util.ResultUtil;
+import io.swagger.annotations.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * <p>
+ * 平常作业成绩表 前端控制器
+ * </p>
+ *
+ * @author wangliang
+ * @since 2024-02-18
+ */
+@Api(tags = "课程目标达成度-成绩管理-平常作业成绩Controller")
+@RestController
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + SystemConstant.PREFIX_URL_COURSE_DEGREE)
+public class TCUsualScoreController {
+    private final static Logger log = LoggerFactory.getLogger(TCUsualScoreController.class);
+
+    @Resource
+    TCUsualScoreService tcUsualScoreService;
+
+    @Resource
+    PrintCommonService printCommonService;
+
+    @ApiOperation(value = "成绩管理列表")
+    @RequestMapping(value = "/score/list", method = RequestMethod.POST)
+    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.SEARCH)
+    @ApiResponses({@ApiResponse(code = 200, message = "分页查询", response = ScoreResult.class)})
+    public Object scoreList(@ApiParam(value = "考试ID", required = true) @RequestParam Long examId,
+                            @ApiParam(value = "课程编码") @RequestParam(required = false) String courseCode,
+                            @ApiParam(value = "分页页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
+                            @ApiParam(value = "分页数", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
+        return ResultUtil.ok(printCommonService.scoreList(new Page<>(pageNumber, pageSize), examId, courseCode));
+    }
+
+    @ApiOperation(value = "导入平时成绩-模板下载")
+    @RequestMapping(value = "/usual_score/template_download", method = RequestMethod.POST)
+    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.EXPORT)
+    @ApiResponses({@ApiResponse(code = 200, message = "下载成功", response = Object.class)})
+    public void usualScoreTemplateDownload(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
+                                           @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
+                                           @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
+        //TODO 待曹子轩补充接口
+        List<ExcelField> excelFieldList = new ArrayList<>();
+        excelFieldList.add(new ExcelField("studentCode", "学号", true));
+        excelFieldList.add(new ExcelField("name", "姓名", true));
+        excelFieldList.add(new ExcelField("score1", "作业1", true));
+        excelFieldList.add(new ExcelField("score2", "作业2", true));
+        excelFieldList.add(new ExcelField("score3", "作业3", false));
+        printCommonService.scoreDownLoadExaminationTemplate("1、所有字段均为必填字段;\n" +
+                "2、平时成绩各项数据均需要填写;\n" +
+                "3、请不要删除此行,也不要删除模板中的任何列。\n" +
+                "4、使用前请先删除样例数据。", "sheet1", "平时成绩导入模版", excelFieldList);
+    }
+
+    @ApiOperation(value = "导入平时成绩")
+    @RequestMapping(value = "/usual_score/import", method = RequestMethod.POST)
+    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.IMPORT)
+    @ApiResponses({@ApiResponse(code = 200, message = "导入成功", response = EditResult.class)})
+    public Object usualScoreImport(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file,
+                                   @ApiParam(value = "考试id", required = true) @RequestParam Long examId,
+                                   @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
+                                   @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
+        return ResultUtil.ok(tcUsualScoreService.usualScoreExcelImport(file, examId, courseCode, paperNumber));
+    }
+
+    @ApiOperation(value = "平时成绩列表")
+    @RequestMapping(value = "/usual_score/list", method = RequestMethod.POST)
+    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.SEARCH)
+    @ApiResponses({@ApiResponse(code = 200, message = "分页查询", response = EditResult.class)})
+    public Object usualScoreList(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
+                                 @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
+                                 @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber,
+                                 @ApiParam(value = "分页页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
+                                 @ApiParam(value = "分页数", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) throws IOException {
+        return ResultUtil.ok(tcUsualScoreService.usualScoreList(new Page<>(pageNumber, pageSize), examId, courseCode, paperNumber));
+    }
+
+    @ApiOperation(value = "平时成绩编辑")
+    @RequestMapping(value = "/usual_score/edit", method = RequestMethod.POST)
+    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.EDIT)
+    @ApiResponses({@ApiResponse(code = 200, message = "编辑", response = EditResult.class)})
+    public Object usualScoreEdit(@ApiParam(value = "主键", required = true) @RequestParam Long id) throws IOException {
+        return ResultUtil.ok(true);
+    }
+
+    @ApiOperation(value = "平时成绩保存")
+    @RequestMapping(value = "/usual_score/save", method = RequestMethod.POST)
+    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.UPDATE)
+    @ApiResponses({@ApiResponse(code = 200, message = "保存", response = EditResult.class)})
+    public Object usualScoreSave(@ApiParam(value = "主键", required = true) @RequestParam Long id,
+                                 @ApiParam(value = "平时成绩json", required = true) @RequestParam String socreNormal) throws IOException {
+        return ResultUtil.ok(true);
+    }
+
+    @ApiOperation(value = "平时成绩启用/禁用")
+    @RequestMapping(value = "/usual_score/enable", method = RequestMethod.POST)
+    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.UPDATE)
+    @ApiResponses({@ApiResponse(code = 200, message = "编辑", response = EditResult.class)})
+    public Object usualScoreEnable(@ApiParam(value = "主键", required = true) @RequestParam Long id,
+                                   @ApiParam(value = "启用/禁用", required = true) @RequestParam Boolean enable) throws IOException {
+        return ResultUtil.ok(true);
+    }
+}

+ 4 - 5
distributed-print/src/main/java/com/qmth/distributed/print/api/TRBasicInfoController.java

@@ -3,7 +3,7 @@ package com.qmth.distributed.print.api;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.distributed.print.business.bean.result.ScoreResult;
-import com.qmth.distributed.print.business.service.TCScoreNormalService;
+import com.qmth.distributed.print.business.service.PrintCommonService;
 import com.qmth.teachcloud.common.annotation.OperationLogDetail;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.enums.log.CustomizedOperationTypeEnum;
@@ -30,18 +30,17 @@ import java.io.IOException;
 public class TRBasicInfoController {
 
     @Resource
-    TCScoreNormalService tcScoreNormalService;
+    PrintCommonService printCommonService;
 
     @ApiOperation(value = "报告管理列表")
     @RequestMapping(value = "/report/list", method = RequestMethod.POST)
     @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.SEARCH)
     @ApiResponses({@ApiResponse(code = 200, message = "分页查询", response = ScoreResult.class)})
-    public Object reportList(@ApiParam(value = "学期ID", required = true) @RequestParam Long semesterId,
-                             @ApiParam(value = "考试ID", required = true) @RequestParam Long examId,
+    public Object reportList(@ApiParam(value = "考试ID", required = true) @RequestParam Long examId,
                              @ApiParam(value = "课程编码") @RequestParam(required = false) String courseCode,
                              @ApiParam(value = "分页页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
                              @ApiParam(value = "分页数", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
-        return ResultUtil.ok(tcScoreNormalService.scoreList(new Page<>(pageNumber, pageSize), semesterId, examId, courseCode));
+        return ResultUtil.ok(printCommonService.scoreList(new Page<>(pageNumber, pageSize), examId, courseCode));
     }
 
     @ApiOperation(value = "查看报告")