|
@@ -0,0 +1,67 @@
|
|
|
+package cn.com.qmth.stmms.ms.admin.exporter;
|
|
|
+
|
|
|
+import cn.com.qmth.stmms.ms.admin.dto.StudentExpDTO;
|
|
|
+import cn.com.qmth.stmms.ms.commons.utils.excel.ExportUtils;
|
|
|
+import cn.com.qmth.stmms.ms.core.domain.Student;
|
|
|
+import cn.com.qmth.stmms.ms.core.repository.StudentRepo;
|
|
|
+import cn.com.qmth.stmms.ms.core.specification.StudentSpecification;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.concurrent.atomic.AtomicInteger;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 考生导出
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("api/export/student")
|
|
|
+public class StudentExporter {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private StudentRepo studentRepo;
|
|
|
+
|
|
|
+ @GetMapping
|
|
|
+ public void export(@RequestParam StudentSpecification params, HttpServletResponse response) {
|
|
|
+
|
|
|
+ List<Student> students = studentRepo.findAll(params.getSpecification());
|
|
|
+ List<StudentExpDTO> list = new ArrayList<>();
|
|
|
+ if (students != null && students.size() > 0) {
|
|
|
+ AtomicInteger atomicInteger = new AtomicInteger(0);
|
|
|
+ students.forEach(s -> {
|
|
|
+ StudentExpDTO studentExpDTO = new StudentExpDTO();
|
|
|
+ studentExpDTO.setSeq(atomicInteger.incrementAndGet());
|
|
|
+ studentExpDTO.setName(s.getName());
|
|
|
+ studentExpDTO.setExamNumber(s.getExamNumber());
|
|
|
+ studentExpDTO.setAreaName(s.getAreaName());
|
|
|
+ studentExpDTO.setSchool(s.getSchool());
|
|
|
+ studentExpDTO.setExamRoom(s.getExamRoom());
|
|
|
+ String uploadStatus = s.getUploadStatus();
|
|
|
+ for (String str : uploadStatus.split(",")) {
|
|
|
+ //色彩
|
|
|
+ if (str.contains("SC")) {
|
|
|
+ String[] strings = str.split(":");
|
|
|
+ studentExpDTO.setSc(strings[1]);
|
|
|
+ }
|
|
|
+ //素描
|
|
|
+ if (str.contains("SM")) {
|
|
|
+ String[] strings = str.split(":");
|
|
|
+ studentExpDTO.setSm(strings[1]);
|
|
|
+ }
|
|
|
+ //速写
|
|
|
+ if (str.contains("SX")) {
|
|
|
+ String[] strings = str.split(":");
|
|
|
+ studentExpDTO.setSx(strings[1]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ list.add(studentExpDTO);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ ExportUtils.exportEXCEL("考生管理", StudentExpDTO.class, list, response);
|
|
|
+ }
|
|
|
+}
|