Browse Source

1.0.5 bug

haogh 10 months ago
parent
commit
b35c2102a2

+ 9 - 1
paper-library-business/src/main/java/com/qmth/paper/library/business/service/impl/PaperLibraryCommonServiceImpl.java

@@ -27,6 +27,7 @@ import com.qmth.paper.library.common.util.ServletUtil;
 import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
@@ -343,7 +344,14 @@ public class PaperLibraryCommonServiceImpl implements PaperLibraryCommonService
         BasicExam basicExam = basicExamService.getById(paperScanTask.getExamId());
         BasicSemester basicSemester = basicSemesterService.getById(basicExam.getSemesterId());
         String courseNameCode = String.format("%s(%s)", paperScanTask.getCourseName(), paperScanTask.getCourseCode());
-        String rootPath = fileStoreUtil.buildPath(UploadFileEnum.IMAGE, false, basicSchool.getName(), basicSemester.getName(), basicExam.getName(), courseNameCode, classRoomName, "other");
+
+        String rootPath;
+        if(StringUtils.isEmpty(classRoomName)) {
+            rootPath = fileStoreUtil.buildPath(UploadFileEnum.IMAGE, false, basicSchool.getName(), basicSemester.getName(), basicExam.getName(), courseNameCode, "other");
+        } else {
+            rootPath = fileStoreUtil.buildPath(UploadFileEnum.IMAGE, false, basicSchool.getName(), basicSemester.getName(), basicExam.getName(), courseNameCode, classRoomName, "other");
+        }
+
         // 根目录
         List<FilePathVo> objects = new ArrayList<>();
         try {

+ 1 - 1
paper-library/src/main/java/com/qmth/paper/library/api/ClientController.java

@@ -124,7 +124,7 @@ public class ClientController {
                               @ApiParam(value = "背面图片", required = true) @RequestParam MultipartFile versoFile,
                               @ApiParam(value = "背面图片md5", required = true) @RequestParam String versoMd5,
                               @ApiParam(value = "文件类型ID", required = true) @RequestParam Long fileTypeId,
-                              @ApiParam(value = "考场/班级的名称", required = true) @RequestParam String classRoomName) {
+                              @ApiParam(value = "考场/班级的名称") @RequestParam(required = false) String classRoomName) {
         return ResultUtil.ok(clientService.otherUpload(paperScanTaskId, frontFile, frontMd5, versoFile, versoMd5, fileTypeId, classRoomName));
     }