|
@@ -7,13 +7,13 @@ import java.util.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
+import com.qmth.boot.core.cache.service.CacheService;
|
|
import com.qmth.boot.tools.excel.ExcelWriter;
|
|
import com.qmth.boot.tools.excel.ExcelWriter;
|
|
import com.qmth.boot.tools.excel.enums.ExcelType;
|
|
import com.qmth.boot.tools.excel.enums.ExcelType;
|
|
import com.qmth.exam.reserve.bean.stdapply.*;
|
|
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 com.qmth.exam.reserve.service.*;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.beans.factory.annotation.Qualifier;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
@@ -32,7 +32,7 @@ import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiParam;
|
|
import io.swagger.annotations.ApiParam;
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
-@Api(tags = "考生预约明细相关接口")
|
|
|
|
|
|
+@Api(tags = "【管理端】考生预约明细相关接口")
|
|
@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/admin/apply")
|
|
@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/admin/apply")
|
|
@Aac(strict = false, auth = true)
|
|
@Aac(strict = false, auth = true)
|
|
public class StudentApplyController extends BaseController {
|
|
public class StudentApplyController extends BaseController {
|
|
@@ -49,8 +49,6 @@ public class StudentApplyController extends BaseController {
|
|
@Autowired
|
|
@Autowired
|
|
private ExamSiteService examSiteService;
|
|
private ExamSiteService examSiteService;
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private ExamRoomService examRoomService;
|
|
|
|
|
|
|
|
@ApiOperation(value = "预约任务列表")
|
|
@ApiOperation(value = "预约任务列表")
|
|
@PostMapping(value = "/task/list")
|
|
@PostMapping(value = "/task/list")
|
|
@@ -164,48 +162,46 @@ public class StudentApplyController extends BaseController {
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "导出考场预约情况表")
|
|
@ApiOperation(value = "导出考场预约情况表")
|
|
- @GetMapping(value = "/export/site/available")
|
|
|
|
- public void exportApplyAvailable(@ApiParam("考点ID") @RequestParam Long examSiteId, HttpServletResponse response) {
|
|
|
|
|
|
+ @GetMapping(value = "/export/teaching/available")
|
|
|
|
+ public void exportApplyAvailable(@ApiParam("教学点ID") @RequestParam Long teachingId, HttpServletResponse response) {
|
|
try {
|
|
try {
|
|
- String fileName = URLEncoder.encode("考场预约情况表", "UTF-8");
|
|
|
|
|
|
+ String fileName = URLEncoder.encode("考点预约情况表", "UTF-8");
|
|
response.setHeader("Content-Disposition", "inline; filename=" + fileName + ".xlsx");
|
|
response.setHeader("Content-Disposition", "inline; filename=" + fileName + ".xlsx");
|
|
response.setContentType("application/vnd.ms-excel");
|
|
response.setContentType("application/vnd.ms-excel");
|
|
ExcelWriter writer = ExcelWriter.create(ExcelType.XLSX);
|
|
ExcelWriter writer = ExcelWriter.create(ExcelType.XLSX);
|
|
- List<ExamRoomEntity> examRoomList = examRoomService.listExamRoom(examSiteId);
|
|
|
|
- if(examRoomList == null || examRoomList.isEmpty()) {
|
|
|
|
- throw new StatusException("当前考点下没有考场");
|
|
|
|
|
|
+ List<CategoryVO> examSiteList = examSiteService.listExamSite(teachingId);
|
|
|
|
+ if(examSiteList == null || examSiteList.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, columnNames, list.iterator());
|
|
|
|
|
|
+ String[] columnNames = getColumnNames(examSiteList);
|
|
|
|
+ String[] firstLineContents = getFirstLineContents(examSiteList);
|
|
|
|
+ List<String[]> exportList = new ArrayList<>();
|
|
|
|
+ exportList.add(firstLineContents);
|
|
|
|
+ List<String[]> avaiableList = studentApplyService.listExamSiteAvailable(examSiteList);
|
|
|
|
+ exportList.addAll(avaiableList);
|
|
|
|
+ writer.writeDataArrays("考点预约情况表", null, columnNames, exportList.iterator());
|
|
writer.output(response.getOutputStream());
|
|
writer.output(response.getOutputStream());
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
- e.printStackTrace();
|
|
|
|
|
|
+ throw new StatusException(e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- 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());
|
|
|
|
|
|
+ private String[] getFirstLineContents(List<CategoryVO> examSiteList) {
|
|
|
|
+ String[] result = new String[examSiteList.size()+1];
|
|
|
|
+ result[0] = "考点容量";
|
|
|
|
+ for (int i = 0; i < examSiteList.size(); i++) {
|
|
|
|
+ CategoryVO category = examSiteList.get(i);
|
|
|
|
+ result[i+1] = String.valueOf(category.getCapacity());
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
- private String[] getColumnNames(List<ExamRoomEntity> examRoomList) {
|
|
|
|
- String[] columnNames = new String[examRoomList.size()+1];
|
|
|
|
|
|
+ private String[] getColumnNames(List<CategoryVO> examSiteList) {
|
|
|
|
+ String[] columnNames = new String[examSiteList.size()+1];
|
|
columnNames[0] = "时段";
|
|
columnNames[0] = "时段";
|
|
- for (int i = 0; i < examRoomList.size(); i++) {
|
|
|
|
- ExamRoomEntity examRoom = examRoomList.get(i);
|
|
|
|
- columnNames[i+1] = examRoom.getName();
|
|
|
|
|
|
+ for (int i = 0; i < examSiteList.size(); i++) {
|
|
|
|
+ CategoryVO category = examSiteList.get(i);
|
|
|
|
+ columnNames[i+1] = category.getName();
|
|
}
|
|
}
|
|
return columnNames;
|
|
return columnNames;
|
|
}
|
|
}
|