| | |
| | | package com.ycl.task; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.mongodb.client.result.DeleteResult; |
| | | import com.ycl.feign.HkApiUtil; |
| | | import com.ycl.feign.HkApiUtil; |
| | | import com.ycl.platform.domain.entity.TMonitor; |
| | | import com.ycl.platform.domain.param.HK.*; |
| | | import com.ycl.platform.domain.result.HK.*; |
| | | import com.ycl.platform.service.ICheckIndexCarService; |
| | | import com.ycl.platform.service.ICheckIndexFaceService; |
| | | import com.ycl.platform.service.ICheckIndexVideoService; |
| | | import com.ycl.platform.service.IYwThresholdService; |
| | | import com.ycl.platform.domain.result.UY.VideoOnlineResult; |
| | | import com.ycl.platform.domain.vo.UpdateOnlineVO; |
| | | import com.ycl.platform.mapper.TMonitorMapper; |
| | | import com.ycl.platform.mapper.WorkOrderMapper; |
| | | import com.ycl.platform.service.*; |
| | | import com.ycl.utils.DateUtils; |
| | | import constant.ApiConstants; |
| | | import com.ycl.feign.HKClient; |
| | | import constant.CheckConstants; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | //海康对接数据任务 |
| | | @Slf4j |
| | | @Component("HKTask") |
| | | public class HKTask { |
| | | |
| | | @Value("${HK.host}") |
| | | public String host; |
| | | @Value("${HK.appKey}") |
| | | public String appKey; |
| | | @Value("${HK.appSecret}") |
| | | public String appSecret; |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Autowired |
| | | private IYwThresholdService ywThresholdService; |
| | | @Autowired |
| | | private ICheckIndexFaceService checkIndexFaceService; |
| | | private YwPointService pointService; |
| | | @Autowired |
| | | private ICheckIndexCarService checkIndexCarService; |
| | | private TMonitorMapper monitorMapper; |
| | | @Autowired |
| | | private ICheckIndexVideoService checkIndexVideoService; |
| | | |
| | | private UYErrorTypeCheckService uyErrorTypeCheckService; |
| | | //车辆设备全检指标监测结果 |
| | | public void vehicleDeviceInspectionTask() { |
| | | log.info("开始执行车辆设备全检指标监测结果数据同步"); |
| | | // VehicleDeviceInspectionParam param = new VehicleDeviceInspectionParam(); |
| | | // param.setPageNo(ApiConstants.PageNo); |
| | | // param.setPageSize(ApiConstants.HKPageSize); |
| | | // param.setDate(DateUtils.getDate()); |
| | | // param.setDataType(ApiConstants.HK_DataType_CAR); |
| | | // List<VehicleDeviceInspectionResult> list = HkApiUtil.sendAPI("/api/dqd/service/rs/v2/data/vehFullAmount/query", param, VehicleDeviceInspectionResult.class); |
| | | // if (!CollectionUtils.isEmpty(list)) { |
| | | // //如果存在之前的数据先删除 |
| | | // Query query = new Query(Criteria.where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | | // DeleteResult result = mongoTemplate.remove(query, VehicleDeviceInspectionResult.class); |
| | | // //存放在mongo中 |
| | | // mongoTemplate.insertAll(list); |
| | | // //同步的数据进行工单阈值处理 |
| | | // ywThresholdService.carCheck(list); |
| | | // } |
| | | Query query = new Query(Criteria.where("mongoCreateTime").lt(DateUtils.getDayEnd(new Date()))); |
| | | ywThresholdService.carCheck(mongoTemplate.find(query, VehicleDeviceInspectionResult.class)); |
| | | VehicleDeviceInspectionParam param = new VehicleDeviceInspectionParam(); |
| | | param.setPageNo(ApiConstants.PageNo); |
| | | param.setPageSize(ApiConstants.HKPageSize); |
| | | param.setDate(DateUtils.getDate()); |
| | | param.setDataType(ApiConstants.HK_DataType_CAR); |
| | | List<VehicleDeviceInspectionResult> list = HkApiUtil.sendAPI(host,appKey,appSecret,"/api/dqd/service/rs/v2/data/vehFullAmount/query", param, VehicleDeviceInspectionResult.class); |
| | | if (!CollectionUtils.isEmpty(list)) { |
| | | //如果存在之前的数据先删除 |
| | | Query query = new Query(Criteria.where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | | DeleteResult result = mongoTemplate.remove(query, VehicleDeviceInspectionResult.class); |
| | | list.stream().forEach(item -> { |
| | | if (Objects.nonNull(item.getExternalIndexCode())) { |
| | | item.setNo(item.getExternalIndexCode()); |
| | | } |
| | | }); |
| | | pointService.setDeviceTagByGB(list, CheckConstants.Rule_Category_Car); |
| | | //存放在mongo中 |
| | | mongoTemplate.insertAll(list); |
| | | //同步的数据进行工单阈值处理 |
| | | ywThresholdService.carCheck(list); |
| | | } |
| | | // 本地测试 |
| | | // Query query = new Query(Criteria.where("mongoCreateTime").lt(DateUtils.getDayEnd(new Date()))); |
| | | // ywThresholdService.carCheck(mongoTemplate.find(query, VehicleDeviceInspectionResult.class)); |
| | | log.info("结束车辆设备全检指标监测结果数据同步"); |
| | | } |
| | | |
| | | //人脸设备全检指标监测结果 |
| | | public void faceDeviceInspectionTask() { |
| | | log.info("开始执行人脸设备全检指标监测结果数据同步"); |
| | | // FaceDeviceInspectionParam param = new FaceDeviceInspectionParam(); |
| | | // param.setPageNo(ApiConstants.PageNo); |
| | | // param.setPageSize(ApiConstants.HKPageSize); |
| | | // param.setDate(DateUtils.getDate()); |
| | | // List<FaceDeviceInspectionResult> list = HkApiUtil.sendAPI("/api/dqd/service/rs/v2/data/faceFullAmount/query", param, FaceDeviceInspectionResult.class); |
| | | // if (!CollectionUtils.isEmpty(list)) { |
| | | // //如果存在之前的数据先删除 |
| | | // Query query = new Query(Criteria.where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | | // DeleteResult result = mongoTemplate.remove(query, FaceDeviceInspectionResult.class); |
| | | // //存放在mongo中 |
| | | // mongoTemplate.insertAll(list); |
| | | // //同步的数据进行工单阈值处理 |
| | | // //TODO:可能有重复工单 |
| | | // ywThresholdService.faceCheck(list); |
| | | // } |
| | | Query query = new Query(Criteria.where("mongoCreateTime").lt(DateUtils.getDayEnd(new Date()))); |
| | | ywThresholdService.faceCheck(mongoTemplate.find(query, FaceDeviceInspectionResult.class)); |
| | | FaceDeviceInspectionParam param = new FaceDeviceInspectionParam(); |
| | | param.setPageNo(ApiConstants.PageNo); |
| | | param.setPageSize(ApiConstants.HKPageSize); |
| | | param.setDate(DateUtils.getDate()); |
| | | List<FaceDeviceInspectionResult> list = HkApiUtil.sendAPI(host,appKey,appSecret,"/api/dqd/service/rs/v2/data/faceFullAmount/query", param, FaceDeviceInspectionResult.class); |
| | | if (!CollectionUtils.isEmpty(list)) { |
| | | //如果存在之前的数据先删除 |
| | | Query query = new Query(Criteria.where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | | DeleteResult result = mongoTemplate.remove(query, FaceDeviceInspectionResult.class); |
| | | list.stream().forEach(item -> { |
| | | if (Objects.nonNull(item.getExternalIndexCode())) { |
| | | item.setNo(item.getExternalIndexCode()); |
| | | } |
| | | }); |
| | | pointService.setDeviceTagByGB(list,CheckConstants.Rule_Category_Face); |
| | | //存放在mongo中 |
| | | mongoTemplate.insertAll(list); |
| | | //同步的数据进行工单阈值处理 |
| | | ywThresholdService.faceCheck(list); |
| | | } |
| | | // Query query = new Query(Criteria.where("mongoCreateTime").lt(DateUtils.getDayEnd(new Date()))); |
| | | // ywThresholdService.faceCheck(mongoTemplate.find(query, FaceDeviceInspectionResult.class)); |
| | | log.info("结束人脸设备全检指标监测结果数据同步"); |
| | | } |
| | | |
| | |
| | | carParam.setPageSize(ApiConstants.HKPageSize); |
| | | carParam.setDate(DateUtils.getDate()); |
| | | carParam.setDataType(ApiConstants.HK_DataType_CAR); |
| | | List<SnapshotDataMonitorResult> carList = HkApiUtil.sendAPI("/api/dqd/service/rs/v1/data/snapCountDetail/query", carParam, SnapshotDataMonitorResult.class); |
| | | List<SnapshotDataMonitorResult> carList = HkApiUtil.sendAPI(host,appKey,appSecret,"/api/dqd/service/rs/v1/data/snapCountDetail/query", carParam, SnapshotDataMonitorResult.class); |
| | | if (!CollectionUtils.isEmpty(carList)) { |
| | | //如果今天存在之前的数据先删除 |
| | | Query query = new Query(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date())) |
| | | .and("dataType").is(ApiConstants.HK_DataType_CAR)); |
| | | DeleteResult result = mongoTemplate.remove(query, SnapshotDataMonitorResult.class); |
| | | carList.stream().forEach(item -> { |
| | | if (Objects.nonNull(item.getExternalIndexCode())) { |
| | | item.setNo(item.getExternalIndexCode()); |
| | | } |
| | | }); |
| | | pointService.setDeviceTagByGB(carList,CheckConstants.Rule_Category_Car); |
| | | //存放在mongo中 |
| | | carList.forEach(item -> item.setDataType(ApiConstants.HK_DataType_CAR)); |
| | | mongoTemplate.insertAll(carList); |
| | |
| | | faceParam.setPageSize(ApiConstants.HKPageSize); |
| | | faceParam.setDate(DateUtils.getDate()); |
| | | faceParam.setDataType(ApiConstants.HK_DataType_FACE); |
| | | List<SnapshotDataMonitorResult> faceList = HkApiUtil.sendAPI("/api/dqd/service/rs/v1/data/snapCountDetail/query", faceParam, SnapshotDataMonitorResult.class); |
| | | List<SnapshotDataMonitorResult> faceList = HkApiUtil.sendAPI(host,appKey,appSecret,"/api/dqd/service/rs/v1/data/snapCountDetail/query", faceParam, SnapshotDataMonitorResult.class); |
| | | if (!CollectionUtils.isEmpty(faceList)) { |
| | | log.info("结果数据大小:{}",faceList.size()); |
| | | //如果今天存在之前的数据先删除 |
| | | Query query = new Query(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date())) |
| | | .and("dataType").is(ApiConstants.HK_DataType_FACE)); |
| | | DeleteResult result = mongoTemplate.remove(query, SnapshotDataMonitorResult.class); |
| | | faceList.stream().forEach(item -> { |
| | | if (Objects.nonNull(item.getExternalIndexCode())) { |
| | | item.setNo(item.getExternalIndexCode()); |
| | | } |
| | | }); |
| | | pointService.setDeviceTagByGB(faceList,CheckConstants.Rule_Category_Face); |
| | | //存放在mongo中 |
| | | carList.forEach(item -> item.setDataType(ApiConstants.HK_DataType_FACE)); |
| | | faceList.forEach(item -> item.setDataType(ApiConstants.HK_DataType_FACE)); |
| | | mongoTemplate.insertAll(faceList); |
| | | } |
| | | //TODO:工单 |
| | | //修改online状态以及生成工单 |
| | | List<SnapshotDataMonitorResult> totalResult =new ArrayList<>(); |
| | | totalResult.addAll(carList); |
| | | totalResult.addAll(faceList); |
| | | if(!CollectionUtils.isEmpty(totalResult)) { |
| | | List<String> numbers = totalResult.stream().map(SnapshotDataMonitorResult::getExternalIndexCode).collect(Collectors.toList()); |
| | | Map<String, TMonitor> map = monitorMapper.selectList(new QueryWrapper<TMonitor>().in("serial_number", numbers)) |
| | | .stream().collect(Collectors.toMap(TMonitor::getSerialNumber, Function.identity())); |
| | | Date now = new Date(); |
| | | totalResult.forEach(item->{ |
| | | TMonitor monitor = map.get(item.getExternalIndexCode()); |
| | | item.setIp(monitor.getIp()); |
| | | }); |
| | | List<UpdateOnlineVO> willUpdateList = totalResult.stream().map(item -> { |
| | | UpdateOnlineVO vo = new UpdateOnlineVO(); |
| | | vo.setOnline(item.getDataCount()>0?1:-1); |
| | | vo.setIp(map.get(item.getExternalIndexCode()).getIp()); |
| | | vo.setUpdateTime(now); |
| | | return vo; |
| | | }).collect(Collectors.toList()); |
| | | monitorMapper.updateOnlineFromUyOrHk(willUpdateList); |
| | | //离线生成工单,一个ip只生成一个工单 |
| | | List<SnapshotDataMonitorResult> workOrders = new ArrayList<>(totalResult.stream() |
| | | .filter(item -> ApiConstants.UY_OnlineSite_Offline.equals(item.getDataCount()>0?1:-1)) |
| | | .collect(Collectors.toMap( |
| | | SnapshotDataMonitorResult::getIp, |
| | | Function.identity(), |
| | | (existing, replacement) -> existing // 如果遇到相同的 IP,保留第一个(existing) |
| | | )).values()); |
| | | uyErrorTypeCheckService.hkOnlineCheck(workOrders); |
| | | } |
| | | log.info("结束抓拍数据量检测结果数据同步"); |
| | | } |
| | | |
| | |
| | | param.setPageNo(ApiConstants.PageNo); |
| | | param.setPageSize(ApiConstants.HKPageSize); |
| | | param.setDate(DateUtils.getDate()); |
| | | List<MonitoringDetailResult> faceList = HkApiUtil.sendAPI("/api/dqd/service/rs/v1/device/cameraExpDetailInfo/query", param, MonitoringDetailResult.class); |
| | | List<MonitoringDetailResult> faceList = HkApiUtil.sendAPI(host,appKey,appSecret,"/api/dqd/service/rs/v1/device/cameraExpDetailInfo/query", param, MonitoringDetailResult.class); |
| | | if (!CollectionUtils.isEmpty(faceList)) { |
| | | //如果今天存在之前的数据先删除 |
| | | Query query = new Query(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | | DeleteResult result = mongoTemplate.remove(query, MonitoringDetailResult.class); |
| | | faceList.stream().forEach(item -> { |
| | | if (Objects.nonNull(item.getExternalIndexCode())) { |
| | | item.setNo(item.getExternalIndexCode()); |
| | | } |
| | | }); |
| | | pointService.setDeviceTagByGB(faceList,CheckConstants.Rule_Category_Face); |
| | | //存放在mongo中 |
| | | mongoTemplate.insertAll(faceList); |
| | | } |
| | | //TODO:工单处理 |
| | | log.info("结束采集设备属性监测结果数据同步"); |
| | | } |
| | | |
| | |
| | | param.setPageNo(ApiConstants.PageNo); |
| | | param.setPageSize(ApiConstants.HKPageSize); |
| | | param.setDate(DateUtils.getDate()); |
| | | List<CrossDetailResult> faceList = HkApiUtil.sendAPI("/api/dqd/service/rs/v1/device/crossExpDetailInfo/query", param, CrossDetailResult.class); |
| | | if (!CollectionUtils.isEmpty(faceList)) { |
| | | List<CrossDetailResult> carList = HkApiUtil.sendAPI(host,appKey,appSecret,"/api/dqd/service/rs/v1/device/crossExpDetailInfo/query", param, CrossDetailResult.class); |
| | | if (!CollectionUtils.isEmpty(carList)) { |
| | | //如果今天存在之前的数据先删除 |
| | | Query query = new Query(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | | DeleteResult result = mongoTemplate.remove(query, CrossDetailResult.class); |
| | | carList.stream().forEach(item -> { |
| | | if (Objects.nonNull(item.getExternalIndexCode())) { |
| | | item.setNo(item.getExternalIndexCode()); |
| | | } |
| | | }); |
| | | pointService.setDeviceTagByGB(carList,CheckConstants.Rule_Category_Car); |
| | | //存放在mongo中 |
| | | mongoTemplate.insertAll(faceList); |
| | | mongoTemplate.insertAll(carList); |
| | | } |
| | | //TODO:工单处理 |
| | | log.info("结束卡口属性监测结果数据同步"); |
| | | } |
| | | |
| | |
| | | param.setPageSize(ApiConstants.HKPageSize); |
| | | param.setDate(DateUtils.getDate()); |
| | | param.setDataType(ApiConstants.HK_DataType_CAR); |
| | | List<DataIntegrityMonitoringResult> faceList = HkApiUtil.sendAPI("/api/dqd/service/rs/v1/data/attributeIntegrity/query", param, DataIntegrityMonitoringResult.class); |
| | | List<DataIntegrityMonitoringResult> carList = HkApiUtil.sendAPI(host,appKey,appSecret,"/api/dqd/service/rs/v1/data/attributeIntegrity/query", param, DataIntegrityMonitoringResult.class); |
| | | |
| | | if (!CollectionUtils.isEmpty(faceList)) { |
| | | if (!CollectionUtils.isEmpty(carList)) { |
| | | //如果今天存在之前的数据先删除 |
| | | Query query = new Query(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | | DeleteResult result = mongoTemplate.remove(query, DataIntegrityMonitoringResult.class); |
| | | carList.stream().forEach(item -> { |
| | | if (Objects.nonNull(item.getExternalIndexCode())) { |
| | | item.setNo(item.getExternalIndexCode()); |
| | | } |
| | | }); |
| | | pointService.setDeviceTagByGB(carList,CheckConstants.Rule_Category_Car); |
| | | //存放在mongo中 |
| | | mongoTemplate.insertAll(faceList); |
| | | mongoTemplate.insertAll(carList); |
| | | } |
| | | //TODO:工单处理 |
| | | log.info("结束数据完整性监测结果数据同步"); |
| | | } |
| | | |
| | |
| | | param.setPageSize(ApiConstants.HKPageSize); |
| | | param.setDate(DateUtils.getDate()); |
| | | param.setDataType(ApiConstants.HK_DataType_CAR); |
| | | List<AttrRecognitionMonitorResult> faceList = HkApiUtil.sendAPI("/api/dqd/service/rs/v1/data/attributeRecognition/query", param, AttrRecognitionMonitorResult.class); |
| | | List<AttrRecognitionMonitorResult> carList = HkApiUtil.sendAPI(host,appKey,appSecret,"/api/dqd/service/rs/v1/data/attributeRecognition/query", param, AttrRecognitionMonitorResult.class); |
| | | |
| | | if (!CollectionUtils.isEmpty(faceList)) { |
| | | if (!CollectionUtils.isEmpty(carList)) { |
| | | //如果今天存在之前的数据先删除 |
| | | Query query = new Query(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | | DeleteResult result = mongoTemplate.remove(query, AttrRecognitionMonitorResult.class); |
| | | carList.stream().forEach(item -> { |
| | | if (Objects.nonNull(item.getExternalIndexCode())) { |
| | | item.setNo(item.getExternalIndexCode()); |
| | | } |
| | | }); |
| | | pointService.setDeviceTagByGB(carList,CheckConstants.Rule_Category_Car); |
| | | //存放在mongo中 |
| | | mongoTemplate.insertAll(faceList); |
| | | mongoTemplate.insertAll(carList); |
| | | } |
| | | //TODO:工单处理 |
| | | log.info("结束属性识别准确监测结果数据同步"); |
| | | |
| | | } |
| | |
| | | carParam.setPageSize(ApiConstants.HKPageSize); |
| | | carParam.setDate(DateUtils.getDate()); |
| | | carParam.setDataType(ApiConstants.HK_DataType_CAR); |
| | | List<SnapshotDelayMonitorResult> carList = HkApiUtil.sendAPI("/api/dqd/service/rs/v1/data/snapAgingDetail/query", carParam, SnapshotDelayMonitorResult.class); |
| | | List<SnapshotDelayMonitorResult> carList = HkApiUtil.sendAPI(host,appKey,appSecret,"/api/dqd/service/rs/v1/data/snapAgingDetail/query", carParam, SnapshotDelayMonitorResult.class); |
| | | |
| | | if (!CollectionUtils.isEmpty(carList)) { |
| | | //如果今天存在之前的数据先删除 |
| | |
| | | .and("dataType").is(ApiConstants.HK_DataType_CAR)); |
| | | DeleteResult result = mongoTemplate.remove(query, SnapshotDelayMonitorResult.class); |
| | | //存放在mongo中 |
| | | carList.forEach(item -> item.setDataType(ApiConstants.HK_DataType_CAR)); |
| | | carList.stream().forEach(item -> { |
| | | item.setDataType(ApiConstants.HK_DataType_CAR); |
| | | if (Objects.nonNull(item.getExternalIndexCode())) { |
| | | item.setNo(item.getExternalIndexCode()); |
| | | } |
| | | }); |
| | | pointService.setDeviceTagByGB(carList,CheckConstants.Rule_Category_Car); |
| | | mongoTemplate.insertAll(carList); |
| | | } |
| | | |
| | |
| | | faceParam.setPageSize(ApiConstants.HKPageSize); |
| | | faceParam.setDate(DateUtils.getDate()); |
| | | faceParam.setDataType(ApiConstants.HK_DataType_FACE); |
| | | List<SnapshotDelayMonitorResult> faceList = HkApiUtil.sendAPI("/api/dqd/service/rs/v1/data/snapAgingDetail/query", faceParam, SnapshotDelayMonitorResult.class); |
| | | List<SnapshotDelayMonitorResult> faceList = HkApiUtil.sendAPI(host,appKey,appSecret,"/api/dqd/service/rs/v1/data/snapAgingDetail/query", faceParam, SnapshotDelayMonitorResult.class); |
| | | |
| | | if (!CollectionUtils.isEmpty(faceList)) { |
| | | //如果今天存在之前的数据先删除 |
| | |
| | | .and("dataType").is(ApiConstants.HK_DataType_FACE)); |
| | | DeleteResult result = mongoTemplate.remove(query, SnapshotDelayMonitorResult.class); |
| | | //存放在mongo中 |
| | | faceList.forEach(item -> item.setDataType(ApiConstants.HK_DataType_FACE)); |
| | | faceList.forEach(item -> { |
| | | item.setDataType(ApiConstants.HK_DataType_FACE); |
| | | if (Objects.nonNull(item.getExternalIndexCode())) { |
| | | item.setNo(item.getExternalIndexCode()); |
| | | } |
| | | }); |
| | | pointService.setDeviceTagByGB(faceList,CheckConstants.Rule_Category_Face); |
| | | mongoTemplate.insertAll(faceList); |
| | | } |
| | | //TODO:工单 |
| | | log.info("结束抓拍数据时延监测结果数据同步"); |
| | | } |
| | | |
| | |
| | | param.setPageSize(ApiConstants.HKPageSize); |
| | | param.setDate(DateUtils.getDate()); |
| | | param.setDataType(ApiConstants.HK_DataType_CAR); |
| | | List<PicAccessResult> faceList = HkApiUtil.sendAPI("/api/dqd/service/rs/v1/data/picAccessDetail/query", param, PicAccessResult.class); |
| | | List<PicAccessResult> carList = HkApiUtil.sendAPI(host,appKey,appSecret,"/api/dqd/service/rs/v1/data/picAccessDetail/query", param, PicAccessResult.class); |
| | | |
| | | if (!CollectionUtils.isEmpty(faceList)) { |
| | | if (!CollectionUtils.isEmpty(carList)) { |
| | | //如果今天存在之前的数据先删除 |
| | | Query query = new Query(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | | DeleteResult result = mongoTemplate.remove(query, PicAccessResult.class); |
| | | carList.stream().forEach(item -> { |
| | | if (Objects.nonNull(item.getExternalIndexCode())) { |
| | | item.setNo(item.getExternalIndexCode()); |
| | | } |
| | | }); |
| | | pointService.setDeviceTagByGB(carList,CheckConstants.Rule_Category_Car); |
| | | //存放在mongo中 |
| | | mongoTemplate.insertAll(faceList); |
| | | mongoTemplate.insertAll(carList); |
| | | } |
| | | //TODO:工单处理 |
| | | log.info("结束图片访问监测结果数据同步"); |
| | | } |
| | | |
| | |
| | | param.setPageSize(ApiConstants.HKPageSize); |
| | | param.setDate(DateUtils.getDate()); |
| | | param.setDataType(ApiConstants.HK_DataType_CAR); |
| | | List<VehicleDeviceSamplingResult> faceList = HkApiUtil.sendAPI("/api/dqd/service/rs/v2/data/vehSampleAmount/query", param, VehicleDeviceSamplingResult.class); |
| | | List<VehicleDeviceSamplingResult> carList = HkApiUtil.sendAPI(host,appKey,appSecret,"/api/dqd/service/rs/v2/data/vehSampleAmount/query", param, VehicleDeviceSamplingResult.class); |
| | | |
| | | if (!CollectionUtils.isEmpty(faceList)) { |
| | | if (!CollectionUtils.isEmpty(carList)) { |
| | | //如果今天存在之前的数据先删除 |
| | | Query query = new Query(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | | DeleteResult result = mongoTemplate.remove(query, VehicleDeviceSamplingResult.class); |
| | | carList.stream().forEach(item -> { |
| | | if (Objects.nonNull(item.getExternalIndexCode())) { |
| | | item.setNo(item.getExternalIndexCode()); |
| | | } |
| | | }); |
| | | pointService.setDeviceTagByGB(carList,CheckConstants.Rule_Category_Car); |
| | | //存放在mongo中 |
| | | mongoTemplate.insertAll(faceList); |
| | | mongoTemplate.insertAll(carList); |
| | | } |
| | | //TODO:工单处理 |
| | | log.info("结束车辆设备抽检指标监测结果数据同步"); |
| | | } |
| | | |
| | |
| | | param.setPageNo(ApiConstants.PageNo); |
| | | param.setPageSize(ApiConstants.HKPageSize); |
| | | param.setDate(DateUtils.getDate()); |
| | | List<FaceDeviceSamplingResult> faceList = HkApiUtil.sendAPI("/api/dqd/service/rs/v2/data/faceSampleAmount/query", param, FaceDeviceSamplingResult.class); |
| | | List<FaceDeviceSamplingResult> faceList = HkApiUtil.sendAPI(host,appKey,appSecret,"/api/dqd/service/rs/v2/data/faceSampleAmount/query", param, FaceDeviceSamplingResult.class); |
| | | |
| | | if (!CollectionUtils.isEmpty(faceList)) { |
| | | //如果今天存在之前的数据先删除 |
| | | Query query = new Query(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | | DeleteResult result = mongoTemplate.remove(query, FaceDeviceSamplingResult.class); |
| | | faceList.stream().forEach(item -> { |
| | | if (Objects.nonNull(item.getExternalIndexCode())) { |
| | | item.setNo(item.getExternalIndexCode()); |
| | | } |
| | | }); |
| | | pointService.setDeviceTagByGB(faceList,CheckConstants.Rule_Category_Face); |
| | | //存放在mongo中 |
| | | mongoTemplate.insertAll(faceList); |
| | | } |
| | | //TODO:工单处理 |
| | | log.info("结束人脸设备抽检指标监测结果数据同步"); |
| | | } |
| | | |
| | | //测试 |
| | | public void test() { |
| | | log.info("测试海康接口"); |
| | | HkApiUtil.sendAPI("/api/dqd/service/rs/v2/data/faceDetect/query", new FaceDeviceSamplingParam(), Object.class); |
| | | log.info("结束->{},调用成功"); |
| | | //业务树 |
| | | public void TreeTask() { |
| | | log.info("开始执行业务树数据"); |
| | | TreeParam param = new TreeParam(); |
| | | param.setStartDate("2024-12-06"); |
| | | param.setEndDate("2024-12-06"); |
| | | List<HKTreeResult> faceList = HkApiUtil.sendGetAPI(host,appKey,appSecret,"/api/third/timeTree", param, HKTreeResult.class); |
| | | // if (!CollectionUtils.isEmpty(faceList)) { |
| | | // //如果今天存在之前的数据先删除 |
| | | // Query query = new Query(Criteria |
| | | // .where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | | // DeleteResult result = mongoTemplate.remove(query, FaceDeviceSamplingResult.class); |
| | | // faceList.stream().forEach(item -> { |
| | | // if (Objects.nonNull(item.getExternalIndexCode())) { |
| | | // item.setNo(item.getExternalIndexCode()); |
| | | // } |
| | | // }); |
| | | // pointService.setDeviceTagByGB(faceList,CheckConstants.Rule_Category_Face); |
| | | // //存放在mongo中 |
| | | // mongoTemplate.insertAll(faceList); |
| | | // } |
| | | log.info("结束业务树数据"); |
| | | } |
| | | |
| | | //测试 |
| | | public void test1() { |
| | | log.info("测试海康接口"); |
| | | HkApiUtil.sendAPI("/api/dqd/service/rs/v1/device/coordinateExpInfo/query", new FaceDeviceSamplingParam(), Object.class); |
| | | log.info("结束->{},调用成功"); |
| | | } |
| | | |
| | | //测试 |
| | | public void test2() { |
| | | log.info("测试海康接口"); |
| | | HkApiUtil.sendAPI("/api/dqd/service/rs/v1/device/gbCodeExpInfo/query", new FaceDeviceSamplingParam(), Object.class); |
| | | log.info("结束->{},调用成功"); |
| | | } |
| | | |
| | | //测试 |
| | | public void test3() { |
| | | log.info("测试海康接口"); |
| | | HkApiUtil.sendAPI("/api/dqd/service/rs/v2/data/passDetect/query", new FaceDeviceSamplingParam(), Object.class); |
| | | log.info("结束->{},调用成功"); |
| | | //考核成绩 |
| | | public void HkScoreTask() { |
| | | log.info("开始执行海康考核成绩数据"); |
| | | ScoreParam param = new ScoreParam(); |
| | | param.setStartDate("2024-12-06"); |
| | | param.setEndDate("2024-12-06"); |
| | | List<HKScoreResult> dataList = HkApiUtil.sendGetAPI(host,appKey,appSecret,"/api/third/score/get", param, HKScoreResult.class); |
| | | // if (!CollectionUtils.isEmpty(faceList)) { |
| | | // //如果今天存在之前的数据先删除 |
| | | // Query query = new Query(Criteria |
| | | // .where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | | // DeleteResult result = mongoTemplate.remove(query, FaceDeviceSamplingResult.class); |
| | | // faceList.stream().forEach(item -> { |
| | | // if (Objects.nonNull(item.getExternalIndexCode())) { |
| | | // item.setNo(item.getExternalIndexCode()); |
| | | // } |
| | | // }); |
| | | // pointService.setDeviceTagByGB(faceList,CheckConstants.Rule_Category_Face); |
| | | // //存放在mongo中 |
| | | // mongoTemplate.insertAll(faceList); |
| | | // } |
| | | log.info("结束海康考核成绩数据"); |
| | | } |
| | | |
| | | //解析数据 |