Bläddra i källkod

1.0.4 bug修改

xiaofei 2 år sedan
förälder
incheckning
eb0edfb260

+ 4 - 0
src/main/java/com/qmth/eds/service/ExamCourseMappingService.java

@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.eds.common.entity.ExamCourseMapping;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.util.List;
+
 /**
  * <p>
  * 武大考务数据和云阅卷课程代码映射关系表 服务类
@@ -15,4 +17,6 @@ public interface ExamCourseMappingService extends IService<ExamCourseMapping> {
     IPage<ExamCourseMapping> pageData(Long semesterId, Long examTypeId, String syncCourseCode, String cloudMarkingCourseCode, Integer pageNumber, Integer pageSize);
 
     void importData(Long semesterId, Long examTypeId, MultipartFile file);
+
+    List<ExamCourseMapping> listBySemesterIdAndExamTypeIdAndCloudMarkCourseCode(Long schoolId, Long semesterId, Long examTypeId, String courseCode);
 }

+ 16 - 5
src/main/java/com/qmth/eds/service/impl/ExamAssignServiceImpl.java

@@ -29,10 +29,7 @@ import org.springframework.util.CollectionUtils;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -61,6 +58,9 @@ public class ExamAssignServiceImpl extends ServiceImpl<ExamAssignMapper, ExamAss
     @Resource
     ExamAssignMapper examAssignMapper;
 
+    @Resource
+    ExamCourseMappingService examCourseMappingService;
+
     @Override
     public IPage<ExamAssignDto> pageData(Long semesterId, Long examTypeId, Long collegeId, String courseCode, Integer pageNumber, Integer pageSize) {
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
@@ -71,13 +71,24 @@ public class ExamAssignServiceImpl extends ServiceImpl<ExamAssignMapper, ExamAss
         if (examSyncTotal == null) {
             throw ExceptionResultEnum.ERROR.exception("未设置使用数据文件,请联系管理员处理");
         }
+
+
         List<ExamSyncStudent> examSyncStudents = examSyncStudentService.listByExamSyncTotalId(examSyncTotal);
         for (ExamAssignDto record : assignListDtoIPage.getRecords()) {
             int actualCount = 0;
             String kkxy = "";
 
+            // 查询关联课程
+            List<ExamCourseMapping> examCourseMappings = examCourseMappingService.listBySemesterIdAndExamTypeIdAndCloudMarkCourseCode(schoolId, semesterId, examTypeId, record.getCourseCode());
             if (!CollectionUtils.isEmpty(examSyncStudents)) {
-                List<ExamSyncStudent> syncStudents = examSyncStudents.stream().filter(m -> m.getKch().equals(record.getCourseCode())).collect(Collectors.toList());
+
+                List<String> courses = Arrays.asList(record.getCourseCode().split(","));
+                if(!CollectionUtils.isEmpty(examCourseMappings)){
+                    courses = examCourseMappings.stream().map(ExamCourseMapping::getSyncCourseCode).collect(Collectors.toList());
+                }
+
+                List<String> finalCourses = courses;
+                List<ExamSyncStudent> syncStudents = examSyncStudents.stream().filter(m -> finalCourses.contains(m.getKch())).collect(Collectors.toList());
                 actualCount = syncStudents.size();
                 List<String> kkxyList = syncStudents.stream().map(ExamSyncStudent::getKkbm).distinct().collect(Collectors.toList());
                 if (!CollectionUtils.isEmpty(kkxyList) && kkxyList.size() > 1) {

+ 10 - 0
src/main/java/com/qmth/eds/service/impl/ExamCourseMappingServiceImpl.java

@@ -115,4 +115,14 @@ public class ExamCourseMappingServiceImpl extends ServiceImpl<ExamCourseMappingM
             throw ExceptionResultEnum.ERROR.exception("导入异常:" + e.getMessage());
         }
     }
+
+    @Override
+    public List<ExamCourseMapping> listBySemesterIdAndExamTypeIdAndCloudMarkCourseCode(Long schoolId, Long semesterId, Long examTypeId, String courseCode) {
+        QueryWrapper<ExamCourseMapping> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(ExamCourseMapping::getSchoolId, schoolId)
+                .eq(ExamCourseMapping::getSemesterId, semesterId)
+                .eq(ExamCourseMapping::getExamTypeId, examTypeId)
+                .eq(ExamCourseMapping::getCloudMarkingCourseCode, courseCode);
+        return this.list(queryWrapper);
+    }
 }