| | |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.mongodb.client.result.DeleteResult; |
| | | import com.ycl.platform.domain.param.UY.OnlineParam; |
| | | import com.ycl.platform.domain.param.UY.QueryVqdParam; |
| | | import com.ycl.platform.domain.result.HK.PicAccessResult; |
| | | import com.ycl.platform.domain.result.UY.QueryVqdResult; |
| | | import com.ycl.platform.service.IYwThresholdService; |
| | | import com.ycl.feign.UYClient; |
| | | import com.ycl.platform.domain.param.UY.OneMachineFileParam; |
| | | import com.ycl.platform.domain.param.UY.QueryVqdParam; |
| | | import com.ycl.platform.domain.param.UY.RecordMetaDSumParam; |
| | | import com.ycl.platform.domain.result.UY.OneMachineFileResult; |
| | | import com.ycl.platform.domain.result.UY.QueryVqdResult; |
| | | import com.ycl.platform.domain.result.UY.RecordMetaDSumResult; |
| | | import com.ycl.platform.service.IYwThresholdService; |
| | | import com.ycl.utils.DateUtils; |
| | | import constant.ApiConstants; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | //一机一档 |
| | | public void monitorTask() { |
| | | log.info("开始执行一机一档数据同步"); |
| | | //一机一档合格率 |
| | | // 一机一档注册率 |
| | | // 档案考核比 |
| | | log.info("开始执行一机一档数据同步"); |
| | | OneMachineFileParam param = new OneMachineFileParam(); |
| | | JSONObject jsonObject = uyClient.oneMachineFile(param); |
| | | if (jsonObject != null) { |
| | | JSONObject cameraList = jsonObject.getJSONObject("CameraList"); |
| | | if (cameraList != null) { |
| | | List<OneMachineFileResult> data = cameraList.getList("data", OneMachineFileResult.class); |
| | | if (!CollectionUtils.isEmpty(data)) { |
| | | //如果今天存在之前的数据先删除 |
| | | Query query = new Query(Criteria |
| | | .where("createTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | | DeleteResult result = mongoTemplate.remove(query, OneMachineFileResult.class); |
| | | //存放在mongo中 |
| | | mongoTemplate.insert(data); |
| | | } else { |
| | | log.error("一机一档数据为空{}", cameraList); |
| | | } |
| | | } else { |
| | | log.error("一机一档数据为空{}", jsonObject); |
| | | } |
| | | } else { |
| | | log.error("一机一档数据为空"); |
| | | } |
| | | log.info("结束执行一机一档数据同步"); |
| | | } |
| | | |
| | | //图像监测诊断结果 |
| | | public void queryVqdResultTask() { |
| | | //点位在线率 |
| | | //视频图像质量 |
| | | log.info("开始执行图像监测诊断结果数据同步"); |
| | | QueryVqdParam param = new QueryVqdParam(); |
| | | param.setTenantId(tenantId); |
| | | JSONObject jsonObject = uyClient.queryVqdResult(param); |
| | | if (jsonObject != null) { |
| | | JSONObject cameraList = jsonObject.getJSONObject("CameraList"); |
| | | if (cameraList != null) { |
| | | List<QueryVqdResult> data = cameraList.getList("data", QueryVqdResult.class); |
| | | if (!CollectionUtils.isEmpty(data)) { |
| | | //如果今天存在之前的数据先删除 |
| | | Query query = new Query(Criteria |
| | | .where("createTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | | DeleteResult result = mongoTemplate.remove(query, PicAccessResult.class); |
| | | //存放在mongo中 |
| | | mongoTemplate.insert(data); |
| | | Integer statusCode = jsonObject.getInteger("statusCode"); |
| | | if (ApiConstants.UYSuccessCode.equals(statusCode)) { |
| | | JSONObject data = jsonObject.getJSONObject("data"); |
| | | if (data != null) { |
| | | List<QueryVqdResult> records = data.getList("records", QueryVqdResult.class); |
| | | if (!CollectionUtils.isEmpty(records)) { |
| | | //如果今天存在之前的数据先删除 |
| | | Query query = new Query(Criteria |
| | | .where("createTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | | DeleteResult result = mongoTemplate.remove(query, QueryVqdResult.class); |
| | | //存放在mongo中 |
| | | mongoTemplate.insert(records); |
| | | } else { |
| | | log.error("图像监测诊断结果数据为空{}", data); |
| | | } |
| | | } else { |
| | | log.error("图像监测诊断结果数据为空{}", cameraList); |
| | | log.error("图像监测诊断结果数据为空{}", jsonObject); |
| | | } |
| | | } else { |
| | | log.error("图像监测诊断结果数据为空{}", jsonObject); |
| | | log.error("图像监测诊断结果请求失败{}", jsonObject); |
| | | } |
| | | } else { |
| | | log.error("图像监测诊断结果数据为空"); |
| | | } |
| | | |
| | | log.info("结束执行图像监测诊断结果数据同步"); |
| | | } |
| | | |
| | | //录像可用 |
| | | public void task3() { |
| | | public void recordMetaDSumTask() { |
| | | //录像可用率 |
| | | } |
| | | |
| | | //视频图像质量 |
| | | public void task4() { |
| | | //录像可用率 |
| | | log.info("开始执行录像可用数据同步"); |
| | | RecordMetaDSumParam param = new RecordMetaDSumParam(); |
| | | JSONObject jsonObject = uyClient.recordMetaDSumList(param); |
| | | if (jsonObject != null) { |
| | | if (jsonObject.getBoolean("success")) { |
| | | JSONObject data = jsonObject.getJSONObject("data"); |
| | | if (data != null) { |
| | | List<RecordMetaDSumResult> records = data.getList("records", RecordMetaDSumResult.class); |
| | | if (!CollectionUtils.isEmpty(records)) { |
| | | //如果今天存在之前的数据先删除 |
| | | Query query = new Query(Criteria |
| | | .where("createTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | | DeleteResult result = mongoTemplate.remove(query, RecordMetaDSumResult.class); |
| | | //存放在mongo中 |
| | | mongoTemplate.insert(records); |
| | | } else { |
| | | log.error("录像可用数据为空{}", data); |
| | | } |
| | | } else { |
| | | log.error("录像可用数据为空{}", jsonObject); |
| | | } |
| | | } else { |
| | | log.error("录像可用数据为空{}", jsonObject); |
| | | } |
| | | } else { |
| | | log.error("录像可用数据为空"); |
| | | } |
| | | log.info("结束执行录像可用数据同步"); |
| | | } |
| | | } |