|
@@ -49,48 +49,47 @@ public class ProcessBaiduFaceLivenessAlarmTask implements ApplicationRunner {
|
|
|
*/
|
|
|
private void faceLivenessDectectAlarm() {
|
|
|
while (true) {
|
|
|
- if (captureLog.isDebugEnabled()){
|
|
|
- captureLog.debug("[FACE_LIVENESS_ALARM] 进入活体检测" + System.currentTimeMillis() + "....totalCount=" +
|
|
|
- ExamCaptureProcessStatisticController.getFaceLivenessDetectCount() + " ,failCount=" +
|
|
|
- ExamCaptureProcessStatisticController.getFaceLivenessDetectFailedCount());
|
|
|
- }
|
|
|
+ try {
|
|
|
+ if (captureLog.isDebugEnabled()) {
|
|
|
+ captureLog.debug("[FACE_LIVENESS_ALARM] 进入活体检测" + System.currentTimeMillis() + "....totalCount=" +
|
|
|
+ ExamCaptureProcessStatisticController.getFaceLivenessDetectCount() + " ,failCount=" +
|
|
|
+ ExamCaptureProcessStatisticController.getFaceLivenessDetectFailedCount());
|
|
|
+ }
|
|
|
|
|
|
- //如果每分钟失败率超过50%则发短信报警,且总数不少于10次则短信报警
|
|
|
- if (ExamCaptureProcessStatisticController.getFaceLivenessDetectCount() > COUNT_WARN_THRESHOLD &&
|
|
|
- ExamCaptureProcessStatisticController.getFaceLivenessDetectFailureRate() > RATE_WARN_THRESHOLD) {
|
|
|
- SysPropertyCacheBean faceLivenessSmsAssemblyCodeProperty = CacheHelper.getSysProperty("capture.faceLiveness.smsAssemblyCode");
|
|
|
- if (!faceLivenessSmsAssemblyCodeProperty.getHasValue()) {
|
|
|
- if (captureLog.isErrorEnabled()){
|
|
|
- captureLog.error("[FACE_LIVENESS_ALARM.] 未配置人脸比对的短信模板代码,totalCount="+ExamCaptureProcessStatisticController.getFaceCompareCount()+",errorCount="+ExamCaptureProcessStatisticController.getFaceCompareFailedCount());
|
|
|
+ //如果每分钟失败率超过50%则发短信报警,且总数不少于10次则短信报警
|
|
|
+ if (ExamCaptureProcessStatisticController.getFaceLivenessDetectCount() > COUNT_WARN_THRESHOLD &&
|
|
|
+ ExamCaptureProcessStatisticController.getFaceLivenessDetectFailureRate() > RATE_WARN_THRESHOLD) {
|
|
|
+ SysPropertyCacheBean faceLivenessSmsAssemblyCodeProperty = CacheHelper.getSysProperty("capture.faceLiveness.smsAssemblyCode");
|
|
|
+ if (!faceLivenessSmsAssemblyCodeProperty.getHasValue()) {
|
|
|
+ captureLog.error("[FACE_LIVENESS_ALARM.] 未配置人脸比对的短信模板代码,totalCount=" + ExamCaptureProcessStatisticController.getFaceCompareCount() + ",errorCount=" + ExamCaptureProcessStatisticController.getFaceCompareFailedCount());
|
|
|
+ throw new StatusException("300003", "未配置人脸活体检测的短信模板代码");
|
|
|
}
|
|
|
- throw new StatusException("300003", "未配置人脸活体检测的短信模板代码");
|
|
|
- }
|
|
|
- SysPropertyCacheBean smsPhoneProperty = CacheHelper.getSysProperty("capture.sms.phones");
|
|
|
- if (!smsPhoneProperty.getHasValue()) {
|
|
|
- if (captureLog.isErrorEnabled()){
|
|
|
- captureLog.error("[FACE_LIVENESS_ALARM.] 未配置图片处理失败的通知手机号,totalCount="+ExamCaptureProcessStatisticController.getFaceCompareCount()+",errorCount="+ExamCaptureProcessStatisticController.getFaceCompareFailedCount());
|
|
|
+ SysPropertyCacheBean smsPhoneProperty = CacheHelper.getSysProperty("capture.sms.phones");
|
|
|
+ if (!smsPhoneProperty.getHasValue()) {
|
|
|
+ captureLog.error("[FACE_LIVENESS_ALARM.] 未配置图片处理失败的通知手机号,totalCount=" + ExamCaptureProcessStatisticController.getFaceCompareCount() + ",errorCount=" + ExamCaptureProcessStatisticController.getFaceCompareFailedCount());
|
|
|
+ throw new StatusException("300004", "未配置图片处理失败的通知手机号");
|
|
|
}
|
|
|
- throw new StatusException("300004", "未配置图片处理失败的通知手机号");
|
|
|
- }
|
|
|
|
|
|
- List<String> phoneList = Arrays.asList(smsPhoneProperty.getValue().toString().split(","));
|
|
|
- SendSmsReq sendSmsReq = new SendSmsReq();
|
|
|
- sendSmsReq.setPhoneList(phoneList);
|
|
|
- sendSmsReq.setSmsAssemblyCode(faceLivenessSmsAssemblyCodeProperty.getValue().toString());
|
|
|
+ List<String> phoneList = Arrays.asList(smsPhoneProperty.getValue().toString().split(","));
|
|
|
+ SendSmsReq sendSmsReq = new SendSmsReq();
|
|
|
+ sendSmsReq.setPhoneList(phoneList);
|
|
|
+ sendSmsReq.setSmsAssemblyCode(faceLivenessSmsAssemblyCodeProperty.getValue().toString());
|
|
|
|
|
|
- HashMap<String, String> params = new HashMap<>();
|
|
|
- params.put("totalCount", String.valueOf(ExamCaptureProcessStatisticController.getFaceLivenessDetectCount()));
|
|
|
- params.put("errorCount", String.valueOf(ExamCaptureProcessStatisticController.getFaceLivenessDetectFailedCount()));
|
|
|
- sendSmsReq.setParams(params);
|
|
|
- try {
|
|
|
- smsCloudService.sendSms(sendSmsReq);
|
|
|
- } catch (Exception e) {
|
|
|
- captureLog.error("[PROCESS_FACE_LIVENESS.] 发送短信出现异常", e);
|
|
|
+ HashMap<String, String> params = new HashMap<>();
|
|
|
+ params.put("totalCount", String.valueOf(ExamCaptureProcessStatisticController.getFaceLivenessDetectCount()));
|
|
|
+ params.put("errorCount", String.valueOf(ExamCaptureProcessStatisticController.getFaceLivenessDetectFailedCount()));
|
|
|
+ sendSmsReq.setParams(params);
|
|
|
+ try {
|
|
|
+ smsCloudService.sendSms(sendSmsReq);
|
|
|
+ } catch (Exception e) {
|
|
|
+ captureLog.error("[PROCESS_FACE_LIVENESS.] 发送短信出现异常", e);
|
|
|
+ }
|
|
|
}
|
|
|
+ //每1分钟重置一次总数量与失败数量
|
|
|
+ ExamCaptureProcessStatisticController.resetAllFaceLivenessDetectCount();
|
|
|
+ } catch (StatusException e) {
|
|
|
+ captureLog.error("[FACE_LIVENESS_ALARM.] 活体检测预警出现异常", e);
|
|
|
}
|
|
|
- //每1分钟重置一次总数量与失败数量
|
|
|
- ExamCaptureProcessStatisticController.resetFaceLivenessDetectCount();
|
|
|
- ExamCaptureProcessStatisticController.resetFaceLivenessDetectFailureCount();
|
|
|
|
|
|
//每分钟轮循一次
|
|
|
Util.sleep(60);
|