|
@@ -1,6 +1,8 @@
|
|
|
package com.qmth.exam.reserve.controller.admin;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
+import java.net.URLEncoder;
|
|
|
+import java.util.List;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
@@ -9,6 +11,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
@@ -17,8 +20,11 @@ import com.qmth.boot.api.annotation.Aac;
|
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
|
import com.qmth.boot.core.collection.PageResult;
|
|
|
import com.qmth.boot.core.exception.StatusException;
|
|
|
+import com.qmth.boot.tools.excel.ExcelWriter;
|
|
|
+import com.qmth.boot.tools.excel.enums.ExcelType;
|
|
|
import com.qmth.exam.reserve.bean.PagerReq;
|
|
|
import com.qmth.exam.reserve.bean.login.LoginUser;
|
|
|
+import com.qmth.exam.reserve.bean.studentimport.StudentImportTaskExport;
|
|
|
import com.qmth.exam.reserve.bean.studentimport.StudentImportTaskVO;
|
|
|
import com.qmth.exam.reserve.controller.BaseController;
|
|
|
import com.qmth.exam.reserve.entity.StudentImportTaskEntity;
|
|
@@ -29,6 +35,7 @@ import com.qmth.exam.reserve.util.ResourceUtil;
|
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
|
|
|
@RestController
|
|
|
@Api(tags = "考生信息导入相关接口")
|
|
@@ -69,4 +76,24 @@ public class StudentImportTaskController extends BaseController {
|
|
|
throw new StatusException("文件读取出错", e);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value = "导出异常信息")
|
|
|
+ @GetMapping(value = "/export/message")
|
|
|
+ public void exportExcepionMessage(@ApiParam("导入的任务ID") @RequestParam Long id, HttpServletResponse response) {
|
|
|
+ try {
|
|
|
+ String fileName = URLEncoder.encode("异常信息", "UTF-8");
|
|
|
+ response.setHeader("Content-Disposition", "inline; filename=" + fileName + ".xlsx");
|
|
|
+ response.setContentType("application/vnd.ms-excel");
|
|
|
+ ExcelWriter writer = ExcelWriter.create(ExcelType.XLSX);
|
|
|
+ List<StudentImportTaskExport> exportList = studentImportService.exportPage(id);
|
|
|
+ if (exportList == null || exportList.isEmpty()) {
|
|
|
+ throw new StatusException("没有异常信息");
|
|
|
+ }
|
|
|
+ writer.writeObjects("异常信息", null, StudentImportTaskExport.class, exportList.iterator());
|
|
|
+ writer.output(response.getOutputStream());
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|