|
@@ -4,6 +4,8 @@ import cn.com.qmth.stmms.biz.exam.model.ExamStudent;
|
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamStudentService;
|
|
|
import cn.com.qmth.stmms.biz.file.service.FileService;
|
|
|
import org.apache.commons.io.IOUtils;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
@@ -19,6 +21,8 @@ import java.io.ByteArrayInputStream;
|
|
|
@RequestMapping("/file")
|
|
|
public class FileDownloadController {
|
|
|
|
|
|
+ private static Logger log = LoggerFactory.getLogger(FileDownloadController.class);
|
|
|
+
|
|
|
@Autowired
|
|
|
private FileService fileService;
|
|
|
|
|
@@ -37,6 +41,7 @@ public class FileDownloadController {
|
|
|
// 直接下载模式
|
|
|
download(response, fileService.downloadSheet(examId, examNumber, index));
|
|
|
} catch (Exception e) {
|
|
|
+ log.error("download sheet error", e);
|
|
|
response.sendError(HttpServletResponse.SC_NOT_FOUND);
|
|
|
}
|
|
|
}
|
|
@@ -55,16 +60,18 @@ public class FileDownloadController {
|
|
|
// 直接下载模式
|
|
|
download(response, fileService.downloadSlice(examId, student.getSecretNumber(), index));
|
|
|
} else {
|
|
|
+ log.error("download slice error: student not found");
|
|
|
response.sendError(HttpServletResponse.SC_NOT_FOUND);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
+ log.error("download slice error", e);
|
|
|
response.sendError(HttpServletResponse.SC_NOT_FOUND);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping("/ft-package/{examId}/{packageCode}/{index}.jpg")
|
|
|
- public void getPackage(HttpServletResponse response, @PathVariable Integer examId,
|
|
|
- @PathVariable String packageCode, @PathVariable Integer index) throws Exception {
|
|
|
+ public void getPackage(HttpServletResponse response, @PathVariable Integer examId, @PathVariable String packageCode,
|
|
|
+ @PathVariable Integer index) throws Exception {
|
|
|
try {
|
|
|
// 重定向模式
|
|
|
// redirect(response, fileService.getFileServer()
|
|
@@ -72,6 +79,7 @@ public class FileDownloadController {
|
|
|
// 直接下载模式
|
|
|
download(response, fileService.downloadPackage(examId, packageCode, index));
|
|
|
} catch (Exception e) {
|
|
|
+ log.error("download package error", e);
|
|
|
response.sendError(HttpServletResponse.SC_NOT_FOUND);
|
|
|
}
|
|
|
}
|