|
@@ -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);
|
|
|
}
|
|
|
|
|
|
}
|