|
@@ -1,8 +1,11 @@
|
|
package com.fdkankan.ucenter.httpClient.service;
|
|
package com.fdkankan.ucenter.httpClient.service;
|
|
|
|
|
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.fdkankan.common.util.FileUtils;
|
|
import com.fdkankan.ucenter.common.CameraTypeEnum;
|
|
import com.fdkankan.ucenter.common.CameraTypeEnum;
|
|
import com.fdkankan.ucenter.common.Result;
|
|
import com.fdkankan.ucenter.common.Result;
|
|
|
|
+import com.fdkankan.ucenter.common.utils.ShellUtil;
|
|
import com.fdkankan.ucenter.entity.Camera;
|
|
import com.fdkankan.ucenter.entity.Camera;
|
|
import com.fdkankan.ucenter.entity.CameraDetail;
|
|
import com.fdkankan.ucenter.entity.CameraDetail;
|
|
import com.fdkankan.ucenter.entity.User;
|
|
import com.fdkankan.ucenter.entity.User;
|
|
@@ -11,6 +14,7 @@ import com.fdkankan.ucenter.service.ICameraService;
|
|
import com.fdkankan.ucenter.service.IUserService;
|
|
import com.fdkankan.ucenter.service.IUserService;
|
|
import com.fdkankan.ucenter.vo.response.SceneNumVo;
|
|
import com.fdkankan.ucenter.vo.response.SceneNumVo;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.http.HttpEntity;
|
|
import org.springframework.http.HttpEntity;
|
|
import org.springframework.http.HttpHeaders;
|
|
import org.springframework.http.HttpHeaders;
|
|
@@ -19,6 +23,8 @@ import org.springframework.http.ResponseEntity;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import java.io.File;
|
|
|
|
+import java.io.IOException;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -116,7 +122,37 @@ public class LaserService {
|
|
return JSONObject.parseObject(JSONObject.toJSONString(result.getData()));
|
|
return JSONObject.parseObject(JSONObject.toJSONString(result.getData()));
|
|
}
|
|
}
|
|
|
|
|
|
- public void copy(Long camaraId, String createTime, String newNum, Integer status, String sceneKey, String sceneName, Long userId){
|
|
|
|
|
|
+
|
|
|
|
+ public String copyDataSource( String oldDataSource,String dataSource) {
|
|
|
|
+ //计算成功 激光转台相机推送
|
|
|
|
+ log.info("激光转台相机 同步 请求 ");
|
|
|
|
+ try {
|
|
|
|
+ //创建目录
|
|
|
|
+ if(oldDataSource.lastIndexOf("/")!=-1){
|
|
|
|
+ oldDataSource = oldDataSource + "_laserData";
|
|
|
|
+ }else{
|
|
|
|
+ oldDataSource = oldDataSource.substring(0,oldDataSource.length()-1) + "_laserData";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(dataSource.lastIndexOf("/")!=-1){
|
|
|
|
+ dataSource = dataSource + "_laserData";
|
|
|
|
+ }else{
|
|
|
|
+ dataSource = dataSource.substring(0,dataSource.length()-1) + "_laserData";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ FileUtils.copyDirectiory(oldDataSource ,dataSource);
|
|
|
|
+
|
|
|
|
+ return dataSource + File.separator + "laserData";
|
|
|
|
+
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public void copy(Long camaraId, String createTime, String newNum, Integer status,
|
|
|
|
+ String path, String sceneKey, String sceneName, Long userId){
|
|
String phone = null;
|
|
String phone = null;
|
|
String snCode = null;
|
|
String snCode = null;
|
|
if(userId != null){
|
|
if(userId != null){
|
|
@@ -133,15 +169,21 @@ public class LaserService {
|
|
params.put("phone", phone);
|
|
params.put("phone", phone);
|
|
params.put("sceneCode", newNum);
|
|
params.put("sceneCode", newNum);
|
|
params.put("snCode",snCode);
|
|
params.put("snCode",snCode);
|
|
- params.put("status", status);
|
|
|
|
|
|
+ params.put("status", 0);
|
|
params.put("password", sceneKey);
|
|
params.put("password", sceneKey);
|
|
params.put("title", sceneName);
|
|
params.put("title", sceneName);
|
|
params.put("userId", userId);
|
|
params.put("userId", userId);
|
|
- params.put("copy", true);
|
|
|
|
|
|
+ params.put("isCopy", true);
|
|
|
|
+ params.put("path",path);
|
|
Result result = laserClient.saveOrEdit(newNum, params);
|
|
Result result = laserClient.saveOrEdit(newNum, params);
|
|
if( result.getCode() != HttpStatus.OK.value()){
|
|
if( result.getCode() != HttpStatus.OK.value()){
|
|
log.error("激光场景状态同步失败!");
|
|
log.error("激光场景状态同步失败!");
|
|
}
|
|
}
|
|
|
|
+ params.put("status",2);
|
|
|
|
+ result = laserClient.saveOrEdit(newNum, params);
|
|
|
|
+ if( result.getCode() != HttpStatus.OK.value()){
|
|
|
|
+ log.error("激光场景状态同步失败!");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|