|
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.nacos.common.http.client.NacosAsyncRestTemplate;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.fdkankan.common.util.FileUtils;
|
|
|
+import com.fdkankan.rabbitmq.util.RabbitMqProducer;
|
|
|
import com.fdkankan.ucenter.common.CameraTypeEnum;
|
|
|
import com.fdkankan.ucenter.common.Result;
|
|
|
import com.fdkankan.ucenter.common.constants.NacosProperty;
|
|
@@ -28,6 +29,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.http.HttpEntity;
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
import org.springframework.http.HttpStatus;
|
|
@@ -52,6 +54,10 @@ public class LaserService {
|
|
|
ICameraService cameraService;
|
|
|
@Autowired
|
|
|
ICameraDetailService cameraDetailService;
|
|
|
+ @Autowired
|
|
|
+ private RabbitMqProducer rabbitMqProducer;
|
|
|
+ @Value("${queue.application.laser.copy-scene:laser-copy-scene}")
|
|
|
+ private String laserCopyScene;
|
|
|
/**
|
|
|
* 根据用户获取激光相机数量
|
|
|
* @param token
|
|
@@ -180,35 +186,13 @@ public class LaserService {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public void copy(Long camaraId, String createTime, String newNum, Integer status,
|
|
|
- String path, String sceneKey, String sceneName, Long userId,String version){
|
|
|
- String phone = null;
|
|
|
- String snCode = null;
|
|
|
- if(userId != null){
|
|
|
- User user = userService.getById(userId);
|
|
|
- phone = user == null ? null :user.getUserName();
|
|
|
- }
|
|
|
- if(camaraId != null){
|
|
|
- Camera camera = cameraService.getById(camaraId);
|
|
|
- snCode = camera == null ? null :camera.getSnCode();
|
|
|
- }
|
|
|
+ public void copy(String oldNum , String newNum, String path,Boolean flag){
|
|
|
Map<String,Object> params = new HashMap<>();
|
|
|
- params.put("childName",snCode);
|
|
|
- params.put("createTime", createTime);
|
|
|
- params.put("phone", phone);
|
|
|
params.put("sceneCode", newNum);
|
|
|
- params.put("snCode",snCode);
|
|
|
- params.put("status", status);
|
|
|
- params.put("password", sceneKey);
|
|
|
- params.put("title", sceneName);
|
|
|
- params.put("userId", userId);
|
|
|
- params.put("isCopy", true);
|
|
|
+ params.put("oldSceneCode", oldNum);
|
|
|
params.put("path",path);
|
|
|
- params.put("version",version);
|
|
|
- Result result = laserClient.saveOrEdit(newNum, params);
|
|
|
- if( result.getCode() != HttpStatus.OK.value()){
|
|
|
- log.error("激光场景状态同步失败!");
|
|
|
- }
|
|
|
+ params.put("init",flag);
|
|
|
+ rabbitMqProducer.sendByWorkQueue(laserCopyScene,params);
|
|
|
}
|
|
|
|
|
|
public List<SceneBySnCodeVo> getScenesBySnCode(String snCode, String token) {
|