Explorar o código

3.2.6 广药新需求-班级被选择后提示信息修改

xiaofei %!s(int64=2) %!d(string=hai) anos
pai
achega
873befa96a

+ 20 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/ExamDetailCourseDto.java

@@ -18,6 +18,10 @@ public class ExamDetailCourseDto extends ExamDetailCourse {
 
     private String sequence;
 
+    private String loginName;
+
+    private String realName;
+
     public Long getExamTaskId() {
         return examTaskId;
     }
@@ -49,4 +53,20 @@ public class ExamDetailCourseDto extends ExamDetailCourse {
     public void setSequence(String sequence) {
         this.sequence = sequence;
     }
+
+    public String getLoginName() {
+        return loginName;
+    }
+
+    public void setLoginName(String loginName) {
+        this.loginName = loginName;
+    }
+
+    public String getRealName() {
+        return realName;
+    }
+
+    public void setRealName(String realName) {
+        this.realName = realName;
+    }
 }

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

@@ -3,10 +3,7 @@ package com.qmth.distributed.print.business.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.qmth.distributed.print.business.bean.dto.ClientExamStudentDto;
-import com.qmth.distributed.print.business.bean.dto.ExamDetailPdfDownloadDto;
-import com.qmth.distributed.print.business.bean.dto.PrintTaskDto;
-import com.qmth.distributed.print.business.bean.dto.PrintTaskTotalDto;
+import com.qmth.distributed.print.business.bean.dto.*;
 import com.qmth.distributed.print.business.bean.result.ExaminationDetailResult;
 import com.qmth.distributed.print.business.bean.result.ExaminationResult;
 import com.qmth.distributed.print.business.bean.result.SummarizedDataResult;
@@ -121,5 +118,5 @@ public interface ExamDetailMapper extends BaseMapper<ExamDetail> {
 
     SummarizedDataResult findSummarizedData(@Param("schoolId") Long schoolId, @Param("semesterId") Long semesterId, @Param("examId") Long examId, @Param("printPlanIdList") List<Long> printPlanIdList, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("examPlace") String examPlace, @Param("examRoom") String examRoom, @Param("packageCode") String packageCode, @Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("dpr") DataPermissionRule dpr);
 
-    List<ExamDetailCourse> listByExamIdAndCourseCode(@Param("schoolId") Long schoolId, @Param("examId") Long examId, @Param("courseCode") String courseCode);
+    List<ExamDetailCourseDto> listByExamIdAndCourseCode(@Param("schoolId") Long schoolId, @Param("examId") Long examId, @Param("courseCode") String courseCode);
 }

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

@@ -248,7 +248,7 @@ public interface ExamDetailService extends IService<ExamDetail> {
 
     List<ExamStudent> listStudentByExamDetailId(String examDetailId);
 
-    List<ExamDetailCourse> listByExamIdAndCourseCode(Long schoolId, Long examId, String courseCode);
+    List<ExamDetailCourseDto> listByExamIdAndCourseCode(Long schoolId, Long examId, String courseCode);
 
     void deleteByExamIdAndPaperNumber(Long schoolId, Long examId, String paperNumber);
 }

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamDetailServiceImpl.java

@@ -1137,7 +1137,7 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
     }
 
     @Override
-    public List<ExamDetailCourse> listByExamIdAndCourseCode(Long schoolId, Long examId, String courseCode) {
+    public List<ExamDetailCourseDto> listByExamIdAndCourseCode(Long schoolId, Long examId, String courseCode) {
         return this.baseMapper.listByExamIdAndCourseCode(schoolId, examId, courseCode);
     }
 

+ 31 - 10
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java

@@ -1732,13 +1732,17 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                 examPrintPlanService.save(examPrintPlan);
 
                 // 查询考试+课程下已用过的班级
-                List<String> usedClassIds = new ArrayList<>();
-                List<ExamDetailCourse> examDetailCourseList = examDetailService.listByExamIdAndCourseCode(schoolId, examTask.getExamId(), examTask.getCourseCode());
+                Map<String, String> usedClassIdsMap = new HashMap<>();
+                List<ExamDetailCourseDto> examDetailCourseList = examDetailService.listByExamIdAndCourseCode(schoolId, examTask.getExamId(), examTask.getCourseCode());
                 if (!CollectionUtils.isEmpty(examDetailCourseList)) {
                     examDetailCourseList.stream().filter(m -> StringUtils.isNotBlank(m.getClazzId())).forEach(m -> {
-                        usedClassIds.addAll(Arrays.asList(m.getClazzId().split(",")));
+//                        usedClassIds.addAll(Arrays.asList(m.getClazzId().split(",")));
+                        for (String s : m.getClazzId().split(",")) {
+                            usedClassIdsMap.put(s, String.format("%s(%s)", m.getRealName(), m.getLoginName()));
+                        }
                     });
                 }
+                Set<String> classIdSet = usedClassIdsMap.keySet();
 
                 // 已使用过的班级集合(报错用)
                 List<String> errorClassIds = new ArrayList<>();
@@ -1753,9 +1757,11 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                             throw ExceptionResultEnum.ERROR.exception("选择的考试班级【" + clazzName + "】下无学生,请确认该班级学生信息");
                         }
 
