Преглед на файлове

Merge remote-tracking branch 'origin/write-file-error'

# Conflicts:
#	src/main/java/com/fdkankan/ucenter/service/impl/SceneCommonService.java
lyhzzz преди 1 година
родител
ревизия
b58bf709be
променени са 2 файла, в които са добавени 4 реда и са изтрити 25 реда
  1. 4 4
      src/main/java/com/fdkankan/ucenter/service/impl/SceneCommonService.java
  2. 0 21
      src/main/java/com/fdkankan/ucenter/util/FileUtil.java

+ 4 - 4
src/main/java/com/fdkankan/ucenter/service/impl/SceneCommonService.java

@@ -142,11 +142,11 @@ public class SceneCommonService {
                     if(fileName.contains("scene.json")){
                         JSONObject jsonObject = JSONObject.parseObject(newJson);
                         jsonObject.put("sceneName",newSceneName);
-                        com.fdkankan.ucenter.util.FileUtil.writeFile(localPath,jsonObject.toJSONString());
+                        FileUtils.writeFile(localPath ,jsonObject.toJSONString());
                         String sceneJsonPath = String.format(SceneResourcePath.dataPath+"/"+fileName, newNum);
                         fYunFileServiceInterface.uploadFile(localPath, sceneJsonPath);
                     }else {
-                        com.fdkankan.ucenter.util.FileUtil.writeFile(localPath,newJson);
+                        FileUtils.writeFile(localPath ,newJson);
                     }
 
                 }
@@ -154,7 +154,7 @@ public class SceneCommonService {
                     JSONObject jsonObject = JSONObject.parseObject(newJson);
                     jsonObject.put("title",newSceneName);
                     jsonObject.put("dynamicPanel",0);
-                    com.fdkankan.ucenter.util.FileUtil.writeFile(localPath,jsonObject.toJSONString());
+                    FileUtils.writeFile(localPath, jsonObject.toJSONString());
 
                     String sceneJsonPath = String.format(SceneResourcePath.DATA_VIEW_PATH+"/" + fileName, newNum);
                     fYunFileServiceInterface.uploadFile(localPath, sceneJsonPath);
@@ -204,7 +204,7 @@ public class SceneCommonService {
         if(StringUtils.isNotBlank(fileContent)){
             String newJson = fileContent.replaceAll(oldNum,newNum);
             try {
-                com.fdkankan.ucenter.util.FileUtil.writeFile(localPath,newJson);
+                FileUtils.writeFile(localPath, newJson);
                 fYunFileServiceInterface.uploadFile(localPath,ossStatusJsonPath);
             }catch (Exception e){
                 log.error("writeFile-error:{}",e);

+ 0 - 21
src/main/java/com/fdkankan/ucenter/util/FileUtil.java

@@ -1,21 +0,0 @@
-package com.fdkankan.ucenter.util;
-
-import java.io.*;
-
-public class FileUtil {
-
-    public static void writeFile(String filePath,String str) throws IOException {
-
-        File fout = new File(filePath);
-        if(!fout.getParentFile().exists()){
-            fout.getParentFile().mkdirs();
-        }
-        if(!fout.exists()){
-            fout.createNewFile();
-        }
-        FileOutputStream fos = new FileOutputStream(fout);
-        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos));
-        bw.write(str);
-        bw.close();
-    }
-}