Bläddra i källkod

激光场景更新status.json上传模式变更

dsx 1 år sedan
förälder
incheckning
0198bef9c5

+ 5 - 1
src/main/java/com/fdkankan/contro/mq/listener/UpdateSceneStatusListener.java

@@ -2,7 +2,9 @@ package com.fdkankan.contro.mq.listener;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.model.constants.ConstantFilePath;
 import com.fdkankan.model.constants.UploadFilePath;
 import com.rabbitmq.client.Channel;
 import lombok.extern.slf4j.Slf4j;
@@ -12,6 +14,7 @@ import org.springframework.amqp.rabbit.annotation.RabbitListener;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.io.File;
 import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 
@@ -43,7 +46,8 @@ public class UpdateSceneStatusListener {
             String fileContent = fYunFileService.getFileContent(statusJsonPath);
             JSONObject jsonObject = JSON.parseObject(fileContent);
             jsonObject.put("status", status);
-            fYunFileService.uploadFile(jsonObject.toJSONString().getBytes(), statusJsonPath);
+            FileUtils.writeFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json", jsonObject.toJSONString());
+            fYunFileService.uploadFile(ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json", statusJsonPath);
         }catch (Exception e){
             log.error("更新场景的的status.json状态, content:{}", msg, e);
         }finally {