Browse Source

课程目标达成度修改

wangliang 1 year ago
parent
commit
93aff7aaf7
28 changed files with 429 additions and 240 deletions
  1. 0 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/report/PaperStructParams.java
  2. 13 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/report/PaperStructDimensionResult.java
  3. 7 6
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TCFinalScore.java
  4. 28 4
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TCPaperStruct.java
  5. 16 4
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TCUsualScore.java
  6. 3 3
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TRBasicInfo.java
  7. 8 8
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TCFinalScoreMapper.java
  8. 2 2
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TCUsualScoreMapper.java
  9. 3 3
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/PrintCommonService.java
  10. 16 8
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TCFinalScoreService.java
  11. 6 3
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TCPaperStructService.java
  12. 6 3
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TCUsualScoreService.java
  13. 8 4
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TRBasicInfoService.java
  14. 2 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TRExamStudentService.java
  15. 9 4
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/PrintCommonServiceImpl.java
  16. 70 35
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TCFinalScoreServiceImpl.java
  17. 33 27
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TCPaperStructServiceImpl.java
  18. 17 14
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TCUsualScoreServiceImpl.java
  19. 49 31
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TRBasicInfoServiceImpl.java
  20. 3 2
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TRExamStudentServiceImpl.java
  21. 10 10
      distributed-print-business/src/main/resources/mapper/TCFinalScoreMapper.xml
  22. 13 15
      distributed-print-business/src/main/resources/mapper/TCUsualScoreMapper.xml
  23. 37 1
      distributed-print/install/mysql/upgrade/3.3.1.sql
  24. 26 9
      distributed-print/src/main/java/com/qmth/distributed/print/api/TCFinalScoreController.java
  25. 11 11
      distributed-print/src/main/java/com/qmth/distributed/print/api/TCPaperStructController.java
  26. 9 7
      distributed-print/src/main/java/com/qmth/distributed/print/api/TCUsualScoreController.java
  27. 22 22
      distributed-print/src/main/java/com/qmth/distributed/print/api/TRBasicInfoController.java
  28. 2 1
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/entity/MarkPaper.java

+ 0 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/report/PaperStructParams.java

@@ -30,7 +30,6 @@ public class PaperStructParams implements Serializable {
     private String courseCode;
     private String courseCode;
 
 
     @ApiModelProperty(value = "试卷编码")
     @ApiModelProperty(value = "试卷编码")
-    @NotNull(message = "试卷编码不能为空")
     private String paperNumber;
     private String paperNumber;
 
 
     @ApiModelProperty(value = "试卷蓝图结构")
     @ApiModelProperty(value = "试卷蓝图结构")

+ 13 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/report/PaperStructDimensionResult.java

@@ -29,6 +29,9 @@ public class PaperStructDimensionResult implements Serializable {
     @Range(min = 1L, message = "小题号最小为1")
     @Range(min = 1L, message = "小题号最小为1")
     private Integer subNumber;
     private Integer subNumber;
 
 
+    @ApiModelProperty(value = "试卷编码")
+    private String paperNumber;
+
     @ApiModelProperty(value = "分数")
     @ApiModelProperty(value = "分数")
     @NotNull(message = "分数不能为空")
     @NotNull(message = "分数不能为空")
     private Double score;
     private Double score;
@@ -45,12 +48,21 @@ public class PaperStructDimensionResult implements Serializable {
 
 
     }
     }
 
 
-    public PaperStructDimensionResult(Integer mainNumber, Integer subNumber, Double score) {
+    public PaperStructDimensionResult(Integer mainNumber, Integer subNumber, String paperNumber, Double score) {
         this.mainNumber = mainNumber;
         this.mainNumber = mainNumber;
         this.subNumber = subNumber;
         this.subNumber = subNumber;
+        this.paperNumber = paperNumber;
         this.score = score;
         this.score = score;
     }
     }
 
 
+    public String getPaperNumber() {
+        return paperNumber;
+    }
+
+    public void setPaperNumber(String paperNumber) {
+        this.paperNumber = paperNumber;
+    }
+
     public String getCourseTargetName() {
     public String getCourseTargetName() {
         return courseTargetName;
         return courseTargetName;
     }
     }

+ 7 - 6
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TCFinalScore.java

@@ -60,31 +60,32 @@ public class TCFinalScore extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "来源,EXCEL_IMPORT:excel导入,SYNC:数据同步")
     @ApiModelProperty(value = "来源,EXCEL_IMPORT:excel导入,SYNC:数据同步")
     private SourceEnum source;
     private SourceEnum source;
 
 
-    @JsonSerialize(using = ToStringSerializer.class)
     @ApiModelProperty(value = "教学课程id")
     @ApiModelProperty(value = "教学课程id")
-    @TableField(exist = false)
+    @JsonSerialize(using = ToStringSerializer.class)
     private Long teachCourseId;
     private Long teachCourseId;
 
 
     public TCFinalScore() {
     public TCFinalScore() {
 
 
     }
     }
 
 
-    public TCFinalScore(Long examId, String courseCode, String courseName, String paperNumber, SourceEnum source, Long userId) {
+    public TCFinalScore(Long examId, String courseCode, String courseName, String paperNumber, Long teachCourseId, SourceEnum source, Long userId) {
         insertInfo(userId);
         insertInfo(userId);
         this.examId = examId;
         this.examId = examId;
         this.courseCode = courseCode;
         this.courseCode = courseCode;
         this.courseName = courseName;
         this.courseName = courseName;
         this.paperNumber = paperNumber;
         this.paperNumber = paperNumber;
+        this.teachCourseId = teachCourseId;
         this.source = source;
         this.source = source;
         this.enable = true;
         this.enable = true;
     }
     }
 
 
-    public TCFinalScore(MarkStudentScoreVo markStudentScoreVo, String scoreDetail, SourceEnum source, Long userId) {
+    public TCFinalScore(MarkStudentScoreVo markStudentScoreVo, String scoreDetail, SourceEnum source, Long userId, Long teachCourseId) {
         insertInfo(userId);
         insertInfo(userId);
         this.examId = markStudentScoreVo.getExamId();
         this.examId = markStudentScoreVo.getExamId();
         this.courseCode = markStudentScoreVo.getCourseCode();
         this.courseCode = markStudentScoreVo.getCourseCode();
         this.courseName = markStudentScoreVo.getCourseName();
         this.courseName = markStudentScoreVo.getCourseName();
         this.paperNumber = markStudentScoreVo.getPaperNumber();
         this.paperNumber = markStudentScoreVo.getPaperNumber();
+        this.teachCourseId = teachCourseId;
         this.name = markStudentScoreVo.getStudentName();
         this.name = markStudentScoreVo.getStudentName();
         this.studentCode = markStudentScoreVo.getStudentCode();
         this.studentCode = markStudentScoreVo.getStudentCode();
         this.score = markStudentScoreVo.getTotalScore();
         this.score = markStudentScoreVo.getTotalScore();
@@ -197,11 +198,11 @@ public class TCFinalScore extends BaseEntity implements Serializable {
             return false;
             return false;
         }
         }
         TCFinalScore that = (TCFinalScore) o;
         TCFinalScore that = (TCFinalScore) o;
-        return examId.equals(that.examId) && courseCode.equals(that.courseCode) && Objects.equals(courseName, that.courseName) && paperNumber.equals(that.paperNumber) && name.equals(that.name) && studentCode.equals(that.studentCode) && score.equals(that.score) && scoreDetail.equals(that.scoreDetail) && enable.equals(that.enable) && Objects.equals(getCreateId(), that.getCreateId());
+        return examId.equals(that.examId) && courseCode.equals(that.courseCode) && Objects.equals(courseName, that.courseName) && Objects.equals(paperNumber, that.paperNumber) && teachCourseId.equals(that.teachCourseId) && name.equals(that.name) && studentCode.equals(that.studentCode) && score.equals(that.score) && scoreDetail.equals(that.scoreDetail) && enable.equals(that.enable) && Objects.equals(getCreateId(), that.getCreateId());
     }
     }
 
 
     @Override
     @Override
     public int hashCode() {
     public int hashCode() {
-        return Objects.hash(examId, courseCode, courseName, paperNumber, name, studentCode, score, scoreDetail, enable, getCreateId());
+        return Objects.hash(examId, courseCode, courseName, paperNumber, teachCourseId, name, studentCode, score, scoreDetail, enable, getCreateId());
     }
     }
 }
 }

+ 28 - 4
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TCPaperStruct.java

@@ -37,6 +37,10 @@ public class TCPaperStruct extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "试卷编码")
     @ApiModelProperty(value = "试卷编码")
     private String paperNumber;
     private String paperNumber;
 
 
+    @ApiModelProperty(value = "教学课程id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long teachCourseId;
+
     @ApiModelProperty(value = "试卷结构")
     @ApiModelProperty(value = "试卷结构")
     @TableField(value = "paper_struct", updateStrategy = FieldStrategy.IGNORED)
     @TableField(value = "paper_struct", updateStrategy = FieldStrategy.IGNORED)
     private String paperStruct;
     private String paperStruct;
@@ -62,23 +66,25 @@ public class TCPaperStruct extends BaseEntity implements Serializable {
 
 
     }
     }
 
 
-    public TCPaperStruct(Long examId, String courseCode, String courseName, String paperNumber, String paperStructDimension, Long userId, Long dimensionSign) {
+    public TCPaperStruct(Long examId, String courseCode, String courseName, String paperNumber, Long teachCourseId, String paperStructDimension, Long userId, Long dimensionSign) {
         insertInfo(userId);
         insertInfo(userId);
         this.examId = examId;
         this.examId = examId;
         this.courseCode = courseCode;
         this.courseCode = courseCode;
         this.courseName = courseName;
         this.courseName = courseName;
         this.paperNumber = paperNumber;
         this.paperNumber = paperNumber;
+        this.teachCourseId = teachCourseId;
         this.paperStructDimension = paperStructDimension;
         this.paperStructDimension = paperStructDimension;
         this.enable = true;
         this.enable = true;
         this.dimensionSign = dimensionSign;
         this.dimensionSign = dimensionSign;
     }
     }
 
 
-    public TCPaperStruct(Long examId, String courseCode, String courseName, String paperNumber, String paperStruct, Double totalScore, Double passScore, Long userId) {
+    public TCPaperStruct(Long examId, String courseCode, String courseName, String paperNumber, Long teachCourseId, String paperStruct, Double totalScore, Double passScore, Long userId) {
         insertInfo(userId);
         insertInfo(userId);
         this.examId = examId;
         this.examId = examId;
         this.courseCode = courseCode;
         this.courseCode = courseCode;
         this.courseName = courseName;
         this.courseName = courseName;
         this.paperNumber = paperNumber;
         this.paperNumber = paperNumber;
+        this.teachCourseId = teachCourseId;
         this.paperStruct = paperStruct;
         this.paperStruct = paperStruct;
         this.totalScore = totalScore;
         this.totalScore = totalScore;
         this.passScore = passScore;
         this.passScore = passScore;
@@ -90,6 +96,24 @@ public class TCPaperStruct extends BaseEntity implements Serializable {
         updateInfo(userId);
         updateInfo(userId);
     }
     }
 
 
+    public TCPaperStruct(Long examId, String courseCode, String courseName, String paperNumber, Long teachCourseId, Long userId) {
+        insertInfo(userId);
+        this.examId = examId;
+        this.courseCode = courseCode;
+        this.courseName = courseName;
+        this.paperNumber = paperNumber;
+        this.teachCourseId = teachCourseId;
+        this.enable = true;
+    }
+
+    public Long getTeachCourseId() {
+        return teachCourseId;
+    }
+
+    public void setTeachCourseId(Long teachCourseId) {
+        this.teachCourseId = teachCourseId;
+    }
+
     public Double getTotalScore() {
     public Double getTotalScore() {
         return totalScore;
         return totalScore;
     }
     }
@@ -179,11 +203,11 @@ public class TCPaperStruct extends BaseEntity implements Serializable {
             return false;
             return false;
         }
         }
         TCPaperStruct that = (TCPaperStruct) o;
         TCPaperStruct that = (TCPaperStruct) o;
-        return examId.equals(that.examId) && courseCode.equals(that.courseCode) && Objects.equals(courseName, that.courseName) && paperNumber.equals(that.paperNumber) && Objects.equals(paperStruct, that.paperStruct) && Objects.equals(paperStructDimension, that.paperStructDimension) && Objects.equals(getCreateId(), that.getCreateId());
+        return examId.equals(that.examId) && courseCode.equals(that.courseCode) && Objects.equals(courseName, that.courseName) && Objects.equals(paperNumber, that.paperNumber) && teachCourseId.equals(that.teachCourseId) && Objects.equals(paperStruct, that.paperStruct) && Objects.equals(paperStructDimension, that.paperStructDimension) && Objects.equals(getCreateId(), that.getCreateId());
     }
     }
 
 
     @Override
     @Override
     public int hashCode() {
     public int hashCode() {
-        return Objects.hash(examId, courseCode, courseName, paperNumber, paperStruct, paperStructDimension, getCreateId());
+        return Objects.hash(examId, courseCode, courseName, paperNumber, teachCourseId, paperStruct, paperStructDimension, getCreateId());
     }
     }
 }
 }

+ 16 - 4
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TCUsualScore.java

@@ -1,6 +1,5 @@
 package com.qmth.distributed.print.business.entity;
 package com.qmth.distributed.print.business.entity;
 
 
-import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.teachcloud.common.base.BaseEntity;
 import com.qmth.teachcloud.common.base.BaseEntity;
@@ -37,6 +36,10 @@ public class TCUsualScore extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "试卷编码")
     @ApiModelProperty(value = "试卷编码")
     private String paperNumber;
     private String paperNumber;
 
 
+    @ApiModelProperty(value = "教学课程id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long teachCourseId;
+
     @ApiModelProperty(value = "考生姓名")
     @ApiModelProperty(value = "考生姓名")
     @NotNull(message = "考生姓名不能为空")
     @NotNull(message = "考生姓名不能为空")
     private String name;
     private String name;
@@ -55,12 +58,13 @@ public class TCUsualScore extends BaseEntity implements Serializable {
 
 
     }
     }
 
 
-    public TCUsualScore(Long examId, String courseCode, String courseName, String paperNumber, Long userId) {
+    public TCUsualScore(Long examId, String courseCode, String courseName, String paperNumber, Long teachCourseId, Long userId) {
         insertInfo(userId);
         insertInfo(userId);
         this.examId = examId;
         this.examId = examId;
         this.courseCode = courseCode;
         this.courseCode = courseCode;
         this.courseName = courseName;
         this.courseName = courseName;
         this.paperNumber = paperNumber;
         this.paperNumber = paperNumber;
+        this.teachCourseId = teachCourseId;
         this.enable = true;
         this.enable = true;
     }
     }
 
 
@@ -70,6 +74,14 @@ public class TCUsualScore extends BaseEntity implements Serializable {
         this.score = tcUsualScore.getScore();
         this.score = tcUsualScore.getScore();
     }
     }
 
 
+    public Long getTeachCourseId() {
+        return teachCourseId;
+    }
+
+    public void setTeachCourseId(Long teachCourseId) {
+        this.teachCourseId = teachCourseId;
+    }
+
     public Long getExamId() {
     public Long getExamId() {
         return examId;
         return examId;
     }
     }
@@ -143,11 +155,11 @@ public class TCUsualScore extends BaseEntity implements Serializable {
             return false;
             return false;
         }
         }
         TCUsualScore that = (TCUsualScore) o;
         TCUsualScore that = (TCUsualScore) o;
-        return examId.equals(that.examId) && courseCode.equals(that.courseCode) && Objects.equals(courseName, that.courseName) && paperNumber.equals(that.paperNumber) && name.equals(that.name) && studentCode.equals(that.studentCode) && score.equals(that.score) && enable.equals(that.enable) && Objects.equals(getCreateId(), that.getCreateId());
+        return examId.equals(that.examId) && courseCode.equals(that.courseCode) && Objects.equals(courseName, that.courseName) && teachCourseId.equals(that.teachCourseId) && name.equals(that.name) && studentCode.equals(that.studentCode) && score.equals(that.score) && enable.equals(that.enable) && Objects.equals(getCreateId(), that.getCreateId());
     }
     }
 
 
     @Override
     @Override
     public int hashCode() {
     public int hashCode() {
-        return Objects.hash(examId, courseCode, courseName, paperNumber, name, studentCode, score, enable, getCreateId());
+        return Objects.hash(examId, courseCode, courseName, teachCourseId, name, studentCode, score, enable, getCreateId());
     }
     }
 }
 }

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

