浏览代码

删除深时场景

lyhzzz 3 年之前
父节点
当前提交
1efbc94b21

+ 18 - 1
src/main/java/com/fdkankan/manage/httpClient/service/LaserService.java

@@ -22,6 +22,7 @@ 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.util.ObjectUtils;
 import org.springframework.web.client.RestTemplate;
 
 import javax.annotation.Resource;
@@ -41,6 +42,9 @@ public class LaserService {
     @Autowired
     IUserService userService;
 
+    private final String SAVE_SCENE_URL_TEMPLATE="/laser/init/%s/saveOrEdit";
+
+
     public PageInfo pageList(SceneParam param) {
         LaserSceneParam newParam = new LaserSceneParam();
         BeanUtils.copyProperties(param,newParam);
@@ -120,7 +124,7 @@ public class LaserService {
                 phone = user.getUserName();
             }
         }
-        String url = basePath + String.format("/laser/init/%s/saveOrEdit",newNum);
+        String url = basePath + String.format(SAVE_SCENE_URL_TEMPLATE,newNum);
         Map<String,Object> params = new HashMap<>();
         params.put("childName",snCode);
         params.put("createTime", createTime);
@@ -139,4 +143,17 @@ public class LaserService {
             log.error("激光场景状态同步失败!");
         }
     }
+
+    public void delete(String num) {
+        String url = basePath + String.format(SAVE_SCENE_URL_TEMPLATE,num);
+        Map<String,Object> params = new HashMap<>();
+        params.put("sceneCode", num);
+        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()){
+            log.error("激光场景状态同步失败!");
+        }
+    }
 }

+ 6 - 0
src/main/java/com/fdkankan/manage/service/impl/SceneProServiceImpl.java

@@ -335,6 +335,9 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         ScenePro scenePro = this.getByNum(num);
         if(scenePro!=null){
             this.removeById(scenePro.getId());
+            if(scenePro.getSceneType() == 4){
+                laserService.delete(num);
+            }
         }
         Scene scene = sceneService.getByNum(num);
         if(scene!=null){
@@ -343,6 +346,9 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         ScenePlus scenePlus = scenePlusService.getByNum(num);
         if(scenePlus!=null){
             scenePlusService.removeById(scenePlus.getId());
+            if(scenePlus.getSceneType() == 4){
+                laserService.delete(num);
+            }
         }
     }