|
@@ -1,19 +1,5 @@
|
|
|
package cn.com.qmth.examcloud.core.oe.admin.api.provider;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamCacheTransferHelper;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.json.JSONException;
|
|
|
-import org.json.JSONObject;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.data.domain.Example;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
-
|
|
|
import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.CourseCloudService;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.bean.CourseBean;
|
|
@@ -23,30 +9,13 @@ import cn.com.qmth.examcloud.core.oe.admin.api.ExamScoreDataCloudService;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.api.bean.ExamScoreDataBean;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.api.bean.QueryCapturePhotoBean;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.api.bean.ScoreDataBean;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.api.request.FindExamScoreDataReq;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.api.request.GetAuditDataReq;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.api.request.GetScoreDataReq;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.api.request.QueryCapturePhotoReq;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.api.request.QueryScoreDataReq;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.api.response.FindExamScoreDataResp;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.api.response.GetAuditDataResp;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.api.response.GetScoreDataResp;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.api.response.QueryCapturePhotoResp;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.api.response.QueryScoreDataResp;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.api.request.*;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.api.response.*;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.service.ExamCacheTransferHelper;
|
|
|
import cn.com.qmth.examcloud.core.oe.common.base.utils.Check;
|
|
|
-import cn.com.qmth.examcloud.core.oe.common.entity.ExamAuditEntity;
|
|
|
-import cn.com.qmth.examcloud.core.oe.common.entity.ExamCaptureEntity;
|
|
|
-import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordDataEntity;
|
|
|
-import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordEntity;
|
|
|
-import cn.com.qmth.examcloud.core.oe.common.entity.ExamScoreEntity;
|
|
|
-import cn.com.qmth.examcloud.core.oe.common.entity.ExamStudentEntity;
|
|
|
+import cn.com.qmth.examcloud.core.oe.common.entity.*;
|
|
|
import cn.com.qmth.examcloud.core.oe.common.enums.DisciplineType;
|
|
|
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamAuditRepo;
|
|
|
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamCaptureRepo;
|
|
|
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordDataRepo;
|
|
|
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordRepo;
|
|
|
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamScoreRepo;
|
|
|
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamStudentRepo;
|
|
|
+import cn.com.qmth.examcloud.core.oe.common.repository.*;
|
|
|
import cn.com.qmth.examcloud.core.oe.common.service.GainBaseDataService;
|
|
|
import cn.com.qmth.examcloud.examwork.api.ExamCloudService;
|
|
|
import cn.com.qmth.examcloud.examwork.api.bean.ExamBean;
|
|
@@ -57,282 +26,288 @@ import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
|
|
|
import cn.com.qmth.examcloud.web.support.ControllerSupport;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.json.JSONException;
|
|
|
+import org.json.JSONObject;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.domain.Example;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
|
|
|
@Api(tags = "考试分数信息相关接口")
|
|
|
@RestController
|
|
|
@RequestMapping("${$rmp.cloud.oe}/examScoreData")
|
|
|
-public class ExamScoreDataCloudServiceProvider extends ControllerSupport implements ExamScoreDataCloudService{
|
|
|
-
|
|
|
- /**
|
|
|
- *
|
|
|
- */
|
|
|
- private static final long serialVersionUID = 8280332746440316604L;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ExamScoreRepo examScoreRepo;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ExamRecordDataRepo examRecordDataRepo;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ExamRecordRepo examRecordRepo;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ExamStudentRepo examStudentRepo;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ExamAuditRepo examAuditRepo;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ExamCaptureRepo examCaptureRepo;
|
|
|
-
|
|
|
+public class ExamScoreDataCloudServiceProvider extends ControllerSupport implements ExamScoreDataCloudService {
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ */
|
|
|
+ private static final long serialVersionUID = 8280332746440316604L;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExamScoreRepo examScoreRepo;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExamRecordDataRepo examRecordDataRepo;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExamStudentRepo examStudentRepo;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExamAuditRepo examAuditRepo;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExamCaptureRepo examCaptureRepo;
|
|
|
+
|
|
|
@Autowired
|
|
|
private GainBaseDataService gainBaseDataService;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private ExamCloudService examCloudService;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private CourseCloudService courseCloudService;
|
|
|
-
|
|
|
- @Override
|
|
|
- @ApiOperation(value = "根据分数id查询考试记录,学生信息,分数信息等数据")
|
|
|
- @PostMapping("/findExamScoreDataByScoreId")
|
|
|
- public FindExamScoreDataResp findExamScoreDataByScoreId(@RequestBody FindExamScoreDataReq findExamScoreDataReq) {
|
|
|
- long scoreId = findExamScoreDataReq.getScoreId();
|
|
|
- ExamScoreEntity examScore = GlobalHelper.getEntity(examScoreRepo,scoreId,ExamScoreEntity.class);
|
|
|
- ExamRecordDataEntity examRecordDataEntity = GlobalHelper.getEntity(examRecordDataRepo,examScore.getExamRecordDataId(),ExamRecordDataEntity.class);
|
|
|
- ExamRecordEntity examRecord =GlobalHelper.getEntity(examRecordRepo,examScore.getExamRecordDataId(),ExamRecordEntity.class);
|
|
|
- ExamStudentEntity examStudentEntity = examStudentRepo.findByExamStudentId(examRecord.getExamStudentId());
|
|
|
-
|
|
|
- FindExamScoreDataResp findExamScoreDataResp = new FindExamScoreDataResp();
|
|
|
- List<ExamScoreDataBean> examScoreDatas = new ArrayList<ExamScoreDataBean>();
|
|
|
- examScoreDatas.add(buildExamScoreDataBean(examScore, examRecordDataEntity, examStudentEntity));
|
|
|
- findExamScoreDataResp.setExamScoreDatas(examScoreDatas);
|
|
|
-
|
|
|
- return findExamScoreDataResp;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- @ApiOperation(value = "根据examIdAndStudentCode查询考试记录,学生信息,分数信息等数据")
|
|
|
- @PostMapping("/findExamScoreDataByExamIdAndStudentCode")
|
|
|
- public FindExamScoreDataResp findExamScoreDataByExamIdAndStudentCode(@RequestBody FindExamScoreDataReq findExamScoreDataReq) {
|
|
|
- Long examId = findExamScoreDataReq.getExamId();
|
|
|
- String studentCode = findExamScoreDataReq.getStudentCode();
|
|
|
- List<ExamRecordEntity> examRecordList = examRecordRepo.findByExamIdAndStudentCode(examId, studentCode);
|
|
|
-
|
|
|
- List<ExamScoreDataBean> examScoreDatas = new ArrayList<ExamScoreDataBean>();
|
|
|
- for(ExamRecordEntity examRecord:examRecordList){
|
|
|
- ExamRecordDataEntity examRecordData = examRecordDataRepo.findByExamRecordId(examRecord.getId());
|
|
|
- ExamScoreEntity examScore = examScoreRepo.findByExamRecordDataId(examRecordData.getId());
|
|
|
- ExamStudentEntity examStudent = examStudentRepo.findByExamStudentId(examRecord.getExamStudentId());
|
|
|
- examScoreDatas.add(buildExamScoreDataBean(examScore, examRecordData, examStudent));
|
|
|
- }
|
|
|
-
|
|
|
- FindExamScoreDataResp findExamScoreDataResp = new FindExamScoreDataResp();
|
|
|
- findExamScoreDataResp.setExamScoreDatas(examScoreDatas);
|
|
|
- return findExamScoreDataResp;
|
|
|
- }
|
|
|
-
|
|
|
- private ExamScoreDataBean buildExamScoreDataBean(ExamScoreEntity examScore,ExamRecordDataEntity examRecordDataEntity,ExamStudentEntity examStudentEntity){
|
|
|
- ExamScoreDataBean examScoreDataBean = new ExamScoreDataBean();
|
|
|
- examScoreDataBean.setExamId(examStudentEntity.getExamId());
|
|
|
- examScoreDataBean.setStudentName(examStudentEntity.getStudentName());
|
|
|
- examScoreDataBean.setStudentCode(examStudentEntity.getStudentCode());
|
|
|
- examScoreDataBean.setIdentityNumber(examStudentEntity.getIdentityNumber());
|
|
|
-
|
|
|
- CourseBean courseBean = ExamCacheTransferHelper.getCachedCourse(examStudentEntity.getCourseId());
|
|
|
- examScoreDataBean.setCourseName(courseBean.getName());
|
|
|
- examScoreDataBean.setCourseCode(examStudentEntity.getCourseCode());
|
|
|
- examScoreDataBean.setStartTime(examRecordDataEntity.getStartTime());
|
|
|
- examScoreDataBean.setEndTime(examRecordDataEntity.getEndTime());
|
|
|
- examScoreDataBean.setSuccPercent(examRecordDataEntity.getFaceSuccessPercent());
|
|
|
- examScoreDataBean.setIsIllegality(examRecordDataEntity.getIsIllegality());
|
|
|
- examScoreDataBean.setScoreId(examScore.getId());
|
|
|
- examScoreDataBean.setTotalScore(examScore.getTotalScore());
|
|
|
- examScoreDataBean.setObjectiveScore(examScore.getObjectiveScore());
|
|
|
- examScoreDataBean.setSubjectiveScore(examScore.getSubjectiveScore());
|
|
|
- return examScoreDataBean;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- @ApiOperation(value = "根据examRecordDataId查询成绩数据")
|
|
|
- @PostMapping("/getScoreData")
|
|
|
- public GetScoreDataResp getScoreData(@RequestBody GetScoreDataReq req) {
|
|
|
- Long examRecordDataId = req.getExamRecordDataId();
|
|
|
- ExamRecordDataEntity examRecordData = GlobalHelper.getEntity(examRecordDataRepo,examRecordDataId,ExamRecordDataEntity.class);
|
|
|
- if(null ==examRecordData) {
|
|
|
- throw new StatusException("getScoreData-exception", "请求参数不正确");
|
|
|
- }
|
|
|
- ExamRecordEntity examRecord =GlobalHelper.getEntity(examRecordRepo,examRecordData.getExamRecordId(),ExamRecordEntity.class);
|
|
|
- ExamScoreEntity examScore = examScoreRepo.findByExamRecordDataId(examRecordDataId);
|
|
|
-
|
|
|
- GetScoreDataResp resp = new GetScoreDataResp();
|
|
|
- resp.setExamRecordDataId(examRecordDataId);
|
|
|
- resp.setStudentCode(examRecord.getStudentCode());
|
|
|
- resp.setStudentName(examRecord.getStudentName());
|
|
|
- resp.setIdentityNumber(examRecord.getIdentityNumber());
|
|
|
-
|
|
|
- CourseBean courseBean = ExamCacheTransferHelper.getCachedCourse(examRecord.getCourseId());
|
|
|
- resp.setCourseCode(courseBean.getCode());
|
|
|
- resp.setCourseName(courseBean.getName());
|
|
|
- resp.setStartTime(examRecordData.getStartTime());
|
|
|
- resp.setEndTime(examRecordData.getEndTime());
|
|
|
- resp.setTotalScore(examScore.getTotalScore());
|
|
|
-
|
|
|
- resp.setIsWarn(examRecordData.getIsWarn());
|
|
|
- resp.setIsAudit(examRecordData.getIsAudit());
|
|
|
- resp.setIsIllegality(examRecordData.getIsIllegality());
|
|
|
-
|
|
|
- return resp;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- @ApiOperation(value = "根据examRecordDataId查询成绩审核数据")
|
|
|
- @PostMapping("/getAuditData")
|
|
|
- public GetAuditDataResp getAuditData(@RequestBody GetAuditDataReq req) {
|
|
|
- Check.isEmpty(req.getExamRecordDataId(), "考试记录ID不能为空");
|
|
|
- ExamAuditEntity examAuditEntity = examAuditRepo.findByExamRecordDataId(req.getExamRecordDataId());
|
|
|
- //考试记录
|
|
|
- ExamRecordDataEntity examRecordData = GlobalHelper.getEntity(examRecordDataRepo,req.getExamRecordDataId(),ExamRecordDataEntity.class);
|
|
|
- if(null == examRecordData) {
|
|
|
- throw new StatusException("100001", "找不到考试记录id为"+req.getExamRecordDataId()+"数据");
|
|
|
- }
|
|
|
- GetAuditDataResp resp = new GetAuditDataResp();
|
|
|
- if(examAuditEntity!=null){
|
|
|
- resp.setExamRecordDataId(examAuditEntity.getExamRecordDataId());
|
|
|
- DisciplineType disciplineType = examAuditEntity.getDisciplineType();
|
|
|
- if(disciplineType!=null){
|
|
|
- resp.setDisciplineType(disciplineType.getName());
|
|
|
- }
|
|
|
- resp.setDisciplineDetail(examAuditEntity.getDisciplineDetail());
|
|
|
- resp.setCreationTime(examAuditEntity.getCreationTime());
|
|
|
- resp.setAuditUserName(examAuditEntity.getAuditUserName());
|
|
|
- //是否违纪
|
|
|
- resp.setIsDiscipline(examRecordData.getIsIllegality()?1:0);
|
|
|
- }
|
|
|
- return resp;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- @ApiOperation(value = "根据examRecordDataId查询抓拍照片数据")
|
|
|
- @PostMapping("/queryCapturePhoto")
|
|
|
- public QueryCapturePhotoResp queryCapturePhoto(@RequestBody QueryCapturePhotoReq req) {
|
|
|
- Check.isEmpty(req.getExamRecordDataId(), "考试记录ID不能为空");
|
|
|
- List<ExamCaptureEntity> examCaptureList = examCaptureRepo.findByExamRecordDataId(req.getExamRecordDataId());
|
|
|
- QueryCapturePhotoResp queryCapturePhotoResp = new QueryCapturePhotoResp();
|
|
|
- queryCapturePhotoResp.setExamRecordDataId(req.getExamRecordDataId());
|
|
|
- List<QueryCapturePhotoBean> capturePhotoList = new ArrayList<QueryCapturePhotoBean>();
|
|
|
- if(examCaptureList.size()>0){
|
|
|
- for(ExamCaptureEntity examCaptureEntity:examCaptureList){
|
|
|
- QueryCapturePhotoBean queryCapturePhotoBean = new QueryCapturePhotoBean();
|
|
|
- queryCapturePhotoBean.setFileUrl(examCaptureEntity.getFileUrl());
|
|
|
- queryCapturePhotoBean.setIsPass(examCaptureEntity.getIsPass());
|
|
|
- queryCapturePhotoBean.setIsStranger(examCaptureEntity.getIsStranger());
|
|
|
- String faceLivenessResult = examCaptureEntity.getFacelivenessResult();
|
|
|
- queryCapturePhotoBean.setIsLivenessPass(isLivenessPass(faceLivenessResult));
|
|
|
- capturePhotoList.add(queryCapturePhotoBean);
|
|
|
- }
|
|
|
- }
|
|
|
- queryCapturePhotoResp.setCapturePhotoList(capturePhotoList);
|
|
|
- return queryCapturePhotoResp;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 人脸真实性是否通过
|
|
|
- * @param faceLivenessResult
|
|
|
- * @return
|
|
|
- */
|
|
|
- private Boolean isLivenessPass(String faceLivenessResult){
|
|
|
- if(StringUtils.isNotBlank(faceLivenessResult)){
|
|
|
- JSONObject jsonObject;
|
|
|
- try {
|
|
|
- jsonObject = new JSONObject(faceLivenessResult);
|
|
|
- if(jsonObject.has("error_code")&&jsonObject.getInt("error_code") == 0&&jsonObject.has("result")){
|
|
|
- JSONObject resultJson = jsonObject.getJSONObject("result");
|
|
|
- if(resultJson.has("face_liveness")){
|
|
|
- double faceLivenessVal = resultJson.getDouble("face_liveness");
|
|
|
- double baiduFacelivenessThreshold = Double.parseDouble(PropertyHolder.getString("$baidu.faceliveness.threshold"));
|
|
|
- if(faceLivenessVal > baiduFacelivenessThreshold){
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (JSONException e) {
|
|
|
- e.printStackTrace();
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- @ApiOperation(value = "按考试名称,rootOrgId,courseCode,身份证号或学号查询成绩信息")
|
|
|
- @PostMapping("/queryScoreData")
|
|
|
- public QueryScoreDataResp queryScoreData(@RequestBody QueryScoreDataReq req) {
|
|
|
- if(StringUtils.isBlank(req.getExamName())){
|
|
|
- throw new StatusException("OE-ADMIN-1000005", "考试名称不能为空");
|
|
|
- }
|
|
|
- if(StringUtils.isBlank(req.getCourseCode())){
|
|
|
- throw new StatusException("OE-ADMIN-1000005", "课程code不能为空");
|
|
|
- }
|
|
|
- if(req.getRootOrgId() == null){
|
|
|
- throw new StatusException("OE-ADMIN-1000005", "rootOrgId不能为空");
|
|
|
- }
|
|
|
- if(StringUtils.isBlank(req.getIdentityNumber()) && StringUtils.isBlank(req.getStudentCode())){
|
|
|
- throw new StatusException("OE-ADMIN-1000005", "身份证号和学号不能都为空");
|
|
|
- }
|
|
|
- GetExamReq getExamReq = new GetExamReq();
|
|
|
- getExamReq.setRootOrgId(req.getRootOrgId());
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @ApiOperation(value = "根据分数id查询考试记录,学生信息,分数信息等数据")
|
|
|
+ @PostMapping("/findExamScoreDataByScoreId")
|
|
|
+ public FindExamScoreDataResp findExamScoreDataByScoreId(@RequestBody FindExamScoreDataReq findExamScoreDataReq) {
|
|
|
+ long scoreId = findExamScoreDataReq.getScoreId();
|
|
|
+ ExamScoreEntity examScore = GlobalHelper.getEntity(examScoreRepo, scoreId, ExamScoreEntity.class);
|
|
|
+ ExamRecordDataEntity examRecordDataEntity = GlobalHelper.getEntity(examRecordDataRepo, examScore.getExamRecordDataId(), ExamRecordDataEntity.class);
|
|
|
+ ExamStudentEntity examStudentEntity = examStudentRepo.findByExamStudentId(examRecordDataEntity.getExamStudentId());
|
|
|
+
|
|
|
+ FindExamScoreDataResp findExamScoreDataResp = new FindExamScoreDataResp();
|
|
|
+ List<ExamScoreDataBean> examScoreDatas = new ArrayList<ExamScoreDataBean>();
|
|
|
+ examScoreDatas.add(buildExamScoreDataBean(examScore, examRecordDataEntity, examStudentEntity));
|
|
|
+ findExamScoreDataResp.setExamScoreDatas(examScoreDatas);
|
|
|
+
|
|
|
+ return findExamScoreDataResp;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @ApiOperation(value = "根据examIdAndStudentCode查询考试记录,学生信息,分数信息等数据")
|
|
|
+ @PostMapping("/findExamScoreDataByExamIdAndStudentCode")
|
|
|
+ public FindExamScoreDataResp findExamScoreDataByExamIdAndStudentCode(@RequestBody FindExamScoreDataReq findExamScoreDataReq) {
|
|
|
+ Long examId = findExamScoreDataReq.getExamId();
|
|
|
+ String studentCode = findExamScoreDataReq.getStudentCode();
|
|
|
+ List<ExamRecordDataEntity> examRecordDataList = examRecordDataRepo.findByExamIdAndStudentCode(examId, studentCode);
|
|
|
+
|
|
|
+ List<ExamScoreDataBean> examScoreDatas = new ArrayList<ExamScoreDataBean>();
|
|
|
+ for (ExamRecordDataEntity examRecordData : examRecordDataList) {
|
|
|
+ ExamScoreEntity examScore = examScoreRepo.findByExamRecordDataId(examRecordData.getId());
|
|
|
+ ExamStudentEntity examStudent = examStudentRepo.findByExamStudentId(examRecordData.getExamStudentId());
|
|
|
+ examScoreDatas.add(buildExamScoreDataBean(examScore, examRecordData, examStudent));
|
|
|
+ }
|
|
|
+
|
|
|
+ FindExamScoreDataResp findExamScoreDataResp = new FindExamScoreDataResp();
|
|
|
+ findExamScoreDataResp.setExamScoreDatas(examScoreDatas);
|
|
|
+ return findExamScoreDataResp;
|
|
|
+ }
|
|
|
+
|
|
|
+ private ExamScoreDataBean buildExamScoreDataBean(ExamScoreEntity examScore, ExamRecordDataEntity examRecordDataEntity, ExamStudentEntity examStudentEntity) {
|
|
|
+ ExamScoreDataBean examScoreDataBean = new ExamScoreDataBean();
|
|
|
+ examScoreDataBean.setExamId(examStudentEntity.getExamId());
|
|
|
+ examScoreDataBean.setStudentName(examStudentEntity.getStudentName());
|
|
|
+ examScoreDataBean.setStudentCode(examStudentEntity.getStudentCode());
|
|
|
+ examScoreDataBean.setIdentityNumber(examStudentEntity.getIdentityNumber());
|
|
|
+
|
|
|
+ CourseBean courseBean = ExamCacheTransferHelper.getCachedCourse(examStudentEntity.getCourseId());
|
|
|
+ examScoreDataBean.setCourseName(courseBean.getName());
|
|
|
+ examScoreDataBean.setCourseCode(examStudentEntity.getCourseCode());
|
|
|
+ examScoreDataBean.setStartTime(examRecordDataEntity.getStartTime());
|
|
|
+ examScoreDataBean.setEndTime(examRecordDataEntity.getEndTime());
|
|
|
+ examScoreDataBean.setSuccPercent(examRecordDataEntity.getFaceSuccessPercent());
|
|
|
+ examScoreDataBean.setIsIllegality(examRecordDataEntity.getIsIllegality());
|
|
|
+ examScoreDataBean.setScoreId(examScore.getId());
|
|
|
+ examScoreDataBean.setTotalScore(examScore.getTotalScore());
|
|
|
+ examScoreDataBean.setObjectiveScore(examScore.getObjectiveScore());
|
|
|
+ examScoreDataBean.setSubjectiveScore(examScore.getSubjectiveScore());
|
|
|
+ return examScoreDataBean;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @ApiOperation(value = "根据examRecordDataId查询成绩数据")
|
|
|
+ @PostMapping("/getScoreData")
|
|
|
+ public GetScoreDataResp getScoreData(@RequestBody GetScoreDataReq req) {
|
|
|
+ Long examRecordDataId = req.getExamRecordDataId();
|
|
|
+ ExamRecordDataEntity examRecordData = GlobalHelper.getEntity(examRecordDataRepo, examRecordDataId, ExamRecordDataEntity.class);
|
|
|
+ if (null == examRecordData) {
|
|
|
+ throw new StatusException("getScoreData-exception", "请求参数不正确");
|
|
|
+ }
|
|
|
+ ExamScoreEntity examScore = examScoreRepo.findByExamRecordDataId(examRecordDataId);
|
|
|
+
|
|
|
+ GetScoreDataResp resp = new GetScoreDataResp();
|
|
|
+ resp.setExamRecordDataId(examRecordDataId);
|
|
|
+ resp.setStudentCode(examRecordData.getStudentCode());
|
|
|
+ resp.setStudentName(examRecordData.getStudentName());
|
|
|
+ resp.setIdentityNumber(examRecordData.getIdentityNumber());
|
|
|
+
|
|
|
+ CourseBean courseBean = ExamCacheTransferHelper.getCachedCourse(examRecordData.getCourseId());
|
|
|
+ resp.setCourseCode(courseBean.getCode());
|
|
|
+ resp.setCourseName(courseBean.getName());
|
|
|
+ resp.setStartTime(examRecordData.getStartTime());
|
|
|
+ resp.setEndTime(examRecordData.getEndTime());
|
|
|
+ resp.setTotalScore(examScore.getTotalScore());
|
|
|
+
|
|
|
+ resp.setIsWarn(examRecordData.getIsWarn());
|
|
|
+ resp.setIsAudit(examRecordData.getIsAudit());
|
|
|
+ resp.setIsIllegality(examRecordData.getIsIllegality());
|
|
|
+
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @ApiOperation(value = "根据examRecordDataId查询成绩审核数据")
|
|
|
+ @PostMapping("/getAuditData")
|
|
|
+ public GetAuditDataResp getAuditData(@RequestBody GetAuditDataReq req) {
|
|
|
+ Check.isEmpty(req.getExamRecordDataId(), "考试记录ID不能为空");
|
|
|
+ ExamAuditEntity examAuditEntity = examAuditRepo.findByExamRecordDataId(req.getExamRecordDataId());
|
|
|
+ //考试记录
|
|
|
+ ExamRecordDataEntity examRecordData = GlobalHelper.getEntity(examRecordDataRepo, req.getExamRecordDataId(), ExamRecordDataEntity.class);
|
|
|
+ if (null == examRecordData) {
|
|
|
+ throw new StatusException("100001", "找不到考试记录id为" + req.getExamRecordDataId() + "数据");
|
|
|
+ }
|
|
|
+ GetAuditDataResp resp = new GetAuditDataResp();
|
|
|
+ if (examAuditEntity != null) {
|
|
|
+ resp.setExamRecordDataId(examAuditEntity.getExamRecordDataId());
|
|
|
+ DisciplineType disciplineType = examAuditEntity.getDisciplineType();
|
|
|
+ if (disciplineType != null) {
|
|
|
+ resp.setDisciplineType(disciplineType.getName());
|
|
|
+ }
|
|
|
+ resp.setDisciplineDetail(examAuditEntity.getDisciplineDetail());
|
|
|
+ resp.setCreationTime(examAuditEntity.getCreationTime());
|
|
|
+ resp.setAuditUserName(examAuditEntity.getAuditUserName());
|
|
|
+ //是否违纪
|
|
|
+ resp.setIsDiscipline(examRecordData.getIsIllegality() ? 1 : 0);
|
|
|
+ }
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @ApiOperation(value = "根据examRecordDataId查询抓拍照片数据")
|
|
|
+ @PostMapping("/queryCapturePhoto")
|
|
|
+ public QueryCapturePhotoResp queryCapturePhoto(@RequestBody QueryCapturePhotoReq req) {
|
|
|
+ Check.isEmpty(req.getExamRecordDataId(), "考试记录ID不能为空");
|
|
|
+ List<ExamCaptureEntity> examCaptureList = examCaptureRepo.findByExamRecordDataId(req.getExamRecordDataId());
|
|
|
+ QueryCapturePhotoResp queryCapturePhotoResp = new QueryCapturePhotoResp();
|
|
|
+ queryCapturePhotoResp.setExamRecordDataId(req.getExamRecordDataId());
|
|
|
+ List<QueryCapturePhotoBean> capturePhotoList = new ArrayList<QueryCapturePhotoBean>();
|
|
|
+ if (examCaptureList.size() > 0) {
|
|
|
+ for (ExamCaptureEntity examCaptureEntity : examCaptureList) {
|
|
|
+ QueryCapturePhotoBean queryCapturePhotoBean = new QueryCapturePhotoBean();
|
|
|
+ queryCapturePhotoBean.setFileUrl(examCaptureEntity.getFileUrl());
|
|
|
+ queryCapturePhotoBean.setIsPass(examCaptureEntity.getIsPass());
|
|
|
+ queryCapturePhotoBean.setIsStranger(examCaptureEntity.getIsStranger());
|
|
|
+ String faceLivenessResult = examCaptureEntity.getFacelivenessResult();
|
|
|
+ queryCapturePhotoBean.setIsLivenessPass(isLivenessPass(faceLivenessResult));
|
|
|
+ capturePhotoList.add(queryCapturePhotoBean);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ queryCapturePhotoResp.setCapturePhotoList(capturePhotoList);
|
|
|
+ return queryCapturePhotoResp;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 人脸真实性是否通过
|
|
|
+ *
|
|
|
+ * @param faceLivenessResult
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private Boolean isLivenessPass(String faceLivenessResult) {
|
|
|
+ if (StringUtils.isNotBlank(faceLivenessResult)) {
|
|
|
+ JSONObject jsonObject;
|
|
|
+ try {
|
|
|
+ jsonObject = new JSONObject(faceLivenessResult);
|
|
|
+ if (jsonObject.has("error_code") && jsonObject.getInt("error_code") == 0 && jsonObject.has("result")) {
|
|
|
+ JSONObject resultJson = jsonObject.getJSONObject("result");
|
|
|
+ if (resultJson.has("face_liveness")) {
|
|
|
+ double faceLivenessVal = resultJson.getDouble("face_liveness");
|
|
|
+ double baiduFacelivenessThreshold = Double.parseDouble(PropertyHolder.getString("$baidu.faceliveness.threshold"));
|
|
|
+ if (faceLivenessVal > baiduFacelivenessThreshold) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (JSONException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @ApiOperation(value = "按考试名称,rootOrgId,courseCode,身份证号或学号查询成绩信息")
|
|
|
+ @PostMapping("/queryScoreData")
|
|
|
+ public QueryScoreDataResp queryScoreData(@RequestBody QueryScoreDataReq req) {
|
|
|
+ if (StringUtils.isBlank(req.getExamName())) {
|
|
|
+ throw new StatusException("OE-ADMIN-1000005", "考试名称不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(req.getCourseCode())) {
|
|
|
+ throw new StatusException("OE-ADMIN-1000005", "课程code不能为空");
|
|
|
+ }
|
|
|
+ if (req.getRootOrgId() == null) {
|
|
|
+ throw new StatusException("OE-ADMIN-1000005", "rootOrgId不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(req.getIdentityNumber()) && StringUtils.isBlank(req.getStudentCode())) {
|
|
|
+ throw new StatusException("OE-ADMIN-1000005", "身份证号和学号不能都为空");
|
|
|
+ }
|
|
|
+ GetExamReq getExamReq = new GetExamReq();
|
|
|
+ getExamReq.setRootOrgId(req.getRootOrgId());
|
|
|
getExamReq.setName(req.getExamName());
|
|
|
GetExamResp getExamResp = examCloudService.getExam(getExamReq);
|
|
|
ExamBean examBean = getExamResp.getExamBean();
|
|
|
-
|
|
|
+
|
|
|
GetCourseReq getCourseReq = new GetCourseReq();
|
|
|
getCourseReq.setRootOrgId(req.getRootOrgId());
|
|
|
getCourseReq.setCode(req.getCourseCode());
|
|
|
GetCourseResp getCourseResp = courseCloudService.getCourse(getCourseReq);
|
|
|
CourseBean courseBean = getCourseResp.getCourseBean();
|
|
|
-
|
|
|
- ExamRecordEntity selectCondition = new ExamRecordEntity();
|
|
|
+
|
|
|
+ ExamRecordDataEntity selectCondition = new ExamRecordDataEntity();
|
|
|
selectCondition.setExamId(examBean.getId());
|
|
|
selectCondition.setCourseId(courseBean.getId());
|
|
|
- if(StringUtils.isNotBlank(req.getIdentityNumber())){
|
|
|
- selectCondition.setIdentityNumber(req.getIdentityNumber());
|
|
|
+ if (StringUtils.isNotBlank(req.getIdentityNumber())) {
|
|
|
+ selectCondition.setIdentityNumber(req.getIdentityNumber());
|
|
|
}
|
|
|
- if(StringUtils.isNotBlank(req.getStudentCode())){
|
|
|
- selectCondition.setStudentCode(req.getStudentCode());
|
|
|
+ if (StringUtils.isNotBlank(req.getStudentCode())) {
|
|
|
+ selectCondition.setStudentCode(req.getStudentCode());
|
|
|
}
|
|
|
//查询考试记录
|
|
|
List<ScoreDataBean> scoreDataBeanList = new ArrayList<ScoreDataBean>();
|
|
|
- List<ExamRecordEntity> examRecordList = examRecordRepo.findAll(Example.of(selectCondition));
|
|
|
- for(ExamRecordEntity examRecord:examRecordList){
|
|
|
- ExamRecordDataEntity examRecordData = examRecordDataRepo.findByExamRecordId(examRecord.getId());
|
|
|
- ExamScoreEntity examScore = examScoreRepo.findByExamRecordDataId(examRecordData.getId());
|
|
|
- if (examScore==null){
|
|
|
- throw new StatusException("100001","该考生未交卷");
|
|
|
- }
|
|
|
-
|
|
|
- ScoreDataBean scoreDataBean = new ScoreDataBean();
|
|
|
- scoreDataBean.setExamRecordDataId(examRecordData.getId());
|
|
|
- scoreDataBean.setStudentCode(examRecord.getStudentCode());
|
|
|
- scoreDataBean.setStudentName(examRecord.getStudentName());
|
|
|
- scoreDataBean.setIdentityNumber(examRecord.getIdentityNumber());
|
|
|
-
|
|
|
- scoreDataBean.setCourseCode(courseBean.getCode());
|
|
|
- scoreDataBean.setCourseName(courseBean.getName());
|
|
|
- scoreDataBean.setStartTime(examRecordData.getStartTime());
|
|
|
- scoreDataBean.setEndTime(examRecordData.getEndTime());
|
|
|
- scoreDataBean.setTotalScore(examScore.getTotalScore());
|
|
|
-
|
|
|
- scoreDataBean.setIsWarn(examRecordData.getIsWarn());
|
|
|
- scoreDataBean.setIsAudit(examRecordData.getIsAudit());
|
|
|
- scoreDataBean.setIsIllegality(examRecordData.getIsIllegality());
|
|
|
- scoreDataBeanList.add(scoreDataBean);
|
|
|
+ List<ExamRecordDataEntity> examRecordList = examRecordDataRepo.findAll(Example.of(selectCondition));
|
|
|
+ for (ExamRecordDataEntity examRecordData : examRecordList) {
|
|
|
+ ExamScoreEntity examScore = examScoreRepo.findByExamRecordDataId(examRecordData.getId());
|
|
|
+ if (examScore == null) {
|
|
|
+ throw new StatusException("100001", "该考生未交卷");
|
|
|
+ }
|
|
|
+
|
|
|
+ ScoreDataBean scoreDataBean = new ScoreDataBean();
|
|
|
+ scoreDataBean.setExamRecordDataId(examRecordData.getId());
|
|
|
+ scoreDataBean.setStudentCode(examRecordData.getStudentCode());
|
|
|
+ scoreDataBean.setStudentName(examRecordData.getStudentName());
|
|
|
+ scoreDataBean.setIdentityNumber(examRecordData.getIdentityNumber());
|
|
|
+
|
|
|
+ scoreDataBean.setCourseCode(courseBean.getCode());
|
|
|
+ scoreDataBean.setCourseName(courseBean.getName());
|
|
|
+ scoreDataBean.setStartTime(examRecordData.getStartTime());
|
|
|
+ scoreDataBean.setEndTime(examRecordData.getEndTime());
|
|
|
+ scoreDataBean.setTotalScore(examScore.getTotalScore());
|
|
|
+
|
|
|
+ scoreDataBean.setIsWarn(examRecordData.getIsWarn());
|
|
|
+ scoreDataBean.setIsAudit(examRecordData.getIsAudit());
|
|
|
+ scoreDataBean.setIsIllegality(examRecordData.getIsIllegality());
|
|
|
+ scoreDataBeanList.add(scoreDataBean);
|
|
|
}
|
|
|
QueryScoreDataResp queryScoreDataResp = new QueryScoreDataResp();
|
|
|
queryScoreDataResp.setScoreDataBeanList(scoreDataBeanList);
|
|
|
- return queryScoreDataResp;
|
|
|
- }
|
|
|
+ return queryScoreDataResp;
|
|
|
+ }
|
|
|
}
|