|
@@ -174,4 +174,55 @@ public class ExamStudentImportController extends ControllerSupport {
|
|
|
return new PageInfo<ExamStudentImportDomain>(list, ret);
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "下载报告")
|
|
|
+ @GetMapping("/getReports/{id}")
|
|
|
+ public void importFileTemplate(@PathVariable Long id) {
|
|
|
+
|
|
|
+ ExamStudentImportEntity entity = examStudentImportRepo.findOne(id);
|
|
|
+ String resultFilePath = entity.getResultFilePath();
|
|
|
+
|
|
|
+ if (!isSuperAdmin()) {
|
|
|
+ if (!entity.getRootOrgId().equals(getRootOrgId())) {
|
|
|
+ exportFile(resultFilePath, "非法请求.".getBytes());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ String path = PathUtil
|
|
|
+ .getCanonicalPath(dir + "/" + EXAM_STUDENT_IMPORT_FILES + "/" + resultFilePath);
|
|
|
+
|
|
|
+ File file = new File(path);
|
|
|
+
|
|
|
+ if (!file.exists()) {
|
|
|
+ exportFile(resultFilePath, "报告未生成.".getBytes());
|
|
|
+ }
|
|
|
+
|
|
|
+ exportFile(resultFilePath, file);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "下载导入文件")
|
|
|
+ @GetMapping("/getUploadedFile/{id}")
|
|
|
+ public void getUploadedFile(@PathVariable Long id) {
|
|
|
+
|
|
|
+ ExamStudentImportEntity entity = examStudentImportRepo.findOne(id);
|
|
|
+ String fileName = entity.getFileName();
|
|
|
+
|
|
|
+ if (!isSuperAdmin()) {
|
|
|
+ if (!entity.getRootOrgId().equals(getRootOrgId())) {
|
|
|
+ exportFile(fileName, "非法请求.".getBytes());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ String filePath = entity.getFilePath();
|
|
|
+ String path = PathUtil
|
|
|
+ .getCanonicalPath(dir + "/" + EXAM_STUDENT_IMPORT_FILES + "/" + filePath);
|
|
|
+
|
|
|
+ File file = new File(path);
|
|
|
+
|
|
|
+ if (!file.exists()) {
|
|
|
+ exportFile(fileName, "文件不存在.".getBytes());
|
|
|
+ }
|
|
|
+
|
|
|
+ exportFile(fileName, file);
|
|
|
+ }
|
|
|
+
|
|
|
}
|