Răsfoiți Sursa

1.0.5 update

xiaofei 9 luni în urmă
părinte
comite
df88d394c0

+ 1 - 1
paper-library-business/src/main/java/com/qmth/paper/library/business/service/PaperLibraryService.java

@@ -44,7 +44,7 @@ public interface PaperLibraryService extends IService<PaperLibrary> {
 
     List<String> listBatchNo(Long studentId);
 
-    boolean deletePicture(List<Long> paperLibraryIds);
+    boolean deletePicture(String data);
 
     boolean rotatePictureUpload(Long paperLibraryId, boolean isFront, Integer rotate);
 

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

@@ -1,6 +1,7 @@
 package com.qmth.paper.library.business.service.impl;
 
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -34,6 +35,7 @@ import com.qmth.paper.library.common.service.TBTaskService;
 import com.qmth.paper.library.common.util.*;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.json.JSONArray;
 import org.springframework.stereotype.Service;
@@ -43,11 +45,7 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.annotation.Resource;
 import java.io.File;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -309,7 +307,7 @@ public class PaperLibraryServiceImpl extends ServiceImpl<PaperLibraryMapper, Pap
 
             //更新扫描任务扫描考生数量、扫描图片数量
             paperScanTaskService.updateScanCount(paperLibrary.getPaperScanTaskId());
-            if(!task.getId().equals(paperLibrary.getPaperScanTaskId())) {
+            if (!task.getId().equals(paperLibrary.getPaperScanTaskId())) {
                 paperScanTaskService.updateScanCount(task.getId());
             }
         }
@@ -374,7 +372,7 @@ public class PaperLibraryServiceImpl extends ServiceImpl<PaperLibraryMapper, Pap
                 ResultUtil.error(e.getMessage());
             }
         }
-        return isAllCopy ? new PathSequenceVo(JSON.toJSONString(objects), sequence+1) : null;
+        return isAllCopy ? new PathSequenceVo(JSON.toJSONString(objects), sequence + 1) : null;
     }
 
     @Override
@@ -404,7 +402,9 @@ public class PaperLibraryServiceImpl extends ServiceImpl<PaperLibraryMapper, Pap
 
     @Transactional
     @Override
-    public boolean deletePicture(List<Long> paperLibraryIds) {
+    public boolean deletePicture(String data) {
+        JSONObject object = JSONObject.parseObject(data, JSONObject.class);
+        List<String> paperLibraryIds = Arrays.asList(object.getString("paperLibraryIds").split(","));
         List<PaperLibrary> paperLibraryList = this.listByIds(paperLibraryIds);
         if (CollectionUtils.isEmpty(paperLibraryList)) {
             throw ExceptionResultEnum.ERROR.exception("图片数据不存在");
@@ -412,7 +412,7 @@ public class PaperLibraryServiceImpl extends ServiceImpl<PaperLibraryMapper, Pap
 
         // 删除后,重新统计绑定数量
         if (this.removeByIds(paperLibraryIds)) {
-            Set<Long> studentIds = paperLibraryList.stream().filter(m->m.getStudentId() != null).map(PaperLibrary::getStudentId).collect(Collectors.toSet());
+            Set<Long> studentIds = paperLibraryList.stream().filter(m -> m.getStudentId() != null).map(PaperLibrary::getStudentId).collect(Collectors.toSet());
             for (Long studentId : studentIds) {
                 examStudentService.updateBindCount(studentId);
                 // 清除pdf文件记录
@@ -426,9 +426,9 @@ public class PaperLibraryServiceImpl extends ServiceImpl<PaperLibraryMapper, Pap
         }
 
         //删除图片
-        for(PaperLibrary paperLibrary : paperLibraryList) {
+        for (PaperLibrary paperLibrary : paperLibraryList) {
             List<FilePathVo> filePathVoList = JSON.parseArray(paperLibrary.getPath(), FilePathVo.class);
-            for(FilePathVo filePathVo : filePathVoList) {
+            for (FilePathVo filePathVo : filePathVoList) {
                 boolean deleted = fileUploadService.deleteFile(filePathVo.getPath());
                 if (!deleted) {
                     log.warn("[删除图片] 删除图片失败,路径:" + filePathVo.getPath());
@@ -478,7 +478,7 @@ public class PaperLibraryServiceImpl extends ServiceImpl<PaperLibraryMapper, Pap
     public Map<String, Object> pdfGenerate(DownLoadPaperParams params) {
         SysUser user = (SysUser) ServletUtil.getRequestUser();
         boolean lockFlag = lockService.trylock(LockType.STUDENT_PDF_GENERATE, user.getId());
-        if(!lockFlag) {
+        if (!lockFlag) {
             throw ExceptionResultEnum.ERROR.exception("已经在生成,在生成完成之前,不要重复生成");
         }
         String remark = JSON.toJSONString(params);
@@ -489,7 +489,7 @@ public class PaperLibraryServiceImpl extends ServiceImpl<PaperLibraryMapper, Pap
 
     @Override
     public int getStudentMaxSequence(Long paperScanTaskId, String batchNo, Long studentId) {
-        return  baseMapper.getStudentMaxSequence(paperScanTaskId, batchNo, studentId);
+        return baseMapper.getStudentMaxSequence(paperScanTaskId, batchNo, studentId);
     }
 
 }

+ 4 - 11
paper-library/src/main/java/com/qmth/paper/library/api/DocManageController.java

@@ -16,16 +16,9 @@ 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.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.annotations.*;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import javax.validation.constraints.Max;
@@ -155,8 +148,8 @@ public class DocManageController {
     @ApiOperation(value = "删除图片")
     @PostMapping("/picture/delete")
     @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = Result.class)})
-    public Result deletePicture(@ApiParam(value = "图片ID", required = true) @RequestParam List<Long> paperLibraryIds) {
-        return ResultUtil.ok(paperLibraryService.deletePicture(paperLibraryIds));
+    public Result deletePicture(@ApiParam(value = "图片ID", required = true) @RequestBody String data) {
+        return ResultUtil.ok(paperLibraryService.deletePicture(data));
     }
 
     @ApiOperation(value = "旋转保存图片")