package com.trs.web2frame.tool.tyjyh.wcmhy01_lcj.utils;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.trs.cms.CMSConstants;
import com.trs.web2frame.WCMServiceCaller;
import com.trs.web2frame.dispatch.Dispatch;

public class DownloadFiles {

	public static void main(String[] args) throws Exception {
        String sServiceId = "gov_webdocument";
        String sMethodName = "saveDocumentInWeb";//自定义视图
        Map<String,Object> oPostData=new HashMap<>();
        oPostData.put("ObjectId", 0);
        oPostData.put("ChannelId", 4);// 目标栏目id
        oPostData.put("DOCTYPE",CMSConstants.CONTENT_BODY_HTML);
        oPostData.put("CurrUserName", "dev");
        oPostData.put("DOCTITLE", "test55");
        oPostData.put("DOCHTMLCON", "<img src=\"/webpic/W0202107/W020210721/W020210721594638208412.png\" title=\"\" alt=\"\"/>");
        
        
        String appFile = "U020210729834681730397.jpg";
        StringBuilder docRelFile = new StringBuilder();// 相关文件
        docRelFile.append("[");
        docRelFile.append("{\"SrcFile\":\"345.png\",\"AppFile\":\"" + appFile
                + "\",\"AppDesc\":\"123\", \"AppendixId\":\"0\" }");
        docRelFile.append("]");
        oPostData.put("docRelFile", docRelFile);
        
        StringBuilder picRelFile = new StringBuilder();// 相关文件
        picRelFile.append("[");
        picRelFile.append("{\"SrcFile\":\"345.png\",\"AppFile\":\"" + appFile
                + "\",\"AppDesc\":\"123\", \"AppendixId\":\"0\" }");
        picRelFile.append("]");
        oPostData.put("DOCRELPIC", picRelFile);
		Dispatch result = WCMServiceCaller.Call(sServiceId, sMethodName, oPostData, true);
//	  DownloadFiles fj=new DownloadFiles();
//	  fj.StartMethord();
	}
	
	 public void StartMethord() {
		 //1、按照站点id遍历wcmappendix中的数据，按照w0下载到本地
		 
		 //2、遍历wcmdocument.dochtmlcon
		 
		 
//		 List<Map<String,Object>> oldMaps=wcm.GetAllDocInfoFromOldDB(wcmChannelId);
	 }

}