@@ -38,7 +38,6 @@ public class TRBasicInfo extends BaseEntity implements Serializable {
     private String courseName;
     private String courseName;
 
 
     @ApiModelProperty(value = "试卷编码")
     @ApiModelProperty(value = "试卷编码")
-    @NotNull(message = "试卷编码不能为空")
     private String paperNumber;
     private String paperNumber;
 
 
     @ApiModelProperty(value = "课程性质")
     @ApiModelProperty(value = "课程性质")
@@ -95,19 +94,19 @@ public class TRBasicInfo extends BaseEntity implements Serializable {
 
 
     @JsonSerialize(using = ToStringSerializer.class)
     @JsonSerialize(using = ToStringSerializer.class)
     @ApiModelProperty(value = "教学课程id")
     @ApiModelProperty(value = "教学课程id")
-    @TableField(exist = false)
     private Long teachCourseId;
     private Long teachCourseId;
 
 
     public TRBasicInfo() {
     public TRBasicInfo() {
 
 
     }
     }
 
 
-    public TRBasicInfo(Long examId, String courseCode, String courseName, String paperNumber, String openTime, String teachingObject, String teacher, Integer participantCount, Long userId) {
+    public TRBasicInfo(Long examId, String courseCode, String courseName, String paperNumber, Long teachCourseId, String openTime, String teachingObject, String teacher, Integer participantCount, Long userId) {
         insertInfo(userId);
         insertInfo(userId);
         this.examId = examId;
         this.examId = examId;
         this.courseCode = courseCode;
         this.courseCode = courseCode;
         this.courseName = courseName;
         this.courseName = courseName;
         this.paperNumber = paperNumber;
         this.paperNumber = paperNumber;
+        this.teachCourseId = teachCourseId;
         this.openTime = openTime;
         this.openTime = openTime;
         this.teachingObject = teachingObject;
         this.teachingObject = teachingObject;
         this.teacher = teacher;
         this.teacher = teacher;
@@ -132,6 +131,7 @@ public class TRBasicInfo extends BaseEntity implements Serializable {
         this.courseCode = trBasicInfo.getCourseCode();
         this.courseCode = trBasicInfo.getCourseCode();
         this.courseName = trBasicInfo.getCourseName();
         this.courseName = trBasicInfo.getCourseName();
         this.paperNumber = trBasicInfo.getPaperNumber();
         this.paperNumber = trBasicInfo.getPaperNumber();
+        this.teachCourseId = trBasicInfo.getTeachCourseId();
         this.courseType = trBasicInfo.getCourseType();
         this.courseType = trBasicInfo.getCourseType();
         this.credit = trBasicInfo.getCredit();
         this.credit = trBasicInfo.getCredit();
         this.period = trBasicInfo.getPeriod();
         this.period = trBasicInfo.getPeriod();

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

@@ -27,10 +27,10 @@ public interface TCFinalScoreMapper extends BaseMapper<TCFinalScore> {
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
-     * @param userId
+     * @param teachCourseId
      * @return
      * @return
      */
      */
-    public IPage<TCFinalScore> finalScoreList(IPage<Map> iPage, @Param("examId") Long examId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("userId") Long userId);
+    public IPage<TCFinalScore> finalScoreList(IPage<Map> iPage, @Param("examId") Long examId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("teachCourseId") Long teachCourseId);
 
 
     /**
     /**
      * 查找期末成绩分数图
      * 查找期末成绩分数图
@@ -38,10 +38,10 @@ public interface TCFinalScoreMapper extends BaseMapper<TCFinalScore> {
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
-     * @param userId
+     * @param teachCourseId
      * @return
      * @return
      */
      */
-    public FinalScoreDto finalScoreScoreOverView(@Param("examId") Long examId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("userId") Long userId);
+    public FinalScoreDto finalScoreScoreOverView(@Param("examId") Long examId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("teachCourseId") Long teachCourseId);
 
 
     /**
     /**
      * 查找期末成绩分数区间
      * 查找期末成绩分数区间
@@ -49,12 +49,12 @@ public interface TCFinalScoreMapper extends BaseMapper<TCFinalScore> {
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @param start
      * @param start
      * @param end
      * @param end
-     * @param userId
      * @return
      * @return
      */
      */
-    public int getCountByScoreRange(@Param("examId") Long examId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("start") Double start, @Param("end") Double end, @Param("userId") Long userId);
+    public int getCountByScoreRange(@Param("examId") Long examId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("teachCourseId") Long teachCourseId, @Param("start") Double start, @Param("end") Double end);
 
 
     /**
     /**
      * 查找考生成绩
      * 查找考生成绩
@@ -62,8 +62,8 @@ public interface TCFinalScoreMapper extends BaseMapper<TCFinalScore> {
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
-     * @param userId
+     * @param teachCourseId
      * @return
      * @return
      */
      */
-    public List<FinalScoreResult> examStudentOverview(@Param("examId") Long examId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("userId") Long userId);
+    public List<FinalScoreResult> examStudentOverview(@Param("examId") Long examId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("teachCourseId") Long teachCourseId);
 }
 }

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

@@ -37,8 +37,8 @@ public interface TCUsualScoreMapper extends BaseMapper<TCUsualScore> {
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
-     * @param userId
+     * @param teachCourseId
      * @return
      * @return
      */
      */
-    public IPage<TCUsualScore> usualScoreList(IPage<Map> iPage, @Param("examId") Long examId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("userId") Long userId);
+    public IPage<TCUsualScore> usualScoreList(IPage<Map> iPage, @Param("examId") Long examId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("teachCourseId") Long teachCourseId);
 }
 }

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

@@ -22,7 +22,6 @@ import com.qmth.teachcloud.common.enums.PageSizeEnum;
 import com.qmth.teachcloud.common.enums.TaskTypeEnum;
 import com.qmth.teachcloud.common.enums.TaskTypeEnum;
 import com.qmth.teachcloud.common.enums.UploadFileEnum;
 import com.qmth.teachcloud.common.enums.UploadFileEnum;
 import com.qmth.teachcloud.mark.entity.MarkPaper;
 import com.qmth.teachcloud.mark.entity.MarkPaper;
-import org.springframework.scheduling.annotation.Async;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
 import java.io.ByteArrayOutputStream;
 import java.io.ByteArrayOutputStream;
@@ -291,10 +290,11 @@ public interface PrintCommonService {
      * 获取阅卷数据
      * 获取阅卷数据
      *
      *
      * @param examId
      * @param examId
+     * @param courseCode
      * @param paperNumber
      * @param paperNumber
      * @return
      * @return
      */
      */
-    public MarkPaper getMarkPaper(Long examId, String paperNumber);
+    public MarkPaper getMarkPaper(Long examId, String courseCode, String paperNumber);
 
 
     /**
     /**
      * 成绩管理动态生成excel
      * 成绩管理动态生成excel
@@ -325,5 +325,5 @@ public interface PrintCommonService {
      * @param paperNumber
      * @param paperNumber
      * @param teachCourseId
      * @param teachCourseId
      */
      */
-    public void getLock(Long examId, String courseCode, String paperNumber,Long teachCourseId);
+    public void getLock(Long examId, String courseCode, String paperNumber, Long teachCourseId);
 }
 }

+ 16 - 8
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TCFinalScoreService.java

@@ -28,10 +28,11 @@ public interface TCFinalScoreService extends IService<TCFinalScore> {
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      * @throws IOException
      * @throws IOException
      */
      */
-    public Map<String, String> finalScoreExcelImport(MultipartFile file, Long examId, String courseCode, String paperNumber) throws IOException;
+    public Map<String, String> finalScoreExcelImport(MultipartFile file, Long examId, String courseCode, String paperNumber, Long teachCourseId) throws IOException;
 
 
     /**
     /**
      * 期末成绩列表(分页)
      * 期末成绩列表(分页)
@@ -40,9 +41,10 @@ public interface TCFinalScoreService extends IService<TCFinalScore> {
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      */
      */
-    public IPage<TCFinalScore> finalScoreList(IPage<Map> iPage, Long examId, String courseCode, String paperNumber);
+    public IPage<TCFinalScore> finalScoreList(IPage<Map> iPage, Long examId, String courseCode, String paperNumber, Long teachCourseId);
 
 
     /**
     /**
      * 查找期末成绩分数图
      * 查找期末成绩分数图
@@ -50,9 +52,10 @@ public interface TCFinalScoreService extends IService<TCFinalScore> {
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      */
      */
-    public FinalScoreDto finalScoreScoreOverView(Long examId, String courseCode, String paperNumber);
+    public FinalScoreDto finalScoreScoreOverView(Long examId, String courseCode, String paperNumber, Long teachCourseId);
 
 
     /**
     /**
      * 查找期末成绩分数区间
      * 查找期末成绩分数区间
@@ -60,11 +63,12 @@ public interface TCFinalScoreService extends IService<TCFinalScore> {
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @param start
      * @param start
      * @param end
      * @param end
      * @return
      * @return
      */
      */
-    public int getCountByScoreRange(Long examId, String courseCode, String paperNumber, Double start, Double end);
+    public int getCountByScoreRange(Long examId, String courseCode, String paperNumber, Long teachCourseId, Double start, Double end);
 
 
     /**
     /**
      * 查找考生成绩
      * 查找考生成绩
@@ -72,9 +76,10 @@ public interface TCFinalScoreService extends IService<TCFinalScore> {
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      */
      */
-    public List<FinalScoreResult> examStudentOverview(Long examId, String courseCode, String paperNumber);
+    public List<FinalScoreResult> examStudentOverview(Long examId, String courseCode, String paperNumber, Long teachCourseId);
 
 
     /**
     /**
      * 同步期末成绩
      * 同步期末成绩
@@ -82,10 +87,11 @@ public interface TCFinalScoreService extends IService<TCFinalScore> {
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      * @throws IOException
      * @throws IOException
      */
      */
-    public Map<String, String> finalScoreSync(Long examId, String courseCode, String paperNumber) throws IOException;
+    public Map<String, String> finalScoreSync(Long examId, String courseCode, String paperNumber, Long teachCourseId) throws IOException;
 
 
     /**
     /**
      * 根据考试id/课程编码/试卷编码删除数据
      * 根据考试id/课程编码/试卷编码删除数据
@@ -93,9 +99,10 @@ public interface TCFinalScoreService extends IService<TCFinalScore> {
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      */
      */
-    public Boolean remove(Long examId, String courseCode, String paperNumber);
+    public Boolean remove(Long examId, String courseCode, String paperNumber, Long teachCourseId);
 
 
     /**
     /**
      * 根据考试id/课程编码/试卷编码查询数据库数据
      * 根据考试id/课程编码/试卷编码查询数据库数据
@@ -103,9 +110,10 @@ public interface TCFinalScoreService extends IService<TCFinalScore> {
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      */
      */
-    public List<TCFinalScore> queryByExamIdAndCourseCodeAndPaperNumber(Long examId, String courseCode, String paperNumber);
+    public List<TCFinalScore> queryFinalScore(Long examId, String courseCode, String paperNumber, Long teachCourseId);
 
 
     /**
     /**
      * 获取期末考试同步锁
      * 获取期末考试同步锁

+ 6 - 3
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TCPaperStructService.java

@@ -23,9 +23,10 @@ public interface TCPaperStructService extends IService<TCPaperStruct> {
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      */
      */
-    public Boolean remove(Long examId, String courseCode, String paperNumber);
+    public Boolean remove(Long examId, String courseCode, String paperNumber, Long teachCourseId);
 
 
     /**
     /**
      * 导入期末成绩-试卷结构excel
      * 导入期末成绩-试卷结构excel
@@ -34,10 +35,11 @@ public interface TCPaperStructService extends IService<TCPaperStruct> {
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      * @throws IOException
      * @throws IOException
      */
      */
-    public Map<String, String> paperStructExcelImport(MultipartFile file, Long examId, String courseCode, String paperNumber) throws IOException;
+    public Map<String, String> paperStructExcelImport(MultipartFile file, Long examId, String courseCode, String paperNumber, Long teachCourseId) throws IOException;
 
 
     /**
     /**
      * 同步试卷结构
      * 同步试卷结构
@@ -57,9 +59,10 @@ public interface TCPaperStructService extends IService<TCPaperStruct> {
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      */
      */
-    public TCPaperStruct queryByExamIdAndCourseCodeAndPaperNumber(Long examId, String courseCode, String paperNumber);
+    public TCPaperStruct queryPaperStruct(Long examId, String courseCode, String paperNumber, Long teachCourseId);
 
 
     /**
     /**
      * 获取试卷结构同步锁
      * 获取试卷结构同步锁

+ 6 - 3
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TCUsualScoreService.java

@@ -26,10 +26,11 @@ public interface TCUsualScoreService extends IService<TCUsualScore> {
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      * @throws IOException
      * @throws IOException
      */
      */
-    public Map<String, String> usualScoreExcelImport(MultipartFile file, Long examId, String courseCode, String paperNumber) throws IOException;
+    public Map<String, String> usualScoreExcelImport(MultipartFile file, Long examId, String courseCode, String paperNumber, Long teachCourseId) throws IOException;
 
 
     /**
     /**
      * 平时成绩列表(分页)
      * 平时成绩列表(分页)
@@ -38,9 +39,10 @@ public interface TCUsualScoreService extends IService<TCUsualScore> {
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      */
      */
-    public IPage<TCUsualScore> usualScoreList(IPage<Map> iPage, Long examId, String courseCode, String paperNumber);
+    public IPage<TCUsualScore> usualScoreList(IPage<Map> iPage, Long examId, String courseCode, String paperNumber, Long teachCourseId);
 
 
     /**
     /**
      * 根据考试id/课程编码/试卷编码查询数据库数据
      * 根据考试id/课程编码/试卷编码查询数据库数据
@@ -48,7 +50,8 @@ public interface TCUsualScoreService extends IService<TCUsualScore> {
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      */
      */
-    public List<TCUsualScore> queryByExamIdAndCourseCodeAndPaperNumber(Long examId, String courseCode, String paperNumber);
+    public List<TCUsualScore> queryUsualScore(Long examId, String courseCode, String paperNumber, Long teachCourseId);
 }
 }

+ 8 - 4
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TRBasicInfoService.java

@@ -31,9 +31,10 @@ public interface TRBasicInfoService extends IService<TRBasicInfo> {
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      */
      */
-    public TRBasicInfo queryByExamIdAndCourseCodeAndPaperNumber(Long examId, String courseCode, String paperNumber);
+    public TRBasicInfo queryBasicInfo(Long examId, String courseCode, String paperNumber, Long teachCourseId);
 
 
     /**
     /**
      * 获取课程目标考核分布-分数图
      * 获取课程目标考核分布-分数图
@@ -70,9 +71,10 @@ public interface TRBasicInfoService extends IService<TRBasicInfo> {
      * @param markPaper
      * @param markPaper
      * @param userId
      * @param userId
      * @param courseWeightResult
      * @param courseWeightResult
+     * @param teachCourseId
      * @return
      * @return
      */
      */
-    public TRBasicInfo getReportView(TRBasicInfo trBasicInfo, MarkPaper markPaper, Long userId, CourseWeightResult courseWeightResult);
+    public TRBasicInfo getReportView(TRBasicInfo trBasicInfo, MarkPaper markPaper, Long userId, CourseWeightResult courseWeightResult, Long teachCourseId);
 
 
     /**
     /**
      * 构建word动态表格1-课程目标与毕业要求指标点的对应关系
      * 构建word动态表格1-课程目标与毕业要求指标点的对应关系
@@ -121,9 +123,10 @@ public interface TRBasicInfoService extends IService<TRBasicInfo> {
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      */
      */
-    public Boolean remove(Long examId, String courseCode, String paperNumber);
+    public Boolean remove(Long examId, String courseCode, String paperNumber, Long teachCourseId);
 
 
     /**
     /**
      * 查找课程评价值
      * 查找课程评价值
@@ -147,7 +150,8 @@ public interface TRBasicInfoService extends IService<TRBasicInfo> {
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @param clearDimension
      * @param clearDimension
      */
      */
-    public void clearReportData(Long examId, String courseCode, String paperNumber, boolean clearDimension);
+    public void clearReportData(Long examId, String courseCode, String paperNumber, Long teachCourseId, boolean clearDimension);
 }
 }

+ 2 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TRExamStudentService.java

@@ -41,7 +41,8 @@ public interface TRExamStudentService extends IService<TRExamStudent> {
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      */
      */
-    public Boolean remove(Long examId, String courseCode, String paperNumber);
+    public Boolean remove(Long examId, String courseCode, String paperNumber, Long teachCourseId);
 }
 }

+ 9 - 4
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/PrintCommonServiceImpl.java

@@ -401,20 +401,25 @@ public class PrintCommonServiceImpl implements PrintCommonService {
         if (!Objects.equals(fileMd5, reqFileMd5)) {
         if (!Objects.equals(fileMd5, reqFileMd5)) {
             throw ExceptionResultEnum.MD5_EQUALS_FALSE.exception();
             throw ExceptionResultEnum.MD5_EQUALS_FALSE.exception();
         }
         }
-        return this.getMarkPaper(examId, paperNumber);
+        return this.getMarkPaper(examId, courseCode, paperNumber);
     }
     }
 
 
     /**
     /**
      * 获取阅卷数据
      * 获取阅卷数据
      *
      *
      * @param examId
      * @param examId
+     * @param courseCode
      * @param paperNumber
      * @param paperNumber
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public MarkPaper getMarkPaper(Long examId, String paperNumber) {
+    public MarkPaper getMarkPaper(Long examId, String courseCode, String paperNumber) {
         MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, paperNumber);
         MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, paperNumber);
-        Objects.requireNonNull(markPaper, "未找到科目信息");
+        if (Objects.isNull(markPaper)) {
+            BasicCourse basicCourse = basicCourseService.getByCode(courseCode);
+            Objects.requireNonNull(basicCourse, "未找到基础课程信息");
+            markPaper = new MarkPaper(examId, courseCode, basicCourse.getName(), paperNumber, 100d, 60d);
+        }
         return markPaper;
         return markPaper;
     }
     }
 
 
@@ -1348,7 +1353,7 @@ public class PrintCommonServiceImpl implements PrintCommonService {
         List<ExamStudent> examStudentList = new ArrayList<>();
         List<ExamStudent> examStudentList = new ArrayList<>();
         for (ExamTaskStudentObjectParam student : examTaskStudentObjectParamList) {
         for (ExamTaskStudentObjectParam student : examTaskStudentObjectParamList) {
             // 禁用考生
             // 禁用考生
-            if(student.isDisabled()){
+            if (student.isDisabled()) {
                 continue;
                 continue;
             }
             }
             Long studentId = student.getStudentId();
             Long studentId = student.getStudentId();

+ 70 - 35
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TCFinalScoreServiceImpl.java

@@ -9,16 +9,21 @@ import com.qmth.boot.tools.excel.enums.ExcelType;
 import com.qmth.distributed.print.business.bean.dto.FinalScoreDto;
 import com.qmth.distributed.print.business.bean.dto.FinalScoreDto;
 import com.qmth.distributed.print.business.bean.dto.TCFinalScoreDto;
 import com.qmth.distributed.print.business.bean.dto.TCFinalScoreDto;
 import com.qmth.distributed.print.business.bean.result.FinalScoreResult;
 import com.qmth.distributed.print.business.bean.result.FinalScoreResult;
+import com.qmth.distributed.print.business.bean.result.report.PaperStructDimensionResult;
 import com.qmth.distributed.print.business.entity.TCFinalScore;
 import com.qmth.distributed.print.business.entity.TCFinalScore;
+import com.qmth.distributed.print.business.entity.TCPaperStruct;
 import com.qmth.distributed.print.business.enums.SourceEnum;
 import com.qmth.distributed.print.business.enums.SourceEnum;
 import com.qmth.distributed.print.business.mapper.TCFinalScoreMapper;
 import com.qmth.distributed.print.business.mapper.TCFinalScoreMapper;
 import com.qmth.distributed.print.business.service.PrintCommonService;
 import com.qmth.distributed.print.business.service.PrintCommonService;
 import com.qmth.distributed.print.business.service.TCFinalScoreService;
 import com.qmth.distributed.print.business.service.TCFinalScoreService;
+import com.qmth.distributed.print.business.service.TCPaperStructService;
 import com.qmth.distributed.print.business.service.TRBasicInfoService;
 import com.qmth.distributed.print.business.service.TRBasicInfoService;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.contant.SystemConstant;
+import com.qmth.teachcloud.common.entity.BasicCourse;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.FieldUniqueEnum;
 import com.qmth.teachcloud.common.enums.FieldUniqueEnum;
+import com.qmth.teachcloud.common.service.BasicCourseService;
 import com.qmth.teachcloud.common.util.JacksonUtil;
 import com.qmth.teachcloud.common.util.JacksonUtil;
 import com.qmth.teachcloud.common.util.RedisUtil;
 import com.qmth.teachcloud.common.util.RedisUtil;
 import com.qmth.teachcloud.common.util.ResultUtil;
 import com.qmth.teachcloud.common.util.ResultUtil;
@@ -68,6 +73,12 @@ public class TCFinalScoreServiceImpl extends ServiceImpl<TCFinalScoreMapper, TCF
     @Resource
     @Resource
     RedisUtil redisUtil;
     RedisUtil redisUtil;
 
 
+    @Resource
+    TCPaperStructService tcPaperStructService;
+
+    @Resource
+    BasicCourseService basicCourseService;
+
     /**
     /**
      * 导入期末成绩excel
      * 导入期末成绩excel
      *
      *
@@ -75,19 +86,19 @@ public class TCFinalScoreServiceImpl extends ServiceImpl<TCFinalScoreMapper, TCF
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      * @throws IOException
      * @throws IOException
      */
      */
     @Override
     @Override
     @Transactional
     @Transactional
