xiangpei
2024-09-03 46aaf9e30acf14a777cda37fe761b3b39e53f568
ycl-server/src/main/java/com/ycl/calculate/FaceSnapshotDataCalculation.java
@@ -11,9 +11,7 @@
import com.ycl.platform.service.ICheckIndexFaceService;
import com.ycl.platform.service.ITMonitorService;
import com.ycl.system.mapper.SysConfigMapper;
import constant.ApiConstants;
import constant.CheckConstants;
import constant.CheckSnapCountConstants;
import constant.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
@@ -38,7 +36,6 @@
 */
@Component
@Slf4j
//TODD:系统配置里的区分人脸和车辆、累加次数的概念、区县不少于40路,不达标市州的当月该项成绩不能得分。
public class FaceSnapshotDataCalculation extends IndexCalculationServe implements CalculationStrategy<SnapshotDataMonitorResult> {
    @Autowired
    private CheckIndexFaceMapper checkIndexFaceMapper;
@@ -78,7 +75,7 @@
        // 判断今天是否是本月的第一天
        if (today.equals(firstDayOfMonth)) {
            // 如果是,则清除Redis中记录中断次数的数据
            redisTemplate.delete(ApiConstants.Check_Face_ViewConnect);
            redisTemplate.delete(RedisConstant.Check_Face_ViewConnect);
        }
        for (SnapshotDataMonitorResult result : list) {
            TMonitorVO monitor = monitorMap.get(result.getExternalIndexCode());
@@ -120,7 +117,6 @@
        stats.totalSites++;
        if (ApiConstants.HK_SnapCount_ResultType_Null != result.getResultType()) {
            stats.onlineSites++;
        } else {
            stats.totalDataSum += result.getDataCount();
        }
    }
@@ -141,7 +137,7 @@
            return null;
        }
        //调用点位在线计算方法
        if (stats.totalSites >= ApiConstants.Check_Face_SiteOnline) {
        if (stats.totalSites >= CheckThreadConstants.Check_Face_SiteOnline) {
            Map<String, Object> siteOnlineParam = new HashMap<>();
            siteOnlineParam.put("totalSites", stats.totalSites);
            siteOnlineParam.put("onlineSites", stats.onlineSites);
@@ -152,7 +148,7 @@
        }
        //视图库对接稳定性
        //Redis记录该区县当月无数据上传次数
        Integer noDateCount = (Integer) redisTemplate.opsForHash().get(ApiConstants.Check_Face_ViewConnect, key);
        Integer noDateCount = (Integer) redisTemplate.opsForHash().get(RedisConstant.Check_Face_ViewConnect, key);
        // 如果值为null,则初始化为0
        if (noDateCount == null) {
            noDateCount = 0;
@@ -170,7 +166,7 @@
            noDateCount++;
        }
        // 将新的值放回Hash中
        redisTemplate.opsForHash().put(ApiConstants.Check_Face_ViewConnect, key, noDateCount);
        redisTemplate.opsForHash().put(RedisConstant.Check_Face_ViewConnect, key, noDateCount);
        return checkIndexFace;
    }
}