haogh 10 luni în urmă
părinte
comite
ea47cda35f

+ 3 - 2
paper-library-business/src/main/java/com/qmth/paper/library/business/service/impl/ClientServiceImpl.java

@@ -79,7 +79,8 @@ public class ClientServiceImpl implements ClientService {
 
     @Transactional
     @Override
-    public Long pictureUpload(Long paperScanTaskId, String studentCode, Integer x, Integer y, Integer width, Integer height, Integer rotate, MultipartFile frontFile, String frontMd5, MultipartFile versoFile, String versoMd5, Long scanUserId, String batchNo,Integer studentPaperNo) {
+    public Long pictureUpload(Long paperScanTaskId, String studentCode, Integer x, Integer y, Integer width, Integer height, Integer rotate,
+            MultipartFile frontFile, String frontMd5, MultipartFile versoFile, String versoMd5, Long scanUserId, String batchNo, Integer studentPaperNo) {
 
         if (Objects.isNull(frontFile) || frontFile.getSize() == 0) {
             throw ExceptionResultEnum.ERROR.exception("frontFile(正面图片)为空");
@@ -131,7 +132,7 @@ public class ClientServiceImpl implements ClientService {
             paperLibrary.setStudentId(examStudent.getId());
             //考生图片序号
             int studentMaxSequence = paperLibraryService.getStudentMaxSequence(paperScanTaskId, batchNo, examStudent.getId());
-            int studentSequence = studentMaxSequence + 1;
+            int studentSequence = studentMaxSequence + studentPaperNo;
             paperLibrary.setSequence(studentSequence);
             // 保存图片,生成路径
             PathSequenceVo pathSequenceVo = paperLibraryCommonService.saveLibraryFile(paperScanTask, examStudent, UploadFileEnum.IMAGE, studentSequence, frontFile, versoFile);

+ 6 - 4
paper-library-business/src/main/java/com/qmth/paper/library/business/service/impl/PaperLibraryCommonServiceImpl.java

@@ -313,11 +313,13 @@ public class PaperLibraryCommonServiceImpl implements PaperLibraryCommonService
         }
         // 根目录
         List<FilePathVo> objects = new ArrayList<>();
-        int sequence = businessCacheService.getSequence(paperScanTask.getId(), examStudent.getStudentCode());
-        String sequenceStr = String.valueOf(sequence);
+        /*int sequence = businessCacheService.getSequence(paperScanTask.getId(), examStudent.getStudentCode());
+        String sequenceStr = String.valueOf(sequence);*/
         try {
             int idx = 1;
-//            String prefix = examStudent.getStudentCode() + "-" + sequenceStr;
+            //以前的方式
+            // String prefix = examStudent.getStudentCode() + "-" + sequenceStr;
+            //现在的方式
             String prefix = examStudent.getStudentCode() + "-" + studentSequence;
             for (MultipartFile file : files) {
                 String fileName = file.getOriginalFilename();
@@ -336,7 +338,7 @@ public class PaperLibraryCommonServiceImpl implements PaperLibraryCommonService
                 ResultUtil.error(e.getMessage());
             }
         }
-        return new PathSequenceVo(JSON.toJSONString(objects), sequence);
+        return new PathSequenceVo(JSON.toJSONString(objects), studentSequence);
     }
 
     @Override

+ 8 - 6
paper-library-business/src/main/java/com/qmth/paper/library/business/service/impl/PaperLibraryServiceImpl.java

@@ -281,9 +281,10 @@ public class PaperLibraryServiceImpl extends ServiceImpl<PaperLibraryMapper, Pap
         PathSequenceVo pathSequenceVo = null;
         try {
             // 将图片复制到学号目录下,并删除原图片
-            pathSequenceVo = copyImageToStudentCode(paperLibrary, studentId, UploadFileEnum.IMAGE);
+            pathSequenceVo = copyImageToStudentCode(paperLibrary, task, studentId, UploadFileEnum.IMAGE);
         } catch (Exception e) {
             log.error("纠错操作复制图片失败");
+            throw ExceptionResultEnum.ERROR.exception("纠错失败");
         }
 
         // 更新绑定考生ID
@@ -315,8 +316,8 @@ public class PaperLibraryServiceImpl extends ServiceImpl<PaperLibraryMapper, Pap
         return true;
     }
 
-    private PathSequenceVo copyImageToStudentCode(PaperLibrary paperLibrary, Long studentId, UploadFileEnum uploadFileEnum) {
-        PaperScanTask paperScanTask = paperScanTaskService.getById(paperLibrary.getPaperScanTaskId());
+    private PathSequenceVo copyImageToStudentCode(PaperLibrary paperLibrary, PaperScanTask task, Long studentId, UploadFileEnum uploadFileEnum) {
+        PaperScanTask paperScanTask = paperScanTaskService.getById(task.getId());
         BasicSchool basicSchool = basicSchoolService.getById(paperScanTask.getSchoolId());
         BasicExam basicExam = basicExamService.getById(paperScanTask.getExamId());
         BasicSemester basicSemester = basicSemesterService.getById(basicExam.getSemesterId());
@@ -333,8 +334,9 @@ public class PaperLibraryServiceImpl extends ServiceImpl<PaperLibraryMapper, Pap
         // 根目录
         boolean isAllCopy = true;
         List<FilePathVo> objects = new ArrayList<>();
-        int sequence = businessCacheService.getSequence(paperScanTask.getId(), examStudent.getStudentCode());
-        String sequenceStr = String.valueOf(sequence);
+//        int sequence = businessCacheService.getSequence(paperScanTask.getId(), examStudent.getStudentCode());
+        int sequence = getStudentMaxSequence(paperScanTask.getId(), null, studentId);
+        String sequenceStr = String.valueOf(sequence + 1);
         try {
             int idx = 1;
             String prefix = examStudent.getStudentCode() + "-" + sequenceStr;
@@ -368,7 +370,7 @@ public class PaperLibraryServiceImpl extends ServiceImpl<PaperLibraryMapper, Pap
                 ResultUtil.error(e.getMessage());
             }
         }
-        return isAllCopy ? new PathSequenceVo(JSON.toJSONString(objects), sequence) : null;
+        return isAllCopy ? new PathSequenceVo(JSON.toJSONString(objects), sequence+1) : null;
     }
 
     @Override

+ 5 - 1
paper-library-business/src/main/resources/mapper/PaperLibraryMapper.xml

@@ -123,7 +123,11 @@
     </select>
 
     <select id="getStudentMaxSequence" resultType="java.lang.Integer">
-        select ifnull(max(sequence),0) from paper_library where paper_scan_task_id=#{paperScanTaskId} and student_id=#{studentId} and batch_no=#{batchNo}
+        select ifnull(max(sequence),0) from paper_library where paper_scan_task_id=#{paperScanTaskId} and student_id=#{studentId}
+        <if test="batchNo != null and batchNo != ''">
+            and batch_no != #{batchNo}
+        </if>
+
     </select>
 
 </mapper>

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

@@ -16,7 +16,11 @@ import com.qmth.paper.library.common.service.TBTaskService;
 import com.qmth.paper.library.common.util.Result;
 import com.qmth.paper.library.common.util.ResultUtil;
 import com.qmth.paper.library.common.util.ServletUtil;
-import io.swagger.annotations.*;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;