| | |
| | | package com.ycl.calculate; |
| | | |
| | | 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.DataIntegrityMonitoringResult; |
| | | import com.ycl.platform.domain.result.HK.VehicleDeviceSamplingResult; |
| | | 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 constant.ApiConstants; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 计算车辆属性识别准确率、url可用性、大图可用性 |
| | | * 计算车辆抓拍数据准确性、url可用性、大图可用性 |
| | | * 车辆数据抽检接口 |
| | | * 获取分省厅、区域的map<k,v> k为deptId或者Province_deptId |
| | | * 更新或新增 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class CarDeviceSampleCalculation extends IndexCalculationServe implements CalculationStrategy<VehicleDeviceSamplingResult> { |
| | | @Autowired |
| | | private CheckIndexCarMapper checkIndexCarMapper; |
| | |
| | | @Override |
| | | public void calculate(List<VehicleDeviceSamplingResult> list) { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | log.info("数据为空"); |
| | | return; |
| | | } |
| | | //返回以国标码为key的设备map |
| | |
| | | |
| | | // 处理省厅数据 |
| | | if (!CollectionUtils.isEmpty(provinceIds) && provinceIds.contains(monitor.getSerialNumber())) { |
| | | String provinceKey = "Province_" + deptId; |
| | | String provinceKey = ApiConstants.Province + deptId; |
| | | updateAreaStats(areaStatsMap, provinceKey, result, importantIds); |
| | | } |
| | | } |
| | |
| | | stats.accuracySites++; |
| | | } |
| | | //重点点位为六项属性 |
| | | if (importantIds.contains(key)) { |
| | | if (importantIds.contains(result.getExternalIndexCode())) { |
| | | stats.importantTotalSites++; |
| | | if (vehDiff.getImportantConPercent() >= 0.9) { |
| | | stats.importantAccuracySites++; |
| | |
| | | if (bigUseful.getBigUsefulPercent() >= 0.9) { |
| | | stats.picUsabilitySites++; |
| | | } |
| | | //图片访问正常量 = 抽检量-异常量 |
| | | BigDecimal picNormalCount = new BigDecimal(bigUseful.getSampleCount() - bigUseful.getBigPicExpCount()); |
| | | //图片抽检量 |
| | | BigDecimal sampleCount = new BigDecimal(bigUseful.getSampleCount()); |
| | | //图片访问率>=90% 视为合格 |
| | | if (picNormalCount.divide(sampleCount, 4, RoundingMode.HALF_UP).compareTo(new BigDecimal("0.9")) >= 0) { |
| | | stats.urlUsabilitySites++; |
| | | if (bigUseful.getSampleCount() != 0) { |
| | | //图片访问正常量 = 抽检量-异常量 |
| | | BigDecimal picNormalCount = new BigDecimal(bigUseful.getSampleCount() - bigUseful.getBigPicExpCount()); |
| | | //图片抽检量 |
| | | BigDecimal sampleCount = new BigDecimal(bigUseful.getSampleCount()); |
| | | //图片访问率>=90% 视为合格 |
| | | if (picNormalCount.divide(sampleCount, 4, RoundingMode.HALF_UP).compareTo(new BigDecimal("0.9")) >= 0) { |
| | | stats.urlUsabilitySites++; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | checkIndexCar.setVehicleUrlAvailability(urlUsability); |
| | | //调用大图可用性计算方法 |
| | | Map<String, Object> usabilityParam = new HashMap<>(); |
| | | urlParam.put("totalSites", stats.totalSites); |
| | | urlParam.put("picUsabilitySites", stats.picUsabilitySites); |
| | | usabilityParam.put("totalSites", stats.totalSites); |
| | | usabilityParam.put("picUsabilitySites", stats.picUsabilitySites); |
| | | BigDecimal picUsability = picUsability(usabilityParam); |
| | | checkIndexCar.setVehiclePictureAvailability(picUsability); |
| | | return checkIndexCar; |