fuliqi
2024-08-16 2a12d6d43b6f7abc0ef594ee9b992f34ee00b7a1
ycl-server/src/main/java/com/ycl/calculate/CarSnapshopDataCalculation.java
@@ -3,8 +3,11 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ycl.platform.domain.entity.CheckIndexCar;
import com.ycl.platform.domain.entity.TMonitor;
import com.ycl.platform.domain.result.HK.CrossDetailResult;
import com.ycl.platform.domain.result.HK.SnapshotDataMonitorResult;
import com.ycl.platform.domain.vo.TMonitorVO;
import com.ycl.platform.mapper.CheckIndexCarMapper;
import com.ycl.platform.mapper.TMonitorMapper;
import com.ycl.platform.service.ICheckIndexCarService;
import com.ycl.platform.service.ITMonitorService;
import com.ycl.system.mapper.SysConfigMapper;
@@ -37,7 +40,7 @@
    @Autowired
    private SysConfigMapper sysConfigMapper;
    @Autowired
    private ITMonitorService monitorService;
    private TMonitorMapper monitorMapper;
    @Autowired
    private ICheckIndexCarService checkIndexCarService;
@@ -55,15 +58,14 @@
        }
        //获得国标码为key的设备map
        Map<String, TMonitor> monitorMap = monitorService.list(new QueryWrapper<TMonitor>()
                        .in("serial_number", list.stream().map(SnapshotDataMonitorResult::getExternalIndexCode).collect(Collectors.toList())))
                .stream().collect(Collectors.toMap(TMonitor::getSerialNumber, Function.identity()));
        Map<String, TMonitorVO> monitorMap = monitorMapper.selectListByIds(list.stream().map(SnapshotDataMonitorResult::getExternalIndexCode).collect(Collectors.toList()))
                .stream().collect(Collectors.toMap(TMonitorVO::getSerialNumber, Function.identity()));
        //获取省厅国标码集合
        List<String> provinceIds = getProvince();
        Map<String, AreaStats> areaStatsMap = new HashMap<>();
        for (SnapshotDataMonitorResult result : list) {
            TMonitor monitor = monitorMap.get(result.getExternalIndexCode());
            TMonitorVO monitor = monitorMap.get(result.getExternalIndexCode());
            if (monitor == null) continue;
            String deptId = monitor.getDeptId().toString();
@@ -71,14 +73,14 @@
            // 处理省厅数据
            if (!CollectionUtils.isEmpty(provinceIds) && provinceIds.contains(monitor.getSerialNumber())) {
                String provinceKey = "Province_" + deptId;
                String provinceKey = ApiConstants.Province + deptId;
                updateAreaStats(areaStatsMap, provinceKey, result);
            }
        }
        //获取2022同期抓拍平均值 省厅、市局
        BigDecimal cityCountAvg = getAverageCount(CheckSnapCountConstants.City);
        BigDecimal countyCountAvg = getAverageCount(CheckSnapCountConstants.County);
        BigDecimal cityCountAvg = getAverageCount(CheckSnapCountConstants.Car_City);
        BigDecimal countyCountAvg = getAverageCount(CheckSnapCountConstants.Car_County);
        // 查询是否index表已经存在今日数据
        List<CheckIndexCar> checkIndexCarList = checkIndexCarMapper.selectToday(DateUtils.getDate());
@@ -135,7 +137,7 @@
        BigDecimal siteOnline = siteOnline(siteOnlineParam);
        checkIndexCar.setSiteOnline(siteOnline);
        //视图库对接稳定性
        BigDecimal avgCount = key.startsWith("Province_") ? cityCountAvg : countyCountAvg;
        BigDecimal avgCount = key.startsWith(ApiConstants.Province) ? cityCountAvg : countyCountAvg;
        Map<String, Object> viewConnectParam = new HashMap<>();
        viewConnectParam.put("totalDataSum", stats.totalDataSum);
        viewConnectParam.put("avgCount", avgCount);