xiaofei 2 жил өмнө
parent
commit
5506d1c79d

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamTaskMapper.java

@@ -61,7 +61,7 @@ public interface ExamTaskMapper extends BaseMapper<ExamTask> {
 
     List<ExamTask> listExamTaskAuditExpire(@Param("startTime") Long startTime, @Param("endTime") Long endTime);
 
-    List<ExamTaskDetailDto> listTaskPaper(@Param("schoolId") Long schoolId, @Param("semesterId") Long semesterId, @Param("examId") Long examId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("cardRuleId") Long cardRuleId, @Param("makeMethod") MakeMethodEnum makeMethod, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("orgIds") Set<Long> orgIds, @Param("containsQuestionTeacher") boolean containsQuestionTeacher, @Param("userId") Long userId);
+    List<ExamTaskDetailDto> listTaskPaper(@Param("schoolId") Long schoolId, @Param("semesterId") Long semesterId, @Param("examId") Long examId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("cardRuleId") Long cardRuleId, @Param("makeMethod") MakeMethodEnum makeMethod, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("dpr") DataPermissionRule dpr, @Param("orgIds") Set<Long> orgIds, @Param("containsQuestionTeacher") boolean containsQuestionTeacher, @Param("userId") Long userId);
 
     /**
      * 获取待办任务

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

@@ -337,7 +337,7 @@ public class ExamPaperStructureServiceImpl extends ServiceImpl<ExamPaperStructur
                     return questionList.stream();
                 }).collect(Collectors.toList()));
         if (!matchSubAndGroup) {
-            throw ExceptionResultEnum.ERROR.exception("题目没有全部完成分组或者试卷构中的主观题结构和分组中主观题结构不一致");
+            throw ExceptionResultEnum.ERROR.exception("题目没有全部完成分组或者试卷构中的主观题结构和分组中主观题结构不一致");
         }
         // 2.保存试卷结构
         ExamPaperStructure examPaperStructure = this.saveExamPaperStructure(evaluationParameterStr, requestUser);

+ 4 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java

@@ -1281,7 +1281,8 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
         boolean containsQuestionTeacher = false;
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
         Set<Long> orgIds = teachcloudCommonService.listSubOrgIds(null);
-        return this.baseMapper.listTaskPaper(schoolId, semesterId, examId, courseCode, paperNumber, cardRuleId, makeMethod, startTime, endTime, orgIds, containsQuestionTeacher, sysUser.getId());
+        DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(schoolId, sysUser.getId(), ServletUtil.getRequest().getServletPath());
+        return this.baseMapper.listTaskPaper(schoolId, semesterId, examId, courseCode, paperNumber, cardRuleId, makeMethod, startTime, endTime, dpr, orgIds, containsQuestionTeacher, sysUser.getId());
     }
 
     @Override
@@ -2086,7 +2087,8 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                 }
             }
             if (excelErrorTemp.size() > 0) {
-                throw ExceptionResultEnum.ERROR.exception(JSONObject.toJSONString(excelErrorTemp));
+                List<String> errors = excelErrorTemp.stream().map(ExcelError::getExcelErrorType).collect(Collectors.toList());
+                throw ExceptionResultEnum.ERROR.exception(JSONObject.toJSONString(errors));
             }
             return finalExcelList;
         });

+ 2 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/annotation/ExcelNote.java

@@ -15,4 +15,6 @@ import java.lang.annotation.*;
 public @interface ExcelNote {
 
     String value() default "";
+
+    boolean require() default true;
 }

+ 4 - 4
teachcloud-common/src/main/java/com/qmth/teachcloud/common/util/ExcelUtil.java

@@ -179,7 +179,7 @@ public class ExcelUtil {
                             }
                         }
                         ExcelImportTempleteVaild excelImportTempleteVaild = o.getClass().getDeclaredAnnotation(ExcelImportTempleteVaild.class);
-                        if (Objects.nonNull(excelImportTempleteVaild) && excelImportTempleteVaild.value() && (lastcell != fields.length || sheets != clazz.size())) {
+                        if (y == 0 && i == 0 && Objects.nonNull(excelImportTempleteVaild) && excelImportTempleteVaild.value() && (lastcell != fields.length || sheets != clazz.size())) {
                             throw ExceptionResultEnum.ERROR.exception("导入文件和模版不一致,表头应包含【" + String.join(",", headList) + "】");
                         }
 
@@ -208,7 +208,7 @@ public class ExcelUtil {
                                             fields[j].set(o, obj);
                                             Annotation annotation = fields[j].getAnnotation(NotNull.class);
                                             ExcelNote note = fields[j].getAnnotation(ExcelNote.class);
-                                            if ((Objects.isNull(obj) || Objects.equals("", obj)) && Objects.nonNull(annotation)) {
+                                            if (note.require() && (Objects.isNull(obj) || Objects.equals("", obj)) && Objects.nonNull(annotation)) {
                                                 excelErrorList.add(y, new ExcelError(j + 1, "excel第" + (y + 1) + "个sheet第" + (j + 1) + "行[" + note.value() + "]为空"));
                                             }
                                         } else {
@@ -232,7 +232,7 @@ public class ExcelUtil {
                                             fields[j].set(o, obj);
                                             Annotation annotation = fields[j].getAnnotation(NotNull.class);
                                             ExcelNote note = fields[j].getAnnotation(ExcelNote.class);
-                                            if ((Objects.isNull(obj) || Objects.equals("", obj)) && Objects.nonNull(annotation)) {
+                                            if (note.require() && (Objects.isNull(obj) || Objects.equals("", obj)) && Objects.nonNull(annotation)) {
                                                 excelErrorList.add(y, new ExcelError(i + 1, "excel第" + (y + 1) + "个sheet第" + (i + 1) + "行[" + note.value() + "]为空"));
                                             }
                                         }
@@ -341,7 +341,7 @@ public class ExcelUtil {
             field.setAccessible(true);
             Annotation annotation = field.getAnnotation(NotNull.class);
             ExcelNote note = field.getAnnotation(ExcelNote.class);
-            if ((Objects.isNull(field.get(obj)) || Objects.equals("", field.get(obj))) && Objects.nonNull(annotation)) {
+            if (note.require() && (Objects.isNull(field.get(obj)) || Objects.equals("", field.get(obj))) && Objects.nonNull(annotation)) {
                 excelErrorList.add(new ExcelError(index + 1, "excel第" + (sheetIndex + 1) + "个sheet第" + (index + 1) + "行[" + note.value() + "]为空"));
             }
         }