|
@@ -11,7 +11,6 @@ import javax.transaction.Transactional;
|
|
import org.apache.commons.fileupload.disk.DiskFileItem;
|
|
import org.apache.commons.fileupload.disk.DiskFileItem;
|
|
import org.apache.commons.io.FileUtils;
|
|
import org.apache.commons.io.FileUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.PageRequest;
|
|
import org.springframework.data.domain.PageRequest;
|
|
import org.springframework.data.domain.Pageable;
|
|
import org.springframework.data.domain.Pageable;
|
|
@@ -44,6 +43,7 @@ import cn.com.qmth.examcloud.task.api.controller.bean.ExamStudentImportDomain;
|
|
import cn.com.qmth.examcloud.task.dao.ExamStudentImportRepo;
|
|
import cn.com.qmth.examcloud.task.dao.ExamStudentImportRepo;
|
|
import cn.com.qmth.examcloud.task.dao.entity.ExamStudentImportEntity;
|
|
import cn.com.qmth.examcloud.task.dao.entity.ExamStudentImportEntity;
|
|
import cn.com.qmth.examcloud.task.dao.enums.ExamStudentImportStatus;
|
|
import cn.com.qmth.examcloud.task.dao.enums.ExamStudentImportStatus;
|
|
|
|
+import cn.com.qmth.examcloud.web.config.SystemConfig;
|
|
import cn.com.qmth.examcloud.web.support.ControllerSupport;
|
|
import cn.com.qmth.examcloud.web.support.ControllerSupport;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
@@ -59,8 +59,8 @@ import io.swagger.annotations.ApiOperation;
|
|
@RequestMapping("${$rmp.ctr.task}" + "examStudentImport")
|
|
@RequestMapping("${$rmp.ctr.task}" + "examStudentImport")
|
|
public class ExamStudentImportController extends ControllerSupport {
|
|
public class ExamStudentImportController extends ControllerSupport {
|
|
|
|
|
|
- @Value("${$dir}")
|
|
|
|
- private String dir;
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ SystemConfig systemConfig;
|
|
|
|
|
|
private static final String EXAM_STUDENT_IMPORT_FILES = "exam_student_import_files";
|
|
private static final String EXAM_STUDENT_IMPORT_FILES = "exam_student_import_files";
|
|
|
|
|
|
@@ -97,8 +97,8 @@ public class ExamStudentImportController extends ControllerSupport {
|
|
String destFileName = name + suffix;
|
|
String destFileName = name + suffix;
|
|
String resultFileName = name + ".txt";
|
|
String resultFileName = name + ".txt";
|
|
|
|
|
|
- String destFilePath = PathUtil
|
|
|
|
- .getCanonicalPath(dir + "/" + EXAM_STUDENT_IMPORT_FILES + "/" + destFileName);
|
|
|
|
|
|
+ String destFilePath = PathUtil.getCanonicalPath(
|
|
|
|
+ systemConfig.getDataDir() + "/" + EXAM_STUDENT_IMPORT_FILES + "/" + destFileName);
|
|
File destFile = new File(destFilePath);
|
|
File destFile = new File(destFilePath);
|
|
|
|
|
|
FileUtils.copyFile(storeLocation, destFile);
|
|
FileUtils.copyFile(storeLocation, destFile);
|
|
@@ -193,8 +193,8 @@ public class ExamStudentImportController extends ControllerSupport {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- String path = PathUtil
|
|
|
|
- .getCanonicalPath(dir + "/" + EXAM_STUDENT_IMPORT_FILES + "/" + resultFilePath);
|
|
|
|
|
|
+ String path = PathUtil.getCanonicalPath(
|
|
|
|
+ systemConfig.getDataDir() + "/" + EXAM_STUDENT_IMPORT_FILES + "/" + resultFilePath);
|
|
|
|
|
|
File file = new File(path);
|
|
File file = new File(path);
|
|
|
|
|
|
@@ -222,8 +222,8 @@ public class ExamStudentImportController extends ControllerSupport {
|
|
}
|
|
}
|
|
|
|
|
|
String filePath = entity.getFilePath();
|
|
String filePath = entity.getFilePath();
|
|
- String path = PathUtil
|
|
|
|
- .getCanonicalPath(dir + "/" + EXAM_STUDENT_IMPORT_FILES + "/" + filePath);
|
|
|
|
|
|
+ String path = PathUtil.getCanonicalPath(
|
|
|
|
+ systemConfig.getDataDir() + "/" + EXAM_STUDENT_IMPORT_FILES + "/" + filePath);
|
|
|
|
|
|
File file = new File(path);
|
|
File file = new File(path);
|
|
|
|
|