Просмотр исходного кода

摄像头执行返回数据code优化调整
摄像头请求参数路径优化

hanzhiwei лет назад: 2
Родитель
Сommit
01a4b35fa8

+ 6 - 3
zd-modules/zd-algorithm/src/main/java/com/zd/alg/iot/vmp/onvif/impl/ONVIFServerIMpl.java

@@ -12,11 +12,11 @@ import be.teletask.onvif.models.OnvifMediaProfile;
 import be.teletask.onvif.models.OnvifServices;
 import be.teletask.onvif.responses.OnvifResponse;
 import com.alibaba.fastjson.JSONObject;
-import com.zd.alg.iot.vmp.service.IStreamProxyService;
 import com.zd.alg.iot.vmp.media.zlm.dto.MediaServerItem;
 import com.zd.alg.iot.vmp.media.zlm.dto.StreamProxyItem;
 import com.zd.alg.iot.vmp.onvif.IONVIFServer;
 import com.zd.alg.iot.vmp.onvif.dto.ONVIFCallBack;
+import com.zd.alg.iot.vmp.service.IStreamProxyService;
 import okhttp3.FormBody;
 import okhttp3.OkHttpClient;
 import okhttp3.Request;
@@ -24,6 +24,7 @@ import okhttp3.Response;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import java.io.File;
@@ -42,6 +43,10 @@ public class ONVIFServerIMpl implements IONVIFServer {
 
     @Autowired
     private IStreamProxyService streamProxyService;
+    @Value("${file.path}")
+    private String rootPath;
+    @Value("${file.prefix}")
+    private String prefixPath;
 
     @Override
     public void search(int timeout, ONVIFCallBack<List<String>> callBack) {
@@ -188,8 +193,6 @@ public class ONVIFServerIMpl implements IONVIFServer {
         String separator= File.separator;
         SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd");
         String strTime=simpleDateFormat.format(new Date());
-        String rootPath="/home/upload";
-        String prefixPath="statics";
         String joinPath=separator+"record"+separator+param.get("app")+separator+param.get("stream")+separator+strTime+separator;
         String urlPath=rootPath+joinPath;
         String returnPath=prefixPath+joinPath;

+ 5 - 1
zd-modules/zd-algorithm/src/main/java/com/zd/alg/iot/vmp/vmanager/onvif/ONVIFController.java

@@ -171,7 +171,11 @@ public class ONVIFController {
                     resultData.setMsg("视频录制中无法重复录制!");
                 }else{
                     JSONObject object=onvifServer.startRecord(mediaServerItem,map);
-                    resultData.setCode(object.getInteger("code"));
+                    if(object.getInteger("code")==0){
+                        resultData.setCode(200);
+                    }else{
+                        resultData.setCode(object.getInteger("code"));
+                    }
                     resultData.setData(object.getString("result"));
                     resultData.setMsg(object.getString("msg"));
                 }