|
@@ -1,6 +1,5 @@
|
|
package cn.com.qmth.stmms.ms.collect.api;
|
|
package cn.com.qmth.stmms.ms.collect.api;
|
|
|
|
|
|
-import cn.com.qmth.stmms.ms.accesscontrol.config.LoginConfig;
|
|
|
|
import cn.com.qmth.stmms.ms.admin.service.DataUploadService;
|
|
import cn.com.qmth.stmms.ms.admin.service.DataUploadService;
|
|
import cn.com.qmth.stmms.ms.collect.dto.CollectStuDTO;
|
|
import cn.com.qmth.stmms.ms.collect.dto.CollectStuDTO;
|
|
import cn.com.qmth.stmms.ms.collect.dto.CollectSubjectDTO;
|
|
import cn.com.qmth.stmms.ms.collect.dto.CollectSubjectDTO;
|
|
@@ -172,35 +171,31 @@ public class CollectApi {
|
|
|
|
|
|
@RequestMapping(value = "exam/listStudents/{examNumber}", method = RequestMethod.GET)
|
|
@RequestMapping(value = "exam/listStudents/{examNumber}", method = RequestMethod.GET)
|
|
public List<CollectStuDTO> listStudents(HttpServletRequest request, @PathVariable String examNumber) {
|
|
public List<CollectStuDTO> listStudents(HttpServletRequest request, @PathVariable String examNumber) {
|
|
- Long organizationId = Long.valueOf(request.getHeader("organizationId"));
|
|
|
|
|
|
+ Long workId = ServletUtil.getWordId();
|
|
List<CollectStuDTO> list = new ArrayList<>();
|
|
List<CollectStuDTO> list = new ArrayList<>();
|
|
-// Work activeWork = workRepo.findByActiveTrue();
|
|
|
|
- Work activeWork = workRepo.findByActiveTrueAndOrganizationId(organizationId);
|
|
|
|
Consumer<Student> consumer = (s) -> {
|
|
Consumer<Student> consumer = (s) -> {
|
|
CollectStuDTO collectStuDTO = new CollectStuDTO();
|
|
CollectStuDTO collectStuDTO = new CollectStuDTO();
|
|
- collectStuDTO.setExamId(activeWork.getId());
|
|
|
|
|
|
+ collectStuDTO.setExamId(workId);
|
|
collectStuDTO.setExamNumber(s.getRelateExamNumber());
|
|
collectStuDTO.setExamNumber(s.getRelateExamNumber());
|
|
collectStuDTO.setName(s.getName());
|
|
collectStuDTO.setName(s.getName());
|
|
collectStuDTO.setSiteCode(s.getAreaName());
|
|
collectStuDTO.setSiteCode(s.getAreaName());
|
|
collectStuDTO.setRoomCode(s.getExamRoom());
|
|
collectStuDTO.setRoomCode(s.getExamRoom());
|
|
list.add(collectStuDTO);
|
|
list.add(collectStuDTO);
|
|
};
|
|
};
|
|
- Student student = studentRepo.findByWorkIdAndRelateExamNumber(activeWork.getId(), examNumber);
|
|
|
|
- studentRepo.findByWorkIdAndTestAndExamRoom(activeWork.getId(), String.valueOf(TrialEnum.DEFAULT.getId()), student.getExamRoom()).forEach(consumer);
|
|
|
|
|
|
+ Student student = studentRepo.findByWorkIdAndRelateExamNumber(workId, examNumber);
|
|
|
|
+ studentRepo.findByWorkIdAndTestAndExamRoom(workId, String.valueOf(TrialEnum.DEFAULT.getId()), student.getExamRoom()).forEach(consumer);
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "exam/getStudent/{examNumber}", method = RequestMethod.GET)
|
|
@RequestMapping(value = "exam/getStudent/{examNumber}", method = RequestMethod.GET)
|
|
public CollectStuDTO getStudent(HttpServletRequest request, @PathVariable String examNumber) {
|
|
public CollectStuDTO getStudent(HttpServletRequest request, @PathVariable String examNumber) {
|
|
- Long organizationId = Long.valueOf(request.getHeader("organizationId"));
|
|
|
|
-// Work activeWork = workRepo.findByActiveTrue();
|
|
|
|
- Work activeWork = workRepo.findByActiveTrueAndOrganizationId(organizationId);
|
|
|
|
- Student student = studentRepo.findByWorkIdAndRelateExamNumberAndTest(activeWork.getId(), examNumber, String.valueOf(TrialEnum.DEFAULT.ordinal()));
|
|
|
|
|
|
+ Long workId = ServletUtil.getWordId();
|
|
|
|
+ Student student = studentRepo.findByWorkIdAndRelateExamNumberAndTest(workId, examNumber, String.valueOf(TrialEnum.DEFAULT.ordinal()));
|
|
if (student == null) {
|
|
if (student == null) {
|
|
throw new RuntimeException("无该考生,请处理");
|
|
throw new RuntimeException("无该考生,请处理");
|
|
}
|
|
}
|
|
CollectStuDTO collectStuDTO = new CollectStuDTO();
|
|
CollectStuDTO collectStuDTO = new CollectStuDTO();
|
|
- collectStuDTO.setExamId(activeWork.getId());
|
|
|
|
|
|
+ collectStuDTO.setExamId(workId);
|
|
collectStuDTO.setExamNumber(student.getRelateExamNumber());
|
|
collectStuDTO.setExamNumber(student.getRelateExamNumber());
|
|
collectStuDTO.setName(student.getName());
|
|
collectStuDTO.setName(student.getName());
|
|
collectStuDTO.setSiteCode(student.getAreaName());
|
|
collectStuDTO.setSiteCode(student.getAreaName());
|
|
@@ -225,19 +220,17 @@ public class CollectApi {
|
|
@RequestMapping(value = "exam/students", method = RequestMethod.GET)
|
|
@RequestMapping(value = "exam/students", method = RequestMethod.GET)
|
|
public List<CollectStuDTO> getStudents(HttpServletRequest request) {
|
|
public List<CollectStuDTO> getStudents(HttpServletRequest request) {
|
|
List<CollectStuDTO> list = new ArrayList<>();
|
|
List<CollectStuDTO> list = new ArrayList<>();
|
|
- Long organizationId = Long.valueOf(request.getHeader("organizationId"));
|
|
|
|
-// Work activeWork = workRepo.findByActiveTrue();
|
|
|
|
- Work activeWork = workRepo.findByActiveTrueAndOrganizationId(organizationId);
|
|
|
|
|
|
+ Long workId = ServletUtil.getWordId();
|
|
Consumer<Student> consumer = (s) -> {
|
|
Consumer<Student> consumer = (s) -> {
|
|
CollectStuDTO collectStuDTO = new CollectStuDTO();
|
|
CollectStuDTO collectStuDTO = new CollectStuDTO();
|
|
- collectStuDTO.setExamId(activeWork.getId());
|
|
|
|
|
|
+ collectStuDTO.setExamId(workId);
|
|
collectStuDTO.setExamNumber(s.getExamNumber());
|
|
collectStuDTO.setExamNumber(s.getExamNumber());
|
|
collectStuDTO.setName(s.getName());
|
|
collectStuDTO.setName(s.getName());
|
|
collectStuDTO.setSiteCode(s.getAreaName());
|
|
collectStuDTO.setSiteCode(s.getAreaName());
|
|
collectStuDTO.setRoomCode(s.getExamRoom());
|
|
collectStuDTO.setRoomCode(s.getExamRoom());
|
|
list.add(collectStuDTO);
|
|
list.add(collectStuDTO);
|
|
};
|
|
};
|
|
- studentRepo.findByWorkIdAndTest(activeWork.getId(), String.valueOf(TrialEnum.DEFAULT.getId())).forEach(consumer);
|
|
|
|
|
|
+ studentRepo.findByWorkIdAndTest(workId, String.valueOf(TrialEnum.DEFAULT.getId())).forEach(consumer);
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -730,10 +723,8 @@ public class CollectApi {
|
|
@RequestMapping(value = "subject/collect-config", method = RequestMethod.POST)
|
|
@RequestMapping(value = "subject/collect-config", method = RequestMethod.POST)
|
|
public boolean updateConfig(HttpServletRequest request, @RequestBody CollectSubjectDTO collectSubjectDTO) {
|
|
public boolean updateConfig(HttpServletRequest request, @RequestBody CollectSubjectDTO collectSubjectDTO) {
|
|
Subject subject = Subject.values()[collectSubjectDTO.getSubjectId() - 1];
|
|
Subject subject = Subject.values()[collectSubjectDTO.getSubjectId() - 1];
|
|
- Long organizationId = Long.valueOf(request.getHeader("organizationId"));
|
|
|
|
-// Work activeWork = workRepo.findByActiveTrue();
|
|
|
|
- Work activeWork = workRepo.findByActiveTrueAndOrganizationId(organizationId);
|
|
|
|
- MarkSubject markSubject = markSubjectRepo.findOne(activeWork.getId() + "-" + subject.toString());
|
|
|
|
|
|
+ Long workId = ServletUtil.getWordId();
|
|
|
|
+ MarkSubject markSubject = markSubjectRepo.findOne(workId + "-" + subject.toString());
|
|
String config = Optional.ofNullable(collectSubjectDTO.getCollectConfig())
|
|
String config = Optional.ofNullable(collectSubjectDTO.getCollectConfig())
|
|
.map(Object::toString)
|
|
.map(Object::toString)
|
|
.map(s -> s.substring(1, s.length() - 1))
|
|
.map(s -> s.substring(1, s.length() - 1))
|