wangliang@qmth.com.cn 4 سال پیش
والد
کامیت
5d4c7ea0be

+ 10 - 10
themis-business/src/main/java/com/qmth/themis/business/cache/ExamRecordCacheUtil.java

@@ -603,31 +603,31 @@ public class ExamRecordCacheUtil {
         }
     }
 
-    public static void setMultipleFaceCountErrorNum(Long recordId, Integer multipleFaceCountErrorNum) {
+    public static void setMultipleFaceCountErrorNum(Long recordId, AtomicInteger multipleFaceCountErrorNum) {
         if (Objects.nonNull(getId(recordId))) {
             redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "multipleFaceCountErrorNum", multipleFaceCountErrorNum);
         }
     }
 
-    public static void setNoFaceCountErrorNum(Long recordId, Integer noFaceCountErrorNum) {
+    public static void setNoFaceCountErrorNum(Long recordId, AtomicInteger noFaceCountErrorNum) {
         if (Objects.nonNull(getId(recordId))) {
             redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "noFaceCountErrorNum", noFaceCountErrorNum);
         }
     }
 
-    public static void setFaceCompareErrorNum(Long recordId, Integer faceCompareErrorNum) {
+    public static void setFaceCompareErrorNum(Long recordId, AtomicInteger faceCompareErrorNum) {
         if (Objects.nonNull(getId(recordId))) {
             redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "faceCompareErrorNum", faceCompareErrorNum);
         }
     }
 
-    public static void setEyeCloseErrorNum(Long recordId, Integer eyeCloseErrorNum) {
+    public static void setEyeCloseErrorNum(Long recordId, AtomicInteger eyeCloseErrorNum) {
         if (Objects.nonNull(getId(recordId))) {
             redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "eyeCloseErrorNum", eyeCloseErrorNum);
         }
     }
 
