|
@@ -577,7 +577,46 @@ public class ExamCloudServiceProvider extends ControllerSupport implements ExamC
|
|
|
@PostMapping("getExamOrgList")
|
|
|
@Override
|
|
|
public GetExamOrgListResp getExamOrgList(@RequestBody GetExamOrgListReq req) {
|
|
|
- return null;
|
|
|
+ final long start = null == req.getStart() ? 1 : req.getStart();
|
|
|
+
|
|
|
+ Pageable pageable = new PageRequest(0, 200, Sort.Direction.ASC, "orgId");
|
|
|
+
|
|
|
+ Specification<ExamStudentEntity> specification = (root, query, cb) -> {
|
|
|
+ List<Predicate> predicates = new ArrayList<>();
|
|
|
+
|
|
|
+ if (null != req.getExamId()) {
|
|
|
+ predicates.add(cb.equal(root.get("examId"), req.getExamId()));
|
|
|
+ }
|
|
|
+
|
|
|
+ predicates.add(cb.greaterThanOrEqualTo(root.get("orgId"), start));
|
|
|
+
|
|
|
+ return cb.and(predicates.toArray(new Predicate[predicates.size()]));
|
|
|
+ };
|
|
|
+
|
|
|
+ Page<ExamStudentEntity> page = examStudentRepo.findAll(specification, pageable);
|
|
|
+
|
|
|
+ Iterator<ExamStudentEntity> iterator = page.iterator();
|
|
|
+
|
|
|
+ List<Long> orgIdList = Lists.newArrayList();
|
|
|
+
|
|
|
+ long next = start;
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ ExamStudentEntity e = iterator.next();
|
|
|
+
|
|
|
+ next = e.getOrgId();
|
|
|
+ if (!orgIdList.contains(next)) {
|
|
|
+ orgIdList.add(next);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ GetExamOrgListResp resp = new GetExamOrgListResp();
|
|
|
+ if (next != start) {
|
|
|
+ next++;
|
|
|
+ }
|
|
|
+ resp.setNext(next);
|
|
|
+ resp.setOrgIdList(orgIdList);
|
|
|
+
|
|
|
+ return resp;
|
|
|
}
|
|
|
|
|
|
}
|