|
@@ -191,9 +191,11 @@ public class CollectApi {
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "exam/listStudents/{examNumber}", method = RequestMethod.GET)
|
|
|
- public List<CollectStuDTO> listStudents(@PathVariable String examNumber) {
|
|
|
+ public List<CollectStuDTO> listStudents(HttpServletRequest request, @PathVariable String examNumber) {
|
|
|
+ Long organizationId = Long.valueOf(request.getHeader("organizationId"));
|
|
|
List<CollectStuDTO> list = new ArrayList<>();
|
|
|
- Work activeWork = workRepo.findByActiveTrue();
|
|
|
+// Work activeWork = workRepo.findByActiveTrue();
|
|
|
+ Work activeWork = workRepo.findByActiveTrueAndOrganizationId(organizationId);
|
|
|
Consumer<Student> consumer = (s) -> {
|
|
|
CollectStuDTO collectStuDTO = new CollectStuDTO();
|
|
|
collectStuDTO.setExamId(activeWork.getId());
|
|
@@ -209,8 +211,10 @@ public class CollectApi {
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "exam/getStudent/{examNumber}", method = RequestMethod.GET)
|
|
|
- public CollectStuDTO getStudent(@PathVariable String examNumber) {
|
|
|
- Work activeWork = workRepo.findByActiveTrue();
|
|
|
+ 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()));
|
|
|
if (student == null) {
|
|
|
throw new RuntimeException("无该考生,请处理");
|
|
@@ -239,9 +243,11 @@ public class CollectApi {
|
|
|
// }
|
|
|
|
|
|
@RequestMapping(value = "exam/students", method = RequestMethod.GET)
|
|
|
- public List<CollectStuDTO> getStudents() {
|
|
|
+ public List<CollectStuDTO> getStudents(HttpServletRequest request) {
|
|
|
List<CollectStuDTO> list = new ArrayList<>();
|
|
|
- Work activeWork = workRepo.findByActiveTrue();
|
|
|
+ Long organizationId = Long.valueOf(request.getHeader("organizationId"));
|
|
|
+// Work activeWork = workRepo.findByActiveTrue();
|
|
|
+ Work activeWork = workRepo.findByActiveTrueAndOrganizationId(organizationId);
|
|
|
Consumer<Student> consumer = (s) -> {
|
|
|
CollectStuDTO collectStuDTO = new CollectStuDTO();
|
|
|
collectStuDTO.setExamId(activeWork.getId());
|
|
@@ -260,7 +266,9 @@ public class CollectApi {
|
|
|
public CollectStuDTO saveStudent(HttpServletRequest request, @PathVariable Integer subjectId,
|
|
|
CollectStuDTO dto) throws Exception {
|
|
|
Subject subject = Subject.values()[subjectId - 1];
|
|
|
- Work activeWork = workRepo.findByActiveTrue();
|
|
|
+ Long organizationId = Long.valueOf(request.getHeader("organizationId"));
|
|
|
+// Work activeWork = workRepo.findByActiveTrue();
|
|
|
+ Work activeWork = workRepo.findByActiveTrueAndOrganizationId(organizationId);
|
|
|
List<CollectStuDTO> list = new ArrayList<>();
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
|
|
|
// for (CollectStuDTO dto : uploadStudentArray) {
|
|
@@ -739,9 +747,11 @@ public class CollectApi {
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "subject/collect-config", method = RequestMethod.POST)
|
|
|
- public boolean updateConfig(@RequestBody CollectSubjectDTO collectSubjectDTO) {
|
|
|
+ public boolean updateConfig(HttpServletRequest request, @RequestBody CollectSubjectDTO collectSubjectDTO) {
|
|
|
Subject subject = Subject.values()[collectSubjectDTO.getSubjectId() - 1];
|
|
|
- Work activeWork = workRepo.findByActiveTrue();
|
|
|
+ Long organizationId = Long.valueOf(request.getHeader("organizationId"));
|
|
|
+// Work activeWork = workRepo.findByActiveTrue();
|
|
|
+ Work activeWork = workRepo.findByActiveTrueAndOrganizationId(organizationId);
|
|
|
MarkSubject markSubject = markSubjectRepo.findOne(activeWork.getId() + "-" + subject.toString());
|
|
|
String config = Optional.ofNullable(collectSubjectDTO.getCollectConfig())
|
|
|
.map(Object::toString)
|