WANG 6 سال پیش
والد
کامیت
3eb80ec605

+ 32 - 3
examcloud-core-examwork-service/src/main/java/cn/com/qmth/examcloud/core/examwork/service/impl/ExamServiceImpl.java

@@ -42,6 +42,8 @@ import cn.com.qmth.examcloud.core.examwork.service.ExamService;
 import cn.com.qmth.examcloud.core.examwork.service.ExamStudentService;
 import cn.com.qmth.examcloud.core.examwork.service.bean.ExamInfo;
 import cn.com.qmth.examcloud.core.examwork.service.bean.ExamSpecialSettingsInfo;
+import cn.com.qmth.examcloud.support.privilege.PrivilegeDefine;
+import cn.com.qmth.examcloud.support.privilege.PrivilegeManager;
 import cn.com.qmth.examcloud.task.api.DataSyncCloudService;
 import cn.com.qmth.examcloud.task.api.request.SyncExamReq;
 import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
@@ -115,7 +117,7 @@ public class ExamServiceImpl implements ExamService {
 		OrgBean rootOrg = getOrgResp.getOrg();
 
 		Map<String, String> properties = examInfo.getProperties();
-		Map<DynamicEnum, String> map = checkAndGetExamProperties(properties);
+		Map<DynamicEnum, String> map = checkAndGetExamProperties(rootOrgId, properties);
 
 		ExamEntity exam = null;
 		CURD realStatus = null;
@@ -261,10 +263,12 @@ public class ExamServiceImpl implements ExamService {
 	 * 方法注释
 	 *
 	 * @author WANGWEI
+	 * @param rootOrgId
 	 * @param properties
 	 * @return
 	 */
-	private Map<DynamicEnum, String> checkAndGetExamProperties(Map<String, String> properties) {
+	private Map<DynamicEnum, String> checkAndGetExamProperties(Long rootOrgId,
+			Map<String, String> properties) {
 		DynamicEnumManager manager = ExamProperty.getDynamicEnumManager();
 
 		Map<DynamicEnum, String> map = Maps.newHashMap();
@@ -302,6 +306,30 @@ public class ExamServiceImpl implements ExamService {
 			throw new StatusException("001002", "作弊说明内容过大");
 		}
 
+		// 校验机构权限
+		// 人脸识别功能校验
+		String faceCheck = PrivilegeDefine.RootOrgFunctions.OnlineExamFunctions.FaceCheck.CODE;
+		Boolean hasFaceCheckFunction = PrivilegeManager.judge(rootOrgId, faceCheck);
+		String isFaceEnable = properties.get("IS_FACE_ENABLE");
+		if (!hasFaceCheckFunction) {
+			if (StringUtils.isNotBlank(isFaceEnable)
+					&& isFaceEnable.equalsIgnoreCase(Boolean.toString(true))) {
+				throw new StatusException("001002", "人脸识别功能未开放");
+			}
+		}
+
+		// 活体检测功能校验
+		String IdentificationOfLivingBody = PrivilegeDefine.RootOrgFunctions.OnlineExamFunctions.IdentificationOfLivingBody.CODE;
+		Boolean hasIdentificationOfLivingBodyFunction = PrivilegeManager.judge(rootOrgId,
+				IdentificationOfLivingBody);
+		String isFceVerify = properties.get("IS_FACE_VERIFY");
+		if (!hasIdentificationOfLivingBodyFunction) {
+			if (StringUtils.isNotBlank(isFceVerify)
+					&& isFceVerify.equalsIgnoreCase(Boolean.toString(true))) {
+				throw new StatusException("001002", "活体检测功能未开放");
+			}
+		}
+
 		return map;
 	}
 
@@ -387,7 +415,8 @@ public class ExamServiceImpl implements ExamService {
 		Map<String, String> orgProperties = examSpecialInfo.getOrgProperties();
 
 		if (null != orgProperties) {
-			Map<DynamicEnum, String> map = checkAndGetExamProperties(orgProperties);
+			Map<DynamicEnum, String> map = checkAndGetExamProperties(examEntity.getRootOrgId(),
+					orgProperties);
 
 			for (Entry<DynamicEnum, String> entry : map.entrySet()) {
 				DynamicEnum de = entry.getKey();