|
@@ -1,6 +1,6 @@
|
|
|
package com.qmth.paper.library.business.service.impl;
|
|
|
|
|
|
-import cn.hutool.core.collection.ArrayIter;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.qmth.boot.tools.excel.ExcelWriter;
|
|
|
import com.qmth.boot.tools.excel.enums.ExcelType;
|
|
|
+import com.qmth.paper.library.business.bean.vo.FilePathVo;
|
|
|
import com.qmth.paper.library.business.entity.PaperScanTask;
|
|
|
import com.qmth.paper.library.business.mapper.ExamStudentMapper;
|
|
|
import com.qmth.paper.library.business.service.*;
|
|
@@ -68,6 +69,8 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentMapper, ExamS
|
|
|
private PaperLibraryCommonService paperLibraryCommonService;
|
|
|
@Resource
|
|
|
private AsyncExamStudentImportService asyncExamStudentImportService;
|
|
|
+ @Resource
|
|
|
+ private FileUploadService fileUploadService;
|
|
|
|
|
|
@Override
|
|
|
public IPage<ExamStudent> findStudentPage(Long examId, String courseCode, String collegeName, String majorName, String clazzName, String queryParams, int pageNumber, int pageSize) {
|
|
@@ -410,4 +413,27 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentMapper, ExamS
|
|
|
return examStudent;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void clearPdfFilePath(Long studentId) {
|
|
|
+ ExamStudent examStudent = this.getById(studentId);
|
|
|
+ try {
|
|
|
+ if (examStudent != null && StringUtils.isNotBlank(examStudent.getFilePath())) {
|
|
|
+ FilePathVo filePathVo = JSON.parseObject(examStudent.getFilePath(), FilePathVo.class);
|
|
|
+ if (this.clearFilePath(studentId)) {
|
|
|
+ fileUploadService.deleteFile(filePathVo.getPath());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("清除pdf文件路径失败" + e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean clearFilePath(Long studentId) {
|
|
|
+ UpdateWrapper<ExamStudent> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.lambda().set(ExamStudent::getFilePath, null)
|
|
|
+ .eq(ExamStudent::getId, studentId);
|
|
|
+ return this.update(updateWrapper);
|
|
|
+ }
|
|
|
}
|