|
@@ -3,9 +3,15 @@ package com.fdkankan.manage.httpClient.service;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
+import com.fdkankan.common.constant.ErrorCode;
|
|
|
|
+import com.fdkankan.common.constant.HttpCode;
|
|
|
|
+import com.fdkankan.common.exception.BusinessException;
|
|
import com.fdkankan.common.response.PageInfo;
|
|
import com.fdkankan.common.response.PageInfo;
|
|
import com.fdkankan.common.response.Result;
|
|
import com.fdkankan.common.response.Result;
|
|
import com.fdkankan.common.util.DateUtil;
|
|
import com.fdkankan.common.util.DateUtil;
|
|
|
|
+import com.fdkankan.manage.common.CameraTypeEnum;
|
|
|
|
+import com.fdkankan.manage.entity.Camera;
|
|
|
|
+import com.fdkankan.manage.entity.CameraDetail;
|
|
import com.fdkankan.manage.entity.User;
|
|
import com.fdkankan.manage.entity.User;
|
|
import com.fdkankan.manage.httpClient.client.LaserClient;
|
|
import com.fdkankan.manage.httpClient.client.LaserClient;
|
|
import com.fdkankan.manage.httpClient.param.LaserSceneMoveParam;
|
|
import com.fdkankan.manage.httpClient.param.LaserSceneMoveParam;
|
|
@@ -42,8 +48,6 @@ public class LaserService {
|
|
@Autowired
|
|
@Autowired
|
|
IUserService userService;
|
|
IUserService userService;
|
|
|
|
|
|
- private final String SAVE_SCENE_URL_TEMPLATE="/laser/init/%s/saveOrEdit";
|
|
|
|
-
|
|
|
|
|
|
|
|
public PageInfo pageList(SceneParam param) {
|
|
public PageInfo pageList(SceneParam param) {
|
|
LaserSceneParam newParam = new LaserSceneParam();
|
|
LaserSceneParam newParam = new LaserSceneParam();
|
|
@@ -113,9 +117,6 @@ public class LaserService {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- private RestTemplate restTemplate = new RestTemplate();
|
|
|
|
-
|
|
|
|
-
|
|
|
|
public void copy(String snCode, String createTime, String newNum, Integer status, String sceneKey, String sceneName, Long userId){
|
|
public void copy(String snCode, String createTime, String newNum, Integer status, String sceneKey, String sceneName, Long userId){
|
|
String phone = null;
|
|
String phone = null;
|
|
if(userId != null){
|
|
if(userId != null){
|
|
@@ -124,7 +125,6 @@ public class LaserService {
|
|
phone = user.getUserName();
|
|
phone = user.getUserName();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- String url = basePath + String.format(SAVE_SCENE_URL_TEMPLATE,newNum);
|
|
|
|
Map<String,Object> params = new HashMap<>();
|
|
Map<String,Object> params = new HashMap<>();
|
|
params.put("childName",snCode);
|
|
params.put("childName",snCode);
|
|
params.put("createTime", createTime);
|
|
params.put("createTime", createTime);
|
|
@@ -136,24 +136,38 @@ public class LaserService {
|
|
params.put("title", sceneName);
|
|
params.put("title", sceneName);
|
|
params.put("userId", userId);
|
|
params.put("userId", userId);
|
|
params.put("copy", true);
|
|
params.put("copy", true);
|
|
- log.info("自研激光转台相机同步,url:{},params:{}",url, JSONObject.toJSONString(params));
|
|
|
|
- ResponseEntity<Result> responseEntity = restTemplate.postForEntity(url,params, Result.class);
|
|
|
|
- log.info("自研激光转台相机同步,url:{},params:{},结果,{}",url, JSONObject.toJSONString(params),JSONObject.toJSONString(responseEntity.getBody()));
|
|
|
|
- if(responseEntity.getStatusCode() != HttpStatus.OK || responseEntity.getBody().getCode() != HttpStatus.OK.value()){
|
|
|
|
|
|
+ Result result = laserClient.saveOrEdit(newNum, params);
|
|
|
|
+ if( result.getCode() != HttpStatus.OK.value()){
|
|
log.error("激光场景状态同步失败!");
|
|
log.error("激光场景状态同步失败!");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public void delete(String num) {
|
|
public void delete(String num) {
|
|
- String url = basePath + String.format(SAVE_SCENE_URL_TEMPLATE,num);
|
|
|
|
Map<String,Object> params = new HashMap<>();
|
|
Map<String,Object> params = new HashMap<>();
|
|
params.put("sceneCode", num);
|
|
params.put("sceneCode", num);
|
|
params.put("status", -1);
|
|
params.put("status", -1);
|
|
- log.info("自研激光转台相机同步,url:{},params:{}",url, JSONObject.toJSONString(params));
|
|
|
|
- ResponseEntity<Result> responseEntity = restTemplate.postForEntity(url,params, Result.class);
|
|
|
|
- log.info("自研激光转台相机同步,url:{},params:{},结果:{}",url, JSONObject.toJSONString(params),JSONObject.toJSONString(responseEntity.getBody()));
|
|
|
|
- if(responseEntity.getStatusCode() != HttpStatus.OK || responseEntity.getBody().getCode() != HttpStatus.OK.value()){
|
|
|
|
|
|
+ Result result = laserClient.saveOrEdit(num, params);
|
|
|
|
+ if(result.getCode() != HttpStatus.OK.value()){
|
|
log.error("激光场景状态同步失败!");
|
|
log.error("激光场景状态同步失败!");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public void disableCooperation(String snCode, String cooperationUserName){
|
|
|
|
+ List<Map<String, String>> laserParams = new ArrayList<>();
|
|
|
|
+ Map<String, String> param = new HashMap<>();
|
|
|
|
+ param.put("snCode", snCode);
|
|
|
|
+ param.put("cooperationUserName", cooperationUserName);
|
|
|
|
+ laserParams.add(param);
|
|
|
|
+ this.disableCooperation(laserParams);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void disableCooperation(List<Map<String, String>> params) {
|
|
|
|
+ if(params.size() <=0){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ laserClient.cooperationDisable(params);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|