|
@@ -0,0 +1,66 @@
|
|
|
+package cn.com.qmth.scancentral.controller.admin;
|
|
|
+
|
|
|
+import java.io.IOException;
|
|
|
+import java.net.URLEncoder;
|
|
|
+import java.util.Collection;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+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.tools.excel.ExcelWriter;
|
|
|
+import com.qmth.boot.tools.excel.enums.ExcelType;
|
|
|
+import com.qmth.boot.tools.iterator.PageListIterator;
|
|
|
+
|
|
|
+import cn.com.qmth.scancentral.controller.BaseController;
|
|
|
+import cn.com.qmth.scancentral.service.StudentService;
|
|
|
+import cn.com.qmth.scancentral.vo.examroom.ExamRoomScannedQuery;
|
|
|
+import cn.com.qmth.scancentral.vo.examroom.ExamRoomScannedVo;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@Api(tags = "考场接口")
|
|
|
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/admin/exam-room")
|
|
|
+@Aac(strict = false, auth = true)
|
|
|
+public class ExamRoomController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private StudentService studentService;
|
|
|
+
|
|
|
+ @ApiOperation(value = "分页查询考场答题卡扫描状态")
|
|
|
+ @PostMapping(value = "scanned/page")
|
|
|
+ public PageResult<ExamRoomScannedVo> examRoomScannedPage(@Validated ExamRoomScannedQuery query) {
|
|
|
+ return studentService.examRoomScannedPage(query);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "导出考场答题卡扫描状态")
|
|
|
+ @PostMapping(value = "scanned/export")
|
|
|
+ public void examRoomScannedExport(@Validated ExamRoomScannedQuery query, HttpServletResponse response)
|
|
|
+ throws IOException {
|
|
|
+ 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);
|
|
|
+ PageListIterator<ExamRoomScannedVo> iterator = new PageListIterator<ExamRoomScannedVo>(5000) {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Collection<ExamRoomScannedVo> getPageList(int pageNumber, int pageSize) {
|
|
|
+ query.setPageNumber(pageNumber);
|
|
|
+ query.setPageSize(pageSize);
|
|
|
+ return studentService.examRoomScannedList(query);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ writer.writeObjects("考场答题卡扫描状态", null, ExamRoomScannedVo.class, iterator);
|
|
|
+ writer.output(response.getOutputStream());
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|