-    public Map<String, String> finalScoreExcelImport(MultipartFile file, Long examId, String courseCode, String paperNumber) throws IOException {
+    public Map<String, String> finalScoreExcelImport(MultipartFile file, Long examId, String courseCode, String paperNumber, Long teachCourseId) throws IOException {
         log.debug("导入Excel开始...");
         log.debug("导入Excel开始...");
         long start = System.currentTimeMillis();
         long start = System.currentTimeMillis();
         Map<String, String> messageMap = new LinkedHashMap<>();
         Map<String, String> messageMap = new LinkedHashMap<>();
         try {
         try {
             MarkPaper markPaper = printCommonService.scoreImportExcelVaild(file, examId, courseCode, paperNumber);
             MarkPaper markPaper = printCommonService.scoreImportExcelVaild(file, examId, courseCode, paperNumber);
             Double totalScore = 100d;
             Double totalScore = 100d;
-//            Objects.requireNonNull(totalScore, "试卷满分为空");
 
 
             StringJoiner errorData = new StringJoiner("");
             StringJoiner errorData = new StringJoiner("");
             StringJoiner successData = new StringJoiner("");
             StringJoiner successData = new StringJoiner("");
@@ -118,7 +129,7 @@ public class TCFinalScoreServiceImpl extends ServiceImpl<TCFinalScoreMapper, TCF
                         }
                         }
                         boolean error = false;
                         boolean error = false;
                         List<TCFinalScoreDto> tcFinalScoreDtoList = new ArrayList<>();
                         List<TCFinalScoreDto> tcFinalScoreDtoList = new ArrayList<>();
-                        TCFinalScore tcFinalScore = new TCFinalScore(examId, courseCode, markPaper.getCourseName(), paperNumber, SourceEnum.EXCEL_IMPORT, sysUser.getId());
+                        TCFinalScore tcFinalScore = new TCFinalScore(examId, courseCode, markPaper.getCourseName(), paperNumber, teachCourseId, SourceEnum.EXCEL_IMPORT, sysUser.getId());
                         BigDecimal score = new BigDecimal(0);
                         BigDecimal score = new BigDecimal(0);
                         for (int j = 0; j < strs.length; j++) {
                         for (int j = 0; j < strs.length; j++) {
                             if (Objects.isNull(strs[j]) || Objects.equals(strs[j].trim(), "")) {
                             if (Objects.isNull(strs[j]) || Objects.equals(strs[j].trim(), "")) {
@@ -165,11 +176,11 @@ public class TCFinalScoreServiceImpl extends ServiceImpl<TCFinalScoreMapper, TCF
                 }
                 }
                 if (!CollectionUtils.isEmpty(tcFinalScoreList)) {
                 if (!CollectionUtils.isEmpty(tcFinalScoreList)) {
                     successData.add("共导入").add(tcFinalScoreList.size() + "").add("条数据");
                     successData.add("共导入").add(tcFinalScoreList.size() + "").add("条数据");
-                    List<TCFinalScore> tcFinalScoreDbSourceList = tcFinalScoreService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
+                    List<TCFinalScore> tcFinalScoreDbSourceList = tcFinalScoreService.queryFinalScore(examId, courseCode, paperNumber, teachCourseId);
                     if (CollectionUtils.isEmpty(tcFinalScoreDbSourceList) || !CollectionUtils.isEqualCollection(tcFinalScoreDbSourceList, tcFinalScoreList)) {
                     if (CollectionUtils.isEmpty(tcFinalScoreDbSourceList) || !CollectionUtils.isEqualCollection(tcFinalScoreDbSourceList, tcFinalScoreList)) {
                         tcFinalScoreService.removeByIds(tcFinalScoreDbSourceList.stream().map(s -> s.getId()).collect(Collectors.toList()));
                         tcFinalScoreService.removeByIds(tcFinalScoreDbSourceList.stream().map(s -> s.getId()).collect(Collectors.toList()));
                         tcFinalScoreService.saveBatch(tcFinalScoreList);
                         tcFinalScoreService.saveBatch(tcFinalScoreList);
-                        trBasicInfoService.clearReportData(examId, courseCode, paperNumber, true);
+                        trBasicInfoService.clearReportData(examId, courseCode, paperNumber, teachCourseId, true);
                     }
                     }
                 }
                 }
             }
             }
@@ -200,12 +211,12 @@ public class TCFinalScoreServiceImpl extends ServiceImpl<TCFinalScoreMapper, TCF
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public IPage<TCFinalScore> finalScoreList(IPage<Map> iPage, Long examId, String courseCode, String paperNumber) {
-        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        return this.baseMapper.finalScoreList(iPage, examId, courseCode, paperNumber, sysUser.getId());
+    public IPage<TCFinalScore> finalScoreList(IPage<Map> iPage, Long examId, String courseCode, String paperNumber, Long teachCourseId) {
+        return this.baseMapper.finalScoreList(iPage, examId, courseCode, paperNumber, teachCourseId);
     }
     }
 
 
     /**
     /**
@@ -214,12 +225,12 @@ public class TCFinalScoreServiceImpl extends ServiceImpl<TCFinalScoreMapper, TCF
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public FinalScoreDto finalScoreScoreOverView(Long examId, String courseCode, String paperNumber) {
-        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        return this.baseMapper.finalScoreScoreOverView(examId, courseCode, paperNumber, sysUser.getId());
+    public FinalScoreDto finalScoreScoreOverView(Long examId, String courseCode, String paperNumber, Long teachCourseId) {
+        return this.baseMapper.finalScoreScoreOverView(examId, courseCode, paperNumber, teachCourseId);
     }
     }
 
 
     /**
     /**
@@ -228,14 +239,14 @@ public class TCFinalScoreServiceImpl extends ServiceImpl<TCFinalScoreMapper, TCF
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @param start
      * @param start
      * @param end
      * @param end
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public int getCountByScoreRange(Long examId, String courseCode, String paperNumber, Double start, Double end) {
-        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        return this.baseMapper.getCountByScoreRange(examId, courseCode, paperNumber, start, end, sysUser.getId());
+    public int getCountByScoreRange(Long examId, String courseCode, String paperNumber, Long teachCourseId, Double start, Double end) {
+        return this.baseMapper.getCountByScoreRange(examId, courseCode, paperNumber, teachCourseId, start, end);
     }
     }
 
 
     /**
     /**
@@ -244,12 +255,12 @@ public class TCFinalScoreServiceImpl extends ServiceImpl<TCFinalScoreMapper, TCF
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public List<FinalScoreResult> examStudentOverview(Long examId, String courseCode, String paperNumber) {
-        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        return this.baseMapper.examStudentOverview(examId, courseCode, paperNumber, sysUser.getId());
+    public List<FinalScoreResult> examStudentOverview(Long examId, String courseCode, String paperNumber, Long teachCourseId) {
+        return this.baseMapper.examStudentOverview(examId, courseCode, paperNumber, teachCourseId);
     }
     }
 
 
     /**
     /**
@@ -258,12 +269,13 @@ public class TCFinalScoreServiceImpl extends ServiceImpl<TCFinalScoreMapper, TCF
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      * @throws IOException
      * @throws IOException
      */
      */
     @Override
     @Override
     @Transactional
     @Transactional
-    public Map<String, String> finalScoreSync(Long examId, String courseCode, String paperNumber) throws IOException {
+    public Map<String, String> finalScoreSync(Long examId, String courseCode, String paperNumber, Long teachCourseId) throws IOException {
         Map<String, String> messageMap = new LinkedHashMap<>();
         Map<String, String> messageMap = new LinkedHashMap<>();
         try {
         try {
             SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
             SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
@@ -272,24 +284,41 @@ public class TCFinalScoreServiceImpl extends ServiceImpl<TCFinalScoreMapper, TCF
             List<MarkStudentScoreVo> markStudentScoreVoList = markStudentService.listMarkStudentScoreList(examId, paperNumber);
             List<MarkStudentScoreVo> markStudentScoreVoList = markStudentService.listMarkStudentScoreList(examId, paperNumber);
             if (!CollectionUtils.isEmpty(markStudentScoreVoList)) {
             if (!CollectionUtils.isEmpty(markStudentScoreVoList)) {
                 List<TCFinalScore> tcFinalScoreList = new ArrayList<>(markStudentScoreVoList.size());
                 List<TCFinalScore> tcFinalScoreList = new ArrayList<>(markStudentScoreVoList.size());
-                for (MarkStudentScoreVo markStudentScoreVo : markStudentScoreVoList) {
+                List<PaperStructDimensionResult> paperStructDimensionResultList = new ArrayList<>(markStudentScoreVoList.size());
+                for (int i = 0; i < markStudentScoreVoList.size(); i++) {
+                    MarkStudentScoreVo markStudentScoreVo = markStudentScoreVoList.get(i);
                     if (!CollectionUtils.isEmpty(markStudentScoreVo.getTotalScoreList())) {
                     if (!CollectionUtils.isEmpty(markStudentScoreVo.getTotalScoreList())) {
                         List<TCFinalScoreDto> tcFinalScoreDtoList = new ArrayList<>();
                         List<TCFinalScoreDto> tcFinalScoreDtoList = new ArrayList<>();
                         for (ScoreItem scoreItem : markStudentScoreVo.getTotalScoreList()) {
                         for (ScoreItem scoreItem : markStudentScoreVo.getTotalScoreList()) {
                             String name = scoreItem.getMainNumber() + "-" + scoreItem.getSubNumber();
                             String name = scoreItem.getMainNumber() + "-" + scoreItem.getSubNumber();
                             tcFinalScoreDtoList.add(new TCFinalScoreDto(scoreItem.getScore().toString(), name));
                             tcFinalScoreDtoList.add(new TCFinalScoreDto(scoreItem.getScore().toString(), name));
+                            if (i == 0) {
+                                paperStructDimensionResultList.add(new PaperStructDimensionResult(scoreItem.getMainNumber(), scoreItem.getSubNumber(), paperNumber, scoreItem.getTotalScore()));
+                            }
                         }
                         }
-                        tcFinalScoreList.add(new TCFinalScore(markStudentScoreVo, JacksonUtil.parseJson(tcFinalScoreDtoList), SourceEnum.SYNC, sysUser.getId()));
+                        tcFinalScoreList.add(new TCFinalScore(markStudentScoreVo, JacksonUtil.parseJson(tcFinalScoreDtoList), SourceEnum.SYNC, sysUser.getId(), teachCourseId));
                     }
                     }
                 }
                 }
-                if (!CollectionUtils.isEmpty(tcFinalScoreList)) {
+                if (!CollectionUtils.isEmpty(tcFinalScoreList) && !CollectionUtils.isEmpty(paperStructDimensionResultList)) {
                     successData.add("共同步").add(tcFinalScoreList.size() + "").add("条数据");
                     successData.add("共同步").add(tcFinalScoreList.size() + "").add("条数据");
-                    List<TCFinalScore> tcFinalScoreDbSourceList = tcFinalScoreService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
+                    List<TCFinalScore> tcFinalScoreDbSourceList = tcFinalScoreService.queryFinalScore(examId, courseCode, paperNumber, teachCourseId);
                     if (CollectionUtils.isEmpty(tcFinalScoreDbSourceList) || !CollectionUtils.isEqualCollection(tcFinalScoreDbSourceList, tcFinalScoreList)) {
                     if (CollectionUtils.isEmpty(tcFinalScoreDbSourceList) || !CollectionUtils.isEqualCollection(tcFinalScoreDbSourceList, tcFinalScoreList)) {
                         tcFinalScoreService.removeByIds(tcFinalScoreDbSourceList.stream().map(s -> s.getId()).collect(Collectors.toList()));
                         tcFinalScoreService.removeByIds(tcFinalScoreDbSourceList.stream().map(s -> s.getId()).collect(Collectors.toList()));
                         tcFinalScoreService.saveBatch(tcFinalScoreList);
                         tcFinalScoreService.saveBatch(tcFinalScoreList);
-                        trBasicInfoService.clearReportData(examId, courseCode, paperNumber, true);
+                        trBasicInfoService.clearReportData(examId, courseCode, paperNumber, teachCourseId, true);
+                    }
+                    TCPaperStruct tcPaperStruct = tcPaperStructService.queryPaperStruct(examId, courseCode, paperNumber, teachCourseId);
+                    if (Objects.nonNull(tcPaperStruct)) {
+                        tcPaperStruct.setPaperNumber(paperNumber);
+                        tcPaperStruct.setPaperStruct(JacksonUtil.parseJson(paperStructDimensionResultList));
+                        tcPaperStruct.updateInfo(sysUser.getId());
+                        tcPaperStructService.updateById(tcPaperStruct);
+                    } else {
+                        BasicCourse basicCourse = basicCourseService.getByCode(courseCode);
+                        Objects.requireNonNull(basicCourse, "未找到基础课程信息");
+                        tcPaperStruct = new TCPaperStruct(examId, courseCode, basicCourse.getName(), paperNumber, teachCourseId, sysUser.getId());
                     }
                     }
+                    tcPaperStructService.saveOrUpdate(tcPaperStruct);
                 }
                 }
             }
             }
             messageMap.put(SystemConstant.SUCCESS, successData.length() > 0 ? successData.toString() : "无");
             messageMap.put(SystemConstant.SUCCESS, successData.length() > 0 ? successData.toString() : "无");
@@ -315,16 +344,19 @@ public class TCFinalScoreServiceImpl extends ServiceImpl<TCFinalScoreMapper, TCF
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      */
      */
     @Override
     @Override
     @Transactional
     @Transactional
-    public Boolean remove(Long examId, String courseCode, String paperNumber) {
-        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        return tcFinalScoreService.remove(new QueryWrapper<TCFinalScore>().lambda().eq(TCFinalScore::getExamId, examId)
-                .eq(TCFinalScore::getCourseCode, courseCode)
-                .eq(TCFinalScore::getPaperNumber, paperNumber)
-                .eq(TCFinalScore::getCreateId, sysUser.getId()));
+    public Boolean remove(Long examId, String courseCode, String paperNumber, Long teachCourseId) {
+        QueryWrapper<TCFinalScore> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(TCFinalScore::getExamId, examId).eq(TCFinalScore::getCourseCode, courseCode);
+        if (Objects.nonNull(paperNumber)) {
+            queryWrapper.lambda().and(w -> w.eq(TCFinalScore::getPaperNumber, paperNumber).or().isNull(TCFinalScore::getPaperNumber));
+        }
+        queryWrapper.lambda().eq(TCFinalScore::getTeachCourseId, teachCourseId);
+        return tcFinalScoreService.remove(queryWrapper);
     }
     }
 
 
     /**
     /**
@@ -333,15 +365,18 @@ public class TCFinalScoreServiceImpl extends ServiceImpl<TCFinalScoreMapper, TCF
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public List<TCFinalScore> queryByExamIdAndCourseCodeAndPaperNumber(Long examId, String courseCode, String paperNumber) {
-        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        return tcFinalScoreService.list(new QueryWrapper<TCFinalScore>().lambda().eq(TCFinalScore::getExamId, examId)
-                .eq(TCFinalScore::getCourseCode, courseCode)
-                .eq(TCFinalScore::getPaperNumber, paperNumber)
-                .eq(TCFinalScore::getCreateId, sysUser.getId()));
+    public List<TCFinalScore> queryFinalScore(Long examId, String courseCode, String paperNumber, Long teachCourseId) {
+        QueryWrapper<TCFinalScore> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(TCFinalScore::getExamId, examId).eq(TCFinalScore::getCourseCode, courseCode);
+        if (Objects.nonNull(paperNumber)) {
+            queryWrapper.lambda().and(w -> w.eq(TCFinalScore::getPaperNumber, paperNumber).or().isNull(TCFinalScore::getPaperNumber));
+        }
+        queryWrapper.lambda().eq(TCFinalScore::getTeachCourseId, teachCourseId);
+        return tcFinalScoreService.list(queryWrapper);
     }
     }
 
 
     /**
     /**

+ 33 - 27
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TCPaperStructServiceImpl.java

@@ -73,16 +73,19 @@ public class TCPaperStructServiceImpl extends ServiceImpl<TCPaperStructMapper, T
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      */
      */
     @Override
     @Override
     @Transactional
     @Transactional
-    public Boolean remove(Long examId, String courseCode, String paperNumber) {
-        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        return tcPaperStructService.remove(new QueryWrapper<TCPaperStruct>().lambda().eq(TCPaperStruct::getExamId, examId)
-                .eq(TCPaperStruct::getCourseCode, courseCode)
-                .eq(TCPaperStruct::getPaperNumber, paperNumber)
-                .eq(TCPaperStruct::getCreateId, sysUser.getId()));
+    public Boolean remove(Long examId, String courseCode, String paperNumber, Long teachCourseId) {
+        QueryWrapper<TCPaperStruct> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(TCPaperStruct::getExamId, examId).eq(TCPaperStruct::getCourseCode, courseCode);
+        if (Objects.nonNull(paperNumber)) {
+            queryWrapper.lambda().and(w -> w.eq(TCPaperStruct::getPaperNumber, paperNumber).or().isNull(TCPaperStruct::getPaperNumber));
+        }
+        queryWrapper.lambda().eq(TCPaperStruct::getTeachCourseId, teachCourseId);
+        return tcPaperStructService.remove(queryWrapper);
     }
     }
 
 
     /**
     /**
@@ -92,12 +95,13 @@ public class TCPaperStructServiceImpl extends ServiceImpl<TCPaperStructMapper, T
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      * @throws IOException
      * @throws IOException
      */
      */
     @Override
     @Override
     @Transactional
     @Transactional
-    public Map<String, String> paperStructExcelImport(MultipartFile file, Long examId, String courseCode, String paperNumber) throws IOException {
+    public Map<String, String> paperStructExcelImport(MultipartFile file, Long examId, String courseCode, String paperNumber, Long teachCourseId) throws IOException {
         log.debug("导入Excel开始...");
         log.debug("导入Excel开始...");
         long start = System.currentTimeMillis();
         long start = System.currentTimeMillis();
         Map<String, String> messageMap = new LinkedHashMap<>();
         Map<String, String> messageMap = new LinkedHashMap<>();
@@ -156,13 +160,13 @@ public class TCPaperStructServiceImpl extends ServiceImpl<TCPaperStructMapper, T
                 }
                 }
                 if (!CollectionUtils.isEmpty(paperStructDtoNewList)) {
                 if (!CollectionUtils.isEmpty(paperStructDtoNewList)) {
                     successData.add("共导入").add(paperStructDtoNewList.size() + "").add("条数据");
                     successData.add("共导入").add(paperStructDtoNewList.size() + "").add("条数据");
-                    TCPaperStruct tcPaperStruct = new TCPaperStruct(examId, courseCode, markPaper.getCourseName(), paperNumber, JacksonUtil.parseJson(paperStructDtoNewList), totalScore, 60d, sysUser.getId());
-                    TCPaperStruct tcPaperStructDb = tcPaperStructService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
+                    TCPaperStruct tcPaperStruct = new TCPaperStruct(examId, courseCode, markPaper.getCourseName(), paperNumber, teachCourseId, JacksonUtil.parseJson(paperStructDtoNewList), totalScore, 60d, sysUser.getId());
+                    TCPaperStruct tcPaperStructDb = tcPaperStructService.queryPaperStruct(examId, courseCode, paperNumber, teachCourseId);
                     if (Objects.nonNull(tcPaperStructDb) && !tcPaperStructDb.equals(tcPaperStruct)) {
                     if (Objects.nonNull(tcPaperStructDb) && !tcPaperStructDb.equals(tcPaperStruct)) {
-                        tcFinalScoreService.remove(examId, courseCode, paperNumber);
-                        trBasicInfoService.clearReportData(examId, courseCode, paperNumber, true);
+                        tcFinalScoreService.remove(examId, courseCode, paperNumber, teachCourseId);
+                        trBasicInfoService.clearReportData(examId, courseCode, paperNumber, teachCourseId, true);
                     }
                     }
-                    tcPaperStructService.remove(examId, courseCode, paperNumber);
+                    tcPaperStructService.remove(examId, courseCode, paperNumber, teachCourseId);
                     tcPaperStructService.save(tcPaperStruct);
                     tcPaperStructService.save(tcPaperStruct);
                 }
                 }
             }
             }
@@ -217,7 +221,7 @@ public class TCPaperStructServiceImpl extends ServiceImpl<TCPaperStructMapper, T
                     paperStructList.add(p.getMainNumber() + "_" + p.getSubNumber() + "_" + p.getScore());
                     paperStructList.add(p.getMainNumber() + "_" + p.getSubNumber() + "_" + p.getScore());
                 }
                 }
                 successData.add("共同步").add(paperStructDimensionResultList.size() + "").add("条数据");
                 successData.add("共同步").add(paperStructDimensionResultList.size() + "").add("条数据");
-                TCPaperStruct tcPaperStructDb = tcPaperStructService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
+                TCPaperStruct tcPaperStructDb = tcPaperStructService.queryPaperStruct(examId, courseCode, paperNumber, teachCourseId);
                 TCPaperStruct tcPaperStruct = null;
                 TCPaperStruct tcPaperStruct = null;
                 if (Objects.nonNull(tcPaperStructDb) && Objects.nonNull(tcPaperStructDb.getPaperStructDimension())) {
                 if (Objects.nonNull(tcPaperStructDb) && Objects.nonNull(tcPaperStructDb.getPaperStructDimension())) {
                     tcPaperStruct = new TCPaperStruct();
                     tcPaperStruct = new TCPaperStruct();
@@ -239,16 +243,16 @@ public class TCPaperStructServiceImpl extends ServiceImpl<TCPaperStructMapper, T
                         Collections.sort(paperStructDbList);
                         Collections.sort(paperStructDbList);
                         Collections.sort(paperStructList);
                         Collections.sort(paperStructList);
 
 
-                        tcFinalScoreService.remove(examId, courseCode, paperNumber);
-                        trBasicInfoService.clearReportData(examId, courseCode, paperNumber, false);
+                        tcFinalScoreService.remove(examId, courseCode, paperNumber, teachCourseId);
+                        trBasicInfoService.clearReportData(examId, courseCode, paperNumber, teachCourseId, false);
                         tcPaperStruct.setPaperStruct(null);
                         tcPaperStruct.setPaperStruct(null);
                     }
                     }
                     tcPaperStruct.updateInfo(sysUser.getId());
                     tcPaperStruct.updateInfo(sysUser.getId());
                 } else {
                 } else {
-                    tcPaperStructService.remove(examId, courseCode, paperNumber);
-                    MarkPaper markPaper = printCommonService.getMarkPaper(examId, paperNumber);
+                    tcPaperStructService.remove(examId, courseCode, paperNumber, teachCourseId);
+                    MarkPaper markPaper = printCommonService.getMarkPaper(examId, courseCode, paperNumber);
                     CourseWeightResult courseWeightResult = trBasicInfoService.findCourseWeightResultRmi(teachCourseId);
                     CourseWeightResult courseWeightResult = trBasicInfoService.findCourseWeightResultRmi(teachCourseId);
-                    tcPaperStruct = new TCPaperStruct(examId, courseCode, markPaper.getCourseName(), paperNumber, JacksonUtil.parseJson(paperStructDimensionResultList), sysUser.getId(), courseWeightResult.getDimensionSign());
+                    tcPaperStruct = new TCPaperStruct(examId, courseCode, markPaper.getCourseName(), paperNumber, teachCourseId, JacksonUtil.parseJson(paperStructDimensionResultList), sysUser.getId(), courseWeightResult.getDimensionSign());
                     List<MarkQuestion> markQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumberAndPaperType(examId, paperNumber, null);
                     List<MarkQuestion> markQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumberAndPaperType(examId, paperNumber, null);
                     if (CollectionUtils.isEmpty(markQuestionList)) {
                     if (CollectionUtils.isEmpty(markQuestionList)) {
                         throw ExceptionResultEnum.ERROR.exception("未找到试卷结构");
                         throw ExceptionResultEnum.ERROR.exception("未找到试卷结构");
@@ -258,8 +262,8 @@ public class TCPaperStructServiceImpl extends ServiceImpl<TCPaperStructMapper, T
                         Collections.sort(paperStructDbList);
                         Collections.sort(paperStructDbList);
                         Collections.sort(paperStructList);
                         Collections.sort(paperStructList);
 
 
-                        tcFinalScoreService.remove(examId, courseCode, paperNumber);
-                        trBasicInfoService.clearReportData(examId, courseCode, paperNumber, false);
+                        tcFinalScoreService.remove(examId, courseCode, paperNumber, teachCourseId);
+                        trBasicInfoService.clearReportData(examId, courseCode, paperNumber, teachCourseId, false);
                     }
                     }
                 }
                 }
                 tcPaperStructService.saveOrUpdate(tcPaperStruct);
                 tcPaperStructService.saveOrUpdate(tcPaperStruct);
