|
@@ -11,6 +11,8 @@ import com.qmth.boot.tools.excel.ExcelWriter;
|
|
|
import com.qmth.boot.tools.excel.enums.ExcelType;
|
|
|
import com.qmth.exam.reserve.bean.stdapply.*;
|
|
|
import com.qmth.exam.reserve.bean.studentimport.StudentImportTaskExport;
|
|
|
+import com.qmth.exam.reserve.entity.ExamRoomEntity;
|
|
|
+import com.qmth.exam.reserve.service.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -23,10 +25,6 @@ import com.qmth.boot.core.exception.StatusException;
|
|
|
import com.qmth.exam.reserve.bean.login.LoginUser;
|
|
|
import com.qmth.exam.reserve.controller.BaseController;
|
|
|
import com.qmth.exam.reserve.enums.Role;
|
|
|
-import com.qmth.exam.reserve.service.ApplyTaskService;
|
|
|
-import com.qmth.exam.reserve.service.CategoryService;
|
|
|
-import com.qmth.exam.reserve.service.ExamSiteService;
|
|
|
-import com.qmth.exam.reserve.service.StudentApplyService;
|
|
|
import com.qmth.exam.reserve.util.ResourceUtil;
|
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -35,7 +33,7 @@ import io.swagger.annotations.ApiParam;
|
|
|
|
|
|
@RestController
|
|
|
@Api(tags = "考生预约明细相关接口")
|
|
|
-@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/apply")
|
|
|
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/admin/apply")
|
|
|
@Aac(strict = false, auth = true)
|
|
|
public class StudentApplyController extends BaseController {
|
|
|
|
|
@@ -51,6 +49,9 @@ public class StudentApplyController extends BaseController {
|
|
|
@Autowired
|
|
|
private ExamSiteService examSiteService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ExamRoomService examRoomService;
|
|
|
+
|
|
|
@ApiOperation(value = "预约任务列表")
|
|
|
@PostMapping(value = "/task/list")
|
|
|
public List<CategoryVO> listTask() {
|
|
@@ -170,17 +171,43 @@ public class StudentApplyController extends BaseController {
|
|
|
response.setHeader("Content-Disposition", "inline; filename=" + fileName + ".xlsx");
|
|
|
response.setContentType("application/vnd.ms-excel");
|
|
|
ExcelWriter writer = ExcelWriter.create(ExcelType.XLSX);
|
|
|
+ List<ExamRoomEntity> examRoomList = examRoomService.listExamRoom(examSiteId);
|
|
|
+ if(examRoomList == null || examRoomList.isEmpty()) {
|
|
|
+ throw new StatusException("当前考点下没有考场");
|
|
|
+ }
|
|
|
+ String[] columnNames = getColumnNames(examRoomList);
|
|
|
+ String[] firstLineContents = getFirstLineContents(examRoomList);
|
|
|
List<SiteApplyExportVO> exportList = studentApplyService.exportPage(examSiteId);
|
|
|
String [] titles= {"测试1" ,"测试2", "测试3"};
|
|
|
List<String[]> list = new ArrayList<>();
|
|
|
list.add(titles);
|
|
|
list.add(titles);
|
|
|
list.add(titles);
|
|
|
- writer.writeDataArrays("考场预约情况表", null, titles, list.iterator());
|
|
|
+ writer.writeDataArrays("考场预约情况表", null, columnNames, list.iterator());
|
|
|
writer.output(response.getOutputStream());
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private String[] getFirstLineContents(List<ExamRoomEntity> examRoomList) {
|
|
|
+ String[] result = new String[examRoomList.size()+1];
|
|
|
+ result[0] = "考场容量";
|
|
|
+ for (int i = 0; i < examRoomList.size(); i++) {
|
|
|
+ ExamRoomEntity examRoom = examRoomList.get(i);
|
|
|
+ result[i+1] = String.valueOf(examRoom.getCapacity());
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ private String[] getColumnNames(List<ExamRoomEntity> examRoomList) {
|
|
|
+ String[] columnNames = new String[examRoomList.size()+1];
|
|
|
+ columnNames[0] = "时段";
|
|
|
+ for (int i = 0; i < examRoomList.size(); i++) {
|
|
|
+ ExamRoomEntity examRoom = examRoomList.get(i);
|
|
|
+ columnNames[i+1] = examRoom.getName();
|
|
|
+ }
|
|
|
+ return columnNames;
|
|
|
+ }
|
|
|
+
|
|
|
}
|