|
@@ -20,6 +20,7 @@ import org.springframework.util.CollectionUtils;
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.File;
|
|
|
+import java.io.IOException;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -35,6 +36,8 @@ public class ExamSyncTotalServiceImpl extends ServiceImpl<ExamSyncTotalMapper, E
|
|
|
|
|
|
@Resource
|
|
|
private ExamTypeService examTypeService;
|
|
|
+ @Resource
|
|
|
+ private ExamSyncStudentService examSyncStudentService;
|
|
|
|
|
|
@Resource
|
|
|
private ExamDownloadRecordService examDownloadRecordService;
|
|
@@ -79,7 +82,19 @@ public class ExamSyncTotalServiceImpl extends ServiceImpl<ExamSyncTotalMapper, E
|
|
|
String filePath = examSyncTotal.getFilePath();
|
|
|
File file = new File(filePath);
|
|
|
if (!file.exists()) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("文件不存在");
|
|
|
+ // 生成excel文件
|
|
|
+ List<ExamSyncStudent> examSyncStudents = examSyncStudentService.listByExamSyncTotalId(examSyncTotal);
|
|
|
+ File excelFile = null;
|
|
|
+ try {
|
|
|
+ excelFile = WhuDataSyncServiceImpl.createExcel(examSyncTotal, examSyncStudents);
|
|
|
+ } catch (IOException e) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("下载文件失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 更新文件路径
|
|
|
+ examSyncTotal.setFileName(excelFile.getName());
|
|
|
+ examSyncTotal.setFilePath(excelFile.getPath());
|
|
|
+ this.updateById(examSyncTotal);
|
|
|
}
|
|
|
|
|
|
if (writeLog) {
|