@@ -287,16 +291,18 @@ public class TCPaperStructServiceImpl extends ServiceImpl<TCPaperStructMapper, T
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public TCPaperStruct queryByExamIdAndCourseCodeAndPaperNumber(Long examId, String courseCode, String paperNumber) {
-        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        return tcPaperStructService.getOne(new QueryWrapper<TCPaperStruct>().lambda()
-                .eq(TCPaperStruct::getExamId, examId)
-                .eq(TCPaperStruct::getCourseCode, courseCode)
-                .eq(TCPaperStruct::getPaperNumber, paperNumber)
-                .eq(TCPaperStruct::getCreateId, sysUser.getId()));
+    public TCPaperStruct queryPaperStruct(Long examId, String courseCode, String paperNumber, Long teachCourseId) {
+        QueryWrapper<TCPaperStruct> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(TCPaperStruct::getExamId, examId).eq(TCPaperStruct::getCourseCode, courseCode);
+        if (Objects.nonNull(paperNumber)) {
+            queryWrapper.lambda().and(w -> w.eq(TCPaperStruct::getPaperNumber, paperNumber).or().isNull(TCPaperStruct::getPaperNumber));
+        }
+        queryWrapper.lambda().eq(TCPaperStruct::getTeachCourseId, teachCourseId);
+        return tcPaperStructService.getOne(queryWrapper);
     }
     }
 
 
     /**
     /**

+ 17 - 14
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TCUsualScoreServiceImpl.java

@@ -61,19 +61,19 @@ public class TCUsualScoreServiceImpl extends ServiceImpl<TCUsualScoreMapper, TCU
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      * @throws IOException
      * @throws IOException
      */
      */
     @Override
     @Override
     @Transactional
     @Transactional
