|
@@ -4,6 +4,8 @@ import java.io.File;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.http.ResponseEntity;
|
|
@@ -27,6 +29,8 @@ import io.swagger.annotations.ApiOperation;
|
|
@RequestMapping("${api_cqb}/")
|
|
@RequestMapping("${api_cqb}/")
|
|
public class ImportPaperController {
|
|
public class ImportPaperController {
|
|
|
|
|
|
|
|
+ protected static final Logger log = LoggerFactory.getLogger(ImportPaperController.class);
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
ImportPaperService importPaperService;
|
|
ImportPaperService importPaperService;
|
|
|
|
|
|
@@ -38,7 +42,6 @@ public class ImportPaperController {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 导入试卷
|
|
* 导入试卷
|
|
- *
|
|
|
|
* @param paperName
|
|
* @param paperName
|
|
* @param file
|
|
* @param file
|
|
* @return
|
|
* @return
|
|
@@ -47,8 +50,10 @@ public class ImportPaperController {
|
|
@PostMapping(value = "/importPaper")
|
|
@PostMapping(value = "/importPaper")
|
|
public ResponseEntity importPaper(@RequestParam String paperName, @RequestParam String courseNo,
|
|
public ResponseEntity importPaper(@RequestParam String paperName, @RequestParam String courseNo,
|
|
@RequestParam("file") CommonsMultipartFile file) {
|
|
@RequestParam("file") CommonsMultipartFile file) {
|
|
|
|
+ log.info("导入开始");
|
|
File tempFile = importPaperService.getUploadFile(file);
|
|
File tempFile = importPaperService.getUploadFile(file);
|
|
- String returnStr = importPaperService.ImportPaper(paperName, courseNo, tempFile);
|
|
|
|
|
|
+ String returnStr = importPaperService.importPaper(paperName, courseNo, tempFile);
|
|
|
|
+ log.info("导入结束");
|
|
if (returnStr.equals("success")) {
|
|
if (returnStr.equals("success")) {
|
|
return new ResponseEntity(returnStr, HttpStatus.OK);
|
|
return new ResponseEntity(returnStr, HttpStatus.OK);
|
|
} else {
|
|
} else {
|
|
@@ -56,13 +61,12 @@ public class ImportPaperController {
|
|
map.put("errorMsg", returnStr);
|
|
map.put("errorMsg", returnStr);
|
|
return new ResponseEntity(map, HttpStatus.INTERNAL_SERVER_ERROR);
|
|
return new ResponseEntity(map, HttpStatus.INTERNAL_SERVER_ERROR);
|
|
}
|
|
}
|
|
- // return returnStr;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 新增一张空白试卷
|
|
|
|
- *
|
|
|
|
- * @param paper
|
|
|
|
|
|
+ * 新增试卷
|
|
|
|
+ * @param courseNo
|
|
|
|
+ * @param paperName
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@ApiOperation(value = "保存导入类型空白试卷", notes = "保存导入类型空白试卷")
|
|
@ApiOperation(value = "保存导入类型空白试卷", notes = "保存导入类型空白试卷")
|