|
@@ -1,5 +1,6 @@
|
|
|
package com.bosshand.virgo.file.service;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.bosshand.virgo.exception.ServiceException;
|
|
|
import com.bosshand.virgo.file.dao.FileNodeDao;
|
|
|
import com.bosshand.virgo.file.model.FileNode;
|
|
@@ -225,14 +226,20 @@ public class FileManagerService {
|
|
|
}
|
|
|
|
|
|
public String getHtml(int id, String name) throws UnsupportedEncodingException {
|
|
|
- List<FileNode> list = list(id);
|
|
|
- for (FileNode node : list) {
|
|
|
- if (node.getName().equals(name)) {
|
|
|
- byte[] aByte = getByte(node.getId());
|
|
|
- return new String(aByte, "UTF-8");
|
|
|
- }
|
|
|
+ FileNode node = fileNodeDao.getParentIdName(id, name);
|
|
|
+ if (node != null) {
|
|
|
+ byte[] aByte = getByte(node.getId());
|
|
|
+ return new String(aByte, "UTF-8");
|
|
|
}
|
|
|
return "";
|
|
|
}
|
|
|
|
|
|
+ public void updateHtml(JSONObject jsonObject) {
|
|
|
+ FileNode node = fileNodeDao.get(jsonObject.getIntValue("id"));
|
|
|
+ String html = jsonObject.getString("html");
|
|
|
+ InputStream is = new ByteArrayInputStream(html.getBytes());
|
|
|
+ node.setNode(AliyunOSSUtil.upload(is));
|
|
|
+ update(node);
|
|
|
+ }
|
|
|
+
|
|
|
}
|