|
@@ -9,15 +9,12 @@ import com.fdkankan.contro.entity.ScenePro;
|
|
import com.fdkankan.contro.service.IFdkkLaserService;
|
|
import com.fdkankan.contro.service.IFdkkLaserService;
|
|
import com.fdkankan.contro.service.IScenePlusService;
|
|
import com.fdkankan.contro.service.IScenePlusService;
|
|
import com.fdkankan.contro.service.ISceneProService;
|
|
import com.fdkankan.contro.service.ISceneProService;
|
|
-import com.fdkankan.web.response.Result;
|
|
|
|
|
|
+import com.fdkankan.rabbitmq.util.RabbitMqProducer;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
-import org.springframework.http.HttpStatus;
|
|
|
|
-import org.springframework.http.ResponseEntity;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.util.ObjectUtils;
|
|
import org.springframework.util.ObjectUtils;
|
|
-import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
@@ -28,23 +25,23 @@ import java.util.Map;
|
|
@Slf4j
|
|
@Slf4j
|
|
public class IFdkkLaserServiceImpl implements IFdkkLaserService {
|
|
public class IFdkkLaserServiceImpl implements IFdkkLaserService {
|
|
|
|
|
|
- private final String SAVE_SCENE_URL_TEMPLATE = "/laser/init/%s/saveOrEdit";
|
|
|
|
- private final String EDIT_LASER_BUILD_STATUS_URL = "/laser/4dage/scene/editBuildStatus";
|
|
|
|
- private final String ENABLE_COOPERATION_CAMERA_URL = "/laser/4dage/scene/cooperation/cameraSave";
|
|
|
|
-
|
|
|
|
- @Value("${4dkk.laserService.host}")
|
|
|
|
- private String laserHost;
|
|
|
|
-
|
|
|
|
- private RestTemplate restTemplate = new RestTemplate();
|
|
|
|
-
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private ISceneProService sceneProService;
|
|
private ISceneProService sceneProService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private IScenePlusService scenePlusService;
|
|
private IScenePlusService scenePlusService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private RabbitMqProducer rabbitMqProducer;
|
|
|
|
+
|
|
|
|
+ @Value("${queue.application.laser.update-scene}")
|
|
|
|
+ private String updateScene;
|
|
|
|
+
|
|
|
|
+ @Value("${queue.application.laser.update-build-status}")
|
|
|
|
+ private String updateBuildStatus;
|
|
|
|
+
|
|
|
|
+
|
|
public void updateSceneStatus(String sceneCode, int sceneStatus, String path, Date createTime) {
|
|
public void updateSceneStatus(String sceneCode, int sceneStatus, String path, Date createTime) {
|
|
- String url = laserHost + String.format(SAVE_SCENE_URL_TEMPLATE, sceneCode);
|
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
Map<String, Object> params = new HashMap<>();
|
|
params.put("sceneCode", sceneCode);
|
|
params.put("sceneCode", sceneCode);
|
|
params.put("status", sceneStatus);
|
|
params.put("status", sceneStatus);
|
|
@@ -53,12 +50,7 @@ public class IFdkkLaserServiceImpl implements IFdkkLaserService {
|
|
if (!ObjectUtils.isEmpty(path)) {
|
|
if (!ObjectUtils.isEmpty(path)) {
|
|
params.put("path", path);
|
|
params.put("path", path);
|
|
}
|
|
}
|
|
- 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()) {
|
|
|
|
- log.error("激光场景状态同步失败!");
|
|
|
|
- }
|
|
|
|
|
|
+ rabbitMqProducer.sendByWorkQueue(updateScene, params);
|
|
}
|
|
}
|
|
|
|
|
|
public void syncBuildResult(String sceneNum, String dataSource,Date createTime) {
|
|
public void syncBuildResult(String sceneNum, String dataSource,Date createTime) {
|
|
@@ -97,21 +89,14 @@ public class IFdkkLaserServiceImpl implements IFdkkLaserService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void pushBuildStatusToLaserSystem(String projectNum, String laserObjFilePath) {
|
|
public void pushBuildStatusToLaserSystem(String projectNum, String laserObjFilePath) {
|
|
- String url = laserHost + EDIT_LASER_BUILD_STATUS_URL;
|
|
|
|
Map<String, String> params = new HashMap<>();
|
|
Map<String, String> params = new HashMap<>();
|
|
params.put("sceneCode", projectNum);
|
|
params.put("sceneCode", projectNum);
|
|
params.put("objPath", laserObjFilePath);
|
|
params.put("objPath", laserObjFilePath);
|
|
- log.info("激光系统同步BuildStatus,url:{},params:{}", ENABLE_COOPERATION_CAMERA_URL, JSONObject.toJSONString(params));
|
|
|
|
- ResponseEntity<com.fdkankan.contro.common.Result> responseEntity = restTemplate.postForEntity(url, params, com.fdkankan.contro.common.Result.class);
|
|
|
|
- log.info("激光系统同步BuildStatus,url:{},params:{},结果:{}", url, JSONObject.toJSONString(params), JSONObject.toJSONString(responseEntity.getBody()));
|
|
|
|
- if (responseEntity.getStatusCode() != HttpStatus.OK || responseEntity.getBody().getCode() != HttpStatus.OK.value()) {
|
|
|
|
- log.error("激光系统同步BuildStatus");
|
|
|
|
- }
|
|
|
|
|
|
+ rabbitMqProducer.sendByWorkQueue(updateBuildStatus, params);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public void saveScene(ScenePlus scenePlus, String scenePassword, Camera cameraEntity, String phone, boolean rebuild) {
|
|
public void saveScene(ScenePlus scenePlus, String scenePassword, Camera cameraEntity, String phone, boolean rebuild) {
|
|
- String url = laserHost + String.format(SAVE_SCENE_URL_TEMPLATE, scenePlus.getNum());
|
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
Map<String, Object> params = new HashMap<>();
|
|
params.put("childName", cameraEntity.getChildName());
|
|
params.put("childName", cameraEntity.getChildName());
|
|
params.put("createTime", DateUtil.date2String(scenePlus.getCreateTime(), null));
|
|
params.put("createTime", DateUtil.date2String(scenePlus.getCreateTime(), null));
|
|
@@ -127,18 +112,15 @@ public class IFdkkLaserServiceImpl implements IFdkkLaserService {
|
|
params.put("version",getSceneVersion(scenePlus.getNum()));
|
|
params.put("version",getSceneVersion(scenePlus.getNum()));
|
|
params.put("title", scenePlus.getTitle());
|
|
params.put("title", scenePlus.getTitle());
|
|
params.put("userId", scenePlus.getUserId());
|
|
params.put("userId", scenePlus.getUserId());
|
|
- 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()) {
|
|
|
|
- log.error("激光场景状态同步失败!");
|
|
|
|
- }
|
|
|
|
|
|
+ rabbitMqProducer.sendByWorkQueue(updateScene, params);
|
|
}
|
|
}
|
|
|
|
|
|
public void saveScene(ScenePro scenePro, String scenePassword, Camera cameraEntity, String phone, boolean rebuild) {
|
|
public void saveScene(ScenePro scenePro, String scenePassword, Camera cameraEntity, String phone, boolean rebuild) {
|
|
- String url = laserHost + String.format(SAVE_SCENE_URL_TEMPLATE, scenePro.getNum());
|
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
Map<String, Object> params = new HashMap<>();
|
|
params.put("childName", cameraEntity.getChildName());
|
|
params.put("childName", cameraEntity.getChildName());
|
|
|
|
+ if(ObjectUtils.isEmpty(scenePro.getCreateTime())){
|
|
|
|
+ scenePro.setCreateTime(new Date());
|
|
|
|
+ }
|
|
params.put("createTime", DateUtil.date2String(scenePro.getCreateTime(), null));
|
|
params.put("createTime", DateUtil.date2String(scenePro.getCreateTime(), null));
|
|
params.put("phone", phone);
|
|
params.put("phone", phone);
|
|
params.put("sceneCode", scenePro.getNum());
|
|
params.put("sceneCode", scenePro.getNum());
|
|
@@ -152,12 +134,7 @@ public class IFdkkLaserServiceImpl implements IFdkkLaserService {
|
|
params.put("version",getSceneVersion(scenePro.getNum()));
|
|
params.put("version",getSceneVersion(scenePro.getNum()));
|
|
params.put("title", scenePro.getSceneName());
|
|
params.put("title", scenePro.getSceneName());
|
|
params.put("userId", scenePro.getUserId());
|
|
params.put("userId", scenePro.getUserId());
|
|
- 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()) {
|
|
|
|
- log.error("激光场景状态同步失败!");
|
|
|
|
- }
|
|
|
|
|
|
+ rabbitMqProducer.sendByWorkQueue(updateScene, params);
|
|
}
|
|
}
|
|
|
|
|
|
private String getSceneVersion(String num) {
|
|
private String getSceneVersion(String num) {
|