From 6b009b0f6d3ef3aee97c362cebcd679d1b9088a3 Mon Sep 17 00:00:00 2001
From: zhangjian <zhangjianrock@163.com>
Date: 星期一, 07 八月 2023 17:34:08 +0800
Subject: [PATCH] 判断列表为空
---
ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectTaskServiceImpl.java | 58 ++++++++++++++++++++++++++++++++++------------------------
1 files changed, 34 insertions(+), 24 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectTaskServiceImpl.java b/ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectTaskServiceImpl.java
index 4c32163..a13a827 100644
--- a/ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectTaskServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectTaskServiceImpl.java
@@ -230,7 +230,7 @@
//寮�濮嬩笅涓�姝ラ
videoInspectTask.setCurrentStepId(nextStepId);
startRunStep(videoInspectTask);
- }else{
+ } else {
//鏈繃鏈熷皾璇曞紩瀵硷紝寮曞澶辫触娓呯┖褰撳墠姝ラ寮�濮嬫椂闂达紝鏍囪涓柇
tryGuide(videoInspectTask);
}
@@ -341,7 +341,9 @@
//寮�濮嬩笅涓�姝ラ
videoInspectTask.setCurrentStepId(nextStepId);
startRunStep(videoInspectTask);
- }else{tryGuide(videoInspectTask);}
+ } else {
+ tryGuide(videoInspectTask);
+ }
}
}
} else {
@@ -450,7 +452,7 @@
cmd.setChannelNum(channel);
cmd.setTargetPosition(targetPositon);
cmd.setOperator("sys_patrol_inspect");
- cmd.setExpired(step.getRecordingTime()*60);
+ cmd.setExpired(step.getRecordingTime() * 60);
boolean setTargetPosition = hikClientService.guideTargetPosition(cmd);
if (setTargetPosition) {
/*鎺у埗鐩告満宸℃鎴愬姛锛屽紑濮嬪綍鍍�*/
@@ -466,6 +468,7 @@
log.error("宸℃寮�濮嬪紓甯革細" + ex.getMessage());
}
}
+
//灏濊瘯鎺у埗寮曞
private void tryGuide(ArdVideoInspectTask ardVideoInspectTask) {
try {
@@ -502,15 +505,13 @@
cmd.setChannelNum(channel);
cmd.setTargetPosition(targetPositon);
cmd.setOperator("sys_patrol_inspect");
- cmd.setExpired(step.getRecordingTime()*60);
+ cmd.setExpired(step.getRecordingTime() * 60);
boolean setTargetPosition = hikClientService.guideTargetPosition(cmd);
if (!setTargetPosition) {
/*鎺у埗澶辫触,褰撳墠姝ラ鍚姩鏃堕棿缃畁ull*/
ardVideoInspectTask.setCurrentStepStartTime("");
ardVideoInspectTaskMapper.updateArdVideoInspectTaskWithCurrentSetpInfo(ardVideoInspectTask);
- }
- else
- {
+ } else {
log.debug("寮曞鎴愬姛!");
}
}
@@ -519,6 +520,7 @@
log.error("宸℃灏濊瘯寮曞寮傚父锛�" + ex.getMessage());
}
}
+
//姝ラ鍋滄
private void stopRunStep(ArdVideoInspectTask ardVideoInspectTask) {
try {
@@ -542,8 +544,8 @@
cmd.setChannelNum(channel);
cmd.setOperator("sys_patrol_inspect");
cmd.setRecordBucketName("record");
- cmd.setRecordObjectName("inspect_"+ IdUtils.fastSimpleUUID());
- String url= hikClientService.recordStopToMinio(cmd);
+ cmd.setRecordObjectName("inspect_" + IdUtils.fastSimpleUUID());
+ String url = hikClientService.recordStopToMinio(cmd);
/*鎻掑叆宸℃璁板綍*/
ArdVideoInspectRecord ardVideoInspectRecord = new ArdVideoInspectRecord();
ardVideoInspectRecord.setStepId(step.getId());
@@ -636,6 +638,11 @@
return ardVideoInspectTaskMapper.getTaskUsedCameraPeriods(cameraId);
}
+ /**
+ * 鑾峰彇鐩告満鐨勭┖闂叉椂娈�
+ * @param cameraId
+ * @return
+ */
public List getCameraIdleTimeList(String cameraId) {
LinkedList<String> timeList = new LinkedList();
List<Map> usedPeriods = this.getTaskUsedCameraPeriods(cameraId);
@@ -645,21 +652,24 @@
timeList.add((String) p.get("end_time"));
}
//鍒ゆ柇绗竴涓捣濮嬬偣
- if (timeList.getFirst().equals("00:00:00")) {
- timeList.removeFirst();
- } else {
- timeList.addFirst("00:00:00");
- }
- //鍒ゆ柇鏈�鍚庝竴涓粨鏉熸椂闂�
- if (timeList.getLast().equals("23:59:59")) {
- timeList.removeLast();
- } else {
- timeList.addLast("23:59:59");
- }
- //浜嬩欢娈典负绌�,鍒欏叏澶╀綔涓轰竴涓椂闂存
- if (timeList.size() == 0) {
- timeList.add("00:00:00");
- timeList.add("23:59:59");
+ if (timeList.size() > 0) {
+ if ("00:00:00".equals(timeList.getFirst())) {
+ timeList.removeFirst();
+ } else {
+ timeList.addFirst("00:00:00");
+ }
+ //鍒ゆ柇鏈�鍚庝竴涓粨鏉熸椂闂�
+ if ("23:59:59".equals(timeList.getLast())) {
+ timeList.removeLast();
+ } else {
+ timeList.addLast("23:59:59");
+ }
+ //浜嬩欢娈典负绌�,鍒欏叏澶╀綔涓轰竴涓椂闂存
+ if (timeList.size() == 0) {
+ timeList.add("00:00:00");
+ timeList.add("23:59:59");
+ }
+
}
return timeList;
--
Gitblit v1.9.3