wangliang 11 mesi fa
parent
commit
be4c1a44e0

+ 18 - 7
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/statistics/PrintCountResult.java

@@ -7,9 +7,11 @@ import com.qmth.distributed.print.business.enums.CardTypeEnum;
 import com.qmth.distributed.print.business.enums.StatisticsStatusEnum;
 import com.qmth.teachcloud.common.annotation.ExcelProperty;
 import io.swagger.annotations.ApiModelProperty;
+import org.apache.commons.lang3.StringUtils;
 
 import java.io.Serializable;
 import java.util.Objects;
+import java.util.StringJoiner;
 
 /**
  * @Description: 印刷任务统计 result
@@ -41,7 +43,7 @@ public class PrintCountResult implements Serializable {
 
     @ApiModelProperty(value = "题卡id")
     @JsonSerialize(using = ToStringSerializer.class)
-    private Long cardId;
+    private String cardId;
 
     @ApiModelProperty(value = "开课学院")
     @ExcelProperty(name = "开课学院", width = 20, index = 4)
@@ -69,7 +71,7 @@ public class PrintCountResult implements Serializable {
     private int reject;
 
     @ApiModelProperty(value = "题卡类型")
-    private CardTypeEnum cardType;
+    private String cardType;
 
     @ApiModelProperty(value = "题卡类型str")
     @ExcelProperty(name = "题卡类型", width = 20, index = 3)
@@ -126,11 +128,11 @@ public class PrintCountResult implements Serializable {
         this.paperNumber = paperNumber;
     }
 
-    public Long getCardId() {
+    public String getCardId() {
         return cardId;
     }
 
-    public void setCardId(Long cardId) {
+    public void setCardId(String cardId) {
         this.cardId = cardId;
     }
 
@@ -214,16 +216,25 @@ public class PrintCountResult implements Serializable {
         this.rejectStr = rejectStr;
     }
 
-    public CardTypeEnum getCardType() {
+    public String getCardType() {
         return cardType;
     }
 
-    public void setCardType(CardTypeEnum cardType) {
+    public void setCardType(String cardType) {
         this.cardType = cardType;
     }
 
     public String getCardTypeStr() {
-        return Objects.nonNull(cardType) ? cardType.getName() : cardTypeStr;
+        if (Objects.nonNull(cardType)) {
+            String[] str = StringUtils.split(cardType, ",");
+            StringJoiner stringJoiner = new StringJoiner(",");
+            for (String s : str) {
+                stringJoiner.add(CardTypeEnum.valueOf(s).getName());
+            }
+            return stringJoiner.toString();
+        } else {
+            return cardTypeStr;
+        }
     }
 
     public void setCardTypeStr(String cardTypeStr) {

+ 24 - 13
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/statistics/ScanCountResult.java

@@ -6,9 +6,11 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.distributed.print.business.enums.CardTypeEnum;
 import com.qmth.teachcloud.common.annotation.ExcelProperty;
 import io.swagger.annotations.ApiModelProperty;
+import org.apache.commons.lang3.StringUtils;
 
 import java.io.Serializable;
 import java.util.Objects;
+import java.util.StringJoiner;
 
 /**
  * @Description: 扫描任务统计 result
@@ -40,7 +42,7 @@ public class ScanCountResult implements Serializable {
 
     @ApiModelProperty(value = "题卡id")
     @JsonSerialize(using = ToStringSerializer.class)
-    private Long cardId;
+    private String cardId;
 
     @ApiModelProperty(value = "开课学院")
     @ExcelProperty(name = "开课学院", width = 20, index = 1)
@@ -62,7 +64,7 @@ public class ScanCountResult implements Serializable {
     private int scanUploadRate;
 
     @ApiModelProperty(value = "题卡类型")
-    private CardTypeEnum cardType;
+    private String cardType;
 
     @ApiModelProperty(value = "题卡类型str")
     @ExcelProperty(name = "题卡类型", width = 20, index = 4)
@@ -96,14 +98,6 @@ public class ScanCountResult implements Serializable {
         this.paperNumber = paperNumber;
     }
 
-    public Long getCardId() {
-        return cardId;
-    }
-
-    public void setCardId(Long cardId) {
-        this.cardId = cardId;
-    }
-
     public String getCollege() {
         return college;
     }
@@ -144,16 +138,33 @@ public class ScanCountResult implements Serializable {
         this.scanUploadRate = scanUploadRate;
     }
 
-    public CardTypeEnum getCardType() {
+    public String getCardId() {
+        return cardId;
+    }
+
+    public void setCardId(String cardId) {
+        this.cardId = cardId;
+    }
+
+    public String getCardType() {
         return cardType;
     }
 
-    public void setCardType(CardTypeEnum cardType) {
+    public void setCardType(String cardType) {
         this.cardType = cardType;
     }
 
     public String getCardTypeStr() {
-        return Objects.nonNull(cardType) ? cardType.getName() : cardTypeStr;
+        if (Objects.nonNull(cardType)) {
+            String[] str = StringUtils.split(cardType, ",");
+            StringJoiner stringJoiner = new StringJoiner(",");
+            for (String s : str) {
+                stringJoiner.add(CardTypeEnum.valueOf(s).getName());
+            }
+            return stringJoiner.toString();
+        } else {
+            return cardTypeStr;
+        }
     }
 
     public void setCardTypeStr(String cardTypeStr) {

+ 13 - 7
distributed-print-business/src/main/resources/mapper/ExamTaskMapper.xml

@@ -1328,7 +1328,7 @@
         select t.*,
         if(t.unGenerated = 0 and t.unPrinted = 0,'FINISH','UN_FINISH') as finishStatus from(select
         t.*,
-        ec.type as cardType,
+        GROUP_CONCAT(distinct ec.type) as cardType,
         (<include refid="printStatusCount" />)) as totalExamination,
         (<include refid="printStatusCount" /> and ed.status in ('READY', 'WAITING', 'PRINTING', 'FINISH'))) as generate,
         (<include refid="printStatusCount" /> and ed.status in ('NEW', 'CREATING'))) as unGenerated,
@@ -1345,7 +1345,7 @@
         bc.name as courseName,
         bc.code as courseCode,
         et.paper_number as paperNumber,
-        replace(substring_index(substring_index(convert((etd.paper_attachment_ids ->>'$[*].cardId') using utf8), ']', 1), '[',-1), '"', '') as cardId,
+        concat(replace(substring_index(substring_index(convert((etd.paper_attachment_ids ->>'$[*].cardId') using utf8), ']', 1), '[',-1), '"', ''),', ') as cardId,
         so.name as college
         from exam_task et
         left join basic_course bc on bc.id = et.course_id
@@ -1394,13 +1394,18 @@
                 </if>
             </if>
         </where>) t
-        left join exam_card ec on ec.id = t.cardId
+        left join tmp_help_topic b on b.help_topic_id <![CDATA[ < ]]> (LENGTH(t.cardId) - LENGTH( REPLACE (t.cardId, ', ', '' ) ) + 1 )
+        left join exam_card ec on ec.id in (SUBSTRING_INDEX(SUBSTRING_INDEX(t.cardId, ', ', b.help_topic_id), ', ',-1))
            <where>
                <if test="cardType != null and cardType != ''">
                    AND ec.type = #{cardType}
                </if>
            </where>
-            ) t
+        group by t.id,
+        t.college,
+        t.courseName,
+        t.courseCode,
+        t.paperNumber) t
         <where>
             <if test="finishStatus != null and finishStatus != ''">
                 <choose>
@@ -1437,7 +1442,7 @@
             t.paperNumber,
             t.studentCount,
             t.absentCount,
-            ec.type as cardType,
+            GROUP_CONCAT(distinct ec.type) as cardType,
             ROUND(sum(t.sheetCount) / 2, 2) as sheetCount,
             sum(case when t.isUpload = 1 then 1 else 0 end) as scanUploadCount
         from
@@ -1453,7 +1458,7 @@
         IFNULL(ms.sheet_count, 0) as sheetCount,
         IFNULL(mp.absent_count, 0) as absentCount,
         IFNULL(ms.is_upload, 0) as isUpload,
-        replace(substring_index(substring_index(convert((etd.paper_attachment_ids ->>'$[*].cardId') using utf8), ']', 1), '[',-1), '"', '') as cardId
+        concat(replace(substring_index(substring_index(convert((etd.paper_attachment_ids ->>'$[*].cardId') using utf8), ']', 1), '[',-1), '"', ''),', ') as cardId
         from mark_paper mp
         left join basic_exam be on be.id = mp.exam_id and be.enable = true
         left join basic_semester bs on bs.id = be.semester_id and bs.enable = true
@@ -1500,7 +1505,8 @@
                 </if>
             </if>
         </where>) t
-        left join exam_card ec on ec.id = t.cardId
+        left join tmp_help_topic b on b.help_topic_id <![CDATA[ < ]]> (LENGTH(t.cardId) - LENGTH( REPLACE (t.cardId, ', ', '' ) ) + 1 )
+        left join exam_card ec on ec.id in (SUBSTRING_INDEX(SUBSTRING_INDEX(t.cardId, ', ', b.help_topic_id), ', ',-1))
         <where>
             <if test="cardType != null and cardType != ''">
                 AND ec.type = #{cardType}

+ 62 - 1
distributed-print/install/mysql/upgrade/3.4.0.sql

@@ -330,4 +330,65 @@ update t_b_task a left join basic_exam be on a.exam_id = be.id left join basic_c
 ALTER TABLE `basic_course` ADD INDEX `index1` (`teaching_room_id` ASC);
 ALTER TABLE `basic_exam_student` ADD INDEX `index1` (`exam_id` ASC, `course_id` ASC, `paper_number` ASC);
 ALTER TABLE `basic_exam_student` ADD INDEX `index2` (`exam_id` ASC, `paper_number` ASC, `student_code` ASC);
-ALTER TABLE `mark_student` ADD INDEX `index6` (`exam_id` ASC, `paper_number` ASC, `paper_type` ASC);
+ALTER TABLE `mark_student` ADD INDEX `index6` (`exam_id` ASC, `paper_number` ASC, `paper_type` ASC);
+
+-- 2024-07-16
+DROP TABLE IF EXISTS `tmp_help_topic`;
+CREATE TABLE `tmp_help_topic` (
+                                  `help_topic_id` bigint(20) NOT NULL AUTO_INCREMENT,
+                                  PRIMARY KEY (`help_topic_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=utf8mb4;
+
+-- ----------------------------
+-- Records of tmp_help_topic
+-- ----------------------------
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (1);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (2);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (3);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (4);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (5);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (6);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (7);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (8);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (9);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (10);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (11);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (12);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (13);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (14);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (15);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (16);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (17);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (18);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (19);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (20);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (21);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (22);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (23);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (24);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (25);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (26);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (27);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (28);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (29);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (30);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (31);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (32);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (33);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (34);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (35);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (36);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (37);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (38);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (39);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (40);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (41);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (42);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (43);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (44);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (45);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (46);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (47);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (48);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (49);
+INSERT INTO `tmp_help_topic` (`help_topic_id`) VALUES (50);

+ 2 - 1
teachcloud-obe/src/main/java/com/qmth/teachcloud/obe/been/report/ObeCourseRequirementDto.java

@@ -41,10 +41,11 @@ public class ObeCourseRequirementDto implements Serializable {
 
     }
 
-    public ObeCourseRequirementDto(CourseRequirementMatrixDto courseRequirementMatrixDto) {
+    public ObeCourseRequirementDto(CourseRequirementMatrixDto courseRequirementMatrixDto,BigDecimal courseMatrixDegree) {
         this.courseCode = courseRequirementMatrixDto.getCourseCode();
         this.courseName = courseRequirementMatrixDto.getCourseName();
         this.semesterName = courseRequirementMatrixDto.getSemesterName();
+        this.courseMatrixDegree = courseMatrixDegree;
     }
 
     public ObeCourseRequirementDto(ObeCourseRequirementDto obeCourseRequirementDto) {

+ 6 - 2
teachcloud-obe/src/main/java/com/qmth/teachcloud/obe/service/impl/ObeCourseRequirementReportServiceImpl.java

@@ -178,11 +178,16 @@ public class ObeCourseRequirementReportServiceImpl extends ServiceImpl<ObeCourse
                     TRBasicInfo trBasicInfo = trBasicInfoService.queryBasicInfo(obeCourseOutline.getCultureProgramId(), obeCourseOutline.getCourseId(), null);
                     if (Objects.nonNull(trBasicInfo)) {
                         ReportCourseEvaluationResultDto reportCourseEvaluationResultDto = Objects.nonNull(trBasicInfo.getCourseEvaluationResult()) ? JSONObject.parseObject(trBasicInfo.getCourseEvaluationResult(), ReportCourseEvaluationResultDto.class) : null;
+                        BigDecimal courseMatrixDegree = new BigDecimal(0);
                         if (Objects.nonNull(reportCourseEvaluationResultDto)) {
                             List<CourseTargetWebDto> courseTargetWebDtoList = reportCourseEvaluationResultDto.getTargetList();
+                            OptionalDouble courseDegree = courseTargetWebDtoList.stream().filter(x -> Objects.nonNull(x.getEvaluationValue()) && x.getEvaluationValue().doubleValue() > 0).mapToDouble(x -> x.getEvaluationValue().doubleValue()).min();
+                            if (courseDegree.isPresent()) {
+                                courseMatrixDegree = new BigDecimal(courseDegree.getAsDouble()).setScale(2, BigDecimal.ROUND_HALF_UP);
+                            }
                             courseTargetWebDtoMap = courseTargetWebDtoList.stream().collect(Collectors.toMap(CourseTargetWebDto::getTargetId, Function.identity(), (dto1, dto2) -> dto1));
                         }
-                        ObeCourseRequirementDto obeCourseRequirementDto = new ObeCourseRequirementDto(c);
+                        ObeCourseRequirementDto obeCourseRequirementDto = new ObeCourseRequirementDto(c, courseMatrixDegree);
                         obeCourseRequirementDtoList.add(obeCourseRequirementDto);
                         List<MatrixRequirementDto> matrixRequirementDtoList = c.getRequirements();
                         if (!CollectionUtils.isEmpty(matrixRequirementDtoList)) {
@@ -228,7 +233,6 @@ public class ObeCourseRequirementReportServiceImpl extends ServiceImpl<ObeCourse
                             for (Map.Entry<Long, List<ObeSubRequirementsDto>> entry : matrixSubRequirementIdMap.entrySet()) {
                                 OptionalDouble evaluationValue = entry.getValue().stream().mapToDouble(x -> Objects.nonNull(x.getEvaluationValue()) ? x.getEvaluationValue().doubleValue() : 0.0d).average();
                                 if (evaluationValue.isPresent()) {
-                                    obeCourseRequirementDto.setCourseMatrixDegree(new BigDecimal(evaluationValue.getAsDouble()));
                                     ObeSubRequirementsDto obeSubRequirementsDto = entry.getValue().get(0);
                                     BigDecimal bigDecimal = new BigDecimal(evaluationValue.getAsDouble()).multiply(obeSubRequirementsDto.getScale()).setScale(2, BigDecimal.ROUND_HALF_UP);
                                     entry.getValue().stream().peek(x -> x.setMatrixDegree(bigDecimal)).collect(Collectors.toList());