瀏覽代碼

1.1.0 update-20250102未赋分取原始分值

xiaofei 6 月之前
父節點
當前提交
be2c218dfb

+ 10 - 0
src/main/java/com/qmth/eds/bean/dto/ExamAssignDto.java

@@ -13,6 +13,8 @@ public class ExamAssignDto extends ExamAssign {
     private String syncCourseCode;
     private String openCollege;
     private String formulaStr;
+    // 赋分系数
+    private String valueStr;
 
     private String statusStr;
     private String resultStr;
@@ -61,6 +63,14 @@ public class ExamAssignDto extends ExamAssign {
         this.formulaStr = formulaStr;
     }
 
+    public String getValueStr() {
+        return valueStr;
+    }
+
+    public void setValueStr(String valueStr) {
+        this.valueStr = valueStr;
+    }
+
     public String getStatusStr() {
         return statusStr;
     }

+ 26 - 10
src/main/java/com/qmth/eds/service/impl/ExamAssignServiceImpl.java

@@ -1,6 +1,5 @@
 package com.qmth.eds.service.impl;
 
-import com.alibaba.excel.EasyExcel;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -11,19 +10,18 @@ import com.qmth.boot.tools.excel.ExcelWriter;
 import com.qmth.boot.tools.excel.enums.ExcelType;
 import com.qmth.eds.bean.dto.ExamAssignDto;
 import com.qmth.eds.bean.dto.ScoreDownloadDto;
+import com.qmth.eds.bean.dto.coefficient.Coefficient;
 import com.qmth.eds.bean.result.AssignResultPreviewResult;
 import com.qmth.eds.common.contant.SystemConstant;
 import com.qmth.eds.common.entity.*;
 import com.qmth.eds.common.enums.ExamAssignStatusEnum;
 import com.qmth.eds.common.enums.ExceptionResultEnum;
-import com.qmth.eds.common.util.FileUtil;
 import com.qmth.eds.common.util.ServletUtil;
 import com.qmth.eds.mapper.ExamAssignMapper;
 import com.qmth.eds.service.*;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.ss.usermodel.CellStyle;
-import org.apache.poi.ss.usermodel.FillPatternType;
 import org.apache.poi.ss.usermodel.IndexedColors;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
@@ -31,8 +29,6 @@ import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
-import java.io.File;
-import java.io.IOException;
 import java.net.URLEncoder;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -78,6 +74,7 @@ public class ExamAssignServiceImpl extends ServiceImpl<ExamAssignMapper, ExamAss
                 record.setId(examAssign.getId());
                 record.setFormula(examAssign.getFormula());
                 record.setFormulaStr(examAssign.getFormula() != null ? examAssign.getFormula().getName() : "/");
+                record.setValueStr(StringUtils.isNotBlank(examAssign.getCoefficient()) ? String.valueOf(JSON.parseObject(examAssign.getCoefficient(), Coefficient.class).getValue()) : "/");
                 record.setStatus(examAssign.getStatus());
                 record.setStatusStr(examAssign.getStatus().getDesc());
                 record.setResultStr(ExamAssignStatusEnum.FINISH.equals(examAssign.getStatus()) ? StringUtils.isBlank(examAssign.getErrorMsg()) ? "成功" : "失败" : "/");
@@ -211,22 +208,41 @@ public class ExamAssignServiceImpl extends ServiceImpl<ExamAssignMapper, ExamAss
 
         List<CloudMarkingScoreForeign> cloudMarkingScoreForeigns = new ArrayList<>();
         List<ExamSyncStudent> examSyncStudents = examSyncStudentService.listByExamSyncTotalId(examSyncTotal);
+        List<CloudMarkingScore> cloudMarkingScoreUpdateList = new ArrayList<>();
         for (CloudMarkingScore cloudMarkingScore : cloudMarkingScoreList) {
+            // 若赋分有值,则发布赋分成绩,否则发布原始成绩
+            String publishScore = StringUtils.isBlank(cloudMarkingScore.getAssignScore()) ? cloudMarkingScore.getTotalScore() : cloudMarkingScore.getAssignScore();
             if (cloudMarkingScore.getExamSyncStudentId() != null) {
                 ExamSyncStudent examSyncStudent = examSyncStudents.stream().filter(m -> cloudMarkingScore.getExamSyncStudentId().equals(m.getId())).findFirst().get();
-                cloudMarkingScoreForeigns.add(new CloudMarkingScoreForeign(collegeId, semesterId, examTypeId, cloudMarkingScore.getExamId(), examSyncStudent.getXnm(), examSyncStudent.getXqm(), examSyncStudent.getJxbId(), examSyncStudent.getKch(), examSyncStudent.getKcmc(), examSyncStudent.getXh(), cloudMarkingScore.getAssignScore()));
+                cloudMarkingScoreForeigns.add(new CloudMarkingScoreForeign(collegeId, semesterId, examTypeId, cloudMarkingScore.getExamId(), examSyncStudent.getXnm(), examSyncStudent.getXqm(), examSyncStudent.getJxbId(), examSyncStudent.getKch(), examSyncStudent.getKcmc(), examSyncStudent.getXh(), publishScore));
             } else {
                 Optional<ExamSyncStudent> optional = examSyncStudents.stream()
                         .filter(s -> s.getKch().equals(cloudMarkingScore.getSyncCourseCode()) && s.getXh().equals(cloudMarkingScore.getStudentCode())).findFirst();
-                if (!optional.isPresent()) {
-                    cloudMarkingScoreForeigns.add(new CloudMarkingScoreForeign(collegeId, semesterId, examTypeId, cloudMarkingScore.getExamId(), null, null, null, cloudMarkingScore.getSyncCourseCode(), cloudMarkingScore.getSubjectName(), cloudMarkingScore.getStudentCode(), cloudMarkingScore.getAssignScore()));
-                } else {
+                if (optional.isPresent()) {
                     ExamSyncStudent examSyncStudent = optional.get();
                     // 匹配上,保存考务数据表ID
-                    cloudMarkingScoreForeigns.add(new CloudMarkingScoreForeign(collegeId, semesterId, examTypeId, cloudMarkingScore.getExamId(), examSyncStudent.getXnm(), examSyncStudent.getXqm(), examSyncStudent.getJxbId(), examSyncStudent.getKch(), examSyncStudent.getKcmc(), examSyncStudent.getXh(), cloudMarkingScore.getAssignScore()));
+                    cloudMarkingScoreForeigns.add(new CloudMarkingScoreForeign(collegeId, semesterId, examTypeId, cloudMarkingScore.getExamId(), examSyncStudent.getXnm(), examSyncStudent.getXqm(), examSyncStudent.getJxbId(), examSyncStudent.getKch(), examSyncStudent.getKcmc(), examSyncStudent.getXh(), publishScore));
+
+                    // 设置关联考务数据id
+                    cloudMarkingScore.setExamSyncStudentId(examSyncStudent.getId());
+                    cloudMarkingScoreUpdateList.add(cloudMarkingScore);
+                } else {
+                    // 未关联到考务数据的数据,不同步到武大成绩表
+//                    cloudMarkingScoreForeigns.add(new CloudMarkingScoreForeign(collegeId, semesterId, examTypeId, cloudMarkingScore.getExamId(), null, null, null, cloudMarkingScore.getSyncCourseCode(), cloudMarkingScore.getSubjectName(), cloudMarkingScore.getStudentCode(), publishScore));
                 }
             }
         }
+
+        // 补更新关联id
+        if (CollectionUtils.isNotEmpty(cloudMarkingScoreUpdateList)) {
+            for (CloudMarkingScore cloudMarkingScore : cloudMarkingScoreUpdateList) {
+                UpdateWrapper<CloudMarkingScore> updateWrapper = new UpdateWrapper<>();
+                updateWrapper.lambda().set(CloudMarkingScore::getExamSyncStudentId, cloudMarkingScore.getExamSyncStudentId())
+                        .eq(CloudMarkingScore::getId, cloudMarkingScore.getId());
+                cloudMarkingScoreService.update(updateWrapper);
+            }
+        }
+
         // 重新发布时,删除已发布的成绩
         cloudMarkingScoreForeignService.deleteByCourseCode(collegeId, semesterId, examTypeId, syncCourseCode, courseCode);