1. 概述
調用SDK本地接口可以實現添加自定義菜單并將選擇的文檔導出。主要可以分三步實現:添加菜單、接收id值、導出xml文檔。
2. 接口說明
根據文檔中文件夾ID(doc_resources表ID),獲取文件夾下文檔列表JSON信息(json信息中的fr_id屬性對應文檔doc_resources表ID)
使用接口:
http請求方式:POST http://ip:port/seeyon/rest/docs/search
參數DEMO:
Map newDep = new HashMap() {
{
put("archiveID", "144411942544885803"); //archiveID:文檔ID(必填):doc_resources表ID
put("searchType", "");//searchType:查詢類型(非必填)
put("propertyName", "");//propertyName:查詢參數名稱(非必填)
put("simple", "");//simple:是否簡單查詢(非必填)
put("value1", "");//value1:查詢值(非必填)
put("pageNo", "1");//頁數
put("pageSize", "20");//每頁條數
}
CTPRestClient client = RestResource.getInstance().resouresClent();
String result = client.post("docs/search",res, String.class);
返回值:
{
"total" : 1,
"data" : [ {
"fr_size" : 0,
"fr_mine_type" : 31,
"is_folder" : true,
"fr_type" : 31,
"fr_id" : "4909783689613689706", //doc_resources表ID
"fr_name" : "文檔統計信息",
"next_Doc_Num" : "1"
}],
"pageNo" : 1,
"pageSize" : 20
}
根據文檔ID(doc_resources表ID)獲取穩定ArcFolderItem對象信息。
使用接口:DocumentFactory
方法:exportArchive
參數:
參數 | 數據類型 | 說明 |
---|---|---|
id | Long | 要導出文檔在A8中的ID |
返回值:ArcFolderItem
3. 實現過程
3.1. 添加自定義菜單
詳細步驟請參考Portal集成-添加自定義菜單.
3.2. 第三方系統接收平臺傳遞的id
因為rightNew頁面已經提供點擊菜單傳遞id功能(注:V6.1新增了獲取文檔ID的接口,也可以通過上面【http://ip:port/seeyon/rest/docs/search】接口來獲取ID),所以這里我們只需要新建一個jsp頁面接收id就行。根據前面在docAddinMenu.xml文件中設定的url值指定的路徑新建一個docFlie.jsp文件。
由于點擊菜單以后是將選中的文檔id以逗號分隔發送到指定的頁面,所以這里我們可以使用request.getParameter取得
String thirdMenuIds=request.getParameter("thirdMenuIds"); String thirdIds[]=thirdMenuIds.split(",");
3.3. 導出指定文檔
在docFile.jsp中添加
<%@page import=”com.seeyon.v3x.services.document.DocumentFactory,com.seeyon.v3x.services.document.impl.DocumentManager”%>
在docFlie.jsp文件中添加邏輯代碼,在這里我們采用java.io.StringWriter接受導出的文件用saveToPropertyList().saveXMLToStream(StringWritersw)方法。
if (thirdMenuIds != null && thirdMenuIds.length() > 0) {
String thirdIds[] = thirdMenuIds.split(",");
try {
DocumentFactory factory = DocumentManager.getInstance();
for (int i = 0; i < thirdIds.length; i++) {
ArcFolderItem doc = factory.exportArchive(Long
.valueOf(thirdIds[i]));
StringWriter sw = new StringWriter();
doc.saveToPropertyList().saveXMLToStream(sw);
// 將導出的XML調用第三方系統的接口,導入到第三方檔案系統
}
} catch (Exception e) {
System.out.println("出異常了");
}
}
將導出的xml文件輸出到指定的外部文件中,用org.dom4j.io.XMLWriter寫到文件中,也可用其他方式寫文件。在import中增加
org.dom4j.io.*,
在for循環前面添加代碼:
XMLWriter output=new XMLWriter(new FileWriter("d:/aaa.xml"));
output.setEscapeText(false);//設置后可以防止導出后的文件將“<”和“>”改成“<”和“>”
String version="<?xml version='1.0' encoding='UTF-8'?><!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>";
output.write(version)
for循環中添加
output.close();
添加后的效果如下:
try {
com.seeyon.v3x.services.document.DocumentFactory factory =java com.seeyon.v3x.services.document.impl.DocumentManager
.getInstance();
XMLWriter output = new XMLWriter(new FileWriter("d:/aaa.xml"));
output.setEscapeText(false);
String version = "<?xml version='1.0' encoding='UTF-8'?><!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>";
output.write(version);
for (int i = 0; i < thirdIds.length; i++) {
ArcFolderItem doc = factory.exportArchive(Long
.valueOf(thirdIds[i]));
StringWriter sw = new StringWriter();
doc.saveToPropertyList().saveXMLToStream(sw);
output.write(sw.toString());
}
output.close();
} catch (Exception e) {
e.printStackTrace();
}
公司主要經營內容:
帆軟報表,帆軟軟件,致遠OA,北京致遠軟件,致遠軟件,致遠OA軟件,OA軟件,致遠OA辦公軟件,致遠OA協同軟件,OA協同軟件,OA辦公軟件,致遠辦公軟件,致遠協同辦公軟件,致遠OA協同辦公軟件,OA綜合辦公軟件,致遠系統,OA系統,致遠OA系統,北京致遠OA系統,北京致遠OA軟件,致遠OA系統軟件,致遠協同辦公系統,致遠協同辦公OA系統,致遠系統OA,致遠軟件OA,OA軟件系統,OA致遠北京,致遠A8OA,OAA8軟件,致遠A8軟件,致遠A8系統Oa軟件,致遠OA系統版本軟件