-    public static void setRealnessErrorNum(Long recordId, Integer realnessErrorNum) {
+    public static void setRealnessErrorNum(Long recordId, AtomicInteger realnessErrorNum) {
         if (Objects.nonNull(getId(recordId))) {
             redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "realnessErrorNum", realnessErrorNum);
         }
@@ -654,23 +654,23 @@ public class ExamRecordCacheUtil {
     }
 
     public static AtomicInteger getMultipleFaceCountErrorNum(Long recordId) {
-        return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "multipleFaceCountErrorNum")) ? new AtomicInteger((Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "multipleFaceCountErrorNum")) : new AtomicInteger(0);
+        return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "multipleFaceCountErrorNum")) ? (AtomicInteger) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "multipleFaceCountErrorNum") : new AtomicInteger(0);
     }
 
     public static AtomicInteger getNoFaceCountErrorNum(Long recordId) {
-        return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "noFaceCountErrorNum")) ? new AtomicInteger((Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "noFaceCountErrorNum")) : new AtomicInteger(0);
+        return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "noFaceCountErrorNum")) ? (AtomicInteger) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "noFaceCountErrorNum") : new AtomicInteger(0);
     }
 
     public static AtomicInteger getFaceCompareErrorNum(Long recordId) {
-        return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "faceCompareErrorNum")) ? new AtomicInteger((Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "faceCompareErrorNum")) : new AtomicInteger(0);
+        return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "faceCompareErrorNum")) ? (AtomicInteger) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "faceCompareErrorNum") : new AtomicInteger(0);
     }
 
     public static AtomicInteger getEyeCloseErrorNum(Long recordId) {
-        return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "eyeCloseErrorNum")) ? new AtomicInteger((Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "eyeCloseErrorNum")) : new AtomicInteger(0);
+        return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "eyeCloseErrorNum")) ? (AtomicInteger) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "eyeCloseErrorNum") : new AtomicInteger(0);
     }
 
     public static AtomicInteger getRealnessErrorNum(Long recordId) {
-        return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "realnessErrorNum")) ? new AtomicInteger((Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "realnessErrorNum")) : new AtomicInteger(0);
+        return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "realnessErrorNum")) ? (AtomicInteger) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "realnessErrorNum") : new AtomicInteger(0);
     }
 
     public static Integer getHasAnswerFile(Long recordId) {

+ 16 - 16
themis-mq/src/main/java/com/qmth/themis/mq/service/impl/MqLogicServiceImpl.java

@@ -364,7 +364,7 @@ public class MqLogicServiceImpl implements MqLogicService {
                         ExamRecordCacheUtil.setRealnessErrorRandom(recordId, realnessErrorRandom);
                     }
                     ExamRecordCacheUtil
-                            .setRealnessErrorNum(recordId, ExamRecordCacheUtil.getRealnessErrorNum(recordId).incrementAndGet());
+                            .setRealnessErrorNum(recordId, new AtomicInteger(ExamRecordCacheUtil.getRealnessErrorNum(recordId).incrementAndGet()));
                     warningDto.setRandom(realnessErrorRandom);
                     faceVerifyHistoryService
                             .save(id, recordId, type, photoUrl, faceCount, similarity, realness, time, exception,
@@ -373,7 +373,7 @@ public class MqLogicServiceImpl implements MqLogicService {
                     if (count > teConfig.getRealnessCount()) {
                         ExamRecordCacheUtil.setRealnessErrorRandom(recordId,
                                 String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
-                        ExamRecordCacheUtil.setRealnessErrorNum(recordId, 0);
+                        ExamRecordCacheUtil.setRealnessErrorNum(recordId, new AtomicInteger(0));
                         warningService.realnessError(warningDto);
                     }
                 } else {
@@ -389,7 +389,7 @@ public class MqLogicServiceImpl implements MqLogicService {
                             ExamRecordCacheUtil.setMultipleFaceCountErrorRandom(recordId, multipleFaceRandom);
                         }
                         ExamRecordCacheUtil.setMultipleFaceCountErrorNum(recordId,
-                                ExamRecordCacheUtil.getMultipleFaceCountErrorNum(recordId).incrementAndGet());
+                                new AtomicInteger(ExamRecordCacheUtil.getMultipleFaceCountErrorNum(recordId).incrementAndGet()));
                         warningDto.setRandom(multipleFaceRandom);
                         faceVerifyHistoryService
                                 .save(id, recordId, type, photoUrl, faceCount, similarity, realness, time, exception,
@@ -398,7 +398,7 @@ public class MqLogicServiceImpl implements MqLogicService {
                         if (count > teConfig.getMultipleFaceCountError()) {
                             ExamRecordCacheUtil.setMultipleFaceCountErrorRandom(recordId,
                                     String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
-                            ExamRecordCacheUtil.setMultipleFaceCountErrorNum(recordId, 0);
+                            ExamRecordCacheUtil.setMultipleFaceCountErrorNum(recordId, new AtomicInteger(0));
                             warningService.faceCountError(warningDto);
                         }
                     } else if (faceCount <= 0) {
@@ -408,7 +408,7 @@ public class MqLogicServiceImpl implements MqLogicService {
                             ExamRecordCacheUtil.setNoFaceCountErrorRandom(recordId, noFaceRandom);
                         }
                         ExamRecordCacheUtil.setNoFaceCountErrorNum(recordId,
-                                ExamRecordCacheUtil.getNoFaceCountErrorNum(recordId).incrementAndGet());
+                                new AtomicInteger(ExamRecordCacheUtil.getNoFaceCountErrorNum(recordId).incrementAndGet()));
                         warningDto.setRandom(noFaceRandom);
                         faceVerifyHistoryService
                                 .save(id, recordId, type, photoUrl, faceCount, similarity, realness, time, exception,
@@ -417,7 +417,7 @@ public class MqLogicServiceImpl implements MqLogicService {
                         if (count > teConfig.getNoFaceCountError()) {
                             ExamRecordCacheUtil.setNoFaceCountErrorRandom(recordId,
                                     String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
-                            ExamRecordCacheUtil.setNoFaceCountErrorNum(recordId, 0);
+                            ExamRecordCacheUtil.setNoFaceCountErrorNum(recordId, new AtomicInteger(0));
                             warningService.faceCountError(warningDto);
                         }
                     }
@@ -428,7 +428,7 @@ public class MqLogicServiceImpl implements MqLogicService {
                         ExamRecordCacheUtil.setFaceCompareErrorRandom(recordId, faceCompareErrorRandom);
                     }
                     ExamRecordCacheUtil
-                            .setFaceCompareErrorNum(recordId, ExamRecordCacheUtil.getFaceCompareErrorNum(recordId).incrementAndGet());
+                            .setFaceCompareErrorNum(recordId, new AtomicInteger(ExamRecordCacheUtil.getFaceCompareErrorNum(recordId).incrementAndGet()));
                     warningDto.setRandom(faceCompareErrorRandom);
                     faceVerifyHistoryService
                             .save(id, recordId, type, photoUrl, faceCount, similarity, realness, time, exception,
@@ -437,7 +437,7 @@ public class MqLogicServiceImpl implements MqLogicService {
                     if (count > teConfig.getTotalFaceCompareErrorCount()) {
                         ExamRecordCacheUtil.setFaceCompareErrorRandom(recordId,
                                 String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
-                        ExamRecordCacheUtil.setFaceCompareErrorNum(recordId, 0);
+                        ExamRecordCacheUtil.setFaceCompareErrorNum(recordId, new AtomicInteger(0));
                         warningService.faceCompareError(warningDto);
                     }
                 } else if (Objects.equals(VerifyExceptionEnum.EYE_CLOSE_ERROR, warningEnum)) {//闭眼检测异常
@@ -447,7 +447,7 @@ public class MqLogicServiceImpl implements MqLogicService {
                         ExamRecordCacheUtil.setEyeCloseErrorRandom(recordId, eyeCloseErrorRandom);
                     }
                     ExamRecordCacheUtil
-                            .setEyeCloseErrorNum(recordId, ExamRecordCacheUtil.getEyeCloseErrorNum(recordId).incrementAndGet());
+                            .setEyeCloseErrorNum(recordId, new AtomicInteger(ExamRecordCacheUtil.getEyeCloseErrorNum(recordId).incrementAndGet()));
                     warningDto.setRandom(eyeCloseErrorRandom);
                     faceVerifyHistoryService
                             .save(id, recordId, type, photoUrl, faceCount, similarity, realness, time, exception,
@@ -456,7 +456,7 @@ public class MqLogicServiceImpl implements MqLogicService {
                     if (count > teConfig.getTotalEyeCloseErrorCount()) {
                         ExamRecordCacheUtil.setEyeCloseErrorRandom(recordId,
                                 String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
-                        ExamRecordCacheUtil.setEyeCloseErrorNum(recordId, 0);
+                        ExamRecordCacheUtil.setEyeCloseErrorNum(recordId, new AtomicInteger(0));
                         warningService.eyeCloseError(warningDto);
                     }
                 }
@@ -539,7 +539,7 @@ public class MqLogicServiceImpl implements MqLogicService {
                                 ExamRecordCacheUtil.setMultipleFaceCountErrorRandom(recordId, multipleFaceRandom);
                             }
                             ExamRecordCacheUtil.setMultipleFaceCountErrorNum(recordId,
-                                    ExamRecordCacheUtil.getMultipleFaceCountErrorNum(recordId).incrementAndGet());
+                                    new AtomicInteger(ExamRecordCacheUtil.getMultipleFaceCountErrorNum(recordId).incrementAndGet()));
                             warningDto.setRandom(multipleFaceRandom);
                             livenessVerifyHistoryService
                                     .save(id, recordId, type, actions, retry, startTime, finishTime, exception,
@@ -548,7 +548,7 @@ public class MqLogicServiceImpl implements MqLogicService {
                             if (count > teConfig.getMultipleFaceCountError()) {
                                 ExamRecordCacheUtil.setMultipleFaceCountErrorRandom(recordId,
                                         String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
-                                ExamRecordCacheUtil.setMultipleFaceCountErrorNum(recordId, 0);
+                                ExamRecordCacheUtil.setMultipleFaceCountErrorNum(recordId, new AtomicInteger(0));
                                 warningService.faceCountError(warningDto);
                             }
                         } else if (faceCount <= 0) {
@@ -558,7 +558,7 @@ public class MqLogicServiceImpl implements MqLogicService {
                                 ExamRecordCacheUtil.setNoFaceCountErrorRandom(recordId, noFaceRandom);
                             }
                             ExamRecordCacheUtil.setNoFaceCountErrorNum(recordId,
-                                    ExamRecordCacheUtil.getMultipleFaceCountErrorNum(recordId).incrementAndGet());
+                                    new AtomicInteger(ExamRecordCacheUtil.getMultipleFaceCountErrorNum(recordId).incrementAndGet()));
                             warningDto.setRandom(noFaceRandom);
                             livenessVerifyHistoryService
                                     .save(id, recordId, type, actions, retry, startTime, finishTime, exception,
@@ -567,7 +567,7 @@ public class MqLogicServiceImpl implements MqLogicService {
                             if (count > teConfig.getNoFaceCountError()) {
                                 ExamRecordCacheUtil.setNoFaceCountErrorRandom(recordId,
                                         String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
-                                ExamRecordCacheUtil.setNoFaceCountErrorNum(recordId, 0);
+                                ExamRecordCacheUtil.setNoFaceCountErrorNum(recordId, new AtomicInteger(0));
                                 warningService.faceCountError(warningDto);
                             }
                         }
@@ -580,7 +580,7 @@ public class MqLogicServiceImpl implements MqLogicService {
                             ExamRecordCacheUtil.setFaceCompareErrorRandom(recordId, faceCompareErrorRandom);
                         }
                         ExamRecordCacheUtil.setFaceCompareErrorNum(recordId,
-                                ExamRecordCacheUtil.getFaceCompareErrorNum(recordId).incrementAndGet());
+                                new AtomicInteger(ExamRecordCacheUtil.getFaceCompareErrorNum(recordId).incrementAndGet()));
                         warningDto.setRandom(faceCompareErrorRandom);
                         livenessVerifyHistoryService
                                 .save(id, recordId, type, actions, retry, startTime, finishTime, exception,
@@ -589,7 +589,7 @@ public class MqLogicServiceImpl implements MqLogicService {
                         if (count > teConfig.getTotalFaceCompareErrorCount()) {
                             ExamRecordCacheUtil.setFaceCompareErrorRandom(recordId,
                                     String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
-                            ExamRecordCacheUtil.setFaceCompareErrorNum(recordId, 0);
+                            ExamRecordCacheUtil.setFaceCompareErrorNum(recordId, new AtomicInteger(0));
                             warningService.faceCompareError(warningDto);
                         }
                     }