diff --git a/web/src/main/java/com/zhehekeji/web/lib/hik/HikCameraControlModuleImpl.java b/web/src/main/java/com/zhehekeji/web/lib/hik/HikCameraControlModuleImpl.java index 450d517..b95859f 100644 --- a/web/src/main/java/com/zhehekeji/web/lib/hik/HikCameraControlModuleImpl.java +++ b/web/src/main/java/com/zhehekeji/web/lib/hik/HikCameraControlModuleImpl.java @@ -257,7 +257,8 @@ public class HikCameraControlModuleImpl implements CameraControlModule { } public void downloadMp4(Integer cameraId, String path, LocalDateTime start, LocalDateTime end) { - + start = start.minusMinutes(1); + end = end.minusMinutes(1); PathUtil.checkDirc(path); Duration duration = Duration.between(start, end); Long seconds = duration.getSeconds(); diff --git a/web/src/main/java/com/zhehekeji/web/service/hikLightSource/HikControlSocket.java b/web/src/main/java/com/zhehekeji/web/service/hikLightSource/HikControlSocket.java index a31060e..784a665 100644 --- a/web/src/main/java/com/zhehekeji/web/service/hikLightSource/HikControlSocket.java +++ b/web/src/main/java/com/zhehekeji/web/service/hikLightSource/HikControlSocket.java @@ -19,13 +19,13 @@ public class HikControlSocket { * <${端口号},${开关状态(0:关 1:开)},${get\post}> */ public static void main(String[] args) { - String code = openLight("172.16.0.82", 9000,2,0); - System.out.println(code); + int code = openLight("172.16.0.72", 9000,2,0); + } - public static String openLight(String ip,int port,int index,int bool){ + public static int openLight(String ip,int port,int index,int bool){ Socket socket = new Socket(); - String code = null; + int status = 0; OutputStream os = null; InputStream is = null; try { @@ -59,8 +59,8 @@ public class HikControlSocket { } catch (IOException e) { e.printStackTrace(); } + return status; - return code; } } @@ -78,12 +78,6 @@ public class HikControlSocket { os.write(bytes); } - private static void getStatus(OutputStream os,int index) throws IOException { - String startCmd = "<"+index+","+0+","+"get>"; - byte [] bytes = startCmd.getBytes(StandardCharsets.UTF_8); - os.write(bytes); - } - private static String read(InputStream inStream) throws IOException { StringBuffer sb = new StringBuffer(); int start = -1; @@ -95,7 +89,7 @@ public class HikControlSocket { inStream.read(buffer); String s = new String(buffer, Charset.forName("utf-8")); sb.append(s); - System.out.println(s); + if(start < 0){ start = sb.indexOf("<"); } @@ -105,7 +99,7 @@ public class HikControlSocket { } }while (start <0 || end <= start); - return sb.substring(start,end); + return sb.substring(start,end+1); } }