| | |
| | | import com.mongodb.client.AggregateIterable; |
| | | import com.mongodb.client.MongoCollection; |
| | | import com.mongodb.client.MongoDatabase; |
| | | import com.ycl.platform.domain.entity.CheckIndexVideo; |
| | | import com.ycl.platform.domain.entity.ImageResourceSecurityDetail; |
| | | import com.ycl.platform.domain.entity.YwPoint; |
| | | import com.ycl.platform.domain.entity.*; |
| | | import com.ycl.platform.domain.query.DataCenterQuery; |
| | | import com.ycl.platform.domain.result.HK.*; |
| | | import com.ycl.platform.domain.result.UY.*; |
| | | import com.ycl.platform.mapper.ImageResourceSecurityDetailMapper; |
| | | import com.ycl.platform.mapper.YwPointMapper; |
| | | import com.ycl.platform.service.DataCenterService; |
| | | import com.ycl.platform.service.ICheckIndexCarService; |
| | | import com.ycl.platform.service.ICheckIndexVideoService; |
| | | import com.ycl.platform.service.YwPointService; |
| | | import com.ycl.platform.service.*; |
| | | import com.ycl.system.Result; |
| | | import com.ycl.system.page.PageUtil; |
| | | import com.ycl.utils.DateUtils; |
| | |
| | | private final ImageResourceSecurityDetailMapper securityDetailMapper; |
| | | private final YwPointMapper pointMapper; |
| | | private final ICheckIndexVideoService checkIndexVideoService; |
| | | private final ICheckIndexCarService checkIndexCarService; |
| | | private final ICheckIndexFaceService checkIndexFaceService; |
| | | |
| | | |
| | | private final static String TIME_FIELD = "mongoCreateTime"; |
| | |
| | | public Result videoPointOnlineRate(DataCenterQuery params) { |
| | | // 生成查询 |
| | | List<String> likeFileds = Arrays.asList("arealayerName", "ipAddr", "deviceName", "deviceId"); |
| | | Query query = MongoUtil.getQuery(params, "deviceId", TIME_FIELD, likeFileds, null); |
| | | Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null); |
| | | |
| | | // 先查总数再分页 |
| | | long total = mongoTemplate.count(query, VideoOnlineResult.class); |
| | |
| | | */ |
| | | @Override |
| | | public Result deptVideoPointOnlineRate(DataCenterQuery params) { |
| | | // 先查出部级点位的国标 |
| | | List<String> deptGBList = pointMapper.getDeptPointGB(0); |
| | | |
| | | List<String> likeFileds = Arrays.asList("arealayerName", "ipAddr", "deviceName", "deviceId"); |
| | | // 生成查询 |
| | | Query query = MongoUtil.getQuery(params, "deviceId", TIME_FIELD, likeFileds, deptGBList); |
| | | Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, 1); |
| | | |
| | | // 先查总数再分页 |
| | | long total = mongoTemplate.count(query, VideoOnlineResult.class); |
| | |
| | | // 统计数量 |
| | | MongoDatabase database = mongoTemplate.getDb(); |
| | | MongoCollection<Document> collection = database.getCollection("uy_online"); |
| | | Document filter = new Document("deviceId", new Document("$in", deptGBList)); |
| | | Document filter = new Document("deptTag", new Document("$eq", Boolean.TRUE)); |
| | | // 构建聚合管道 |
| | | List<Document> pipeline = Arrays.asList( |
| | | // 只要部级的 |
| | |
| | | */ |
| | | @Override |
| | | public Result videoImportantPointOnlineRate(DataCenterQuery params) { |
| | | // 先查出重点点位的国标 |
| | | List<String> deptGBList = pointMapper.getDeptPointGB(1); |
| | | List<String> likeFileds = Arrays.asList("arealayerName", "ipAddr", "deviceName", "deviceId"); |
| | | Query query = MongoUtil.getQuery(params, "deviceId", TIME_FIELD, likeFileds, deptGBList); |
| | | Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, 3); |
| | | |
| | | long total = mongoTemplate.count(query, VideoOnlineResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | |
| | | // 统计数量 |
| | | MongoDatabase database = mongoTemplate.getDb(); |
| | | MongoCollection<Document> collection = database.getCollection("uy_online"); |
| | | Document filter = new Document("deviceId", new Document("$in", deptGBList)); |
| | | Document filter = new Document("importantTag", new Document("$eq", Boolean.TRUE)); |
| | | // 构建聚合管道 |
| | | List<Document> pipeline = Arrays.asList( |
| | | new Document("$match", filter), |
| | |
| | | */ |
| | | @Override |
| | | public Result videoImportantPointImageOnlineRate(DataCenterQuery params) { |
| | | // 先查出重点指挥图像点位的国标 |
| | | List<String> deptGBList = pointMapper.getDeptPointGB(2); |
| | | List<String> likeFileds = Arrays.asList("arealayerName", "ipAddr", "deviceName", "deviceId"); |
| | | Query query = MongoUtil.getQuery(params, "deviceId", TIME_FIELD, likeFileds, deptGBList); |
| | | Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, 4); |
| | | |
| | | long total = mongoTemplate.count(query, VideoOnlineResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | |
| | | // 统计数量 |
| | | MongoDatabase database = mongoTemplate.getDb(); |
| | | MongoCollection<Document> collection = database.getCollection("uy_online"); |
| | | Document filter = new Document("deviceId", new Document("$in", deptGBList)); |
| | | Document filter = new Document("importantCommandImageTag", new Document("$eq", Boolean.TRUE)); |
| | | // 构建聚合管道 |
| | | List<Document> pipeline = Arrays.asList( |
| | | new Document("$match", filter), |
| | |
| | | @Override |
| | | public Result videoOneMachineDocumentRegister(DataCenterQuery params) { |
| | | List<String> likeFileds = Arrays.asList("ip.showValue", "name.showValue", "serialNumber.showValue"); |
| | | Query query = MongoUtil.getQuery(params, "serialNumber.showValue", TIME_FIELD, likeFileds, null); |
| | | Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null); |
| | | |
| | | long total = mongoTemplate.count(query, MonitorQualifyResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | |
| | | @Override |
| | | public Result videoOneMachineDocumentQualified(DataCenterQuery params) { |
| | | List<String> likeFileds = Arrays.asList("ip.showValue", "name.showValue", "serialNumber.showValue"); |
| | | Query query = MongoUtil.getQuery(params, "serialNumber.showValue", TIME_FIELD, likeFileds, null); |
| | | Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null); |
| | | |
| | | long total = mongoTemplate.count(query, MonitorQualifyResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | |
| | | public Result videoAssessmentFileRatio(DataCenterQuery params) { |
| | | // TODO 新增一张表记录每次的档案考核 |
| | | List<String> likeFileds = Arrays.asList("ip.showValue", "name.showValue", "serialNumber.showValue"); |
| | | Query query = MongoUtil.getQuery(params, "serialNumber.showValue", TIME_FIELD, likeFileds, null); |
| | | Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null); |
| | | |
| | | long total = mongoTemplate.count(query, MonitorQualifyResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | |
| | | @Override |
| | | public Result videoAvailabilityRate(DataCenterQuery params) { |
| | | List<String> likeFileds = Arrays.asList("deviceId", "deviceName"); |
| | | Query query = MongoUtil.getQuery(params, "deviceId", "createTime", likeFileds, null); |
| | | Query query = MongoUtil.getQuery(params,"createTime", likeFileds, null); |
| | | |
| | | long total = mongoTemplate.count(query, RecordMetaDSumResult.class); |
| | | MongoUtil.setPage(query, params, "createTime"); |
| | |
| | | */ |
| | | @Override |
| | | public Result deptVideoAvailabilityRate(DataCenterQuery params) { |
| | | |
| | | List<String> deptGBList = pointMapper.getDeptPointGB(0); |
| | | List<String> likeFileds = Arrays.asList("deviceId", "deviceName"); |
| | | Query query = MongoUtil.getQuery(params, "deviceId", "createTime", likeFileds, deptGBList); |
| | | Query query = MongoUtil.getQuery(params,"createTime", likeFileds, 1); |
| | | |
| | | long total = mongoTemplate.count(query, RecordMetaDSumResult.class); |
| | | MongoUtil.setPage(query, params, "createTime"); |
| | |
| | | List<Integer> status = Arrays.asList(1, 0, -1); |
| | | List<String> resultCount = status.stream().map(item -> { |
| | | Document filter = new Document("$and", Arrays.asList( |
| | | new Document("deviceId", new Document("$in", deptGBList)), // $in 条件 |
| | | new Document("deptTag", new Document("$eq", Boolean.TRUE)), |
| | | new Document("recordStatus", item) |
| | | )); |
| | | // 构建聚合管道 |
| | |
| | | */ |
| | | @Override |
| | | public Result videoImportantPointAvailabilityRate(DataCenterQuery params) { |
| | | |
| | | List<String> deptGBList = pointMapper.getDeptPointGB(1); |
| | | List<String> likeFileds = Arrays.asList("deviceId", "deviceName"); |
| | | Query query = MongoUtil.getQuery(params, "deviceId", "createTime", likeFileds, deptGBList); |
| | | Query query = MongoUtil.getQuery(params,"createTime", likeFileds, 3); |
| | | |
| | | long total = mongoTemplate.count(query, RecordMetaDSumResult.class); |
| | | MongoUtil.setPage(query, params, "createTime"); |
| | |
| | | List<Integer> status = Arrays.asList(1, 0, -1); |
| | | List<String> resultCount = status.stream().map(item -> { |
| | | Document filter = new Document("$and", Arrays.asList( |
| | | new Document("deviceId", new Document("$in", deptGBList)), // $in 条件 |
| | | new Document("importantTag", new Document("$eq", Boolean.TRUE)), |
| | | new Document("recordStatus", item) |
| | | )); |
| | | // 构建聚合管道 |
| | |
| | | @Override |
| | | public Result videoLabelingAccuracy(DataCenterQuery params) { |
| | | List<String> likeFileds = Arrays.asList("deviceId", "deviceName"); |
| | | Query query = MongoUtil.getQuery(params, "deviceId", TIME_FIELD, likeFileds, null); |
| | | Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null); |
| | | |
| | | long total = mongoTemplate.count(query, RecordMetaDSumResult.class); |
| | | List<RecordMetaDSumResult> resultList = mongoTemplate.find(query, RecordMetaDSumResult.class); |
| | |
| | | */ |
| | | @Override |
| | | public Result videoImportantPointLabelingAccuracy(DataCenterQuery params) { |
| | | |
| | | List<String> deptGBList = pointMapper.getDeptPointGB(1); |
| | | List<String> likeFileds = Arrays.asList("deviceNo", "osdName"); |
| | | Query query = MongoUtil.getQuery(params, "deviceNo", "checkTime", likeFileds, deptGBList); |
| | | Query query = MongoUtil.getQuery(params,"checkTime", likeFileds, 3); |
| | | |
| | | long total = mongoTemplate.count(query, OsdCheckResult.class); |
| | | MongoUtil.setPage(query, params, "checkTime"); |
| | |
| | | MongoDatabase database = mongoTemplate.getDb(); |
| | | MongoCollection<Document> collection = database.getCollection("osd_check_result"); |
| | | |
| | | Document osdNameFilter = new Document("osdNameCorrect", 1); |
| | | Document osdNameErrFilter = new Document("osdNameCorrect", -1); |
| | | Document osdTimeFilter = new Document("osdTimeCorrect", 1); |
| | | Document osdTimeErrFilter = new Document("osdTimeCorrect", -1); |
| | | Document importantTag = new Document("importantTag", Boolean.TRUE); |
| | | Document osdNameFilter = new Document("$and", Arrays.asList(new Document("osdNameCorrect", 1), importantTag)); |
| | | Document osdNameErrFilter = new Document("$and", Arrays.asList(new Document("osdNameCorrect", -1), importantTag)); |
| | | Document osdTimeFilter = new Document("$and", Arrays.asList(new Document("osdTimeCorrect", 1), importantTag)); |
| | | Document osdTimeErrFilter = new Document("$and", Arrays.asList(new Document("osdTimeCorrect", -1), importantTag)); |
| | | List<Document> lists = Arrays.asList(osdNameFilter, osdNameErrFilter, osdTimeFilter, osdTimeErrFilter); |
| | | List<String> rList = lists.stream().map(filter -> { |
| | | // 构建聚合管道 |
| | |
| | | public Result videoCheckTimeAccuracy(DataCenterQuery params) { |
| | | |
| | | List<String> likeFileds = Arrays.asList("deviceId"); |
| | | Query query = MongoUtil.getQuery(params, "deviceId", TIME_FIELD, likeFileds, null); |
| | | Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null); |
| | | |
| | | long total = mongoTemplate.count(query, OneMachineFileResult.class); |
| | | List<OneMachineFileResult> resultList = mongoTemplate.find(query, OneMachineFileResult.class); |
| | |
| | | @Override |
| | | public Result videoImportantPointCheckTimeAccuracy(DataCenterQuery params) { |
| | | |
| | | List<String> deptGBList = pointMapper.getDeptPointGB(1); |
| | | List<String> likeFileds = Arrays.asList("deviceNo", "osdName"); |
| | | Query query = MongoUtil.getQuery(params, "deviceNo", "checkTime", likeFileds, deptGBList); |
| | | Query query = MongoUtil.getQuery(params,"checkTime", likeFileds, 3); |
| | | |
| | | long total = mongoTemplate.count(query, OsdCheckResult.class); |
| | | MongoUtil.setPage(query, params, "checkTime"); |
| | |
| | | MongoDatabase database = mongoTemplate.getDb(); |
| | | MongoCollection<Document> collection = database.getCollection("osd_check_result"); |
| | | |
| | | Document osdTimeFilter = new Document("osdTimeCorrect", 1); |
| | | Document osdTimeErrFilter = new Document("osdTimeCorrect", -1); |
| | | Document importantTag = new Document("importantTag", Boolean.TRUE); |
| | | Document osdTimeFilter = new Document("$and", Arrays.asList(new Document("osdTimeCorrect", 1), importantTag)); |
| | | Document osdTimeErrFilter = new Document("$and", Arrays.asList(new Document("osdTimeCorrect", -1), importantTag)); |
| | | List<Document> lists = Arrays.asList(osdTimeFilter, osdTimeErrFilter); |
| | | List<String> rList = lists.stream().map(filter -> { |
| | | // 构建聚合管道 |
| | |
| | | @Override |
| | | public Result vehicleViewDockStable(DataCenterQuery params) { |
| | | List<String> likeFileds = Arrays.asList("externalIndexCode", "deviceName"); |
| | | Query query = MongoUtil.getQuery(params, "externalIndexCode", TIME_FIELD, likeFileds, null); |
| | | Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null); |
| | | |
| | | long total = mongoTemplate.count(query, SnapshotDataMonitorResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | |
| | | Document trFilter = new Document("resultType", 3); |
| | | Document littleFilter = new Document("resultType", 4); |
| | | List<Document> lists = Arrays.asList(normalFilter, noDataFilter, trFilter, littleFilter); |
| | | List<Integer> rList = lists.stream().map(filter -> { |
| | | List<String> rList = lists.stream().map(filter -> { |
| | | // 构建聚合管道 |
| | | List<Document> pipeline = Arrays.asList( |
| | | new Document("$match", filter), |
| | |
| | | uniqueDeviceIdCount = doc.getInteger("uniqueDeviceIds"); |
| | | break; // 不需要继续遍历,因为 $count 只会产生一个结果 |
| | | } |
| | | return uniqueDeviceIdCount; |
| | | return uniqueDeviceIdCount + ""; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | Date now = new Date(); |
| | | List<CheckIndexCar> videoList = new LambdaQueryChainWrapper<>(checkIndexCarService.getBaseMapper()) |
| | | .select(CheckIndexCar::getViewConnectStability) |
| | | .between(CheckIndexCar::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now)) |
| | | .list(); |
| | | BigDecimal onlineRate = BigDecimal.ZERO; |
| | | if (CollectionUtils.isNotEmpty(videoList)) { |
| | | BigDecimal sum = videoList.stream().map(CheckIndexCar::getViewConnectStability).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal count = BigDecimal.valueOf(videoList.size()); |
| | | onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); |
| | | } |
| | | rList.add(onlineRate + "%"); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("count", rList); |
| | | map.put("list", resultList); |
| | |
| | | @Override |
| | | public Result vehiclePointOnlineRate(DataCenterQuery params) { |
| | | List<String> likeFileds = Arrays.asList("externalIndexCode", "deviceName"); |
| | | Query query = MongoUtil.getQuery(params, "externalIndexCode", TIME_FIELD, likeFileds, null); |
| | | Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null); |
| | | |
| | | long total = mongoTemplate.count(query, SnapshotDataMonitorResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | |
| | | MongoCollection<Document> collection = database.getCollection("hk_snapshot_data_monitor"); |
| | | long distinctCount = collection.distinct("externalIndexCode", String.class).into(new ArrayList<>()).size(); |
| | | |
| | | Date now = new Date(); |
| | | List<CheckIndexCar> videoList = new LambdaQueryChainWrapper<>(checkIndexCarService.getBaseMapper()) |
| | | .select(CheckIndexCar::getSiteOnline) |
| | | .between(CheckIndexCar::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now)) |
| | | .list(); |
| | | BigDecimal onlineRate = BigDecimal.ZERO; |
| | | if (CollectionUtils.isNotEmpty(videoList)) { |
| | | BigDecimal sum = videoList.stream().map(CheckIndexCar::getSiteOnline).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal count = BigDecimal.valueOf(videoList.size()); |
| | | onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); |
| | | } |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("count", Arrays.asList(distinctCount)); |
| | | map.put("count", Arrays.asList(distinctCount + "%", onlineRate + "%")); |
| | | map.put("list", resultList); |
| | | return Result.ok().data(map).total(total); |
| | | } |
| | |
| | | @Override |
| | | public Result vehicleNetDeviceDirectoryConsistency(DataCenterQuery params) { |
| | | List<String> likeFileds = Arrays.asList("ip.showValue", "name.showValue", "serialNumber.showValue"); |
| | | Query query = MongoUtil.getQuery(params, "externalIndexCode", TIME_FIELD, likeFileds, null); |
| | | Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null); |
| | | |
| | | long total = mongoTemplate.count(query, MonitorQualifyResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | |
| | | Document longitudeErrFilter = new Document("longitude.error", true); |
| | | |
| | | List<Document> lists = Arrays.asList(ipErrFilter, macdzErrFilter, latitudeErrFilter, longitudeErrFilter); |
| | | List<Integer> rList = lists.stream().map(filter -> { |
| | | List<String> rList = lists.stream().map(filter -> { |
| | | // 构建聚合管道 |
| | | List<Document> pipeline = Arrays.asList( |
| | | new Document("$match", filter), |
| | |
| | | uniqueDeviceIdCount = doc.getInteger("uniqueDeviceIds"); |
| | | break; // 不需要继续遍历,因为 $count 只会产生一个结果 |
| | | } |
| | | return uniqueDeviceIdCount; |
| | | return uniqueDeviceIdCount + "%"; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | Date now = new Date(); |
| | | List<CheckIndexCar> videoList = new LambdaQueryChainWrapper<>(checkIndexCarService.getBaseMapper()) |
| | | .select(CheckIndexCar::getDeviceDirectoryConsistent) |
| | | .between(CheckIndexCar::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now)) |
| | | .list(); |
| | | BigDecimal onlineRate = BigDecimal.ZERO; |
| | | if (CollectionUtils.isNotEmpty(videoList)) { |
| | | BigDecimal sum = videoList.stream().map(CheckIndexCar::getDeviceDirectoryConsistent).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal count = BigDecimal.valueOf(videoList.size()); |
| | | onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); |
| | | } |
| | | rList.add(onlineRate + "%"); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("count", rList); |
| | | map.put("list", resultList); |
| | |
| | | @Override |
| | | public Result vehicleCollectionConsistency(DataCenterQuery params) { |
| | | List<String> likeFileds = Arrays.asList("externalIndexCode", "crossName"); |
| | | Query query = MongoUtil.getQuery(params, "externalIndexCode", TIME_FIELD, likeFileds, null); |
| | | Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null); |
| | | |
| | | long total = mongoTemplate.count(query, CrossDetailResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | |
| | | Document longitudeErrFilter = new Document("lalType", 4); |
| | | |
| | | List<Document> lists = Arrays.asList(ipErrFilter, macdzErrFilter, latitudeErrFilter, longitudeErrFilter); |
| | | List<Integer> rList = lists.stream().map(filter -> { |
| | | List<String> rList = lists.stream().map(filter -> { |
| | | // 构建聚合管道 |
| | | List<Document> pipeline = Arrays.asList( |
| | | new Document("$match", filter), |
| | |
| | | uniqueDeviceIdCount = doc.getInteger("uniqueDeviceIds"); |
| | | break; // 不需要继续遍历,因为 $count 只会产生一个结果 |
| | | } |
| | | return uniqueDeviceIdCount; |
| | | return uniqueDeviceIdCount + ""; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | Date now = new Date(); |
| | | List<CheckIndexCar> videoList = new LambdaQueryChainWrapper<>(checkIndexCarService.getBaseMapper()) |
| | | .select(CheckIndexCar::getVehicleInformationCollectionAccuracy) |
| | | .between(CheckIndexCar::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now)) |
| | | .list(); |
| | | BigDecimal onlineRate = BigDecimal.ZERO; |
| | | if (CollectionUtils.isNotEmpty(videoList)) { |
| | | BigDecimal sum = videoList.stream().map(CheckIndexCar::getVehicleInformationCollectionAccuracy).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal count = BigDecimal.valueOf(videoList.size()); |
| | | onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); |
| | | } |
| | | rList.add(onlineRate + "%"); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("count", rList); |
| | | map.put("list", resultList); |
| | |
| | | @Override |
| | | public Result vehicleCollectionDataIntegrity(DataCenterQuery params) { |
| | | List<String> likeFileds = Arrays.asList("externalIndexCode", "deviceName"); |
| | | Query query = MongoUtil.getQuery(params, "externalIndexCode", TIME_FIELD, likeFileds, null); |
| | | Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null); |
| | | |
| | | long total = mongoTemplate.count(query, DataIntegrityMonitoringResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | |
| | | MongoDatabase database = mongoTemplate.getDb(); |
| | | MongoCollection<Document> collection = database.getCollection("hk_data_integrity_monitoring"); |
| | | |
| | | Date now = new Date(); |
| | | List<CheckIndexCar> videoList = new LambdaQueryChainWrapper<>(checkIndexCarService.getBaseMapper()) |
| | | .select(CheckIndexCar::getVehicleCaptureIntegrity) |
| | | .between(CheckIndexCar::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now)) |
| | | .list(); |
| | | BigDecimal onlineRate = BigDecimal.ZERO; |
| | | if (CollectionUtils.isNotEmpty(videoList)) { |
| | | BigDecimal sum = videoList.stream().map(CheckIndexCar::getVehicleCaptureIntegrity).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal count = BigDecimal.valueOf(videoList.size()); |
| | | onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); |
| | | } |
| | | |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("count", CollectionUtils.EMPTY_COLLECTION); |
| | | map.put("count", Arrays.asList(onlineRate + "%")); |
| | | map.put("list", resultList); |
| | | return Result.ok().data(map).total(total); |
| | | } |
| | |
| | | @Override |
| | | public Result vehicleCollectionDataCaptured(DataCenterQuery params) { |
| | | List<String> likeFileds = Arrays.asList("externalIndexCode", "deviceName"); |
| | | Query query = MongoUtil.getQuery(params, "externalIndexCode", TIME_FIELD, likeFileds, null); |
| | | Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null); |
| | | |
| | | long total = mongoTemplate.count(query, AttrRecognitionMonitorResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | | List<AttrRecognitionMonitorResult> resultList = mongoTemplate.find(query, AttrRecognitionMonitorResult.class); |
| | | // 统计数 |
| | | |
| | | Date now = new Date(); |
| | | List<CheckIndexCar> videoList = new LambdaQueryChainWrapper<>(checkIndexCarService.getBaseMapper()) |
| | | .select(CheckIndexCar::getVehicleCaptureAccuracy) |
| | | .between(CheckIndexCar::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now)) |
| | | .list(); |
| | | BigDecimal onlineRate = BigDecimal.ZERO; |
| | | if (CollectionUtils.isNotEmpty(videoList)) { |
| | | BigDecimal sum = videoList.stream().map(CheckIndexCar::getVehicleCaptureAccuracy).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal count = BigDecimal.valueOf(videoList.size()); |
| | | onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); |
| | | } |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("count", CollectionUtils.EMPTY_COLLECTION); |
| | | map.put("count", Arrays.asList(onlineRate + "%")); |
| | | map.put("list", resultList); |
| | | return Result.ok().data(map).total(total); |
| | | } |
| | |
| | | @Override |
| | | public Result vehicleClockAccuracy(DataCenterQuery params) { |
| | | List<String> likeFileds = Arrays.asList("externalIndexCode", "deviceName"); |
| | | Query query = MongoUtil.getQuery(params, "externalIndexCode", TIME_FIELD, likeFileds, null); |
| | | Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null); |
| | | |
| | | long total = mongoTemplate.count(query, VehicleDeviceInspectionResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | |
| | | Document longitudeErrFilter = new Document("snapResult", 4); |
| | | |
| | | List<Document> lists = Arrays.asList(ipErrFilter, macdzErrFilter, longitudeErrFilter); |
| | | List<Integer> rList = lists.stream().map(filter -> { |
| | | List<String> rList = lists.stream().map(filter -> { |
| | | // 构建聚合管道 |
| | | List<Document> pipeline = Arrays.asList( |
| | | new Document("$match", filter), |
| | |
| | | uniqueDeviceIdCount = doc.getInteger("uniqueDeviceIds"); |
| | | break; // 不需要继续遍历,因为 $count 只会产生一个结果 |
| | | } |
| | | return uniqueDeviceIdCount; |
| | | return uniqueDeviceIdCount + ""; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | Date now = new Date(); |
| | | List<CheckIndexCar> videoList = new LambdaQueryChainWrapper<>(checkIndexCarService.getBaseMapper()) |
| | | .select(CheckIndexCar::getVehicleTimingAccuracy) |
| | | .between(CheckIndexCar::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now)) |
| | | .list(); |
| | | BigDecimal onlineRate = BigDecimal.ZERO; |
| | | if (CollectionUtils.isNotEmpty(videoList)) { |
| | | BigDecimal sum = videoList.stream().map(CheckIndexCar::getVehicleTimingAccuracy).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal count = BigDecimal.valueOf(videoList.size()); |
| | | onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); |
| | | } |
| | | rList.add(onlineRate + "%"); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("count", rList); |
| | | map.put("list", resultList); |
| | |
| | | @Override |
| | | public Result vehicleTimelyUploadAccuracy(DataCenterQuery params) { |
| | | List<String> likeFileds = Arrays.asList("externalIndexCode", "deviceName"); |
| | | Query query = MongoUtil.getQuery(params, "externalIndexCode", TIME_FIELD, likeFileds, null); |
| | | Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null); |
| | | |
| | | long total = mongoTemplate.count(query, SnapshotDelayMonitorResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | | List<SnapshotDelayMonitorResult> resultList = mongoTemplate.find(query, SnapshotDelayMonitorResult.class); |
| | | |
| | | // 统计数 |
| | | Date now = new Date(); |
| | | List<CheckIndexCar> videoList = new LambdaQueryChainWrapper<>(checkIndexCarService.getBaseMapper()) |
| | | .select(CheckIndexCar::getVehicleUploadTimeliness) |
| | | .between(CheckIndexCar::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now)) |
| | | .list(); |
| | | BigDecimal onlineRate = BigDecimal.ZERO; |
| | | if (CollectionUtils.isNotEmpty(videoList)) { |
| | | BigDecimal sum = videoList.stream().map(CheckIndexCar::getVehicleUploadTimeliness).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal count = BigDecimal.valueOf(videoList.size()); |
| | | onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); |
| | | } |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("count", CollectionUtils.EMPTY_COLLECTION); |
| | | map.put("count", Arrays.asList(onlineRate + "%")); |
| | | map.put("list", resultList); |
| | | return Result.ok().data(map).total(total); |
| | | } |
| | |
| | | @Override |
| | | public Result vehicleUrlAccuracy(DataCenterQuery params) { |
| | | List<String> likeFileds = Arrays.asList("externalIndexCode", "deviceName"); |
| | | Query query = MongoUtil.getQuery(params, "externalIndexCode", TIME_FIELD, likeFileds, null); |
| | | Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null); |
| | | |
| | | long total = mongoTemplate.count(query, PicAccessResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | | List<PicAccessResult> resultList = mongoTemplate.find(query, PicAccessResult.class); |
| | | |
| | | // 统计数 |
| | | Date now = new Date(); |
| | | List<CheckIndexCar> videoList = new LambdaQueryChainWrapper<>(checkIndexCarService.getBaseMapper()) |
| | | .select(CheckIndexCar::getVehicleUrlAvailability) |
| | | .between(CheckIndexCar::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now)) |
| | | .list(); |
| | | BigDecimal onlineRate = BigDecimal.ZERO; |
| | | if (CollectionUtils.isNotEmpty(videoList)) { |
| | | BigDecimal sum = videoList.stream().map(CheckIndexCar::getVehicleUrlAvailability).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal count = BigDecimal.valueOf(videoList.size()); |
| | | onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); |
| | | } |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("count", CollectionUtils.EMPTY_COLLECTION); |
| | | map.put("count", Arrays.asList(onlineRate + "%")); |
| | | map.put("list", resultList); |
| | | return Result.ok().data(map).total(total); |
| | | } |
| | |
| | | @Override |
| | | public Result vehicleBigImgAccuracy(DataCenterQuery params) { |
| | | List<String> likeFileds = Arrays.asList("externalIndexCode", "deviceName"); |
| | | Query query = MongoUtil.getQuery(params, "externalIndexCode", TIME_FIELD, likeFileds, null); |
| | | Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null); |
| | | |
| | | long total = mongoTemplate.count(query, VehicleDeviceSamplingResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | | List<VehicleDeviceSamplingResult> resultList = mongoTemplate.find(query, VehicleDeviceSamplingResult.class); |
| | | |
| | | // 统计数 |
| | | Date now = new Date(); |
| | | List<CheckIndexCar> videoList = new LambdaQueryChainWrapper<>(checkIndexCarService.getBaseMapper()) |
| | | .select(CheckIndexCar::getVehiclePictureAvailability) |
| | | .between(CheckIndexCar::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now)) |
| | | .list(); |
| | | BigDecimal onlineRate = BigDecimal.ZERO; |
| | | if (CollectionUtils.isNotEmpty(videoList)) { |
| | | BigDecimal sum = videoList.stream().map(CheckIndexCar::getVehiclePictureAvailability).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal count = BigDecimal.valueOf(videoList.size()); |
| | | onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); |
| | | } |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("count", CollectionUtils.EMPTY_COLLECTION); |
| | | map.put("count", Arrays.asList(onlineRate + "%")); |
| | | map.put("list", resultList); |
| | | return Result.ok().data(map).total(total); |
| | | } |
| | |
| | | @Override |
| | | public Result faceViewDockStable(DataCenterQuery params) { |
| | | List<String> likeFileds = Arrays.asList("externalIndexCode", "deviceName"); |
| | | Query query = MongoUtil.getQuery(params, "externalIndexCode", TIME_FIELD, likeFileds, null); |
| | | Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null); |
| | | |
| | | long total = mongoTemplate.count(query, SnapshotDataMonitorResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | |
| | | Document trFilter = new Document("resultType", 3); |
| | | Document littleFilter = new Document("resultType", 4); |
| | | List<Document> lists = Arrays.asList(normalFilter, noDataFilter, trFilter, littleFilter); |
| | | List<Integer> rList = lists.stream().map(filter -> { |
| | | List<String> rList = lists.stream().map(filter -> { |
| | | // 构建聚合管道 |
| | | List<Document> pipeline = Arrays.asList( |
| | | new Document("$match", filter), |
| | |
| | | uniqueDeviceIdCount = doc.getInteger("uniqueDeviceIds"); |
| | | break; // 不需要继续遍历,因为 $count 只会产生一个结果 |
| | | } |
| | | return uniqueDeviceIdCount; |
| | | return uniqueDeviceIdCount + ""; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | Date now = new Date(); |
| | | List<CheckIndexFace> videoList = new LambdaQueryChainWrapper<>(checkIndexFaceService.getBaseMapper()) |
| | | .select(CheckIndexFace::getViewConnectStability) |
| | | .between(CheckIndexFace::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now)) |
| | | .list(); |
| | | BigDecimal onlineRate = BigDecimal.ZERO; |
| | | if (CollectionUtils.isNotEmpty(videoList)) { |
| | | BigDecimal sum = videoList.stream().map(CheckIndexFace::getViewConnectStability).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal count = BigDecimal.valueOf(videoList.size()); |
| | | onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); |
| | | } |
| | | rList.add(onlineRate + "%"); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("count", rList); |
| | | map.put("list", resultList); |
| | |
| | | @Override |
| | | public Result facePointOnlineRate(DataCenterQuery params) { |
| | | List<String> likeFileds = Arrays.asList("externalIndexCode", "deviceName"); |
| | | Query query = MongoUtil.getQuery(params, "externalIndexCode", TIME_FIELD, likeFileds, null); |
| | | Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null); |
| | | |
| | | long total = mongoTemplate.count(query, SnapshotDataMonitorResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | |
| | | Document trFilter = new Document("resultType", 3); |
| | | Document littleFilter = new Document("resultType", 4); |
| | | List<Document> lists = Arrays.asList(normalFilter, noDataFilter, trFilter, littleFilter); |
| | | List<Integer> rList = lists.stream().map(filter -> { |
| | | List<String> rList = lists.stream().map(filter -> { |
| | | // 构建聚合管道 |
| | | List<Document> pipeline = Arrays.asList( |
| | | new Document("$match", filter), |
| | |
| | | uniqueDeviceIdCount = doc.getInteger("uniqueDeviceIds"); |
| | | break; // 不需要继续遍历,因为 $count 只会产生一个结果 |
| | | } |
| | | return uniqueDeviceIdCount; |
| | | return uniqueDeviceIdCount + ""; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | Date now = new Date(); |
| | | List<CheckIndexFace> videoList = new LambdaQueryChainWrapper<>(checkIndexFaceService.getBaseMapper()) |
| | | .select(CheckIndexFace::getSiteOnline) |
| | | .between(CheckIndexFace::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now)) |
| | | .list(); |
| | | BigDecimal onlineRate = BigDecimal.ZERO; |
| | | if (CollectionUtils.isNotEmpty(videoList)) { |
| | | BigDecimal sum = videoList.stream().map(CheckIndexFace::getSiteOnline).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal count = BigDecimal.valueOf(videoList.size()); |
| | | onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); |
| | | } |
| | | rList.add(onlineRate + "%"); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("count", rList); |
| | | map.put("list", resultList); |
| | |
| | | @Override |
| | | public Result faceDirectoryConsistency(DataCenterQuery params) { |
| | | List<String> likeFileds = Arrays.asList("serialNumber.showValue", "ip.showValue", "name.showValue"); |
| | | Query query = MongoUtil.getQuery(params, "serialNumber.showValue", TIME_FIELD, likeFileds, null); |
| | | Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null); |
| | | |
| | | long total = mongoTemplate.count(query, MonitorQualifyResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | |
| | | Document longitudeErrFilter = new Document("longitude.error", true); |
| | | |
| | | List<Document> lists = Arrays.asList(ipErrFilter, macdzErrFilter, latitudeErrFilter, longitudeErrFilter); |
| | | List<Integer> rList = lists.stream().map(filter -> { |
| | | List<String> rList = lists.stream().map(filter -> { |
| | | // 构建聚合管道 |
| | | List<Document> pipeline = Arrays.asList( |
| | | new Document("$match", filter), |
| | |
| | | uniqueDeviceIdCount = doc.getInteger("uniqueDeviceIds"); |
| | | break; // 不需要继续遍历,因为 $count 只会产生一个结果 |
| | | } |
| | | return uniqueDeviceIdCount; |
| | | return uniqueDeviceIdCount + ""; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | Date now = new Date(); |
| | | List<CheckIndexFace> videoList = new LambdaQueryChainWrapper<>(checkIndexFaceService.getBaseMapper()) |
| | | .select(CheckIndexFace::getDeviceDirectoryConsistent) |
| | | .between(CheckIndexFace::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now)) |
| | | .list(); |
| | | BigDecimal onlineRate = BigDecimal.ZERO; |
| | | if (CollectionUtils.isNotEmpty(videoList)) { |
| | | BigDecimal sum = videoList.stream().map(CheckIndexFace::getDeviceDirectoryConsistent).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal count = BigDecimal.valueOf(videoList.size()); |
| | | onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); |
| | | } |
| | | rList.add(onlineRate + "%"); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("count", rList); |
| | | map.put("list", resultList); |
| | |
| | | @Override |
| | | public Result faceCollectionConsistency(DataCenterQuery params) { |
| | | List<String> likeFileds = Arrays.asList("externalIndexCode", "crossName"); |
| | | Query query = MongoUtil.getQuery(params, "externalIndexCode", TIME_FIELD, likeFileds, null); |
| | | Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null); |
| | | |
| | | long total = mongoTemplate.count(query, CrossDetailResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | |
| | | Document longitudeErrFilter = new Document("lalType", 4); |
| | | |
| | | List<Document> lists = Arrays.asList(ipErrFilter, macdzErrFilter, latitudeErrFilter, longitudeErrFilter); |
| | | List<Integer> rList = lists.stream().map(filter -> { |
| | | List<String> rList = lists.stream().map(filter -> { |
| | | // 构建聚合管道 |
| | | List<Document> pipeline = Arrays.asList( |
| | | new Document("$match", filter), |
| | |
| | | uniqueDeviceIdCount = doc.getInteger("uniqueDeviceIds"); |
| | | break; // 不需要继续遍历,因为 $count 只会产生一个结果 |
| | | } |
| | | return uniqueDeviceIdCount; |
| | | return uniqueDeviceIdCount + ""; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | Date now = new Date(); |
| | | List<CheckIndexFace> videoList = new LambdaQueryChainWrapper<>(checkIndexFaceService.getBaseMapper()) |
| | | .select(CheckIndexFace::getFaceInformationCollectionAccuracy) |
| | | .between(CheckIndexFace::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now)) |
| | | .list(); |
| | | BigDecimal onlineRate = BigDecimal.ZERO; |
| | | if (CollectionUtils.isNotEmpty(videoList)) { |
| | | BigDecimal sum = videoList.stream().map(CheckIndexFace::getFaceInformationCollectionAccuracy).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal count = BigDecimal.valueOf(videoList.size()); |
| | | onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); |
| | | } |
| | | rList.add(onlineRate + "%"); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("count", rList); |
| | | map.put("list", resultList); |
| | |
| | | @Override |
| | | public Result faceImgQualification(DataCenterQuery params) { |
| | | List<String> likeFileds = Arrays.asList("externalIndexCode", "cameraName"); |
| | | Query query = MongoUtil.getQuery(params, "externalIndexCode", TIME_FIELD, likeFileds, null); |
| | | Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null); |
| | | |
| | | long total = mongoTemplate.count(query, MonitoringDetailResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | |
| | | Document longitudeErrFilter = new Document("lalType", 4); |
| | | |
| | | List<Document> lists = Arrays.asList(ipErrFilter, macdzErrFilter, latitudeErrFilter, longitudeErrFilter); |
| | | List<Integer> rList = lists.stream().map(filter -> { |
| | | List<String> rList = lists.stream().map(filter -> { |
| | | // 构建聚合管道 |
| | | List<Document> pipeline = Arrays.asList( |
| | | new Document("$match", filter), |
| | |
| | | uniqueDeviceIdCount = doc.getInteger("uniqueDeviceIds"); |
| | | break; // 不需要继续遍历,因为 $count 只会产生一个结果 |
| | | } |
| | | return uniqueDeviceIdCount; |
| | | return uniqueDeviceIdCount + ""; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | Date now = new Date(); |
| | | List<CheckIndexFace> videoList = new LambdaQueryChainWrapper<>(checkIndexFaceService.getBaseMapper()) |
| | | .select(CheckIndexFace::getFacePictureQualification) |
| | | .between(CheckIndexFace::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now)) |
| | | .list(); |
| | | BigDecimal onlineRate = BigDecimal.ZERO; |
| | | if (CollectionUtils.isNotEmpty(videoList)) { |
| | | BigDecimal sum = videoList.stream().map(CheckIndexFace::getFacePictureQualification).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal count = BigDecimal.valueOf(videoList.size()); |
| | | onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); |
| | | } |
| | | rList.add(onlineRate + "%"); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("count", rList); |
| | | map.put("list", resultList); |
| | |
| | | @Override |
| | | public Result faceCapturesImagesAccuracy(DataCenterQuery params) { |
| | | List<String> likeFileds = Arrays.asList("externalIndexCode", "deviceName"); |
| | | Query query = MongoUtil.getQuery(params, "externalIndexCode", TIME_FIELD, likeFileds, null); |
| | | Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null); |
| | | |
| | | long total = mongoTemplate.count(query, FaceDeviceInspectionResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | |
| | | Document longitudeErrFilter = new Document("snapResult", 4); |
| | | |
| | | List<Document> lists = Arrays.asList(ipErrFilter, macdzErrFilter, longitudeErrFilter); |
| | | List<Integer> rList = lists.stream().map(filter -> { |
| | | List<String> rList = lists.stream().map(filter -> { |
| | | // 构建聚合管道 |
| | | List<Document> pipeline = Arrays.asList( |
| | | new Document("$match", filter), |
| | |
| | | uniqueDeviceIdCount = doc.getInteger("uniqueDeviceIds"); |
| | | break; // 不需要继续遍历,因为 $count 只会产生一个结果 |
| | | } |
| | | return uniqueDeviceIdCount; |
| | | return uniqueDeviceIdCount + ""; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | Date now = new Date(); |
| | | List<CheckIndexFace> videoList = new LambdaQueryChainWrapper<>(checkIndexFaceService.getBaseMapper()) |
| | | .select(CheckIndexFace::getFaceTimingAccuracy) |
| | | .between(CheckIndexFace::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now)) |
| | | .list(); |
| | | BigDecimal onlineRate = BigDecimal.ZERO; |
| | | if (CollectionUtils.isNotEmpty(videoList)) { |
| | | BigDecimal sum = videoList.stream().map(CheckIndexFace::getFaceTimingAccuracy).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal count = BigDecimal.valueOf(videoList.size()); |
| | | onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); |
| | | } |
| | | rList.add(onlineRate + "%"); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("count", rList); |
| | | map.put("list", resultList); |
| | |
| | | @Override |
| | | public Result faceTimelyUpload(DataCenterQuery params) { |
| | | List<String> likeFileds = Arrays.asList("externalIndexCode", "deviceName"); |
| | | Query query = MongoUtil.getQuery(params, "externalIndexCode", TIME_FIELD, likeFileds, null); |
| | | Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null); |
| | | |
| | | long total = mongoTemplate.count(query, FaceDeviceInspectionResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | |
| | | Document longitudeErrFilter = new Document("snapResult", 4); |
| | | |
| | | List<Document> lists = Arrays.asList(ipErrFilter, macdzErrFilter, longitudeErrFilter); |
| | | List<Integer> rList = lists.stream().map(filter -> { |
| | | List<String> rList = lists.stream().map(filter -> { |
| | | // 构建聚合管道 |
| | | List<Document> pipeline = Arrays.asList( |
| | | new Document("$match", filter), |
| | |
| | | uniqueDeviceIdCount = doc.getInteger("uniqueDeviceIds"); |
| | | break; // 不需要继续遍历,因为 $count 只会产生一个结果 |
| | | } |
| | | return uniqueDeviceIdCount; |
| | | return uniqueDeviceIdCount + ""; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | Date now = new Date(); |
| | | List<CheckIndexFace> videoList = new LambdaQueryChainWrapper<>(checkIndexFaceService.getBaseMapper()) |
| | | .select(CheckIndexFace::getFaceUploadTimeliness) |
| | | .between(CheckIndexFace::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now)) |
| | | .list(); |
| | | BigDecimal onlineRate = BigDecimal.ZERO; |
| | | if (CollectionUtils.isNotEmpty(videoList)) { |
| | | BigDecimal sum = videoList.stream().map(CheckIndexFace::getFaceUploadTimeliness).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal count = BigDecimal.valueOf(videoList.size()); |
| | | onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); |
| | | } |
| | | rList.add(onlineRate + "%"); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("count", rList); |
| | | map.put("list", resultList); |
| | |
| | | @Override |
| | | public Result faceAvailabilityOfLargeImg(DataCenterQuery params) { |
| | | List<String> likeFileds = Arrays.asList("externalIndexCode", "deviceName"); |
| | | Query query = MongoUtil.getQuery(params, "externalIndexCode", TIME_FIELD, likeFileds, null); |
| | | Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null); |
| | | |
| | | long total = mongoTemplate.count(query, FaceDeviceSamplingResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | | List<FaceDeviceSamplingResult> resultList = mongoTemplate.find(query, FaceDeviceSamplingResult.class); |
| | | |
| | | // 统计数 |
| | | Date now = new Date(); |
| | | List<CheckIndexFace> videoList = new LambdaQueryChainWrapper<>(checkIndexFaceService.getBaseMapper()) |
| | | .select(CheckIndexFace::getFacePictureAvailability) |
| | | .between(CheckIndexFace::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now)) |
| | | .list(); |
| | | BigDecimal onlineRate = BigDecimal.ZERO; |
| | | if (CollectionUtils.isNotEmpty(videoList)) { |
| | | BigDecimal sum = videoList.stream().map(CheckIndexFace::getFacePictureAvailability).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal count = BigDecimal.valueOf(videoList.size()); |
| | | onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); |
| | | } |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("count", CollectionUtils.EMPTY_COLLECTION); |
| | | map.put("count", Arrays.asList(onlineRate + "%")); |
| | | map.put("list", resultList); |
| | | return Result.ok().data(map).total(total); |
| | | } |