|
@@ -19,11 +19,13 @@ import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.data.domain.Example;
|
|
import org.springframework.data.domain.Example;
|
|
|
|
+import org.springframework.data.jpa.domain.Specification;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
+import javax.persistence.criteria.Predicate;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
@@ -32,10 +34,6 @@ import java.util.List;
|
|
@RequestMapping("${$rmp.cloud.oe.student}/examRecordData")
|
|
@RequestMapping("${$rmp.cloud.oe.student}/examRecordData")
|
|
public class ExamRecordDataCloudServiceProvider extends ControllerSupport implements ExamRecordDataCloudService {
|
|
public class ExamRecordDataCloudServiceProvider extends ControllerSupport implements ExamRecordDataCloudService {
|
|
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- *
|
|
|
|
- */
|
|
|
|
private static final long serialVersionUID = 6142107111834463854L;
|
|
private static final long serialVersionUID = 6142107111834463854L;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -65,6 +63,33 @@ public class ExamRecordDataCloudServiceProvider extends ControllerSupport implem
|
|
@Autowired
|
|
@Autowired
|
|
private ExamControlService examControlService;
|
|
private ExamControlService examControlService;
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ @ApiOperation(value = "查询是否存在考试记录")
|
|
|
|
+ @PostMapping("/existExamRecordData")
|
|
|
|
+ public ExistExamRecordDataResp existExamRecordData(ExistExamRecordDataReq req) {
|
|
|
|
+ if (req.getExamId() == null) {
|
|
|
|
+ throw new StatusException("400400", "考试ID不允许为空");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Specification<ExamRecordDataEntity> specification = (root, query, cb) -> {
|
|
|
|
+ List<Predicate> predicates = new ArrayList<>();
|
|
|
|
+ predicates.add(cb.equal(root.get("examId"), req.getExamId()));
|
|
|
|
+
|
|
|
|
+ if (req.getCourseId() != null) {
|
|
|
|
+ predicates.add(cb.equal(root.get("courseId"), req.getCourseId()));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (req.getStudentId() != null) {
|
|
|
|
+ predicates.add(cb.equal(root.get("studentId"), req.getStudentId()));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return cb.and(predicates.toArray(new Predicate[predicates.size()]));
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ long count = examRecordDataRepo.count(specification);
|
|
|
|
+ return new ExistExamRecordDataResp(count > 0);
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
@ApiOperation(value = "批量获取未同步的考试记录ID")
|
|
@ApiOperation(value = "批量获取未同步的考试记录ID")
|
|
@PostMapping("/getExamRecordDataIds")
|
|
@PostMapping("/getExamRecordDataIds")
|