wangwei пре 7 година
родитељ
комит
adcfc41565

+ 51 - 0
examcloud-task-api-provider/src/main/java/cn/com/qmth/examcloud/task/api/controller/ExamStudentImportController.java

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

+ 2 - 2
examcloud-task-service/src/main/java/cn/com/qmth/examcloud/task/service/job/ExamStudentImportDataProcessingTask.java

@@ -185,7 +185,7 @@ public class ExamStudentImportDataProcessingTask extends AbstractTask {
 			debugLog.error("查询课程异常", e);
 			Map<String, Object> map = Maps.newHashMap();
 			map.put("lineNum", entity.getLineNum());
-			map.put("msg", e.getDesc());
+			map.put("msg", "  " + e.getDesc());
 			failRecords.add(map);
 			entity.setStatusCode(e.getCode());
 			entity.setStatusDesc(e.getDesc());
@@ -204,7 +204,7 @@ public class ExamStudentImportDataProcessingTask extends AbstractTask {
 			debugLog.error("查询机构异常", e);
 			Map<String, Object> map = Maps.newHashMap();
 			map.put("lineNum", entity.getLineNum());
-			map.put("msg", e.getDesc());
+			map.put("msg", "  " + e.getDesc());
 			failRecords.add(map);
 			entity.setStatusCode(e.getCode());
 			entity.setStatusDesc(e.getDesc());