-    public Map<String, String> usualScoreExcelImport(MultipartFile file, Long examId, String courseCode, String paperNumber) throws IOException {
+    public Map<String, String> usualScoreExcelImport(MultipartFile file, Long examId, String courseCode, String paperNumber, Long teachCourseId) throws IOException {
         log.debug("导入Excel开始...");
         log.debug("导入Excel开始...");
         long start = System.currentTimeMillis();
         long start = System.currentTimeMillis();
         Map<String, String> messageMap = new LinkedHashMap<>();
         Map<String, String> messageMap = new LinkedHashMap<>();
         try {
         try {
             MarkPaper markPaper = printCommonService.scoreImportExcelVaild(file, examId, courseCode, paperNumber);
             MarkPaper markPaper = printCommonService.scoreImportExcelVaild(file, examId, courseCode, paperNumber);
             Double totalScore = 100d;
             Double totalScore = 100d;
-//            Objects.requireNonNull(totalScore, "试卷满分为空");
 
 
             StringJoiner errorData = new StringJoiner("");
             StringJoiner errorData = new StringJoiner("");
             StringJoiner successData = new StringJoiner("");
             StringJoiner successData = new StringJoiner("");
@@ -101,7 +101,7 @@ public class TCUsualScoreServiceImpl extends ServiceImpl<TCUsualScoreMapper, TCU
                         }
                         }
                         boolean error = false;
                         boolean error = false;
                         List<TCUsualScoreDto> tcUsualScoreDtoList = new ArrayList<>();
                         List<TCUsualScoreDto> tcUsualScoreDtoList = new ArrayList<>();
-                        TCUsualScore tcUsualScore = new TCUsualScore(examId, courseCode, markPaper.getCourseName(), paperNumber, sysUser.getId());
+                        TCUsualScore tcUsualScore = new TCUsualScore(examId, courseCode, markPaper.getCourseName(), paperNumber, teachCourseId, sysUser.getId());
                         for (int j = 0; j < strs.length; j++) {
                         for (int j = 0; j < strs.length; j++) {
                             if (Objects.isNull(strs[j]) || Objects.equals(strs[j].trim(), "")) {
                             if (Objects.isNull(strs[j]) || Objects.equals(strs[j].trim(), "")) {
                                 errorData.add("excel第").add((i + 1) + "").add("行[").add(columnNames[j] + "]为空;").add("\r\n");
                                 errorData.add("excel第").add((i + 1) + "").add("行[").add(columnNames[j] + "]为空;").add("\r\n");
@@ -137,11 +137,11 @@ public class TCUsualScoreServiceImpl extends ServiceImpl<TCUsualScoreMapper, TCU
                 }
                 }
                 if (!CollectionUtils.isEmpty(tcUsualScoreList)) {
                 if (!CollectionUtils.isEmpty(tcUsualScoreList)) {
                     successData.add("共导入").add(tcUsualScoreList.size() + "").add("条数据");
                     successData.add("共导入").add(tcUsualScoreList.size() + "").add("条数据");
-                    List<TCUsualScore> tcUsualScoreDbSourceList = tcUsualScoreService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
+                    List<TCUsualScore> tcUsualScoreDbSourceList = tcUsualScoreService.queryUsualScore(examId, courseCode, paperNumber, teachCourseId);
                     if (CollectionUtils.isEmpty(tcUsualScoreDbSourceList) || !CollectionUtils.isEqualCollection(tcUsualScoreDbSourceList, tcUsualScoreList)) {
                     if (CollectionUtils.isEmpty(tcUsualScoreDbSourceList) || !CollectionUtils.isEqualCollection(tcUsualScoreDbSourceList, tcUsualScoreList)) {
                         tcUsualScoreService.removeByIds(tcUsualScoreDbSourceList.stream().map(s -> s.getId()).collect(Collectors.toList()));
                         tcUsualScoreService.removeByIds(tcUsualScoreDbSourceList.stream().map(s -> s.getId()).collect(Collectors.toList()));
                         tcUsualScoreService.saveBatch(tcUsualScoreList);
                         tcUsualScoreService.saveBatch(tcUsualScoreList);
-                        trBasicInfoService.clearReportData(examId, courseCode, paperNumber, false);
+                        trBasicInfoService.clearReportData(examId, courseCode, paperNumber, teachCourseId, false);
                     }
                     }
                 }
                 }
             }
             }
@@ -172,12 +172,12 @@ public class TCUsualScoreServiceImpl extends ServiceImpl<TCUsualScoreMapper, TCU
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public IPage<TCUsualScore> usualScoreList(IPage<Map> iPage, Long examId, String courseCode, String paperNumber) {
-        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        return this.baseMapper.usualScoreList(iPage, examId, courseCode, paperNumber, sysUser.getId());
+    public IPage<TCUsualScore> usualScoreList(IPage<Map> iPage, Long examId, String courseCode, String paperNumber, Long teachCourseId) {
+        return this.baseMapper.usualScoreList(iPage, examId, courseCode, paperNumber, teachCourseId);
     }
     }
 
 
     /**
     /**
@@ -186,14 +186,17 @@ public class TCUsualScoreServiceImpl extends ServiceImpl<TCUsualScoreMapper, TCU
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public List<TCUsualScore> queryByExamIdAndCourseCodeAndPaperNumber(Long examId, String courseCode, String paperNumber) {
-        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        return tcUsualScoreService.list(new QueryWrapper<TCUsualScore>().lambda().eq(TCUsualScore::getExamId, examId)
-                .eq(TCUsualScore::getCourseCode, courseCode)
-                .eq(TCUsualScore::getPaperNumber, paperNumber)
-                .eq(TCUsualScore::getCreateId, sysUser.getId()));
+    public List<TCUsualScore> queryUsualScore(Long examId, String courseCode, String paperNumber, Long teachCourseId) {
+        QueryWrapper<TCUsualScore> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(TCUsualScore::getExamId, examId).eq(TCUsualScore::getCourseCode, courseCode);
+        if (Objects.nonNull(paperNumber)) {
+            queryWrapper.lambda().and(w -> w.eq(TCUsualScore::getPaperNumber, paperNumber).or().isNull(TCUsualScore::getPaperNumber));
+        }
+        queryWrapper.lambda().eq(TCUsualScore::getTeachCourseId, teachCourseId);
+        return tcUsualScoreService.list(queryWrapper);
     }
     }
 }
 }

+ 49 - 31
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TRBasicInfoServiceImpl.java

@@ -23,9 +23,11 @@ import com.qmth.distributed.print.business.entity.TRExamStudent;
 import com.qmth.distributed.print.business.mapper.TRBasicInfoMapper;
 import com.qmth.distributed.print.business.mapper.TRBasicInfoMapper;
 import com.qmth.distributed.print.business.service.*;
 import com.qmth.distributed.print.business.service.*;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.contant.SystemConstant;
+import com.qmth.teachcloud.common.entity.BasicCourse;
 import com.qmth.teachcloud.common.entity.BasicSemester;
 import com.qmth.teachcloud.common.entity.BasicSemester;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
+import com.qmth.teachcloud.common.service.BasicCourseService;
 import com.qmth.teachcloud.common.service.BasicSemesterService;
 import com.qmth.teachcloud.common.service.BasicSemesterService;
 import com.qmth.teachcloud.common.util.GsonUtil;
 import com.qmth.teachcloud.common.util.GsonUtil;
 import com.qmth.teachcloud.common.util.JacksonUtil;
 import com.qmth.teachcloud.common.util.JacksonUtil;
@@ -77,6 +79,9 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
     @Resource
     @Resource
     ExamStudentService examStudentService;
     ExamStudentService examStudentService;
 
 
+    @Resource
+    BasicCourseService basicCourseService;
+
     protected static final String tbBgColor = "F2F2F2";
     protected static final String tbBgColor = "F2F2F2";
     protected static final String tbPercentWidth = "100%";
     protected static final String tbPercentWidth = "100%";
 
 
@@ -86,15 +91,18 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public TRBasicInfo queryByExamIdAndCourseCodeAndPaperNumber(Long examId, String courseCode, String paperNumber) {
-        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        return trBasicInfoService.getOne(new QueryWrapper<TRBasicInfo>().lambda().eq(TRBasicInfo::getExamId, examId)
-                .eq(TRBasicInfo::getCourseCode, courseCode)
-                .eq(TRBasicInfo::getPaperNumber, paperNumber)
-                .eq(TRBasicInfo::getCreateId, sysUser.getId()));
+    public TRBasicInfo queryBasicInfo(Long examId, String courseCode, String paperNumber, Long teachCourseId) {
+        QueryWrapper<TRBasicInfo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(TRBasicInfo::getExamId, examId).eq(TRBasicInfo::getCourseCode, courseCode);
+        if (Objects.nonNull(paperNumber)) {
+            queryWrapper.lambda().and(w -> w.eq(TRBasicInfo::getPaperNumber, paperNumber).or().isNull(TRBasicInfo::getPaperNumber));
+        }
+        queryWrapper.lambda().eq(TRBasicInfo::getTeachCourseId, teachCourseId);
+        return trBasicInfoService.getOne(queryWrapper);
     }
     }
 
 
     /**
     /**
@@ -106,13 +114,16 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
      */
      */
     @Override
     @Override
     public ReportScoreViewDto getScoreList(TRBasicInfo trBasicInfo, MarkPaper markPaper) {
     public ReportScoreViewDto getScoreList(TRBasicInfo trBasicInfo, MarkPaper markPaper) {
-        FinalScoreDto finalScoreDto = tcFinalScoreService.finalScoreScoreOverView(trBasicInfo.getExamId(), trBasicInfo.getCourseCode(), trBasicInfo.getPaperNumber());
+        FinalScoreDto finalScoreDto = tcFinalScoreService.finalScoreScoreOverView(trBasicInfo.getExamId(), trBasicInfo.getCourseCode(), trBasicInfo.getPaperNumber(), trBasicInfo.getTeachCourseId());
         Objects.requireNonNull(finalScoreDto, "未找到期末成绩分数信息");
         Objects.requireNonNull(finalScoreDto, "未找到期末成绩分数信息");
 
 
         ReportScoreViewDto reportScoreViewDto = null;
         ReportScoreViewDto reportScoreViewDto = null;
-        TCPaperStruct tcPaperStruct = tcPaperStructService.queryByExamIdAndCourseCodeAndPaperNumber(markPaper.getExamId(), markPaper.getCourseCode(), markPaper.getPaperNumber());
-        markPaper = Objects.nonNull(tcPaperStruct) && Objects.nonNull(tcPaperStruct.getPaperStruct()) && Objects.nonNull(tcPaperStruct.getTotalScore()) ? new MarkPaper(markPaper.getExamId(), markPaper.getCourseCode(), markPaper.getPaperNumber(), tcPaperStruct.getTotalScore(), tcPaperStruct.getPassScore()) : markPaper;
-        fillScoreRange(finalScoreDto, trBasicInfo.getExamId(), trBasicInfo.getPaperNumber(), markPaper);
+        TCPaperStruct tcPaperStruct = tcPaperStructService.queryPaperStruct(markPaper.getExamId(), markPaper.getCourseCode(), markPaper.getPaperNumber(), trBasicInfo.getTeachCourseId());
+        if (Objects.nonNull(tcPaperStruct) && Objects.nonNull(tcPaperStruct.getPaperStruct()) && Objects.nonNull(tcPaperStruct.getTotalScore())) {
+            BasicCourse basicCourse = basicCourseService.getByCode(trBasicInfo.getCourseCode());
+            markPaper = new MarkPaper(markPaper.getExamId(), markPaper.getCourseCode(), basicCourse.getName(), markPaper.getPaperNumber(), tcPaperStruct.getTotalScore(), tcPaperStruct.getPassScore());
+        }
+        fillScoreRange(finalScoreDto, trBasicInfo.getExamId(), trBasicInfo.getPaperNumber(), trBasicInfo.getTeachCourseId(), markPaper);
         List<ScoreRangeVo> scoreRangeVoList = finalScoreDto.getScoreRange();
         List<ScoreRangeVo> scoreRangeVoList = finalScoreDto.getScoreRange();
         if (!CollectionUtils.isEmpty(scoreRangeVoList)) {
         if (!CollectionUtils.isEmpty(scoreRangeVoList)) {
             Integer failCount = scoreRangeVoList.get(0).getStudentCount();//第一行数据默认为不及格
             Integer failCount = scoreRangeVoList.get(0).getStudentCount();//第一行数据默认为不及格
@@ -137,7 +148,7 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
     public Map<String, Object> getReportCalculateParams(TRBasicInfo trBasicInfo, List<PaperStructDimensionResult> paperStructDimensionResultList, CourseWeightResult courseWeightResult) {
     public Map<String, Object> getReportCalculateParams(TRBasicInfo trBasicInfo, List<PaperStructDimensionResult> paperStructDimensionResultList, CourseWeightResult courseWeightResult) {
         Map<String, Object> paramsMap = new HashMap<>();
         Map<String, Object> paramsMap = new HashMap<>();
         //查询考生数据
         //查询考生数据
-        List<FinalScoreResult> finalScoreResultList = tcFinalScoreService.examStudentOverview(trBasicInfo.getExamId(), trBasicInfo.getCourseCode(), trBasicInfo.getPaperNumber());//考生成绩
+        List<FinalScoreResult> finalScoreResultList = tcFinalScoreService.examStudentOverview(trBasicInfo.getExamId(), trBasicInfo.getCourseCode(), trBasicInfo.getPaperNumber(), trBasicInfo.getTeachCourseId());//考生成绩
         if (CollectionUtils.isEmpty(finalScoreResultList)) {
         if (CollectionUtils.isEmpty(finalScoreResultList)) {
             throw ExceptionResultEnum.ERROR.exception("成绩数据异常,平时成绩与期末成绩里考生名单不一致,请检查");
             throw ExceptionResultEnum.ERROR.exception("成绩数据异常,平时成绩与期末成绩里考生名单不一致,请检查");
         }
         }
@@ -365,11 +376,12 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
      * @param markPaper
      * @param markPaper
      * @param userId
      * @param userId
      * @param courseWeightResult
      * @param courseWeightResult
+     * @param teachCourseId
      * @return
      * @return
      */
      */
     @Override
     @Override
     @Transactional
     @Transactional
-    public TRBasicInfo getReportView(TRBasicInfo trBasicInfo, MarkPaper markPaper, Long userId, CourseWeightResult courseWeightResult) {
+    public TRBasicInfo getReportView(TRBasicInfo trBasicInfo, MarkPaper markPaper, Long userId, CourseWeightResult courseWeightResult, Long teachCourseId) {
         BasicSemester basicSemester = basicSemesterService.selectByExamId(markPaper.getExamId());
         BasicSemester basicSemester = basicSemesterService.selectByExamId(markPaper.getExamId());
         Objects.requireNonNull(basicSemester, "未找到学期信息");
         Objects.requireNonNull(basicSemester, "未找到学期信息");
 
 
@@ -378,7 +390,7 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
         String teacher = Objects.nonNull(examStudentDto) ? examStudentDto.getTeacherNames() : null;
         String teacher = Objects.nonNull(examStudentDto) ? examStudentDto.getTeacherNames() : null;
 
 
         if (Objects.isNull(trBasicInfo)) {
         if (Objects.isNull(trBasicInfo)) {
-            trBasicInfo = new TRBasicInfo(markPaper.getExamId(), markPaper.getCourseCode(), markPaper.getCourseName(), markPaper.getPaperNumber(), basicSemester.getName(), teachingObject, teacher, null, userId);
+            trBasicInfo = new TRBasicInfo(markPaper.getExamId(), markPaper.getCourseCode(), markPaper.getCourseName(), markPaper.getPaperNumber(), teachCourseId, basicSemester.getName(), teachingObject, teacher, null, userId);
         } else {
         } else {
             trBasicInfo.setBasicInfo(markPaper.getExamId(), markPaper.getCourseCode(), markPaper.getCourseName(), markPaper.getPaperNumber(), basicSemester.getName(), teachingObject, teacher, null);
             trBasicInfo.setBasicInfo(markPaper.getExamId(), markPaper.getCourseCode(), markPaper.getCourseName(), markPaper.getPaperNumber(), basicSemester.getName(), teachingObject, teacher, null);
         }
         }
@@ -387,7 +399,7 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
         trBasicInfo.getReportResult().setCourseBasicInfo(reportCourseBasicInfoDto);
         trBasicInfo.getReportResult().setCourseBasicInfo(reportCourseBasicInfoDto);
 
 
         //课程目标考核分布-题目信息
         //课程目标考核分布-题目信息
-        TCPaperStruct tcPaperStruct = tcPaperStructService.queryByExamIdAndCourseCodeAndPaperNumber(markPaper.getExamId(), markPaper.getCourseCode(), markPaper.getPaperNumber());
+        TCPaperStruct tcPaperStruct = tcPaperStructService.queryPaperStruct(markPaper.getExamId(), markPaper.getCourseCode(), markPaper.getPaperNumber(), teachCourseId);
         if (Objects.isNull(tcPaperStruct) || Objects.isNull(tcPaperStruct.getPaperStructDimension())) {
         if (Objects.isNull(tcPaperStruct) || Objects.isNull(tcPaperStruct.getPaperStructDimension())) {
             throw ExceptionResultEnum.ERROR.exception("未找到试卷蓝图信息");
             throw ExceptionResultEnum.ERROR.exception("未找到试卷蓝图信息");
         }
         }
@@ -800,16 +812,19 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      */
      */
     @Override
     @Override
     @Transactional
     @Transactional
-    public Boolean remove(Long examId, String courseCode, String paperNumber) {
-        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        return trBasicInfoService.remove(new QueryWrapper<TRBasicInfo>().lambda().eq(TRBasicInfo::getExamId, examId)
-                .eq(TRBasicInfo::getCourseCode, courseCode)
-                .eq(TRBasicInfo::getPaperNumber, paperNumber)
-                .eq(TRBasicInfo::getCreateId, sysUser.getId()));
+    public Boolean remove(Long examId, String courseCode, String paperNumber, Long teachCourseId) {
+        QueryWrapper<TRBasicInfo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(TRBasicInfo::getExamId, examId).eq(TRBasicInfo::getCourseCode, courseCode);
+        if (Objects.nonNull(paperNumber)) {
+            queryWrapper.lambda().and(w -> w.eq(TRBasicInfo::getPaperNumber, paperNumber).or().isNull(TRBasicInfo::getPaperNumber));
+        }
+        queryWrapper.lambda().eq(TRBasicInfo::getTeachCourseId, teachCourseId);
+        return trBasicInfoService.remove(queryWrapper);
     }
     }
 
 
     /**
     /**
@@ -854,15 +869,16 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @param clearDimension
      * @param clearDimension
      */
      */
     @Override
     @Override
     @Transactional
     @Transactional
-    public void clearReportData(Long examId, String courseCode, String paperNumber, boolean clearDimension) {
-        trExamStudentService.remove(examId, courseCode, paperNumber);
-        trBasicInfoService.remove(examId, courseCode, paperNumber);
+    public void clearReportData(Long examId, String courseCode, String paperNumber, Long teachCourseId, boolean clearDimension) {
+        trExamStudentService.remove(examId, courseCode, paperNumber, teachCourseId);
+        trBasicInfoService.remove(examId, courseCode, paperNumber, teachCourseId);
         if (clearDimension) {
         if (clearDimension) {
-            TCPaperStruct tcPaperStruct = tcPaperStructService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
+            TCPaperStruct tcPaperStruct = tcPaperStructService.queryPaperStruct(examId, courseCode, paperNumber, teachCourseId);
             if (Objects.nonNull(tcPaperStruct)) {
             if (Objects.nonNull(tcPaperStruct)) {
                 tcPaperStruct.setPaperStructDimension(null);
                 tcPaperStruct.setPaperStructDimension(null);
                 SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
                 SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
@@ -911,9 +927,10 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
      * @param finalScoreDto
      * @param finalScoreDto
      * @param examId
      * @param examId
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @param markPaper
      * @param markPaper
      */
      */
-    protected void fillScoreRange(FinalScoreDto finalScoreDto, Long examId, String paperNumber, MarkPaper markPaper) {
+    protected void fillScoreRange(FinalScoreDto finalScoreDto, Long examId, String paperNumber, Long teachCourseId, MarkPaper markPaper) {
         //分数区间
         //分数区间
         Double passScore = markPaper.getPassScore();//及格分
         Double passScore = markPaper.getPassScore();//及格分
         Objects.requireNonNull(passScore, "及格分为空");
         Objects.requireNonNull(passScore, "及格分为空");
@@ -927,20 +944,20 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
         //开始、结束分数区间
         //开始、结束分数区间
         Double startInterval = 0.5d, endInterval = 9.5d, increaseStartScore = passScore - startInterval,
         Double startInterval = 0.5d, endInterval = 9.5d, increaseStartScore = passScore - startInterval,
                 increaseEndScore = increaseStartScore + startInterval + endInterval;
                 increaseEndScore = increaseStartScore + startInterval + endInterval;
-        scoreRange.add(getScoreRangeVo(finalScoreDto.getStudentCount(), examId, markPaper.getCourseCode(), paperNumber, 1.0d, increaseStartScore));
+        scoreRange.add(getScoreRangeVo(finalScoreDto.getStudentCount(), examId, markPaper.getCourseCode(), paperNumber, teachCourseId, 1.0d, increaseStartScore));
         increaseStartScore = increaseStartScore + startInterval;
         increaseStartScore = increaseStartScore + startInterval;
         increaseEndScore = increaseStartScore + endInterval;
         increaseEndScore = increaseStartScore + endInterval;
         if (totalScore.doubleValue() - increaseEndScore.doubleValue() == startInterval || increaseEndScore.doubleValue() >= totalScore.doubleValue()) {
         if (totalScore.doubleValue() - increaseEndScore.doubleValue() == startInterval || increaseEndScore.doubleValue() >= totalScore.doubleValue()) {
             increaseEndScore = totalScore;
             increaseEndScore = totalScore;
-            scoreRange.add(getScoreRangeVo(finalScoreDto.getStudentCount(), examId, markPaper.getCourseCode(), paperNumber, increaseStartScore, increaseEndScore));
+            scoreRange.add(getScoreRangeVo(finalScoreDto.getStudentCount(), examId, markPaper.getCourseCode(), paperNumber, teachCourseId, increaseStartScore, increaseEndScore));
         } else {
         } else {
             while (increaseEndScore.doubleValue() < totalScore.doubleValue()) {
             while (increaseEndScore.doubleValue() < totalScore.doubleValue()) {
-                scoreRange.add(getScoreRangeVo(finalScoreDto.getStudentCount(), examId, markPaper.getCourseCode(), paperNumber, increaseStartScore, increaseEndScore));
+                scoreRange.add(getScoreRangeVo(finalScoreDto.getStudentCount(), examId, markPaper.getCourseCode(), paperNumber, teachCourseId, increaseStartScore, increaseEndScore));
                 increaseStartScore = increaseEndScore + startInterval;
                 increaseStartScore = increaseEndScore + startInterval;
                 increaseEndScore = increaseStartScore + endInterval;
                 increaseEndScore = increaseStartScore + endInterval;
                 if (totalScore.doubleValue() - increaseEndScore.doubleValue() == startInterval || increaseEndScore.doubleValue() >= totalScore.doubleValue()) {
                 if (totalScore.doubleValue() - increaseEndScore.doubleValue() == startInterval || increaseEndScore.doubleValue() >= totalScore.doubleValue()) {
                     increaseEndScore = totalScore;
                     increaseEndScore = totalScore;
-                    scoreRange.add(getScoreRangeVo(finalScoreDto.getStudentCount(), examId, markPaper.getCourseCode(), paperNumber, increaseStartScore, increaseEndScore));
+                    scoreRange.add(getScoreRangeVo(finalScoreDto.getStudentCount(), examId, markPaper.getCourseCode(), paperNumber, teachCourseId, increaseStartScore, increaseEndScore));
                 }
                 }
             }
             }
         }
         }
@@ -1055,12 +1072,13 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @param start
      * @param start
      * @param end
      * @param end
      * @return
      * @return
      */
      */
-    protected ScoreRangeVo getScoreRangeVo(int toltal, Long examId, String courseCode, String paperNumber, Double start, Double end) {
-        int count = tcFinalScoreService.getCountByScoreRange(examId, courseCode, paperNumber, start, end);
+    protected ScoreRangeVo getScoreRangeVo(int toltal, Long examId, String courseCode, String paperNumber, Long teachCourseId, Double start, Double end) {
+        int count = tcFinalScoreService.getCountByScoreRange(examId, courseCode, paperNumber, teachCourseId, start, end);
         Double rate = null;
         Double rate = null;
         if (toltal != 0) {
         if (toltal != 0) {
             rate = new BigDecimal(count).divide(new BigDecimal(toltal), 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP).multiply(SystemConstant.PERCENT).doubleValue();
             rate = new BigDecimal(count).divide(new BigDecimal(toltal), 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP).multiply(SystemConstant.PERCENT).doubleValue();

+ 3 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TRExamStudentServiceImpl.java

@@ -153,12 +153,13 @@ public class TRExamStudentServiceImpl extends ServiceImpl<TRExamStudentMapper, T
      * @param examId
      * @param examId
      * @param courseCode
      * @param courseCode
      * @param paperNumber
      * @param paperNumber
+     * @param teachCourseId
      * @return
      * @return
      */
      */
     @Override
     @Override
     @Transactional
     @Transactional
-    public Boolean remove(Long examId, String courseCode, String paperNumber) {
-        TRBasicInfo trBasicInfo = trBasicInfoService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
+    public Boolean remove(Long examId, String courseCode, String paperNumber, Long teachCourseId) {
+        TRBasicInfo trBasicInfo = trBasicInfoService.queryBasicInfo(examId, courseCode, paperNumber, teachCourseId);
         return Objects.nonNull(trBasicInfo) ? trExamStudentService.remove(trBasicInfo.getId()) : false;
         return Objects.nonNull(trBasicInfo) ? trExamStudentService.remove(trBasicInfo.getId()) : false;
     }
     }
 
 

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

@@ -14,8 +14,8 @@
             <if test="paperNumber != null and paperNumber != ''">
             <if test="paperNumber != null and paperNumber != ''">
                 and t.paper_number = #{paperNumber}
                 and t.paper_number = #{paperNumber}
             </if>
             </if>
-            <if test="userId != null and userId != ''">
-                and t.create_id = #{userId}
+            <if test="teachCourseId != null and teachCourseId != ''">
+                and t.teach_course_id = #{teachCourseId}
             </if>
             </if>
         </where>
         </where>
         order by t.student_code
         order by t.student_code
@@ -27,7 +27,7 @@
             min(case when tcfs.score is not null then tcfs.score else null end) finalScoreMinScore,
             min(case when tcfs.score is not null then tcfs.score else null end) finalScoreMinScore,
             avg(case when tcfs.score is not null then tcfs.score else null end) finalScoreAvgScore
             avg(case when tcfs.score is not null then tcfs.score else null end) finalScoreAvgScore
             from t_c_final_score tcfs
             from t_c_final_score tcfs
-            join t_c_usual_score tcus on tcfs.exam_id = tcus.exam_id and tcfs.course_code = tcus.course_code and tcfs.paper_number = tcus.paper_number and tcfs.student_code = tcus.student_code
+            join t_c_usual_score tcus on tcfs.exam_id = tcus.exam_id and tcfs.course_code = tcus.course_code and tcfs.teach_course_id = tcus.teach_course_id and tcfs.student_code = tcus.student_code
         <where>
         <where>
             <if test="examId != null and examId != ''">
             <if test="examId != null and examId != ''">
                 and tcfs.exam_id = #{examId}
                 and tcfs.exam_id = #{examId}
@@ -38,8 +38,8 @@
             <if test="paperNumber != null and paperNumber != ''">
             <if test="paperNumber != null and paperNumber != ''">
                 and tcfs.paper_number = #{paperNumber}
                 and tcfs.paper_number = #{paperNumber}
             </if>
             </if>
-            <if test="userId != null and userId != ''">
-                and tcfs.create_id = #{userId} and tcus.create_id = #{userId}
+            <if test="teachCourseId != null and teachCourseId != ''">
+                and tcfs.teach_course_id = #{teachCourseId}
             </if>
             </if>
                 and tcfs.enable = true and tcus.enable = true
                 and tcfs.enable = true and tcus.enable = true
         </where>
         </where>
@@ -57,8 +57,8 @@
             <if test="paperNumber != null and paperNumber != ''">
             <if test="paperNumber != null and paperNumber != ''">
                 and tcfs.paper_number = #{paperNumber}
                 and tcfs.paper_number = #{paperNumber}
             </if>
             </if>
-            <if test="userId != null and userId != ''">
-                and tcfs.create_id = #{userId}
+            <if test="teachCourseId != null and teachCourseId != ''">
+                and tcfs.teach_course_id = #{teachCourseId}
             </if>
             </if>
                 and tcfs.score &gt;= #{start} and tcfs.score &lt;= #{end}
                 and tcfs.score &gt;= #{start} and tcfs.score &lt;= #{end}
                 and tcfs.enable = true
                 and tcfs.enable = true
@@ -73,7 +73,7 @@
             tcus.score as usualScore,
             tcus.score as usualScore,
             es.teach_clazz_name as administrativeClass
             es.teach_clazz_name as administrativeClass
         from t_c_final_score tcfs
         from t_c_final_score tcfs
-        join t_c_usual_score tcus on tcfs.exam_id = tcus.exam_id and tcfs.course_code = tcus.course_code and tcfs.paper_number = tcus.paper_number and tcfs.student_code = tcus.student_code
+        join t_c_usual_score tcus on tcfs.exam_id = tcus.exam_id and tcfs.course_code = tcus.course_code and tcfs.teach_course_id = tcus.teach_course_id and tcfs.student_code = tcus.student_code
         left join exam_student es on es.exam_id = tcfs.exam_id and es.paper_number = tcfs.paper_number and es.student_code = tcfs.student_code
         left join exam_student es on es.exam_id = tcfs.exam_id and es.paper_number = tcfs.paper_number and es.student_code = tcfs.student_code
         <where>
         <where>
             <if test="examId != null and examId != ''">
             <if test="examId != null and examId != ''">
@@ -85,8 +85,8 @@
             <if test="paperNumber != null and paperNumber != ''">
             <if test="paperNumber != null and paperNumber != ''">
                 and tcfs.paper_number = #{paperNumber}
                 and tcfs.paper_number = #{paperNumber}
             </if>
             </if>
-            <if test="userId != null and userId != ''">
-                and tcfs.create_id = #{userId} and tcus.create_id = #{userId}
+            <if test="teachCourseId != null and teachCourseId != ''">
+                and tcfs.teach_course_id = #{teachCourseId}
             </if>
             </if>
                 and tcfs.enable = true and tcus.enable = true
                 and tcfs.enable = true and tcus.enable = true
         </where>
         </where>

+ 13 - 15
distributed-print-business/src/main/resources/mapper/TCUsualScoreMapper.xml

@@ -3,30 +3,28 @@
 <mapper namespace="com.qmth.distributed.print.business.mapper.TCUsualScoreMapper">
 <mapper namespace="com.qmth.distributed.print.business.mapper.TCUsualScoreMapper">
 
 
     <select id="scoreList" resultType="com.qmth.distributed.print.business.bean.result.ScoreResult">
     <select id="scoreList" resultType="com.qmth.distributed.print.business.bean.result.ScoreResult">
-        SELECT distinct t.id,
+        SELECT distinct
                  bs.id as semesterId,
                  bs.id as semesterId,
-                 t.exam_id as examId,
-                 t.course_code as courseCode,
-                 t.course_name as courseName,
-                 t.paper_number as paperNumber,
+                 tc.exam_id as examId,
+                 tc.course_code as courseCode,
+                 bc.name as courseName,
                  tc.id AS teachCourseId,
                  tc.id AS teachCourseId,
                  creator.real_name AS userName,
                  creator.real_name AS userName,
                  creator.login_name AS userLoginName
                  creator.login_name AS userLoginName
         FROM
         FROM
-            mark_paper t
-            left join basic_exam be on be.id = t.exam_id
+            teach_course tc
+            left join basic_exam be on be.id = tc.exam_id
             left join basic_semester bs on bs.id = be.semester_id
             left join basic_semester bs on bs.id = be.semester_id
-            left join teach_course tc ON tc.exam_id = t.exam_id and tc.course_code = t.course_code
+            left join basic_course bc on bc.code = tc.course_code and bc.school_id = be.school_id
             left join sys_user su on tc.user_id = su.id
             left join sys_user su on tc.user_id = su.id
-            left join sys_user creator ON creator.id = tc.user_id
+            left join sys_user creator on creator.id = tc.user_id
         <where>
         <where>
             <if test="examId != null and examId != ''">
             <if test="examId != null and examId != ''">
-                and t.exam_id = #{examId}
+                and tc.exam_id = #{examId}
             </if>
             </if>
             <if test="courseCode != null and courseCode != ''">
             <if test="courseCode != null and courseCode != ''">
-                and t.course_code = #{courseCode}
+                and tc.course_code = #{courseCode}
             </if>
             </if>
-            AND t.status = 'FINISH'
             <if test="dpr != null">
             <if test="dpr != null">
                 <if test="dpr.requestUserId != null">
                 <if test="dpr.requestUserId != null">
                     AND tc.user_id = #{dpr.requestUserId}
                     AND tc.user_id = #{dpr.requestUserId}
@@ -39,7 +37,7 @@
                 </if>
                 </if>
             </if>
             </if>
         </where>
         </where>
-        ORDER BY t.course_code
+        ORDER BY tc.course_code
     </select>
     </select>
 
 
     <select id="usualScoreList" resultType="com.qmth.distributed.print.business.entity.TCUsualScore">
     <select id="usualScoreList" resultType="com.qmth.distributed.print.business.entity.TCUsualScore">
@@ -54,8 +52,8 @@
             <if test="paperNumber != null and paperNumber != ''">
             <if test="paperNumber != null and paperNumber != ''">
                 and t.paper_number = #{paperNumber}
                 and t.paper_number = #{paperNumber}
             </if>
             </if>
-            <if test="userId != null and userId != ''">
-                and t.create_id = #{userId}
+            <if test="teachCourseId != null and teachCourseId != ''">
+                and t.teach_course_id = #{teachCourseId}
             </if>
             </if>
         </where>
         </where>
         order by t.student_code
         order by t.student_code

+ 37 - 1
distributed-print/install/mysql/upgrade/3.3.1.sql

@@ -723,9 +723,45 @@ ALTER TABLE t_r_basic_info ADD CONSTRAINT t_r_basic_info_unique UNIQUE KEY (exam
 
 
 -- 2024/04/08
 -- 2024/04/08
 INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1134', '编辑试卷结构', 'EditPaperStruct', 'LINK', '897', '17', 'AUTH', '1', '1', '1');
 INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1134', '编辑试卷结构', 'EditPaperStruct', 'LINK', '897', '17', 'AUTH', '1', '1', '1');
+
+-- 2024/04/09
+UPDATE sys_privilege
+SET name='管理成绩', url='Score', `type`='LINK', parent_id=2001, `sequence`=1, property='AUTH', related='2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2029,2030,2031,2032,2033,2034', enable=1, default_auth=0, front_display=1
+WHERE id=2006;
+
+INSERT INTO sys_privilege
+(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
+VALUES(2034, '同步期末成绩选择试卷', '/api/admin/course/degree/final_score/choose_paper', '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 (1135, '客观题导入', '/api/admin/mark/setting/objective_struct/import', 'URL', '897', '17', 'AUTH',NULL, '1', '1', '1');
 INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1135, '客观题导入', '/api/admin/mark/setting/objective_struct/import', 'URL', '897', '17', 'AUTH',NULL, '1', '1', '1');
 INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1136, '主观题导入', '/api/admin/mark/setting/subjective_struct/import', 'URL', '897', '18', 'AUTH',NULL, '1', '1', '1');
 INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1136, '主观题导入', '/api/admin/mark/setting/subjective_struct/import', 'URL', '897', '18', 'AUTH',NULL, '1', '1', '1');
 INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1137, '客观题导入', 'ObjectiveStructImport', 'BUTTON', '897', '6', 'AUTH', '1135', '1', '0', '1');
 INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1137, '客观题导入', 'ObjectiveStructImport', 'BUTTON', '897', '6', 'AUTH', '1135', '1', '0', '1');
 INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1138, '主观题导入', 'SubjectiveStructImport', 'BUTTON', '897', '7', 'AUTH', '1136', '1', '0', '1');
 INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1138, '主观题导入', 'SubjectiveStructImport', 'BUTTON', '897', '7', 'AUTH', '1136', '1', '0', '1');
 
 
-update sys_privilege set related = '490,543,955' where id = 488;
+update sys_privilege set related = '490,543,955' where id = 488;
+
+-- 2024/04/10
+ALTER TABLE t_c_usual_score MODIFY COLUMN paper_number varchar(100) NULL COMMENT '试卷编码';
+ALTER TABLE t_c_final_score MODIFY COLUMN paper_number varchar(100) NULL COMMENT '试卷编码';
+ALTER TABLE t_c_paper_struct MODIFY COLUMN paper_number varchar(100) NULL COMMENT '试卷编码';
+ALTER TABLE t_r_basic_info MODIFY COLUMN paper_number varchar(100) NULL COMMENT '试卷编码';
+ALTER TABLE t_c_usual_score ADD teach_course_id BIGINT NOT NULL COMMENT '教学课程id';
+ALTER TABLE t_c_usual_score CHANGE teach_course_id teach_course_id bigint NOT NULL COMMENT '教学课程id' AFTER paper_number;
+ALTER TABLE t_c_usual_score DROP KEY t_c_usual_score_unique;
+ALTER TABLE t_c_usual_score ADD CONSTRAINT t_c_usual_score_unique UNIQUE KEY (exam_id,course_code,teach_course_id,name,student_code);
+ALTER TABLE t_c_final_score ADD teach_course_id BIGINT NOT NULL COMMENT '教学课程id';
+ALTER TABLE t_c_final_score CHANGE teach_course_id teach_course_id BIGINT NULL COMMENT '教学课程id' AFTER paper_number;
+ALTER TABLE t_c_final_score DROP KEY t_c_final_score_unique;
+ALTER TABLE t_c_final_score ADD CONSTRAINT t_c_final_score_unique UNIQUE KEY (exam_id,course_code,teach_course_id,name,student_code);
+ALTER TABLE t_c_paper_struct ADD teach_course_id BIGINT NOT NULL COMMENT '教学课程id';
+ALTER TABLE t_c_paper_struct CHANGE teach_course_id teach_course_id BIGINT NOT NULL COMMENT '教学课程id' AFTER paper_number;
+ALTER TABLE t_c_paper_struct DROP KEY t_c_paper_struct_unique;
+ALTER TABLE t_c_paper_struct ADD CONSTRAINT t_c_paper_struct_unique UNIQUE KEY (exam_id,course_code,teach_course_id);
+ALTER TABLE t_r_basic_info ADD teach_course_id BIGINT NOT NULL COMMENT '教学课程id';
+ALTER TABLE t_r_basic_info CHANGE teach_course_id teach_course_id BIGINT NOT NULL COMMENT '教学课程id' AFTER paper_number;
+ALTER TABLE t_r_basic_info DROP KEY t_r_basic_info_unique;
+ALTER TABLE t_r_basic_info ADD CONSTRAINT t_r_basic_info_unique UNIQUE KEY (exam_id,course_code,teach_course_id);
+ALTER TABLE t_c_usual_score MODIFY COLUMN course_name varchar(100) NULL COMMENT '课程名称';
+ALTER TABLE t_c_final_score MODIFY COLUMN course_name varchar(100) NULL COMMENT '课程名称';
+ALTER TABLE t_c_paper_struct MODIFY COLUMN course_name varchar(100) NULL COMMENT '课程名称';
+ALTER TABLE t_r_basic_info MODIFY COLUMN course_name varchar(100) NULL COMMENT '课程名称';
+ALTER TABLE t_r_basic_info MODIFY COLUMN teaching_object varchar(1000) NULL COMMENT '授课对象';

+ 26 - 9
distributed-print/src/main/java/com/qmth/distributed/print/api/TCFinalScoreController.java

@@ -1,5 +1,6 @@
 package com.qmth.distributed.print.api;
 package com.qmth.distributed.print.api;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.google.gson.reflect.TypeToken;
 import com.google.gson.reflect.TypeToken;
 import com.qmth.boot.api.annotation.Aac;
 import com.qmth.boot.api.annotation.Aac;
@@ -23,6 +24,8 @@ import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.log.CustomizedOperationTypeEnum;
 import com.qmth.teachcloud.common.enums.log.CustomizedOperationTypeEnum;
 import com.qmth.teachcloud.common.util.*;
 import com.qmth.teachcloud.common.util.*;
+import com.qmth.teachcloud.mark.entity.MarkPaper;
+import com.qmth.teachcloud.mark.service.MarkPaperService;
 import com.qmth.teachcloud.mark.service.MarkQuestionService;
 import com.qmth.teachcloud.mark.service.MarkQuestionService;
 import io.swagger.annotations.*;
 import io.swagger.annotations.*;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.CollectionUtils;
@@ -73,16 +76,19 @@ public class TCFinalScoreController {
     @Resource
     @Resource
     TCPaperStructService tcPaperStructService;
     TCPaperStructService tcPaperStructService;
 
 
+    @Resource
+    MarkPaperService markPaperService;
+
     @ApiOperation(value = "导入期末成绩-模板下载")
     @ApiOperation(value = "导入期末成绩-模板下载")
     @RequestMapping(value = "/final_score/template_download", method = RequestMethod.POST)
     @RequestMapping(value = "/final_score/template_download", method = RequestMethod.POST)
     @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.EXPORT)
     @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.EXPORT)
     @ApiResponses({@ApiResponse(code = 200, message = "下载成功", response = Object.class)})
     @ApiResponses({@ApiResponse(code = 200, message = "下载成功", response = Object.class)})
     public void finalScoreTemplateDownload(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
     public void finalScoreTemplateDownload(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
                                            @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
                                            @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
-                                           @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber,
+                                           @ApiParam(value = "试卷编号") @RequestParam(required = false) String paperNumber,
                                            @ApiParam(value = "教学课程id", required = true) @RequestParam Long teachCourseId) throws IOException {
                                            @ApiParam(value = "教学课程id", required = true) @RequestParam Long teachCourseId) throws IOException {
         printCommonService.getLock(examId, courseCode, paperNumber, teachCourseId);
         printCommonService.getLock(examId, courseCode, paperNumber, teachCourseId);
-        TCPaperStruct tcPaperStruct = tcPaperStructService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
+        TCPaperStruct tcPaperStruct = tcPaperStructService.queryPaperStruct(examId, courseCode, paperNumber, teachCourseId);
         List<ExcelField> excelFieldList = new ArrayList<>();
         List<ExcelField> excelFieldList = new ArrayList<>();
         excelFieldList.addAll(new ArrayList<>(Arrays.asList(new ExcelField("studentCode", "学号", true), new ExcelField("name", "姓名", true), new ExcelField("score", "成绩", true))));
         excelFieldList.addAll(new ArrayList<>(Arrays.asList(new ExcelField("studentCode", "学号", true), new ExcelField("name", "姓名", true), new ExcelField("score", "成绩", true))));
         if (Objects.isNull(tcPaperStruct) || Objects.isNull(tcPaperStruct.getPaperStruct())) {
         if (Objects.isNull(tcPaperStruct) || Objects.isNull(tcPaperStruct.getPaperStruct())) {
@@ -115,7 +121,7 @@ public class TCFinalScoreController {
     public Result finalScoreImport(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file,
     public Result finalScoreImport(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file,
                                    @ApiParam(value = "考试id", required = true) @RequestParam Long examId,
                                    @ApiParam(value = "考试id", required = true) @RequestParam Long examId,
                                    @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
                                    @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
-                                   @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber,
+                                   @ApiParam(value = "试卷编号") @RequestParam(required = false) String paperNumber,
                                    @ApiParam(value = "教学课程id", required = true) @RequestParam Long teachCourseId) throws IOException {
                                    @ApiParam(value = "教学课程id", required = true) @RequestParam Long teachCourseId) throws IOException {
         printCommonService.getLock(examId, courseCode, paperNumber, teachCourseId);
         printCommonService.getLock(examId, courseCode, paperNumber, teachCourseId);
         String lockKey = SystemConstant.REDIS_FINAL_SCORE_DATA_FLOW_PREFIX + SystemConstant.IMPORT + examId + "_" + courseCode + "_" + paperNumber + "_" + teachCourseId;
         String lockKey = SystemConstant.REDIS_FINAL_SCORE_DATA_FLOW_PREFIX + SystemConstant.IMPORT + examId + "_" + courseCode + "_" + paperNumber + "_" + teachCourseId;
@@ -125,7 +131,7 @@ public class TCFinalScoreController {
         }
         }
         Map<String, String> map = null;
         Map<String, String> map = null;
         try {
         try {
-            map = tcFinalScoreService.finalScoreExcelImport(file, examId, courseCode, paperNumber);
+            map = tcFinalScoreService.finalScoreExcelImport(file, examId, courseCode, paperNumber, teachCourseId);
         } catch (Exception e) {
         } catch (Exception e) {
             log.error(SystemConstant.LOG_ERROR, e);
             log.error(SystemConstant.LOG_ERROR, e);
             if (e instanceof ApiException) {
             if (e instanceof ApiException) {
@@ -139,6 +145,16 @@ public class TCFinalScoreController {
         return ResultUtil.ok(map);
         return ResultUtil.ok(map);
     }
     }
 
 
+    @ApiOperation(value = "同步期末成绩选择试卷")
+    @RequestMapping(value = "/final_score/choose_paper", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "同步成功", response = EditResult.class)})
+    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.PUSH)
+    public Result finalScoreSyncChoosePaper(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
+                                            @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
+                                            @ApiParam(value = "教学课程id", required = true) @RequestParam Long teachCourseId) {
+        return ResultUtil.ok(markPaperService.list(new QueryWrapper<MarkPaper>().lambda().eq(MarkPaper::getExamId, examId).eq(MarkPaper::getCourseCode, courseCode)));
+    }
+
     @ApiOperation(value = "同步期末成绩")
     @ApiOperation(value = "同步期末成绩")
     @RequestMapping(value = "/final_score/sync", method = RequestMethod.POST)
     @RequestMapping(value = "/final_score/sync", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "同步成功", response = EditResult.class)})
     @ApiResponses({@ApiResponse(code = 200, message = "同步成功", response = EditResult.class)})
@@ -156,7 +172,7 @@ public class TCFinalScoreController {
         }
         }
         Map<String, String> map = null;
         Map<String, String> map = null;
         try {
         try {
-            map = tcFinalScoreService.finalScoreSync(examId, courseCode, paperNumber);
+            map = tcFinalScoreService.finalScoreSync(examId, courseCode, paperNumber, teachCourseId);
         } catch (Exception e) {
         } catch (Exception e) {
             log.error(SystemConstant.LOG_ERROR, e);
             log.error(SystemConstant.LOG_ERROR, e);
             if (e instanceof ApiException) {
             if (e instanceof ApiException) {
@@ -176,10 +192,11 @@ public class TCFinalScoreController {
     @ApiResponses({@ApiResponse(code = 200, message = "分页查询", response = TCFinalScore.class)})
     @ApiResponses({@ApiResponse(code = 200, message = "分页查询", response = TCFinalScore.class)})
     public Result finalScoreList(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
     public Result finalScoreList(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
                                  @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
                                  @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
-                                 @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber,
+                                 @ApiParam(value = "试卷编号") @RequestParam(required = false) String paperNumber,
+                                 @ApiParam(value = "教学课程id", required = true) @RequestParam Long teachCourseId,
                                  @ApiParam(value = "分页页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
                                  @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 {
                                  @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));
+        return ResultUtil.ok(tcFinalScoreService.finalScoreList(new Page<>(pageNumber, pageSize), examId, courseCode, paperNumber, teachCourseId));
     }
     }
 
 
     @ApiOperation(value = "期末成绩编辑")
     @ApiOperation(value = "期末成绩编辑")
@@ -219,7 +236,7 @@ public class TCFinalScoreController {
         tcFinalScoreDb.updateInfo(tcFinalScore, sysUser.getId());
         tcFinalScoreDb.updateInfo(tcFinalScore, sysUser.getId());
 
 
         if (!tcFinalScoreSource.equals(tcFinalScoreDb)) {
         if (!tcFinalScoreSource.equals(tcFinalScoreDb)) {
-            trBasicInfoService.clearReportData(tcFinalScoreDb.getExamId(), tcFinalScoreDb.getCourseCode(), tcFinalScoreDb.getPaperNumber(), false);
+            trBasicInfoService.clearReportData(tcFinalScoreDb.getExamId(), tcFinalScoreDb.getCourseCode(), tcFinalScoreDb.getPaperNumber(), tcFinalScoreDb.getTeachCourseId(), false);
             tcFinalScoreService.updateById(tcFinalScoreDb);
             tcFinalScoreService.updateById(tcFinalScoreDb);
         }
         }
         return ResultUtil.ok(true);
         return ResultUtil.ok(true);
@@ -244,7 +261,7 @@ public class TCFinalScoreController {
         if (!tcFinalScoreSource.equals(tcFinalScoreDb)) {
         if (!tcFinalScoreSource.equals(tcFinalScoreDb)) {
             SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
             SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
             tcFinalScoreDb.updateInfo(sysUser.getId());
             tcFinalScoreDb.updateInfo(sysUser.getId());
-            trBasicInfoService.clearReportData(tcFinalScoreDb.getExamId(), tcFinalScoreDb.getCourseCode(), tcFinalScoreDb.getPaperNumber(), false);
+            trBasicInfoService.clearReportData(tcFinalScoreDb.getExamId(), tcFinalScoreDb.getCourseCode(), tcFinalScoreDb.getPaperNumber(), teachCourseId, false);
             tcFinalScoreService.updateById(tcFinalScoreDb);
             tcFinalScoreService.updateById(tcFinalScoreDb);
         }
         }
         return ResultUtil.ok(true);
         return ResultUtil.ok(true);

+ 11 - 11
distributed-print/src/main/java/com/qmth/distributed/print/api/TCPaperStructController.java

@@ -80,7 +80,7 @@ public class TCPaperStructController {
     public Result finalScorePaperStructImport(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file,
     public Result finalScorePaperStructImport(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file,
                                               @ApiParam(value = "考试id", required = true) @RequestParam Long examId,
                                               @ApiParam(value = "考试id", required = true) @RequestParam Long examId,
                                               @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
                                               @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
-                                              @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber,
+                                              @ApiParam(value = "试卷编号") @RequestParam(required = false) String paperNumber,
                                               @ApiParam(value = "教学课程id", required = true) @RequestParam Long teachCourseId) throws IOException {
                                               @ApiParam(value = "教学课程id", required = true) @RequestParam Long teachCourseId) throws IOException {
         printCommonService.getLock(examId, courseCode, paperNumber, teachCourseId);
         printCommonService.getLock(examId, courseCode, paperNumber, teachCourseId);
         String lockKey = SystemConstant.REDIS_PAPER_STRUCT_FLOW_PREFIX + SystemConstant.IMPORT + examId + "_" + courseCode + "_" + paperNumber + "_" + teachCourseId;
         String lockKey = SystemConstant.REDIS_PAPER_STRUCT_FLOW_PREFIX + SystemConstant.IMPORT + examId + "_" + courseCode + "_" + paperNumber + "_" + teachCourseId;
@@ -90,7 +90,7 @@ public class TCPaperStructController {
         }
         }
         Map<String, String> map = null;
         Map<String, String> map = null;
         try {
         try {
-            map = tcPaperStructService.paperStructExcelImport(file, examId, courseCode, paperNumber);
+            map = tcPaperStructService.paperStructExcelImport(file, examId, courseCode, paperNumber, teachCourseId);
         } catch (Exception e) {
         } catch (Exception e) {
             log.error(SystemConstant.LOG_ERROR, e);
             log.error(SystemConstant.LOG_ERROR, e);
             if (e instanceof ApiException) {
             if (e instanceof ApiException) {
@@ -170,17 +170,17 @@ public class TCPaperStructController {
             }).collect(Collectors.toList());
             }).collect(Collectors.toList());
         }
         }
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        TCPaperStruct tcPaperStructDb = tcPaperStructService.queryByExamIdAndCourseCodeAndPaperNumber(paperStructParams.getExamId(), paperStructParams.getCourseCode(), paperStructParams.getPaperNumber());
+        TCPaperStruct tcPaperStructDb = tcPaperStructService.queryPaperStruct(paperStructParams.getExamId(), paperStructParams.getCourseCode(), paperStructParams.getPaperNumber(), paperStructParams.getTeachCourseId());
         if (Objects.isNull(tcPaperStructDb)) {
         if (Objects.isNull(tcPaperStructDb)) {
-            MarkPaper markPaper = printCommonService.getMarkPaper(paperStructParams.getExamId(), paperStructParams.getPaperNumber());
-            tcPaperStructDb = new TCPaperStruct(paperStructParams.getExamId(), paperStructParams.getCourseCode(), markPaper.getCourseName(), paperStructParams.getPaperNumber(), JacksonUtil.parseJson(paperStructParams.getPaperStruct()), sysUser.getId(), courseWeightResult.getDimensionSign());
+            MarkPaper markPaper = printCommonService.getMarkPaper(paperStructParams.getExamId(), paperStructParams.getCourseCode(), paperStructParams.getPaperNumber());
+            tcPaperStructDb = new TCPaperStruct(paperStructParams.getExamId(), paperStructParams.getCourseCode(), markPaper.getCourseName(), paperStructParams.getPaperNumber(), paperStructParams.getTeachCourseId(), JacksonUtil.parseJson(paperStructParams.getPaperStruct()), sysUser.getId(), courseWeightResult.getDimensionSign());
             tcPaperStructService.save(tcPaperStructDb);
             tcPaperStructService.save(tcPaperStructDb);
         } else {
         } else {
             TCPaperStruct tcPaperStructSource = new TCPaperStruct();
             TCPaperStruct tcPaperStructSource = new TCPaperStruct();
             BeanUtils.copyProperties(tcPaperStructDb, tcPaperStructSource);
             BeanUtils.copyProperties(tcPaperStructDb, tcPaperStructSource);
             tcPaperStructDb.updateInfo(JacksonUtil.parseJson(paperStructParams.getPaperStruct()), sysUser.getId());
             tcPaperStructDb.updateInfo(JacksonUtil.parseJson(paperStructParams.getPaperStruct()), sysUser.getId());
             if (!tcPaperStructDb.equals(tcPaperStructSource)) {
             if (!tcPaperStructDb.equals(tcPaperStructSource)) {
-                trBasicInfoService.clearReportData(tcPaperStructDb.getExamId(), tcPaperStructDb.getCourseCode(), tcPaperStructDb.getPaperNumber(), false);
+                trBasicInfoService.clearReportData(tcPaperStructDb.getExamId(), tcPaperStructDb.getCourseCode(), tcPaperStructDb.getPaperNumber(), paperStructParams.getTeachCourseId(), false);
                 tcPaperStructDb.setDimensionSign(courseWeightResult.getDimensionSign());
                 tcPaperStructDb.setDimensionSign(courseWeightResult.getDimensionSign());
                 tcPaperStructService.updateById(tcPaperStructDb);
                 tcPaperStructService.updateById(tcPaperStructDb);
             }
             }
@@ -194,10 +194,10 @@ public class TCPaperStructController {
     @ApiResponses({@ApiResponse(code = 200, message = "试卷蓝图保存", response = PaperStructDimensionResult.class)})
     @ApiResponses({@ApiResponse(code = 200, message = "试卷蓝图保存", response = PaperStructDimensionResult.class)})
     public Result finalScorePaperStructQuery(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
     public Result finalScorePaperStructQuery(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
                                              @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
                                              @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
-                                             @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber,
+                                             @ApiParam(value = "试卷编号") @RequestParam(required = false) String paperNumber,
                                              @ApiParam(value = "教学课程id", required = true) @RequestParam Long teachCourseId) throws IOException {
                                              @ApiParam(value = "教学课程id", required = true) @RequestParam Long teachCourseId) throws IOException {
         List<PaperStructDimensionResult> paperStructDimensionResultList = null;
         List<PaperStructDimensionResult> paperStructDimensionResultList = null;
-        TCPaperStruct tcPaperStruct = tcPaperStructService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
+        TCPaperStruct tcPaperStruct = tcPaperStructService.queryPaperStruct(examId, courseCode, paperNumber, teachCourseId);
         if (Objects.isNull(tcPaperStruct) || (Objects.isNull(tcPaperStruct.getPaperStruct()) && Objects.isNull(tcPaperStruct.getPaperStructDimension()))) {
         if (Objects.isNull(tcPaperStruct) || (Objects.isNull(tcPaperStruct.getPaperStruct()) && Objects.isNull(tcPaperStruct.getPaperStructDimension()))) {
             List<MarkQuestion> markQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumberAndPaperType(examId, paperNumber, null);
             List<MarkQuestion> markQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumberAndPaperType(examId, paperNumber, null);
             if (CollectionUtils.isEmpty(markQuestionList)) {
             if (CollectionUtils.isEmpty(markQuestionList)) {
@@ -205,12 +205,12 @@ public class TCPaperStructController {
             }
             }
             paperStructDimensionResultList = new ArrayList<>(markQuestionList.size());
             paperStructDimensionResultList = new ArrayList<>(markQuestionList.size());
             for (MarkQuestion markQuestion : markQuestionList) {
             for (MarkQuestion markQuestion : markQuestionList) {
-                paperStructDimensionResultList.add(new PaperStructDimensionResult(markQuestion.getMainNumber(), markQuestion.getSubNumber(), markQuestion.getTotalScore()));
+                paperStructDimensionResultList.add(new PaperStructDimensionResult(markQuestion.getMainNumber(), markQuestion.getSubNumber(), paperNumber, markQuestion.getTotalScore()));
             }
             }
         } else {
         } else {
             CourseWeightResult courseWeightResult = trBasicInfoService.findCourseWeightResultRmi(teachCourseId);
             CourseWeightResult courseWeightResult = trBasicInfoService.findCourseWeightResultRmi(teachCourseId);
             if (Objects.nonNull(tcPaperStruct.getDimensionSign()) && tcPaperStruct.getDimensionSign().longValue() != courseWeightResult.getDimensionSign().longValue()) {
             if (Objects.nonNull(tcPaperStruct.getDimensionSign()) && tcPaperStruct.getDimensionSign().longValue() != courseWeightResult.getDimensionSign().longValue()) {
-                trBasicInfoService.clearReportData(examId, courseCode, paperNumber, false);
+                trBasicInfoService.clearReportData(examId, courseCode, paperNumber, teachCourseId, false);
                 paperStructDimensionResultList = this.getPaperStructDimensionResult(tcPaperStruct, paperStructDimensionResultList);
                 paperStructDimensionResultList = this.getPaperStructDimensionResult(tcPaperStruct, paperStructDimensionResultList);
             } else {
             } else {
                 paperStructDimensionResultList = this.getPaperStructDimensionResult(tcPaperStruct, paperStructDimensionResultList);
                 paperStructDimensionResultList = this.getPaperStructDimensionResult(tcPaperStruct, paperStructDimensionResultList);
@@ -236,7 +236,7 @@ public class TCPaperStructController {
             }.getType());
             }.getType());
             paperStructDimensionResultList = new ArrayList<>(paperStructDtoList.size());
             paperStructDimensionResultList = new ArrayList<>(paperStructDtoList.size());
             for (PaperStructDto paperStructDto : paperStructDtoList) {
             for (PaperStructDto paperStructDto : paperStructDtoList) {
-                paperStructDimensionResultList.add(new PaperStructDimensionResult(paperStructDto.getMainNumber(), paperStructDto.getSubNumber(), paperStructDto.getScore()));
+                paperStructDimensionResultList.add(new PaperStructDimensionResult(paperStructDto.getMainNumber(), paperStructDto.getSubNumber(), tcPaperStruct.getPaperNumber(), paperStructDto.getScore()));
             }
             }
         }
         }
         return paperStructDimensionResultList;
         return paperStructDimensionResultList;

+ 9 - 7
distributed-print/src/main/java/com/qmth/distributed/print/api/TCUsualScoreController.java

@@ -84,7 +84,7 @@ public class TCUsualScoreController {
     @ApiResponses({@ApiResponse(code = 200, message = "下载成功", response = Object.class)})
     @ApiResponses({@ApiResponse(code = 200, message = "下载成功", response = Object.class)})
     public void usualScoreTemplateDownload(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
     public void usualScoreTemplateDownload(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
                                            @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
                                            @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
-                                           @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber,
+                                           @ApiParam(value = "试卷编号") @RequestParam(required = false) String paperNumber,
                                            @ApiParam(value = "教学课程id", required = true) @RequestParam Long teachCourseId) throws IOException {
                                            @ApiParam(value = "教学课程id", required = true) @RequestParam Long teachCourseId) throws IOException {
         CourseWeightResult courseWeightResult = trBasicInfoService.findCourseWeightResultRmi(teachCourseId);
         CourseWeightResult courseWeightResult = trBasicInfoService.findCourseWeightResultRmi(teachCourseId);
         List<CourseWeightDto> courseWeightDtoList = courseWeightResult.getSubmitForm();
         List<CourseWeightDto> courseWeightDtoList = courseWeightResult.getSubmitForm();
@@ -112,8 +112,9 @@ public class TCUsualScoreController {
     public Result usualScoreImport(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file,
     public Result usualScoreImport(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file,
                                    @ApiParam(value = "考试id", required = true) @RequestParam Long examId,
                                    @ApiParam(value = "考试id", required = true) @RequestParam Long examId,
                                    @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
                                    @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));
+                                   @ApiParam(value = "试卷编号") @RequestParam(required = false) String paperNumber,
+                                   @ApiParam(value = "教学课程id", required = true) @RequestParam Long teachCourseId) throws IOException {
+        return ResultUtil.ok(tcUsualScoreService.usualScoreExcelImport(file, examId, courseCode, paperNumber, teachCourseId));
     }
     }
 
 
     @ApiOperation(value = "平时成绩列表")
     @ApiOperation(value = "平时成绩列表")
@@ -122,10 +123,11 @@ public class TCUsualScoreController {
     @ApiResponses({@ApiResponse(code = 200, message = "分页查询", response = TCUsualScore.class)})
     @ApiResponses({@ApiResponse(code = 200, message = "分页查询", response = TCUsualScore.class)})
     public Result usualScoreList(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
     public Result usualScoreList(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
                                  @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
                                  @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
-                                 @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber,
+                                 @ApiParam(value = "试卷编号") @RequestParam(required = false) String paperNumber,
+                                 @ApiParam(value = "教学课程id", required = true) @RequestParam Long teachCourseId,
                                  @ApiParam(value = "分页页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
                                  @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 {
                                  @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));
+        return ResultUtil.ok(tcUsualScoreService.usualScoreList(new Page<>(pageNumber, pageSize), examId, courseCode, paperNumber, teachCourseId));
     }
     }
 
 
     @ApiOperation(value = "平时成绩编辑")
     @ApiOperation(value = "平时成绩编辑")
@@ -165,7 +167,7 @@ public class TCUsualScoreController {
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         tcUsualScoreDb.updateInfo(tcUsualScore, sysUser.getId());
         tcUsualScoreDb.updateInfo(tcUsualScore, sysUser.getId());
         if (!tcUsualScoreSource.equals(tcUsualScoreDb)) {
         if (!tcUsualScoreSource.equals(tcUsualScoreDb)) {
-            trBasicInfoService.clearReportData(tcUsualScoreDb.getExamId(), tcUsualScoreDb.getCourseCode(), tcUsualScoreDb.getPaperNumber(), false);
+            trBasicInfoService.clearReportData(tcUsualScoreDb.getExamId(), tcUsualScoreDb.getCourseCode(), tcUsualScoreDb.getPaperNumber(), tcUsualScoreDb.getTeachCourseId(), false);
             tcUsualScoreService.updateById(tcUsualScoreDb);
             tcUsualScoreService.updateById(tcUsualScoreDb);
         }
         }
         return ResultUtil.ok(true);
         return ResultUtil.ok(true);
@@ -187,7 +189,7 @@ public class TCUsualScoreController {
         if (!tcUsualScoreSource.equals(tcUsualScoreDb)) {
         if (!tcUsualScoreSource.equals(tcUsualScoreDb)) {
             SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
             SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
             tcUsualScoreDb.updateInfo(sysUser.getId());
             tcUsualScoreDb.updateInfo(sysUser.getId());
-            trBasicInfoService.clearReportData(tcUsualScoreDb.getExamId(), tcUsualScoreDb.getCourseCode(), tcUsualScoreDb.getPaperNumber(), false);
+            trBasicInfoService.clearReportData(tcUsualScoreDb.getExamId(), tcUsualScoreDb.getCourseCode(), tcUsualScoreDb.getPaperNumber(), tcUsualScoreDb.getTeachCourseId(), false);
             tcUsualScoreService.updateById(tcUsualScoreDb);
             tcUsualScoreService.updateById(tcUsualScoreDb);
         }
         }
         return ResultUtil.ok(true);
         return ResultUtil.ok(true);

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

@@ -115,14 +115,14 @@ public class TRBasicInfoController {
     @Transactional
     @Transactional
     public Result reportView(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
     public Result reportView(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
                              @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
                              @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
-                             @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber,
+                             @ApiParam(value = "试卷编号") @RequestParam(required = false) String paperNumber,
                              @ApiParam(value = "教学课程id", required = true) @RequestParam Long teachCourseId) {
                              @ApiParam(value = "教学课程id", required = true) @RequestParam Long teachCourseId) {
-        MarkPaper markPaper = printCommonService.getMarkPaper(examId, paperNumber);
+        MarkPaper markPaper = printCommonService.getMarkPaper(examId, courseCode, paperNumber);
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        TRBasicInfo trBasicInfo = trBasicInfoService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
+        TRBasicInfo trBasicInfo = trBasicInfoService.queryBasicInfo(examId, courseCode, paperNumber, teachCourseId);
 
 
         CourseWeightResult courseWeightResult = trBasicInfoService.findCourseWeightResultRmi(teachCourseId);
         CourseWeightResult courseWeightResult = trBasicInfoService.findCourseWeightResultRmi(teachCourseId);
-        TCPaperStruct tcPaperStruct = tcPaperStructService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
+        TCPaperStruct tcPaperStruct = tcPaperStructService.queryPaperStruct(examId, courseCode, paperNumber, teachCourseId);
         if (Objects.nonNull(tcPaperStruct) && Objects.nonNull(tcPaperStruct.getPaperStructDimension())) {
         if (Objects.nonNull(tcPaperStruct) && Objects.nonNull(tcPaperStruct.getPaperStructDimension())) {
             List<PaperStructDimensionResult> paperStructDimensionResultList = GsonUtil.fromJson(tcPaperStruct.getPaperStructDimension(), new TypeToken<List<PaperStructDimensionResult>>() {
             List<PaperStructDimensionResult> paperStructDimensionResultList = GsonUtil.fromJson(tcPaperStruct.getPaperStructDimension(), new TypeToken<List<PaperStructDimensionResult>>() {
             }.getType());
             }.getType());
@@ -131,19 +131,19 @@ public class TRBasicInfoController {
                 Objects.requireNonNull(c.getTotalWeight(), "[" + c.getCourseTargetName() + "]未设置权重");
                 Objects.requireNonNull(c.getTotalWeight(), "[" + c.getCourseTargetName() + "]未设置权重");
                 Objects.requireNonNull(c.getTotalScore(), "[" + c.getCourseTargetName() + "]未设置目标分值");
                 Objects.requireNonNull(c.getTotalScore(), "[" + c.getCourseTargetName() + "]未设置目标分值");
                 if (new BigDecimal(score).compareTo(c.getTotalWeight()) == 1) {
                 if (new BigDecimal(score).compareTo(c.getTotalWeight()) == 1) {
-                    trBasicInfoService.clearReportData(examId, courseCode, paperNumber, false);
+                    trBasicInfoService.clearReportData(examId, courseCode, paperNumber, teachCourseId, false);
                     throw ExceptionResultEnum.ERROR.exception("[" + c.getCourseTargetName() + "]包含的小题总分与权重设置不一致,请到期末成绩--试卷蓝图设置里调整");
                     throw ExceptionResultEnum.ERROR.exception("[" + c.getCourseTargetName() + "]包含的小题总分与权重设置不一致,请到期末成绩--试卷蓝图设置里调整");
                 }
                 }
             }
             }
         }
         }
 
 
         if (Objects.isNull(trBasicInfo)) {
         if (Objects.isNull(trBasicInfo)) {
-            trBasicInfo = trBasicInfoService.getReportView(trBasicInfo, markPaper, sysUser.getId(), courseWeightResult);
+            trBasicInfo = trBasicInfoService.getReportView(trBasicInfo, markPaper, sysUser.getId(), courseWeightResult, teachCourseId);
         } else {
         } else {
             ReportCourseEvaluationResultDto reportCourseEvaluationResultDto = Objects.nonNull(trBasicInfo.getCourseEvaluationResult()) ? JSONObject.parseObject(trBasicInfo.getCourseEvaluationResult(), ReportCourseEvaluationResultDto.class) : null;
             ReportCourseEvaluationResultDto reportCourseEvaluationResultDto = Objects.nonNull(trBasicInfo.getCourseEvaluationResult()) ? JSONObject.parseObject(trBasicInfo.getCourseEvaluationResult(), ReportCourseEvaluationResultDto.class) : null;
             if (Objects.nonNull(reportCourseEvaluationResultDto.getWeightSettingSign()) && reportCourseEvaluationResultDto.getWeightSettingSign().longValue() != courseWeightResult.getWeightSettingSign().longValue()) {
             if (Objects.nonNull(reportCourseEvaluationResultDto.getWeightSettingSign()) && reportCourseEvaluationResultDto.getWeightSettingSign().longValue() != courseWeightResult.getWeightSettingSign().longValue()) {
-                trBasicInfoService.clearReportData(examId, courseCode, paperNumber, Objects.nonNull(tcPaperStruct) && Objects.nonNull(tcPaperStruct.getDimensionSign()) && tcPaperStruct.getDimensionSign().longValue() != courseWeightResult.getDimensionSign().longValue() ? true : false);
-                trBasicInfo = trBasicInfoService.getReportView(trBasicInfo, markPaper, sysUser.getId(), courseWeightResult);
+                trBasicInfoService.clearReportData(examId, courseCode, paperNumber, teachCourseId, Objects.nonNull(tcPaperStruct) && Objects.nonNull(tcPaperStruct.getDimensionSign()) && tcPaperStruct.getDimensionSign().longValue() != courseWeightResult.getDimensionSign().longValue() ? true : false);
+                trBasicInfo = trBasicInfoService.getReportView(trBasicInfo, markPaper, sysUser.getId(), courseWeightResult, teachCourseId);
             } else {
             } else {
                 ReportCourseBasicInfoDto reportCourseBasicInfoDto = new ReportCourseBasicInfoDto(trBasicInfo);
                 ReportCourseBasicInfoDto reportCourseBasicInfoDto = new ReportCourseBasicInfoDto(trBasicInfo);
                 ReportCourseEvaluationSpreadDto reportCourseEvaluationSpreadDto = Objects.nonNull(trBasicInfo.getCourseEvaluationSpread()) ? JSONObject.parseObject(trBasicInfo.getCourseEvaluationSpread(), ReportCourseEvaluationSpreadDto.class) : null;
                 ReportCourseEvaluationSpreadDto reportCourseEvaluationSpreadDto = Objects.nonNull(trBasicInfo.getCourseEvaluationSpread()) ? JSONObject.parseObject(trBasicInfo.getCourseEvaluationSpread(), ReportCourseEvaluationSpreadDto.class) : null;
@@ -177,11 +177,11 @@ public class TRBasicInfoController {
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         TRBasicInfo trBasicInfoDb = null;
         TRBasicInfo trBasicInfoDb = null;
         try {
         try {
-            trBasicInfoDb = trBasicInfoService.queryByExamIdAndCourseCodeAndPaperNumber(trBasicInfo.getExamId(), trBasicInfo.getCourseCode(), trBasicInfo.getPaperNumber());
+            trBasicInfoDb = trBasicInfoService.queryBasicInfo(trBasicInfo.getExamId(), trBasicInfo.getCourseCode(), trBasicInfo.getPaperNumber(), trBasicInfo.getTeachCourseId());
             if (Objects.isNull(trBasicInfoDb)) {
             if (Objects.isNull(trBasicInfoDb)) {
                 trBasicInfoDb = new TRBasicInfo(trBasicInfo, sysUser.getId());
                 trBasicInfoDb = new TRBasicInfo(trBasicInfo, sysUser.getId());
-                MarkPaper markPaper = printCommonService.getMarkPaper(trBasicInfo.getExamId(), trBasicInfo.getPaperNumber());
-                trBasicInfoDb = trBasicInfoService.getReportView(trBasicInfoDb, markPaper, sysUser.getId(), trBasicInfoService.findCourseWeightResultRmi(trBasicInfo.getTeachCourseId()));
+                MarkPaper markPaper = printCommonService.getMarkPaper(trBasicInfo.getExamId(), trBasicInfo.getCourseCode(), trBasicInfo.getPaperNumber());
+                trBasicInfoDb = trBasicInfoService.getReportView(trBasicInfoDb, markPaper, sysUser.getId(), trBasicInfoService.findCourseWeightResultRmi(trBasicInfo.getTeachCourseId()), trBasicInfo.getTeachCourseId());
             } else {
             } else {
                 trBasicInfoDb.updateInfo(trBasicInfo, sysUser.getId());
                 trBasicInfoDb.updateInfo(trBasicInfo, sysUser.getId());
             }
             }
@@ -207,20 +207,20 @@ public class TRBasicInfoController {
     @Aac(rateLimit = @RateLimit(count = 1, period = 1000L))
     @Aac(rateLimit = @RateLimit(count = 1, period = 1000L))
     public void reportExport(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
     public void reportExport(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
                              @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
                              @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
-                             @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber,
+                             @ApiParam(value = "试卷编号") @RequestParam(required = false) String paperNumber,
                              @ApiParam(value = "教学课程id", required = true) @RequestParam Long teachCourseId) throws IOException {
                              @ApiParam(value = "教学课程id", required = true) @RequestParam Long teachCourseId) throws IOException {
         File txtFileTemp = null, fileTemp = null;
         File txtFileTemp = null, fileTemp = null;
         try {
         try {
             Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
             Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
             BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
             BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
 
 
-            TRBasicInfo trBasicInfo = trBasicInfoService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
+            TRBasicInfo trBasicInfo = trBasicInfoService.queryBasicInfo(examId, courseCode, paperNumber, teachCourseId);
             Objects.requireNonNull(trBasicInfo, "没有报告信息");
             Objects.requireNonNull(trBasicInfo, "没有报告信息");
             Objects.requireNonNull(trBasicInfo.getCourseEvaluationResult(), "没有课程目标信息");
             Objects.requireNonNull(trBasicInfo.getCourseEvaluationResult(), "没有课程目标信息");
             Objects.requireNonNull(trBasicInfo.getCourseEvaluationResultDetail(), "没有课程考生信息");
             Objects.requireNonNull(trBasicInfo.getCourseEvaluationResultDetail(), "没有课程考生信息");
 
 
             CourseWeightResult courseWeightResult = trBasicInfoService.findCourseWeightResultRmi(teachCourseId);
             CourseWeightResult courseWeightResult = trBasicInfoService.findCourseWeightResultRmi(teachCourseId);
-            TCPaperStruct tcPaperStruct = tcPaperStructService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
+            TCPaperStruct tcPaperStruct = tcPaperStructService.queryPaperStruct(examId, courseCode, paperNumber, teachCourseId);
             if (Objects.nonNull(tcPaperStruct) && Objects.nonNull(tcPaperStruct.getPaperStructDimension())) {
             if (Objects.nonNull(tcPaperStruct) && Objects.nonNull(tcPaperStruct.getPaperStructDimension())) {
                 List<PaperStructDimensionResult> paperStructDimensionResultList = GsonUtil.fromJson(tcPaperStruct.getPaperStructDimension(), new TypeToken<List<PaperStructDimensionResult>>() {
                 List<PaperStructDimensionResult> paperStructDimensionResultList = GsonUtil.fromJson(tcPaperStruct.getPaperStructDimension(), new TypeToken<List<PaperStructDimensionResult>>() {
                 }.getType());
                 }.getType());
@@ -229,7 +229,7 @@ public class TRBasicInfoController {
                     Objects.requireNonNull(c.getTotalWeight(), "[" + c.getCourseTargetName() + "]未设置权重");
                     Objects.requireNonNull(c.getTotalWeight(), "[" + c.getCourseTargetName() + "]未设置权重");
                     Objects.requireNonNull(c.getTotalScore(), "[" + c.getCourseTargetName() + "]未设置目标分值");
                     Objects.requireNonNull(c.getTotalScore(), "[" + c.getCourseTargetName() + "]未设置目标分值");
                     if (new BigDecimal(score).compareTo(c.getTotalWeight()) == 1) {
                     if (new BigDecimal(score).compareTo(c.getTotalWeight()) == 1) {
-                        trBasicInfoService.clearReportData(examId, courseCode, paperNumber, false);
+                        trBasicInfoService.clearReportData(examId, courseCode, paperNumber, teachCourseId, false);
                         throw ExceptionResultEnum.ERROR.exception("[" + c.getCourseTargetName() + "]包含的小题总分与权重设置不一致,请到期末成绩--试卷蓝图设置里调整");
                         throw ExceptionResultEnum.ERROR.exception("[" + c.getCourseTargetName() + "]包含的小题总分与权重设置不一致,请到期末成绩--试卷蓝图设置里调整");
                     }
                     }
                 }
                 }
@@ -237,8 +237,8 @@ public class TRBasicInfoController {
 
 
             ReportCourseEvaluationResultDto reportCourseEvaluationResultDto = JSONObject.parseObject(trBasicInfo.getCourseEvaluationResult(), ReportCourseEvaluationResultDto.class);
             ReportCourseEvaluationResultDto reportCourseEvaluationResultDto = JSONObject.parseObject(trBasicInfo.getCourseEvaluationResult(), ReportCourseEvaluationResultDto.class);
             if (Objects.nonNull(reportCourseEvaluationResultDto.getWeightSettingSign()) && reportCourseEvaluationResultDto.getWeightSettingSign().longValue() != courseWeightResult.getWeightSettingSign().longValue()) {
             if (Objects.nonNull(reportCourseEvaluationResultDto.getWeightSettingSign()) && reportCourseEvaluationResultDto.getWeightSettingSign().longValue() != courseWeightResult.getWeightSettingSign().longValue()) {
-                printCommonService.getMarkPaper(examId, paperNumber);
-                trBasicInfoService.clearReportData(examId, courseCode, paperNumber, Objects.nonNull(tcPaperStruct) && Objects.nonNull(tcPaperStruct.getDimensionSign()) && tcPaperStruct.getDimensionSign().longValue() != courseWeightResult.getDimensionSign().longValue() ? true : false);
+                printCommonService.getMarkPaper(examId, courseCode, paperNumber);
+                trBasicInfoService.clearReportData(examId, courseCode, paperNumber, teachCourseId, Objects.nonNull(tcPaperStruct) && Objects.nonNull(tcPaperStruct.getDimensionSign()) && tcPaperStruct.getDimensionSign().longValue() != courseWeightResult.getDimensionSign().longValue() ? true : false);
                 this.reportView(examId, courseCode, paperNumber, teachCourseId);
                 this.reportView(examId, courseCode, paperNumber, teachCourseId);
                 this.reportExport(examId, courseCode, paperNumber, teachCourseId);
                 this.reportExport(examId, courseCode, paperNumber, teachCourseId);
             } else {
             } else {
@@ -317,11 +317,11 @@ public class TRBasicInfoController {
     @ApiResponses({@ApiResponse(code = 200, message = "下载成功", response = Object.class)})
     @ApiResponses({@ApiResponse(code = 200, message = "下载成功", response = Object.class)})
     public Result reportDataChange(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
     public Result reportDataChange(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
                                    @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
                                    @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
-                                   @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber,
+                                   @ApiParam(value = "试卷编号") @RequestParam(required = false) String paperNumber,
                                    @ApiParam(value = "true:报告,false:成绩管理", required = true) @RequestParam boolean report,
                                    @ApiParam(value = "true:报告,false:成绩管理", required = true) @RequestParam boolean report,
                                    @ApiParam(value = "教学课程id", required = true) @RequestParam Long teachCourseId) throws IOException {
                                    @ApiParam(value = "教学课程id", required = true) @RequestParam Long teachCourseId) throws IOException {
         ReportChangeResult reportChangeResult = new ReportChangeResult();
         ReportChangeResult reportChangeResult = new ReportChangeResult();
-        List<TCUsualScore> tcUsualScoreList = tcUsualScoreService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
+        List<TCUsualScore> tcUsualScoreList = tcUsualScoreService.queryUsualScore(examId, courseCode, paperNumber, teachCourseId);
         if (CollectionUtils.isNotEmpty(tcUsualScoreList)) {
         if (CollectionUtils.isNotEmpty(tcUsualScoreList)) {
             Set<String> usualScoreCourseSet = new LinkedHashSet<>();
             Set<String> usualScoreCourseSet = new LinkedHashSet<>();
             TCUsualScore tcUsualScore = tcUsualScoreList.get(0);
             TCUsualScore tcUsualScore = tcUsualScoreList.get(0);
@@ -351,7 +351,7 @@ public class TRBasicInfoController {
                 }
                 }
             }
             }
 
 
-            TRBasicInfo trBasicInfo = trBasicInfoService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
+            TRBasicInfo trBasicInfo = trBasicInfoService.queryBasicInfo(examId, courseCode, paperNumber, teachCourseId);
             if (Objects.nonNull(trBasicInfo) && Objects.nonNull(trBasicInfo.getCourseEvaluationResultDetail())) {
             if (Objects.nonNull(trBasicInfo) && Objects.nonNull(trBasicInfo.getCourseEvaluationResultDetail())) {
                 JSONObject jsonObject = JSONObject.parseObject(trBasicInfo.getCourseEvaluationResultDetail());
                 JSONObject jsonObject = JSONObject.parseObject(trBasicInfo.getCourseEvaluationResultDetail());
                 List<CourseTargetWordDto> courseTargetWordDtoList = JSONArray.parseArray(jsonObject.get("targetWordMap").toString(), CourseTargetWordDto.class);
                 List<CourseTargetWordDto> courseTargetWordDtoList = JSONArray.parseArray(jsonObject.get("targetWordMap").toString(), CourseTargetWordDto.class);
@@ -366,7 +366,7 @@ public class TRBasicInfoController {
             }
             }
 
 
             if (!report) {
             if (!report) {
-                TCPaperStruct tcPaperStruct = tcPaperStructService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
+                TCPaperStruct tcPaperStruct = tcPaperStructService.queryPaperStruct(examId, courseCode, paperNumber, teachCourseId);
                 if (Objects.nonNull(tcPaperStruct) && Objects.nonNull(tcPaperStruct.getPaperStructDimension())) {
                 if (Objects.nonNull(tcPaperStruct) && Objects.nonNull(tcPaperStruct.getPaperStructDimension())) {
                     List<PaperStructDimensionResult> paperStructDimensionResultList = GsonUtil.fromJson(tcPaperStruct.getPaperStructDimension(), new TypeToken<List<PaperStructDimensionResult>>() {
                     List<PaperStructDimensionResult> paperStructDimensionResultList = GsonUtil.fromJson(tcPaperStruct.getPaperStructDimension(), new TypeToken<List<PaperStructDimensionResult>>() {
                     }.getType());
                     }.getType());
@@ -385,7 +385,7 @@ public class TRBasicInfoController {
                         }
                         }
                     }
                     }
                     if (reportChangeResult.isTargetScoreChange()) {
                     if (reportChangeResult.isTargetScoreChange()) {
-                        trBasicInfoService.clearReportData(examId, courseCode, paperNumber, false);
+                        trBasicInfoService.clearReportData(examId, courseCode, paperNumber, teachCourseId, false);
                         reportChangeResult.setTargetScoreChangeStr(stringJoiner.toString());
                         reportChangeResult.setTargetScoreChangeStr(stringJoiner.toString());
                     }
                     }
                 }
                 }

+ 2 - 1
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/entity/MarkPaper.java

@@ -151,9 +151,10 @@ public class MarkPaper implements Serializable {
         this.showObjectScore = false;
         this.showObjectScore = false;
     }
     }
 
 
-    public MarkPaper(Long examId, String courseCode, String paperNumber, Double totalScore, Double passScore) {
+    public MarkPaper(Long examId, String courseCode, String courseName, String paperNumber, Double totalScore, Double passScore) {
         this.examId = examId;
         this.examId = examId;
         this.courseCode = courseCode;
         this.courseCode = courseCode;
+        this.courseName = courseName;
         this.paperNumber = paperNumber;
         this.paperNumber = paperNumber;
         this.totalScore = totalScore;
         this.totalScore = totalScore;
         this.passScore = passScore;
         this.passScore = passScore;