wangwei 5 anos atrás
pai
commit
d3d17f0f20

+ 60 - 2
examcloud-core-examwork-api-provider/src/main/java/cn/com/qmth/examcloud/core/examwork/api/controller/ExamController.java

@@ -98,6 +98,8 @@ import cn.com.qmth.examcloud.support.cache.bean.ExamPropertyCacheBean;
 import cn.com.qmth.examcloud.support.cache.bean.ExamSettingsCacheBean;
 import cn.com.qmth.examcloud.support.cache.bean.OrgPropertyCacheBean;
 import cn.com.qmth.examcloud.support.cache.bean.StudentCacheBean;
+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.config.SystemConfig;
@@ -1321,8 +1323,10 @@ public class ExamController extends ControllerSupport {
 	@ApiOperation(value = "是否可以微信作答", notes = "")
 	@GetMapping("weixinAnswerEnabled/{examId}")
 	public Boolean weixinAnswerEnabled(@PathVariable Long examId) {
-		User accessUser = getAccessUser();
-		OrgPropertyCacheBean orgConf = CacheHelper.getOrgProperty(accessUser.getRootOrgId(),
+
+		ExamSettingsCacheBean examSettings = CacheHelper.getExamSettings(examId);
+
+		OrgPropertyCacheBean orgConf = CacheHelper.getOrgProperty(examSettings.getRootOrgId(),
 				"WEIXIN_ANSWER_ENABLED");
 		ExamPropertyCacheBean examConf = CacheHelper.getExamProperty(examId,
 				"WEIXIN_ANSWER_ENABLED");
@@ -1348,4 +1352,58 @@ public class ExamController extends ControllerSupport {
 		return false;
 	}
 
+	@ApiOperation(value = "是否支持人脸识别", notes = "")
+	@GetMapping("faceCheckEnabled/{examId}")
+	public Boolean faceCheckEnabled(@PathVariable Long examId) {
+		ExamSettingsCacheBean examSettings = CacheHelper.getExamSettings(examId);
+
+		String faceCheck = PrivilegeDefine.RootOrgFunctions.OnlineExamFunctions.FaceCheck.CODE;
+		Boolean hasFaceCheckFunction = PrivilegeManager.judge(examSettings.getRootOrgId(),
+				faceCheck);
+
+		ExamPropertyCacheBean examConf = CacheHelper.getExamProperty(examId, "IS_FACE_ENABLE");
+		String examValue = examConf.getValue();
+
+		if (!hasFaceCheckFunction) {
+			return false;
+		}
+
+		if (StringUtils.isBlank(examValue)) {
+			return false;
+		}
+
+		if (StringUtil.isTrue(examValue)) {
+			return true;
+		}
+
+		return false;
+	}
+
+	@ApiOperation(value = "是否支持活体检测", notes = "")
+	@GetMapping("identificationOfLivingEnabled/{examId}")
+	public Boolean identificationOfLivingEnabled(@PathVariable Long examId) {
+		ExamSettingsCacheBean examSettings = CacheHelper.getExamSettings(examId);
+
+		String IdentificationOfLivingBody = PrivilegeDefine.RootOrgFunctions.OnlineExamFunctions.IdentificationOfLivingBody.CODE;
+		Boolean hasIdentificationOfLivingBodyFunction = PrivilegeManager
+				.judge(examSettings.getRootOrgId(), IdentificationOfLivingBody);
+
+		ExamPropertyCacheBean examConf = CacheHelper.getExamProperty(examId, "IS_FACE_VERIFY");
+		String examValue = examConf.getValue();
+
+		if (!hasIdentificationOfLivingBodyFunction) {
+			return false;
+		}
+
+		if (StringUtils.isBlank(examValue)) {
+			return false;
+		}
+
+		if (StringUtil.isTrue(examValue)) {
+			return true;
+		}
+
+		return false;
+	}
+
 }