-                        for (String s : examDetailList.getClassId().split(",")) {
-                            if (usedClassIds.contains(s)) {
-                                errorClassIds.add(s);
+                        if (!CollectionUtils.isEmpty(classIdSet)) {
+                            for (String s : examDetailList.getClassId().split(",")) {
+                                if (classIdSet.contains(s)) {
+                                    errorClassIds.add(s);
+                                }
                             }
                         }
 
@@ -1815,9 +1821,9 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                         }
                     }
                 } else if (ExamModelEnum.MODEL2.equals(basicExam.getExamModel())) {
-                    if (StringUtils.isNotBlank(examDetailParams.getClassId())) {
+                    if (StringUtils.isNotBlank(examDetailParams.getClassId()) && !CollectionUtils.isEmpty(classIdSet)) {
                         for (String s : examDetailParams.getClassId().split(",")) {
-                            if (usedClassIds.contains(s)) {
+                            if (classIdSet.contains(s)) {
                                 errorClassIds.add(s);
                             }
                         }
@@ -1860,9 +1866,24 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                 }
 
                 if (!CollectionUtils.isEmpty(errorClassIds)) {
+                    Map<String, List<String>> finalMap = new HashMap<>();
+                    StringJoiner stringJoiner = new StringJoiner(",");
                     List<BasicClazz> basicClazzList = basicClazzService.listByIds(errorClassIds);
-                    String clazzNames = basicClazzList.stream().map(m -> m.getClazzName()).collect(Collectors.joining(","));
-                    throw ExceptionResultEnum.ERROR.exception("考试对象[" + clazzNames + "]已被其它人占用");
+                    for (BasicClazz basicClazz : basicClazzList) {
+                        String key = usedClassIdsMap.get(basicClazz.getId().toString());
+                        List<String> value;
+                        if (finalMap.containsKey(key)) {
+                            value = finalMap.get(key);
+                        } else {
+                            value = new ArrayList<>();
+                        }
+                        value.add(basicClazz.getClazzName());
+                        finalMap.put(key, value);
+                    }
+                    for (Map.Entry<String, List<String>> entry : finalMap.entrySet()) {
+                        stringJoiner.add("考试对象[" + String.join(",", entry.getValue()) + "]已被" + entry.getKey() + "选择");
+                    }
+                    throw ExceptionResultEnum.ERROR.exception(stringJoiner.toString());
                 }
             }
 

+ 6 - 2
distributed-print-business/src/main/resources/mapper/ExamDetailMapper.xml

@@ -665,13 +665,17 @@
         </trim>
     </select>
     <select id="listByExamIdAndCourseCode"
-            resultMap="com.qmth.distributed.print.business.mapper.ExamDetailCourseMapper.BaseResultMap">
+            resultType="com.qmth.distributed.print.business.bean.dto.ExamDetailCourseDto">
         SELECT
-            *
+            edc.clazz_id clazzId,
+            su.login_name loginName,
+            su.real_name realName
         FROM
             exam_detail_course edc
                 JOIN
             exam_detail ed ON edc.exam_detail_id = ed.id
+                left join
+            sys_user su ON ed.create_id = su.id
         WHERE
             edc.school_id = #{schoolId} AND ed.exam_id = #{examId}
           AND edc.course_code = #{courseCode} AND ed.status != 'CANCEL'