Эх сурвалжийг харах

bug fix.包含未修改完毕的部分代码

lideyin 5 жил өмнө
parent
commit
9fcd5bdc33

+ 26 - 13
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/examcapture/ExamCaptureAuditInfo.java

@@ -18,7 +18,7 @@ import cn.com.qmth.examcloud.core.oe.admin.base.utils.excel.ExcelProperty;
  */
 public class ExamCaptureAuditInfo implements JsonSerializable {
     /**
-	 * 
+	 *
 	 */
 	private static final long serialVersionUID = 6991258456890821018L;
 
@@ -26,20 +26,20 @@ public class ExamCaptureAuditInfo implements JsonSerializable {
      * 考试记录ID
      */
 	private Long examRecordDataId;
-	
+
     private Long studentId;
-    
+
     private String studentName;
-    
+
     private String studentCode;
-    
+
     private String identityNumber;
-    
+
     private String courseCode;
-    
+
     private String courseName;
-    
-    
+
+
     /**
      * 审核状态
      */
@@ -89,12 +89,12 @@ public class ExamCaptureAuditInfo implements JsonSerializable {
      * 人脸五官坐标比对值
      */
     private Double faceLandmarkVal;
-    
+
     /**
      * 百度人脸活体检测通过率
      */
     private Double baiduFaceLivenessSuccessPercent;
-    
+
     /**
      * 虚拟摄像头名称
      */
@@ -120,6 +120,11 @@ public class ExamCaptureAuditInfo implements JsonSerializable {
      */
     private String courseLevel;
 
+    /**
+     * 客观题总分
+     */
+    private String objectiveTotalScore;
+
     public String getStatus() {
         return status;
     }
@@ -296,7 +301,7 @@ public class ExamCaptureAuditInfo implements JsonSerializable {
 	public void setVirtualCameraNames(String virtualCameraNames) {
 		this.virtualCameraNames = virtualCameraNames;
 	}
-	
+
 	public String getSyncCaptureFileUrl() {
         return syncCaptureFileUrl;
     }
@@ -328,4 +333,12 @@ public class ExamCaptureAuditInfo implements JsonSerializable {
     public void setCourseLevel(String courseLevel) {
         this.courseLevel = courseLevel;
     }
-}
+
+    public String getObjectiveTotalScore() {
+        return objectiveTotalScore;
+    }
+
+    public void setObjectiveTotalScore(String objectiveTotalScore) {
+        this.objectiveTotalScore = objectiveTotalScore;
+    }
+}

+ 110 - 103
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamCaptureServiceImpl.java

@@ -11,11 +11,9 @@ import cn.com.qmth.examcloud.commons.exception.StatusException;
 import cn.com.qmth.examcloud.core.basic.api.bean.CourseBean;
 import cn.com.qmth.examcloud.core.oe.admin.dao.ExamCaptureRepo;
 import cn.com.qmth.examcloud.core.oe.admin.dao.ExamRecordDataRepo;
+import cn.com.qmth.examcloud.core.oe.admin.dao.ExamScoreRepo;
 import cn.com.qmth.examcloud.core.oe.admin.dao.ExamSyncCaptureRepo;
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamAuditEntity;
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamCaptureEntity;
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamRecordDataEntity;
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamSyncCaptureEntity;
+import cn.com.qmth.examcloud.core.oe.admin.dao.entity.*;
 import cn.com.qmth.examcloud.core.oe.admin.dao.enums.AuditStatus;
 import cn.com.qmth.examcloud.core.oe.admin.service.ExamAuditService;
 import cn.com.qmth.examcloud.core.oe.admin.service.ExamCaptureService;
@@ -57,13 +55,15 @@ public class ExamCaptureServiceImpl implements ExamCaptureService {
     private ExamRecordDataRepo examRecordDataRepo;
     @Autowired
     private ExamSyncCaptureRepo examSyncCaptureRepo;
+    @Autowired
+    private ExamScoreRepo examScoreRepo;
 
     @Override
     public ExamCaptureAuditInfo getExamCaptureAuditDetail(Long examRecordDataId) {
         if (examRecordDataId == null) {
             return null;
         }
-        ExamRecordDataEntity recordData = GlobalHelper.getEntity(examRecordDataRepo,examRecordDataId,ExamRecordDataEntity.class);
+        ExamRecordDataEntity recordData = GlobalHelper.getEntity(examRecordDataRepo, examRecordDataId, ExamRecordDataEntity.class);
         if (recordData == null) {
             return null;
         }
@@ -71,28 +71,28 @@ public class ExamCaptureServiceImpl implements ExamCaptureService {
         ExamAuditEntity audit = examAuditService.getExamAuditByExamRecordDataId(examRecordDataId);
         ExamCaptureAuditInfo detail = new ExamCaptureAuditInfo();
         if (audit != null) {
-             if (audit.getStatus() != null) {
-                 detail.setStatus(audit.getStatus().getName());
-             } else {
-                 detail.setStatus(AuditStatus.UN_PASS.getName());
-             }
-             detail.setDisciplineDetail(audit.getDisciplineDetail());
-             if(audit.getDisciplineType() != null){
-             	detail.setDisciplineType(audit.getDisciplineType().getName());
-             }
+            if (audit.getStatus() != null) {
+                detail.setStatus(audit.getStatus().getName());
+            } else {
+                detail.setStatus(AuditStatus.UN_PASS.getName());
+            }
+            detail.setDisciplineDetail(audit.getDisciplineDetail());
+            if (audit.getDisciplineType() != null) {
+                detail.setDisciplineType(audit.getDisciplineType().getName());
+            }
         }
-        
+
         detail.setExamRecordDataId(examRecordDataId);
         detail.setStudentId(recordData.getStudentId());
         detail.setStudentCode(recordData.getStudentCode());
         detail.setStudentName(recordData.getStudentName());
         detail.setIdentityNumber(recordData.getIdentityNumber());
-        
+
         CourseBean courseBean = ExamCacheTransferHelper.getCachedCourse(recordData.getCourseId());
 
         detail.setCourseCode(courseBean.getCode());
         detail.setCourseName(courseBean.getName());
-        
+
         detail.setIsWarn(recordData.getIsWarn());
         detail.setIsAudit(recordData.getIsAudit());
         detail.setIsIllegality(recordData.getIsIllegality());
@@ -103,12 +103,12 @@ public class ExamCaptureServiceImpl implements ExamCaptureService {
         detail.setFaceSuccessPercent(recordData.getFaceSuccessPercent());
         detail.setFaceLandmarkVal(recordData.getFaceLandmarkVal());
         detail.setBaiduFaceLivenessSuccessPercent(recordData.getBaiduFaceLivenessSuccessPercent());
-        if(recordData.getFaceVerifyResult()!=null){
-        	detail.setFaceVerifyResult(recordData.getFaceVerifyResult().name());
+        if (recordData.getFaceVerifyResult() != null) {
+            detail.setFaceVerifyResult(recordData.getFaceVerifyResult().name());
         }
         detail.setVirtualCameraNames(getVirtualCameraNames(examRecordDataId));
 
-		//同步人脸比较时抓拍照片的url
+        //同步人脸比较时抓拍照片的url
         detail.setSyncCaptureFileUrl(getSyncCaptureFileUrl(examRecordDataId));
 
         //组织机构
@@ -122,6 +122,12 @@ public class ExamCaptureServiceImpl implements ExamCaptureService {
         //课程层次
         detail.setCourseLevel(recordData.getCourseLevel());
 
+        //客观题总分
+        ExamScoreEntity examScore = examScoreRepo.findByExamRecordDataId(recordData.getId());
+        if (null != examScore) {
+            detail.setObjectiveTotalScore(String.valueOf(examScore.getObjectiveScore()));
+        }
+
         return detail;
     }
 
@@ -134,42 +140,43 @@ public class ExamCaptureServiceImpl implements ExamCaptureService {
 
         return syncCapture.getFileUrl();
     }
-    
+
     /**
      * 获取虚拟摄像头名称
+     *
      * @param examRecordDataId
      * @return
      */
     @Override
-    public String getVirtualCameraNames(Long examRecordDataId){
-    	 Set<String> virtualCameraNames = new HashSet<String>();
-         List<ExamCaptureEntity> examCaptureList = examCaptureRepo.findByExamRecordDataId(examRecordDataId);
-         if(examCaptureList != null && examCaptureList.size() >0){
-         	for(ExamCaptureEntity examCapture:examCaptureList){
-         		String cameraInfos = examCapture.getCameraInfos();
-         		if(StringUtils.isNotBlank(cameraInfos)){
-         			JSONArray jsonArray;
-					try {
-						jsonArray = new JSONArray(cameraInfos);						
-						for(int i = 0;i<jsonArray.length();i++){
-	         				JSONObject jsonObject = (JSONObject) jsonArray.get(i);
-	         				if(StringUtils.isBlank(jsonObject.getString("pid"))){
-	         					virtualCameraNames.add(jsonObject.getString("name"));
-	         				}
-	         			}
-					} catch (JSONException e) {
-						e.printStackTrace();
-						throw new StatusException("ExamCaptureService-001", "获取虚拟摄像头名称失败");
-					}
-         			
-         		}
-         	}
-         }
-         StringBuffer sb = new StringBuffer();
-         for(String cameraName:virtualCameraNames){
-        	 sb.append(cameraName).append(";");
-         }
-         return sb.toString();
+    public String getVirtualCameraNames(Long examRecordDataId) {
+        Set<String> virtualCameraNames = new HashSet<String>();
+        List<ExamCaptureEntity> examCaptureList = examCaptureRepo.findByExamRecordDataId(examRecordDataId);
+        if (examCaptureList != null && examCaptureList.size() > 0) {
+            for (ExamCaptureEntity examCapture : examCaptureList) {
+                String cameraInfos = examCapture.getCameraInfos();
+                if (StringUtils.isNotBlank(cameraInfos)) {
+                    JSONArray jsonArray;
+                    try {
+                        jsonArray = new JSONArray(cameraInfos);
+                        for (int i = 0; i < jsonArray.length(); i++) {
+                            JSONObject jsonObject = (JSONObject) jsonArray.get(i);
+                            if (StringUtils.isBlank(jsonObject.getString("pid"))) {
+                                virtualCameraNames.add(jsonObject.getString("name"));
+                            }
+                        }
+                    } catch (JSONException e) {
+                        e.printStackTrace();
+                        throw new StatusException("ExamCaptureService-001", "获取虚拟摄像头名称失败");
+                    }
+
+                }
+            }
+        }
+        StringBuffer sb = new StringBuffer();
+        for (String cameraName : virtualCameraNames) {
+            sb.append(cameraName).append(";");
+        }
+        return sb.toString();
     }
 
     @Override
@@ -179,13 +186,13 @@ public class ExamCaptureServiceImpl implements ExamCaptureService {
         }
         List<ExamCaptureEntity> examCaptureEntityList = examCaptureRepo.findByExamRecordDataId(examRecordDataId);
         List<ExamCaptureInfo> examCaptureInfoList = new ArrayList<ExamCaptureInfo>();
-        for(ExamCaptureEntity examCapture:examCaptureEntityList){
-        	examCaptureInfoList.add(buildExamCaptureInfo(examCapture));
+        for (ExamCaptureEntity examCapture : examCaptureEntityList) {
+            examCaptureInfoList.add(buildExamCaptureInfo(examCapture));
         }
         return examCaptureInfoList;
     }
 
-    
+
     public ExamCaptureInfo buildExamCaptureInfo(ExamCaptureEntity entity) {
         ExamCaptureInfo info = new ExamCaptureInfo();
         info.setId(entity.getId());
@@ -194,48 +201,48 @@ public class ExamCaptureServiceImpl implements ExamCaptureService {
         info.setReturnMessage(entity.getFaceCompareResult());
         info.setPass(entity.getIsPass());
         info.setStranger(entity.getIsStranger());
-        
+
         String faceLivenessResult = entity.getFacelivenessResult();
         info.setIsFacelivenessPass(isFaceLivenessPass(faceLivenessResult));
-        
+
         String cameraInfos = entity.getCameraInfos();
         info.setVirtualCameraNames(getVirtualCameraNames(cameraInfos));
         return info;
     }
-    
-    private String getVirtualCameraNames(String cameraInfos){
-    	StringBuffer sb = new StringBuffer();
-    	if(StringUtils.isNotBlank(cameraInfos)){
- 			JSONArray jsonArray;
-			try {
-				jsonArray = new JSONArray(cameraInfos);
-				for(int i = 0;i<jsonArray.length();i++){
-	 				JSONObject jsonObject = (JSONObject) jsonArray.get(i);
-	 				if(StringUtils.isBlank(jsonObject.getString("pid"))){
-	 					sb.append(jsonObject.getString("name")+",");
-	 				}
-	 			}
-			} catch (JSONException e) {
-				e.printStackTrace();
-				throw new StatusException("ExamCaptureService-002", "获取虚拟摄像头名称失败");
-			}
- 			
- 			if(sb.lastIndexOf(",")>-1){
- 				return sb.substring(0, sb.lastIndexOf(","));
- 			}
- 		}
-    	return sb.toString();
+
+    private String getVirtualCameraNames(String cameraInfos) {
+        StringBuffer sb = new StringBuffer();
+        if (StringUtils.isNotBlank(cameraInfos)) {
+            JSONArray jsonArray;
+            try {
+                jsonArray = new JSONArray(cameraInfos);
+                for (int i = 0; i < jsonArray.length(); i++) {
+                    JSONObject jsonObject = (JSONObject) jsonArray.get(i);
+                    if (StringUtils.isBlank(jsonObject.getString("pid"))) {
+                        sb.append(jsonObject.getString("name") + ",");
+                    }
+                }
+            } catch (JSONException e) {
+                e.printStackTrace();
+                throw new StatusException("ExamCaptureService-002", "获取虚拟摄像头名称失败");
+            }
+
+            if (sb.lastIndexOf(",") > -1) {
+                return sb.substring(0, sb.lastIndexOf(","));
+            }
+        }
+        return sb.toString();
     }
-    
-    private boolean isFaceLivenessPass(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");
+
+    private boolean isFaceLivenessPass(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;
                         SysPropertyCacheBean baiduFacelivenessThresholdProperty = CacheHelper.getSysProperty("$baidu.faceliveness.threshold");
@@ -245,18 +252,18 @@ public class ExamCaptureServiceImpl implements ExamCaptureService {
                             baiduFacelivenessThreshold = Double.valueOf(baiduFacelivenessThresholdProperty.getValue().toString());
                         }
 
-						if(faceLivenessVal > baiduFacelivenessThreshold){
-							return true;
-						}
-					}
-				}
-			} catch (JSONException e) {
-				e.printStackTrace();
-				return false;
-			}
-			
-    	}
-		return false;
-	}
-    
-}
+                        if (faceLivenessVal > baiduFacelivenessThreshold) {
+                            return true;
+                        }
+                    }
+                }
+            } catch (JSONException e) {
+                e.printStackTrace();
+                return false;
+            }
+
+        }
+        return false;
+    }
+
+}