| | |
| | | import constant.CheckConstants; |
| | | import lombok.Data; |
| | | import org.springframework.lang.NonNull; |
| | | import utils.StringUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Data |
| | | @TableName("t_check_index_car") |
| | | public class CheckIndexCar extends CheckIndex |
| | | { |
| | | public class CheckIndexCar extends CheckIndex { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 视图库对接稳定性 */ |
| | | /** |
| | | * 视图库对接稳定性 |
| | | */ |
| | | @TableField("view_connect_stability") |
| | | private BigDecimal viewConnectStability; |
| | | |
| | | /** 点位在线率 */ |
| | | /** |
| | | * 点位在线率 |
| | | */ |
| | | @TableField("site_online") |
| | | private BigDecimal siteOnline; |
| | | |
| | | /** 联网卡口设备目录一致率 */ |
| | | /** |
| | | * 联网卡口设备目录一致率 |
| | | */ |
| | | @TableField("device_directory_consistent") |
| | | private BigDecimal deviceDirectoryConsistent; |
| | | |
| | | /** 车辆卡口信息采集准确率 */ |
| | | /** |
| | | * 车辆卡口信息采集准确率 |
| | | */ |
| | | @TableField("vehicle_information_collection_accuracy") |
| | | private BigDecimal vehicleInformationCollectionAccuracy; |
| | | |
| | | /** 车辆卡口设备抓拍数据完整性 */ |
| | | /** |
| | | * 车辆卡口设备抓拍数据完整性 |
| | | */ |
| | | @TableField("vehicle_capture_integrity") |
| | | private BigDecimal vehicleCaptureIntegrity; |
| | | |
| | | /** 车辆卡口设备抓拍数据准确性 */ |
| | | /** |
| | | * 车辆卡口设备抓拍数据准确性 |
| | | */ |
| | | @TableField("vehicle_capture_accuracy") |
| | | private BigDecimal vehicleCaptureAccuracy; |
| | | |
| | | /** 车辆卡口设备时钟准确性 */ |
| | | /** |
| | | * 车辆卡口设备时钟准确性 |
| | | */ |
| | | @TableField("vehicle_timing_accuracy") |
| | | private BigDecimal vehicleTimingAccuracy; |
| | | |
| | | /** 车辆卡口设备抓拍数据上传及时性 */ |
| | | /** |
| | | * 车辆卡口设备抓拍数据上传及时性 |
| | | */ |
| | | @TableField("vehicle_upload_timeliness") |
| | | private BigDecimal vehicleUploadTimeliness; |
| | | |
| | | /** 车辆卡口设备url可用性 */ |
| | | /** |
| | | * 车辆卡口设备url可用性 |
| | | */ |
| | | @TableField("vehicle_url_availability") |
| | | private BigDecimal vehicleUrlAvailability; |
| | | |
| | | /** 车辆卡口设备抓拍数据大图可用性 */ |
| | | /** |
| | | * 车辆卡口设备抓拍数据大图可用性 |
| | | */ |
| | | @TableField("vehicle_picture_availability") |
| | | private BigDecimal vehiclePictureAvailability; |
| | | |
| | |
| | | //转换成字符串用于excel导出 |
| | | public static CheckIndexCarVO getExcelVo(@NonNull CheckIndexCar checkIndexCar) { |
| | | CheckIndexCarVO checkIndexCarVo = new CheckIndexCarVO(); |
| | | checkIndexCarVo.setScore(checkIndexCar.getScore()); |
| | | checkIndexCarVo.setDeptName(checkIndexCar.getDeptName()); |
| | | checkIndexCarVo.setCreateTime(checkIndexCar.getCreateTime()); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | //避免合计行报错(合计数据 缺少createTimeStr字段 直接将createTimeStr设置为"合计") |
| | | if (StringUtils.isEmpty(checkIndexCar.getCreateTimeStr())) { |
| | | checkIndexCarVo.setCreateTimeStr(format.format(checkIndexCar.getCreateTime())); |
| | | }else { |
| | | checkIndexCarVo.setCreateTimeStr(checkIndexCar.getCreateTimeStr()); |
| | | } |
| | | checkIndexCarVo.setExamineTagStr(CheckConstants.Examine_Tag_Province.equals(checkIndexCar.getExamineTag()) ? "省厅考核" : "区县考核"); |
| | | checkIndexCarVo.setSiteOnlineText(checkIndexCar.getSiteOnline().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)+"%"); |
| | | checkIndexCarVo.setVehicleCaptureAccuracyText(checkIndexCar.getVehicleCaptureAccuracy().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)+"%"); |
| | |
| | | checkIndexCarVo.setVehicleInformationCollectionAccuracyText(checkIndexCar.getVehicleInformationCollectionAccuracy().multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)+"%"); |
| | | return checkIndexCarVo; |
| | | } |
| | | |
| | | /** |
| | | * 导出时用于计算平均值 |
| | | */ |
| | | public static CheckIndexCar calculateAverage(List<CheckIndexCar> checkIndexCars) { |
| | | BigDecimal scoreSum = BigDecimal.ZERO; |
| | | BigDecimal viewConnectStabilitySum = BigDecimal.ZERO; |
| | | BigDecimal siteOnlineSum = BigDecimal.ZERO; |
| | | BigDecimal deviceDirectoryConsistentSum = BigDecimal.ZERO; |
| | | BigDecimal vehicleInformationCollectionAccuracySum = BigDecimal.ZERO; |
| | | BigDecimal vehicleCaptureIntegritySum = BigDecimal.ZERO; |
| | | BigDecimal vehicleCaptureAccuracySum = BigDecimal.ZERO; |
| | | BigDecimal vehicleTimingAccuracySum = BigDecimal.ZERO; |
| | | BigDecimal vehicleUploadTimelinessSum = BigDecimal.ZERO; |
| | | BigDecimal vehicleUrlAvailabilitySum = BigDecimal.ZERO; |
| | | BigDecimal vehiclePictureAvailabilitySum = BigDecimal.ZERO; |
| | | for (CheckIndexCar car : checkIndexCars) { |
| | | scoreSum = scoreSum.add(car.getScore() == null ? BigDecimal.ZERO : car.getScore()); |
| | | viewConnectStabilitySum = viewConnectStabilitySum.add(car.getViewConnectStability()); |
| | | siteOnlineSum = siteOnlineSum.add(car.getSiteOnline()); |
| | | deviceDirectoryConsistentSum = deviceDirectoryConsistentSum.add(car.getDeviceDirectoryConsistent()); |
| | | vehicleInformationCollectionAccuracySum = vehicleInformationCollectionAccuracySum.add(car.getVehicleInformationCollectionAccuracy()); |
| | | vehicleCaptureIntegritySum = vehicleCaptureIntegritySum.add(car.getVehicleCaptureIntegrity()); |
| | | vehicleCaptureAccuracySum = vehicleCaptureAccuracySum.add(car.getVehicleCaptureAccuracy()); |
| | | vehicleTimingAccuracySum = vehicleTimingAccuracySum.add(car.getVehicleTimingAccuracy()); |
| | | vehicleUploadTimelinessSum = vehicleUploadTimelinessSum.add(car.getVehicleUploadTimeliness()); |
| | | vehicleUrlAvailabilitySum = vehicleUrlAvailabilitySum.add(car.getVehicleUrlAvailability()); |
| | | vehiclePictureAvailabilitySum = vehiclePictureAvailabilitySum.add(car.getVehiclePictureAvailability()); |
| | | } |
| | | CheckIndexCar checkIndexCar = new CheckIndexCar(); |
| | | checkIndexCar.setCreateTimeStr("合计"); |
| | | checkIndexCar.setDeptName(checkIndexCars.get(0).getDeptName()); |
| | | checkIndexCar.setExamineTag(checkIndexCars.get(0).getExamineTag()); |
| | | checkIndexCar.setScore(scoreSum); |
| | | checkIndexCar.setViewConnectStability(viewConnectStabilitySum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP)); |
| | | checkIndexCar.setSiteOnline(siteOnlineSum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP)); |
| | | checkIndexCar.setDeviceDirectoryConsistent(deviceDirectoryConsistentSum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP)); |
| | | checkIndexCar.setVehicleInformationCollectionAccuracy(vehicleInformationCollectionAccuracySum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP)); |
| | | checkIndexCar.setVehicleCaptureIntegrity(vehicleCaptureIntegritySum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP)); |
| | | checkIndexCar.setVehicleCaptureAccuracy(vehicleCaptureAccuracySum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP)); |
| | | checkIndexCar.setVehicleTimingAccuracy(vehicleTimingAccuracySum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP)); |
| | | checkIndexCar.setVehicleUploadTimeliness(vehicleUploadTimelinessSum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP)); |
| | | checkIndexCar.setVehicleUrlAvailability(vehicleUrlAvailabilitySum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP)); |
| | | checkIndexCar.setVehiclePictureAvailability(vehiclePictureAvailabilitySum.divide(new BigDecimal(checkIndexCars.size()), 2, RoundingMode.HALF_UP)); |
| | | return checkIndexCar; |
| | | } |
| | | } |