package com.trs.web2frame.tool.tyjyh.tonglaozheng;

import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.read.listener.PageReadListener;
import com.alibaba.fastjson.JSON;
import com.trs.cms.CMSConstants;
import com.trs.web2frame.WCMServiceCaller;
import com.trs.web2frame.dispatch.Dispatch;
import com.trs.web2frame.tool.tyjyh.Log_Exception;
import com.trs.web2frame.tool.tyjyh.tongliao.DemoDataJiGou;
import com.trs.web2frame.tool.tyjyh.tongliao.DocumentData;
import com.trs.web2frame.tool.tyjyh.tongliao.DocumentDataStr;
import com.trs.web2frame.tool.tyjyh.tongliao.JsoupUtils;
import net.sf.json.JSONObject;
import org.jsoup.Jsoup;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;

/**
 * 视图类
 */
public class ViewMoveTest2 {

    public static void main(String[] args) {
        ViewMoveTest2 viewMove = new ViewMoveTest2();
        viewMove.DataZWGKByChannelByTitle("218270ceb2fe4f6685d0411466e3aab5","4481","WCMMETATABLEGovOpenData");

    }
    /**
     * 资讯视图
     * @param kpChannelId
     * @param hyChannelId
     */
    public void DataZhiXunByChannel(String kpChannelId,String hyChannelId){
        Log_Exception.Logger_txt("-------Start-------kpChannelId:" + kpChannelId + "--hyChannelId:" + hyChannelId + "---------Start--------");
        String sServiceId = "gov_webdocument";
        String sMethodName = "saveDocumentInWeb";//自定义视图
        ServiceImplKp serviceImplKp=new ServiceImplKp();
        Annex annex = new Annex();
        try {
            List<Map<String,Object>> allDocInfoFromKPDBdMaps = serviceImplKp.GetAllDocInfoFromKPDB(kpChannelId);
            if(allDocInfoFromKPDBdMaps!=null){
                int count=0;
                for (Map<String,Object> map : allDocInfoFromKPDBdMaps) {
                    System.out.println("------------------------------------------------------------");
                    Map<String,Object> oPostData=new HashMap<>();
                    oPostData.put("ObjectId", 0);
                    oPostData.put("ChannelId", Integer.parseInt(hyChannelId));// 目标栏目id
                    oPostData.put("CurrUserName", "dev");
                    oPostData.put("isShenhe", "1");
                    oPostData.put("DOCTYPE", CMSConstants.CONTENT_BODY_HTML);
                    DocumentData documentData = new DocumentData(map);
                    System.out.println(documentData);
                    //标题-必填
                    if (documentData.getTitle() != null && documentData.getTitle() != "null") {
                        oPostData.put("DOCTITLE", Jsoup.parse(documentData.getTitle()).text()  );
                    }
                    //副标题
                    if (documentData.getSubTitle() != null && documentData.getSubTitle() != "null") {
                        oPostData.put("SUBDOCTITLE",Jsoup.parse(documentData.getSubTitle()).text() );
                    }
                    //短标题
                    if (documentData.getShortTitle() != null && documentData.getShortTitle() != "null") {
                        oPostData.put("SHORTTITLE",Jsoup.parse(documentData.getShortTitle()).text());
                    }
                    //关键词
                    if (documentData.getKEYWORD() != null  && documentData.getKEYWORD() != "") {
                        String keyword = documentData.getKEYWORD();
                        keyword = keyword.replaceAll("<br/>", "");//
                        keyword = keyword.replaceAll("<br>", "");//
                        oPostData.put("DOCKEYWORDS", keyword);
                    }
                    //发布时间
                    if (documentData.getPublishedTime() != null) {
                        oPostData.put("DOCRELTIME", documentData.getPublishedTime());
                    }
                    //创建时间
                    if (documentData.getCREATED_TIME() != null) {
                        oPostData.put("CRTIME", documentData.getCREATED_TIME());
                    }
                    //来源
                    if (documentData.getB_source() != null && documentData.getB_source() != "") {
                        oPostData.put("DOCSOURCENAME",documentData.getB_source());
                    }
                    //摘要
                    if (documentData.getMemo() != null && documentData.getMemo() != "") {
                        oPostData.put("DOCABSTRACT", documentData.getMemo());
                    }
                    if (documentData.getManuscriptId() != null) {
                        oPostData.put("oldDocid", documentData.getManuscriptId());
                    }
                    //处理附件
                    try {
                        if (documentData.getManuscriptId() != null) {
                            Map<String, Object> getRelFileInfoByDocId = annex.getZhiXunFileInfoByDocId(documentData.getManuscriptId());
                            if( getRelFileInfoByDocId.get("docRelFile") != null){
                                oPostData.put("docRelFile", getRelFileInfoByDocId.get("docRelFile"));
                            }
                            if( getRelFileInfoByDocId.get("docRelPic") != null){
                                oPostData.put("docRelPic", getRelFileInfoByDocId.get("docRelPic"));
                            }
                        }
                    }catch (Exception e){
                        e.printStackTrace();
                    }
                    try {
                        // 内容中图片和附件需要特殊处理
                        if (documentData.getCurrentFilePathHtmlUrl()  != null) {
                            String  currentFilePathHtmlUrl = documentData.getCurrentFilePathHtmlUrl();
                            System.out.println("===================start=======================");
                            System.out.println(currentFilePathHtmlUrl);
                            JsoupUtilsView jsoupUtils = new JsoupUtilsView();
                            String html = jsoupUtils.rexStringHtml(currentFilePathHtmlUrl);
                            System.out.println("==============================================");
                            System.out.println(html);
                            System.out.println("===================end========================");
                            oPostData.put("DOCHTMLCON", html);
                        } else {
                            oPostData.put("DocHtmlCon", "&nbsp;");
                            oPostData.put("DOCCONTENT", "&nbsp;");
                        }
                    }catch (Exception e){
                        oPostData.put("DocHtmlCon", "&nbsp;");
                        oPostData.put("DOCCONTENT", "&nbsp;");
                        e.printStackTrace();
                    }
                    //查询是否有重定向链接，如果有调用链接视图
                    if (documentData.getREDIRECT_URL() != null && documentData.getREDIRECT_URL() != "") {
                        oPostData.put("DOCTYPE", CMSConstants.CONTENT_BODY_LINK);
                        oPostData.put("DOCLINK", documentData.getREDIRECT_URL());
                    }
                    try {
                        System.out.println(oPostData);
                        Dispatch result = WCMServiceCaller.Call(sServiceId, sMethodName, oPostData, true);
                        count++;
                        if(result!=null){
                            JSONObject rObject = JSONObject.fromObject(result.getResponseText().toString());
                            if (rObject.get("ISSUCCESS").toString().equals("true")){
                                System.out.println("DOCTITLE:"+documentData.getTitle());
                                System.out.println("count:"+count);
                                System.out.println("oldDocid:"+documentData.getManuscriptId());
                                try {
                                    //处理引用文章
                                    String manuscriptId = documentData.getManuscriptId();
                                    if(manuscriptId != null && manuscriptId != ""){
                                        ColumnMapping columnMapping = new ColumnMapping();
                                        columnMapping.ColumnMappingCheck(manuscriptId);
                                    }
                                }catch (Exception ee){
                                    ee.printStackTrace();
                                }
                            }else{
                                String serror = JSON.toJSONString(rObject);
                                System.out.println(serror);
                                outPrint(serror,documentData.getManuscriptId(),count);
                            }
                        }
                    }catch(Exception e) {
                        outPrint("",documentData.getManuscriptId(),count);
                        e.printStackTrace();
                    }
                    System.out.println("------------------------------------------------------------");
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
            Log_Exception.Error_txt("DataZhiXunByChannel error"+e.getMessage());
        } finally {

        }
    }

    /**
     * 资讯视图 - 抄送栏目数据迁移
     * @param kpChannelId
     * @param hyChannelId
     */
    public void DataZhiXunByChannelGetAllDoc(String kpChannelId,String hyChannelId){
        Log_Exception.Logger_txt("-------Start-------kpChannelId:" + kpChannelId + "--hyChannelId:" + hyChannelId + "---------Start--------");
        String sServiceId = "gov_webdocument";
        String sMethodName = "saveDocumentInWeb";//自定义视图
        ServiceImplKp serviceImplKp=new ServiceImplKp();
        Annex annex = new Annex();
        List<Map<String, String>> mapAllDocs = serviceImplKp.GetAllDocCmsCarbonCopy(kpChannelId);
        for (Map<String, String> mapAllDoc : mapAllDocs) {
            String manuscript_id = mapAllDoc.get("MANUSCRIPT_ID");
            List<Map<String, Object>> allDocInfoFromKPDBdMaps = serviceImplKp.GetAllDocInfoFromByMANUSCRIPT_ID(manuscript_id);
            System.out.println(allDocInfoFromKPDBdMaps);
            if(allDocInfoFromKPDBdMaps!=null){
                int count=0;
                for (Map<String,Object> map : allDocInfoFromKPDBdMaps) {
                    System.out.println("------------------------------------------------------------");
                    Map<String,Object> oPostData=new HashMap<>();
                    oPostData.put("ObjectId", 0);
                    oPostData.put("ChannelId", Integer.parseInt(hyChannelId));// 目标栏目id
                    oPostData.put("CurrUserName", "dev");
                    oPostData.put("isShenhe", "1");
                    oPostData.put("DOCTYPE", CMSConstants.CONTENT_BODY_HTML);
                    DocumentData documentData = new DocumentData(map);
                    System.out.println(documentData);
                    //标题-必填
                    if (documentData.getTitle() != null && documentData.getTitle() != "null") {
                        oPostData.put("DOCTITLE", Jsoup.parse(documentData.getTitle()).text()  );
                    }
                    //副标题
                    if (documentData.getSubTitle() != null && documentData.getSubTitle() != "null") {
                        oPostData.put("SUBDOCTITLE",Jsoup.parse(documentData.getSubTitle()).text() );
                    }
                    //短标题
                    if (documentData.getShortTitle() != null && documentData.getShortTitle() != "null") {
                        oPostData.put("SHORTTITLE",Jsoup.parse(documentData.getShortTitle()).text());
                    }
                    //关键词
                    if (documentData.getKEYWORD() != null  && documentData.getKEYWORD() != "") {
                        String keyword = documentData.getKEYWORD();
                        keyword = keyword.replaceAll("<br/>", "");//
                        keyword = keyword.replaceAll("<br>", "");//
                        oPostData.put("DOCKEYWORDS", keyword);
                    }
                    //发布时间
                    if (documentData.getPublishedTime() != null) {
                        oPostData.put("DOCRELTIME", documentData.getPublishedTime());
                    }
                    //创建时间
                    if (documentData.getCREATED_TIME() != null) {
                        oPostData.put("CRTIME", documentData.getCREATED_TIME());
                    }
                    //来源
                    if (documentData.getB_source() != null && documentData.getB_source() != "") {
                        oPostData.put("DOCSOURCENAME",documentData.getB_source());
                    }
                    //摘要
                    if (documentData.getMemo() != null && documentData.getMemo() != "") {
                        oPostData.put("DOCABSTRACT", documentData.getMemo());
                    }
                    if (documentData.getManuscriptId() != null) {
                        oPostData.put("oldDocid", documentData.getManuscriptId());
                    }
                    //处理附件
                    try {
                        if (documentData.getManuscriptId() != null) {
                            Map<String, Object> getRelFileInfoByDocId = annex.getZhiXunFileInfoByDocId(documentData.getManuscriptId());
                            if( getRelFileInfoByDocId.get("docRelFile") != null){
                                oPostData.put("docRelFile", getRelFileInfoByDocId.get("docRelFile"));
                            }
                            if( getRelFileInfoByDocId.get("docRelPic") != null){
                                oPostData.put("docRelPic", getRelFileInfoByDocId.get("docRelPic"));
                            }
                        }
                    }catch (Exception e){
                        e.printStackTrace();
                    }
                    try {
                        // 内容中图片和附件需要特殊处理
                        if (documentData.getCurrentFilePathHtmlUrl()  != null) {
                            String  currentFilePathHtmlUrl = documentData.getCurrentFilePathHtmlUrl();
                            System.out.println("===================start=======================");
                            System.out.println(currentFilePathHtmlUrl);
                            JsoupUtilsView jsoupUtils = new JsoupUtilsView();
                            String html = jsoupUtils.rexStringHtml(currentFilePathHtmlUrl);
                            System.out.println("==============================================");
                            System.out.println(html);
                            System.out.println("===================end========================");
                            oPostData.put("DOCHTMLCON", html);
                        } else {
                            oPostData.put("DocHtmlCon", "&nbsp;");
                            oPostData.put("DOCCONTENT", "&nbsp;");
                        }
                    }catch (Exception e){
                        oPostData.put("DocHtmlCon", "&nbsp;");
                        oPostData.put("DOCCONTENT", "&nbsp;");
                        e.printStackTrace();
                    }
                    /*//查询是否有重定向链接，如果有调用链接视图
                    if (documentData.getREDIRECT_URL() != null && documentData.getREDIRECT_URL() != "") {
                        oPostData.put("DOCTYPE", CMSConstants.CONTENT_BODY_LINK);
                        oPostData.put("DOCLINK", documentData.getREDIRECT_URL());
                    }*/
                    try {
                        System.out.println(oPostData);
                        Dispatch result = WCMServiceCaller.Call(sServiceId, sMethodName, oPostData, true);
                        count++;
                        if(result!=null){
                            JSONObject rObject = JSONObject.fromObject(result.getResponseText().toString());
                            if (rObject.get("ISSUCCESS").toString().equals("true")){
                                System.out.println("DOCTITLE:"+documentData.getTitle());
                                System.out.println("count:"+count);
                                System.out.println("oldDocid:"+documentData.getManuscriptId());
                                try {
                                    //处理引用文章
                                    String manuscriptId = documentData.getManuscriptId();
                                    if(manuscriptId != null && manuscriptId != ""){
                                        ColumnMapping columnMapping = new ColumnMapping();
                                        columnMapping.ColumnMappingCheck(manuscriptId);
                                    }
                                }catch (Exception ee){
                                    ee.printStackTrace();
                                }
                            }else{
                                String serror = JSON.toJSONString(rObject);
                                System.out.println(serror);
                                outPrint(serror,documentData.getManuscriptId(),count);
                            }
                        }
                    }catch(Exception e) {
                        outPrint("",documentData.getManuscriptId(),count);
                        e.printStackTrace();
                    }
                    System.out.println("------------------------------------------------------------");
                }
            }

        }


    }

    /**
     * 资讯视图 - 多栏目数据迁移
     * @param kpChannelIdList,hyChannelId
     * @param hyChannelId
     */
    public void DataZhiXunByChannelGetAllDocAll(String []kpChannelIdList,String hyChannelId){
        Log_Exception.Logger_txt("-------Start-------kpChannelId:" + kpChannelIdList + "--hyChannelId:" + hyChannelId + "---------Start--------");
        String sServiceId = "gov_webdocument";
        String sMethodName = "saveDocumentInWeb";//自定义视图
        ServiceImplKp serviceImplKp=new ServiceImplKp();
        Annex annex = new Annex();
        List<Map<String, String>> allDocInfoFromKPDBdMaps = serviceImplKp.GetAllDocCmsCarbonCopyAll(kpChannelIdList);
        if(allDocInfoFromKPDBdMaps!=null){
            int count=0;
            for (Map<String,String> map : allDocInfoFromKPDBdMaps) {
                System.out.println("------------------------------------------------------------");
                Map<String,Object> oPostData=new HashMap<>();
                oPostData.put("ObjectId", 0);
                oPostData.put("ChannelId", Integer.parseInt(hyChannelId));// 目标栏目id
                oPostData.put("CurrUserName", "dev");
                oPostData.put("isShenhe", "1");
                oPostData.put("DOCTYPE", CMSConstants.CONTENT_BODY_HTML);
                DocumentDataStr documentData = new DocumentDataStr(map);
                System.out.println(documentData);
                //标题-必填
                if (documentData.getTitle() != null && documentData.getTitle() != "null") {
                    oPostData.put("DOCTITLE", Jsoup.parse(documentData.getTitle()).text()  );
                }
                //副标题
                if (documentData.getSubTitle() != null && documentData.getSubTitle() != "null") {
                    oPostData.put("SUBDOCTITLE",Jsoup.parse(documentData.getSubTitle()).text() );
                }
                //短标题
                if (documentData.getShortTitle() != null && documentData.getShortTitle() != "null") {
                    oPostData.put("SHORTTITLE",Jsoup.parse(documentData.getShortTitle()).text());
                }
                //关键词
                if (documentData.getKEYWORD() != null  && documentData.getKEYWORD() != "") {
                    String keyword = documentData.getKEYWORD();
                    keyword = keyword.replaceAll("<br/>", "");//
                    keyword = keyword.replaceAll("<br>", "");//
                    oPostData.put("DOCKEYWORDS", keyword);
                }
                //发布时间
                if (documentData.getPublishedTime() != null) {
                    oPostData.put("DOCRELTIME", documentData.getPublishedTime());
                }
                //创建时间
                if (documentData.getCREATED_TIME() != null) {
                    oPostData.put("CRTIME", documentData.getCREATED_TIME());
                }
                //来源
                if (documentData.getB_source() != null && documentData.getB_source() != "") {
                    oPostData.put("DOCSOURCENAME",documentData.getB_source());
                }
                //摘要
                if (documentData.getMemo() != null && documentData.getMemo() != "") {
                    oPostData.put("DOCABSTRACT", documentData.getMemo());
                }
                if (documentData.getManuscriptId() != null) {
                    oPostData.put("oldDocid", documentData.getManuscriptId());
                }
                //处理附件
                try {
                    if (documentData.getManuscriptId() != null) {
                        Map<String, Object> getRelFileInfoByDocId = annex.getZhiXunFileInfoByDocId(documentData.getManuscriptId());
                        if( getRelFileInfoByDocId.get("docRelFile") != null){
                            oPostData.put("docRelFile", getRelFileInfoByDocId.get("docRelFile"));
                        }
                        if( getRelFileInfoByDocId.get("docRelPic") != null){
                            oPostData.put("docRelPic", getRelFileInfoByDocId.get("docRelPic"));
                        }
                    }
                }catch (Exception e){
                    e.printStackTrace();
                }
                try {
                    // 内容中图片和附件需要特殊处理
                    if (documentData.getCurrentFilePathHtmlUrl()  != null) {
                        String  currentFilePathHtmlUrl = documentData.getCurrentFilePathHtmlUrl();
                        System.out.println("===================start=======================");
                        System.out.println(currentFilePathHtmlUrl);
                        JsoupUtilsView jsoupUtils = new JsoupUtilsView();
                        String html = jsoupUtils.rexStringHtml(currentFilePathHtmlUrl);
                        System.out.println("==============================================");
                        System.out.println(html);
                        System.out.println("===================end========================");
                        oPostData.put("DOCHTMLCON", html);
                    } else {
                        oPostData.put("DocHtmlCon", "&nbsp;");
                        oPostData.put("DOCCONTENT", "&nbsp;");
                    }
                }catch (Exception e){
                    oPostData.put("DocHtmlCon", "&nbsp;");
                    oPostData.put("DOCCONTENT", "&nbsp;");
                    e.printStackTrace();
                }
                //查询是否有重定向链接，如果有调用链接视图
                if (documentData.getREDIRECT_URL() != null && documentData.getREDIRECT_URL() != "") {
                   /* System.out.println(documentData.getREDIRECT_URL());
                    oPostData.put("DOCTYPE", CMSConstants.CONTENT_BODY_LINK);
                    oPostData.put("DOCLINK", documentData.getREDIRECT_URL());*/
                }
                try {
                    System.out.println(oPostData);
                    Dispatch result = WCMServiceCaller.Call(sServiceId, sMethodName, oPostData, true);
                    count++;
                    if(result!=null){
                        JSONObject rObject = JSONObject.fromObject(result.getResponseText().toString());
                        if (rObject.get("ISSUCCESS").toString().equals("true")){
                            System.out.println("DOCTITLE:"+documentData.getTitle());
                            System.out.println("count:"+count);
                            System.out.println("oldDocid:"+documentData.getManuscriptId());
                            try {
                                //处理引用文章
                                String manuscriptId = documentData.getManuscriptId();
                                if(manuscriptId != null && manuscriptId != ""){
                                    ColumnMapping columnMapping = new ColumnMapping();
                                    columnMapping.ColumnMappingCheck(manuscriptId);
                                }
                            }catch (Exception ee){
                                ee.printStackTrace();
                            }
                        }else{
                            String serror = JSON.toJSONString(rObject);
                            System.out.println(serror);
                            outPrint(serror,documentData.getManuscriptId(),count);
                        }
                    }
                }catch(Exception e) {
                    outPrint("",documentData.getManuscriptId(),count);
                    e.printStackTrace();
                }
                System.out.println("------------------------------------------------------------");
            }
        }


    }
    /**
     * 资讯视图 - 增量数据迁移
     * 开普系统的文档id 对应 海运系统当中的 oldDocid 去海云里面查询对应的文档对应的docid，将docid设置到对应的ObjectId即可完成更新
     *
     * @param kpChannelId
     * @param hyChannelId
     */
    public void DataZhiXunByChannelAddOrUpdate(String kpChannelId,String hyChannelId){
        Log_Exception.Logger_txt("-------Start-------kpChannelId:" + kpChannelId + "--hyChannelId:" + hyChannelId + "---------Start--------");
        String sServiceId = "gov_webdocument";
        String sMethodName = "saveDocumentInWeb";//自定义视图
        ServiceImplKp serviceImplKp=new ServiceImplKp();
        Annex annex = new Annex();
        try {
            List<Map<String,Object>> allDocInfoFromKPDBdMaps = serviceImplKp.GetAllDocInfoFromKPDB(kpChannelId);
            if(allDocInfoFromKPDBdMaps!=null){
                int count=0;
                for (Map<String,Object> map : allDocInfoFromKPDBdMaps) {
                    System.out.println("------------------------------------------------------------");
                    Map<String,Object> oPostData=new HashMap<>();

                    oPostData.put("ObjectId", 0);
                    oPostData.put("ChannelId", Integer.parseInt(hyChannelId));// 目标栏目id
                    oPostData.put("CurrUserName", "dev");
                    oPostData.put("DOCTYPE", CMSConstants.CONTENT_BODY_HTML);
                    oPostData.put("isShenhe", "1");
                    DocumentData documentData = new DocumentData(map);
                    String manuscriptIdOldDocId = documentData.getManuscriptId();
                    if(manuscriptIdOldDocId != null && manuscriptIdOldDocId != ""){
                        //查询海云的docid
                        String ObjectId = serviceImplKp.GetWcmMetaTableGovDocNewsMetaDataIdByOldDocId(manuscriptIdOldDocId,hyChannelId);
                        if(ObjectId != null && ObjectId != ""){
                            oPostData.put("ObjectId", ObjectId);
                        }
                    }
                    System.out.println(documentData);
                    //标题-必填
                    if (documentData.getTitle() != null && documentData.getTitle() != "null") {
                        oPostData.put("DOCTITLE", Jsoup.parse(documentData.getTitle()).text()  );
                    }
                    //副标题
                    if (documentData.getSubTitle() != null && documentData.getSubTitle() != "null") {
                        oPostData.put("SUBDOCTITLE",Jsoup.parse(documentData.getSubTitle()).text() );
                    }
                    //短标题
                    if (documentData.getShortTitle() != null && documentData.getShortTitle() != "null") {
                        oPostData.put("SHORTTITLE",Jsoup.parse(documentData.getShortTitle()).text());
                    }
                    //关键词
                    if (documentData.getKEYWORD() != null  && documentData.getKEYWORD() != "") {
                        String keyword = documentData.getKEYWORD();
                        keyword = keyword.replaceAll("<br/>", "");//
                        keyword = keyword.replaceAll("<br>", "");//
                        oPostData.put("DOCKEYWORDS", keyword);
                    }
                    //发布时间
                    if (documentData.getPublishedTime() != null) {
                        oPostData.put("DOCRELTIME", documentData.getPublishedTime());
                    }
                    //创建时间
                    if (documentData.getCREATED_TIME() != null) {
                        oPostData.put("CRTIME", documentData.getCREATED_TIME());
                    }
                    //来源
                    if (documentData.getB_source() != null && documentData.getB_source() != "") {
                        oPostData.put("DOCSOURCENAME",documentData.getB_source());
                    }
                    //摘要
                    if (documentData.getMemo() != null && documentData.getMemo() != "") {
                        oPostData.put("DOCABSTRACT", documentData.getMemo());
                    }
                    if (documentData.getManuscriptId() != null) {
                        oPostData.put("oldDocid", documentData.getManuscriptId());
                    }
                    //处理附件
                    try {
                        if (documentData.getManuscriptId() != null) {
                            Map<String, Object> getRelFileInfoByDocId = annex.getZhiXunFileInfoByDocId(documentData.getManuscriptId());
                            if( getRelFileInfoByDocId.get("docRelFile") != null){
                                oPostData.put("docRelFile", getRelFileInfoByDocId.get("docRelFile"));
                            }
                            if( getRelFileInfoByDocId.get("docRelPic") != null){
                                oPostData.put("docRelPic", getRelFileInfoByDocId.get("docRelPic"));
                            }
                        }
                    }catch (Exception e){
                        e.printStackTrace();
                    }
                    try {
                        // 内容中图片和附件需要特殊处理
                        if (documentData.getCurrentFilePathHtmlUrl()  != null) {
                            String  currentFilePathHtmlUrl = documentData.getCurrentFilePathHtmlUrl();
                            System.out.println("===================start=======================");
                            System.out.println(currentFilePathHtmlUrl);
                            JsoupUtilsView jsoupUtils = new JsoupUtilsView();
                            String html = jsoupUtils.rexStringHtml(currentFilePathHtmlUrl);
                            System.out.println("==============================================");
                            System.out.println(html);
                            System.out.println("===================end========================");
                            oPostData.put("DOCHTMLCON", html);
                        } else {
                            oPostData.put("DocHtmlCon", "&nbsp;");
                            oPostData.put("DOCCONTENT", "&nbsp;");
                        }
                    }catch (Exception e){
                        oPostData.put("DocHtmlCon", "&nbsp;");
                        oPostData.put("DOCCONTENT", "&nbsp;");
                        e.printStackTrace();
                    }
                    //查询是否有重定向链接，如果有调用链接视图
                    if (documentData.getREDIRECT_URL() != null && documentData.getREDIRECT_URL() != "") {
                        oPostData.put("DOCTYPE", CMSConstants.CONTENT_BODY_LINK);
                        oPostData.put("DOCLINK", documentData.getREDIRECT_URL());
                    }
                    try {
                        System.out.println(oPostData);
                        Dispatch result = WCMServiceCaller.Call(sServiceId, sMethodName, oPostData, true);
                        count++;
                        if(result!=null){
                            JSONObject rObject = JSONObject.fromObject(result.getResponseText().toString());
                            if (rObject.get("ISSUCCESS").toString().equals("true")){
                                System.out.println("DOCTITLE:"+documentData.getTitle());
                                System.out.println("count:"+count);
                                System.out.println("oldDocid:"+documentData.getManuscriptId());
                                try {
                                    //处理引用文章
                                    String manuscriptId = documentData.getManuscriptId();
                                    if(manuscriptId != null && manuscriptId != ""){
                                        ColumnMapping columnMapping = new ColumnMapping();
                                        columnMapping.ColumnMappingCheck(manuscriptId);
                                    }
                                }catch (Exception ee){
                                    ee.printStackTrace();
                                }
                            }else{
                                String serror = JSON.toJSONString(rObject);
                                System.out.println(serror);
                                outPrint(serror,documentData.getManuscriptId(),count);
                            }
                        }
                    }catch(Exception e) {
                        outPrint("",documentData.getManuscriptId(),count);
                        e.printStackTrace();
                    }
                    System.out.println("------------------------------------------------------------");
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
            Log_Exception.Error_txt("DataZhiXunByChannel error"+e.getMessage());
        } finally {
        }
    }
    /**
     * 资讯视图 - 抄送增量栏目数据迁移
     * @param kpChannelId
     * @param hyChannelId
     */
    public void DataZhiXunByChannelGetAllDocAddOrUpdate(String kpChannelId,String hyChannelId){
        Log_Exception.Logger_txt("-------Start-------kpChannelId:" + kpChannelId + "--hyChannelId:" + hyChannelId + "---------Start--------");
        String sServiceId = "gov_webdocument";
        String sMethodName = "saveDocumentInWeb";//自定义视图
        ServiceImplKp serviceImplKp=new ServiceImplKp();
        Annex annex = new Annex();
        List<Map<String, String>> mapAllDocs = serviceImplKp.GetAllDocCmsCarbonCopy(kpChannelId);
        for (Map<String, String> mapAllDoc : mapAllDocs) {
            String manuscript_id = mapAllDoc.get("MANUSCRIPT_ID");
            List<Map<String, Object>> allDocInfoFromKPDBdMaps = serviceImplKp.GetAllDocInfoFromByMANUSCRIPT_ID(manuscript_id);
            System.out.println(allDocInfoFromKPDBdMaps);
            if(allDocInfoFromKPDBdMaps!=null){
                int count=0;
                for (Map<String,Object> map : allDocInfoFromKPDBdMaps) {
                    System.out.println("------------------------------------------------------------");
                    Map<String,Object> oPostData=new HashMap<>();
                    oPostData.put("ObjectId", 0);
                    oPostData.put("ChannelId", Integer.parseInt(hyChannelId));// 目标栏目id
                    oPostData.put("CurrUserName", "dev");
                    oPostData.put("isShenhe", "1");
                    oPostData.put("DOCTYPE", CMSConstants.CONTENT_BODY_HTML);
                    DocumentData documentData = new DocumentData(map);
                    String manuscriptIdOldDocId = documentData.getManuscriptId();
                    if(manuscriptIdOldDocId != null && manuscriptIdOldDocId != ""){
                        //查询海云的docid
                        String ObjectId = serviceImplKp.GetWcmMetaTableGovDocNewsMetaDataIdByOldDocId(manuscriptIdOldDocId,hyChannelId);
                        if(ObjectId != null && ObjectId != ""){
                            oPostData.put("ObjectId", ObjectId);
                        }
                    }
                    System.out.println(documentData);
                    //标题-必填
                    if (documentData.getTitle() != null && documentData.getTitle() != "null") {
                        oPostData.put("DOCTITLE", Jsoup.parse(documentData.getTitle()).text()  );
                    }
                    //副标题
                    if (documentData.getSubTitle() != null && documentData.getSubTitle() != "null") {
                        oPostData.put("SUBDOCTITLE",Jsoup.parse(documentData.getSubTitle()).text() );
                    }
                    //短标题
                    if (documentData.getShortTitle() != null && documentData.getShortTitle() != "null") {
                        oPostData.put("SHORTTITLE",Jsoup.parse(documentData.getShortTitle()).text());
                    }
                    //关键词
                    if (documentData.getKEYWORD() != null  && documentData.getKEYWORD() != "") {
                        String keyword = documentData.getKEYWORD();
                        keyword = keyword.replaceAll("<br/>", "");//
                        keyword = keyword.replaceAll("<br>", "");//
                        oPostData.put("DOCKEYWORDS", keyword);
                    }
                    //发布时间
                    if (documentData.getPublishedTime() != null) {
                        oPostData.put("DOCRELTIME", documentData.getPublishedTime());
                    }
                    //创建时间
                    if (documentData.getCREATED_TIME() != null) {
                        oPostData.put("CRTIME", documentData.getCREATED_TIME());
                    }
                    //来源
                    if (documentData.getB_source() != null && documentData.getB_source() != "") {
                        oPostData.put("DOCSOURCENAME",documentData.getB_source());
                    }
                    //摘要
                    if (documentData.getMemo() != null && documentData.getMemo() != "") {
                        oPostData.put("DOCABSTRACT", documentData.getMemo());
                    }
                    if (documentData.getManuscriptId() != null) {
                        oPostData.put("oldDocid", documentData.getManuscriptId());
                    }
                    //处理附件
                    try {
                        if (documentData.getManuscriptId() != null) {
                            Map<String, Object> getRelFileInfoByDocId = annex.getZhiXunFileInfoByDocId(documentData.getManuscriptId());
                            if( getRelFileInfoByDocId.get("docRelFile") != null){
                                oPostData.put("docRelFile", getRelFileInfoByDocId.get("docRelFile"));
                            }
                            if( getRelFileInfoByDocId.get("docRelPic") != null){
                                oPostData.put("docRelPic", getRelFileInfoByDocId.get("docRelPic"));
                            }
                        }
                    }catch (Exception e){
                        e.printStackTrace();
                    }
                    try {
                        // 内容中图片和附件需要特殊处理
                        if (documentData.getCurrentFilePathHtmlUrl()  != null) {
                            String  currentFilePathHtmlUrl = documentData.getCurrentFilePathHtmlUrl();
                            System.out.println("===================start=======================");
                            System.out.println(currentFilePathHtmlUrl);
                            JsoupUtilsView jsoupUtils = new JsoupUtilsView();
                            String html = jsoupUtils.rexStringHtml(currentFilePathHtmlUrl);
                            System.out.println("==============================================");
                            System.out.println(html);
                            System.out.println("===================end========================");
                            oPostData.put("DOCHTMLCON", html);
                        } else {
                            oPostData.put("DocHtmlCon", "&nbsp;");
                            oPostData.put("DOCCONTENT", "&nbsp;");
                        }
                    }catch (Exception e){
                        oPostData.put("DocHtmlCon", "&nbsp;");
                        oPostData.put("DOCCONTENT", "&nbsp;");
                        e.printStackTrace();
                    }
                    /*//查询是否有重定向链接，如果有调用链接视图
                    if (documentData.getREDIRECT_URL() != null && documentData.getREDIRECT_URL() != "") {
                        oPostData.put("DOCTYPE", CMSConstants.CONTENT_BODY_LINK);
                        oPostData.put("DOCLINK", documentData.getREDIRECT_URL());
                    }*/
                    try {
                        System.out.println(oPostData);
                        Dispatch result = WCMServiceCaller.Call(sServiceId, sMethodName, oPostData, true);
                        count++;
                        if(result!=null){
                            JSONObject rObject = JSONObject.fromObject(result.getResponseText().toString());
                            if (rObject.get("ISSUCCESS").toString().equals("true")){
                                System.out.println("DOCTITLE:"+documentData.getTitle());
                                System.out.println("count:"+count);
                                System.out.println("oldDocid:"+documentData.getManuscriptId());
                                try {
                                    //处理引用文章
                                    String manuscriptId = documentData.getManuscriptId();
                                    if(manuscriptId != null && manuscriptId != ""){
                                        ColumnMapping columnMapping = new ColumnMapping();
                                        columnMapping.ColumnMappingCheck(manuscriptId);
                                    }
                                }catch (Exception ee){
                                    ee.printStackTrace();
                                }
                            }else{
                                String serror = JSON.toJSONString(rObject);
                                System.out.println(serror);
                                outPrint(serror,documentData.getManuscriptId(),count);
                            }
                        }
                    }catch(Exception e) {
                        outPrint("",documentData.getManuscriptId(),count);
                        e.printStackTrace();
                    }
                    System.out.println("------------------------------------------------------------");
                }
            }

        }


    }
    /**
     * 	政务公开
     * @param kpChannelId
     * @param hyChannelId
     */
    public void DataZWGKByChannel(String kpChannelId,String hyChannelId){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Log_Exception.Logger_txt("-------Start-------kpChannelId:" + kpChannelId + "--hyChannelId:" + hyChannelId + "---------Start--------");
        String sServiceId = "gov_webdocument";
        String sMethodName = "saveDocumentInOpenData";//自定义视图
        ServiceImplKp serviceImplKp=new ServiceImplKp();
        Annex annex = new Annex();
        try {
            List<Map<String,Object>> allDocInfoFromKPDBdMaps = serviceImplKp.GetAllDocInfoFromKPDB(kpChannelId);
            System.out.println(allDocInfoFromKPDBdMaps);
            if(allDocInfoFromKPDBdMaps!=null){
                int count=0;
                for (Map<String,Object> map : allDocInfoFromKPDBdMaps) {
                    System.out.println("----------------------------"+map+"--------------------------------");
                    Map<String,Object> oPostData=new HashMap<>();
                    oPostData.put("ObjectId", 0);
                    oPostData.put("ChannelId", Integer.parseInt(hyChannelId));// 目标栏目id
                    oPostData.put("CurrUserName", "dev");
                    oPostData.put("isShenhe", "1");
                    oPostData.put("DOCTYPE",CMSConstants.CONTENT_BODY_HTML);
                    DocumentData documentData = new DocumentData(map);
                    System.out.println(documentData);
                    //标题-必填
                    if (documentData.getTitle() != null) {
                        oPostData.put("title",Jsoup.parse(documentData.getTitle()).text() );
                    }
                    // 内容
                    try {
                        // 内容中图片和附件需要特殊处理
                        if (documentData.getCurrentFilePathHtmlUrl() != null) {
                            String  currentFilePathHtmlUrl = documentData.getCurrentFilePathHtmlUrl();
                            JsoupUtilsView jsoupUtils = new JsoupUtilsView();
                            String html = jsoupUtils.rexStringHtml(currentFilePathHtmlUrl);
                            oPostData.put("UEDITOR", html);
                        } else {
                            oPostData.put("UEDITOR", "&nbsp;");
                        }
                    }catch (Exception e){
                        e.printStackTrace();
                    }
                    //发文字号
                    if (documentData.getC_WJBH() != null) {
                        oPostData.put("docno",documentData.getC_WJBH());
                    }
                    //创建时间
                    if (documentData.getC_FWRQ() != null) {
                        try {
                            Date date1 = new Date(Long.parseLong(documentData.getC_FWRQ()));
                            try {
                                LocalDateTime localDateTime = date1.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
                                LocalDateTime after8Hours = localDateTime.plusHours(8);
                                date1 = Date.from(after8Hours.atZone(ZoneId.systemDefault()).toInstant());
                            }catch (Exception e){
                                e.printStackTrace();
                            }
                            oPostData.put("scrq",simpleDateFormat.format(date1));
                        }catch (Exception e){
                            e.printStackTrace();
                        }
                    }
                    //发布时间
                    if (documentData.getPublishedTime() != null) {
                        Date parse = simpleDateFormat.parse(documentData.getPublishedTime());
                        long pubtime = parse.getTime();
                        Date date1 = new Date(pubtime);
                        try {
                            LocalDateTime localDateTime = date1.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
                            LocalDateTime after8Hours = localDateTime.plusHours(8);
                            date1 = Date.from(after8Hours.atZone(ZoneId.systemDefault()).toInstant());
                        }catch (Exception e){
                        }
                        oPostData.put("DocRelTime", simpleDateFormat.format(date1));
                    }
                    //关键词
                    if (documentData.getKEYWORD() != null) {
                        String keyword = documentData.getKEYWORD();
                        keyword = keyword.replaceAll("<br/>", "");//
                        keyword = keyword.replaceAll("<br>", "");//
                        oPostData.put("DOCKEYWORDS", keyword);
                    }
                    //摘要
                    if (documentData.getMemo() != null) {
                        try {
                            oPostData.put("DOCABSTRACT","");
                        }catch (Exception e){
                            oPostData.put("DOCABSTRACT",documentData.getMemo());
                        }
                    }
                    //旧索引号
                    if (documentData.getC_SYH() != null) {
                        oPostData.put("oldidxid",documentData.getC_SYH());
                    }
                    //来源
                    if (documentData.getB_source() != null) {
                        oPostData.put("SOURCE", documentData.getB_source());
                    }
                    //首页标题
                    if (documentData.getShortTitle() != null) {
                        oPostData.put("SHORTTITLE",Jsoup.parse(documentData.getTitle()).text());
                    }
                    //副标题
                    if (documentData.getSubTitle() != null) {
                        oPostData.put("SUB_TITLE",Jsoup.parse(documentData.getSubTitle()).text());
                    }
                    //公文时效
                    if (documentData.getC_GKSX() != null && documentData.getC_GKSX() != "") {
                        oPostData.put("validity",documentData.getC_GKSX());
                    }
                    //机构分类
                    if (documentData.getC_FBJG()  != null) {
                        String jg = documentData.getC_FBJG();
                        if(jg != null && jg != ""){
                            //查询开普对应发布机构名称的海运的发布机构id
                            String kyid = serviceImplKp.GetKpFPJG(jg);
                            System.out.println("=====kyid======"+kyid);
                            if(kyid != "" && kyid != null){
                                oPostData.put("custcat",kyid);
                            }
                        }else{
                            oPostData.put("old_publish",documentData.getC_FBJG());
                        }
                    }
                    //主题分类
                    if (documentData.getC_FBJG()  != null) {
                        oPostData.put("ztword",documentData.getC_ZTC());
                    }
                    //处理附件
                    try {
                        if (documentData.getManuscriptId() != null) {
                            Map<String, Object> zfggFileInfoByDocId = annex.getZWGKFileInfoByDocId(documentData.getManuscriptId());
                            System.out.println(zfggFileInfoByDocId);
                           /* if(zfggFileInfoByDocId.get("DOCRELPIC") != null){
                                oPostData.put("DOCRELPIC", zfggFileInfoByDocId.get("DOCRELPIC"));
                            }
                            if(zfggFileInfoByDocId.get("DOCATTACHFILEFIELD") != null){
                                oPostData.put("DOCATTACHFILEFIELD", zfggFileInfoByDocId.get("DOCATTACHFILEFIELD"));
                            }
                            if(zfggFileInfoByDocId.get("DOCATTACHPICFIELD") != null){
                                oPostData.put("DOCATTACHPICFIELD", zfggFileInfoByDocId.get("DOCATTACHPICFIELD"));
                            }
                            if(zfggFileInfoByDocId.get("DOCRELAPPENDIX") != null){
                                oPostData.put("DOCRELAPPENDIX", zfggFileInfoByDocId.get("DOCRELAPPENDIX"));
                            }*/
                            if(zfggFileInfoByDocId.get("qzbword") != null){
                                oPostData.put("qzbword", zfggFileInfoByDocId.get("qzbword"));
                            }
                            if(zfggFileInfoByDocId.get("wjyl") != null){
                                oPostData.put("wjyl", zfggFileInfoByDocId.get("wjyl"));
                            }
                        }
                    }catch (Exception e){
                        e.printStackTrace();
                    }
                    //查询是否有重定向链接，如果有调用链接视图
                    if (documentData.getREDIRECT_URL() != null && documentData.getREDIRECT_URL() != "") {
                        oPostData.put("DOCTYPE", CMSConstants.CONTENT_BODY_LINK);
                        oPostData.put("DOCLINK", documentData.getREDIRECT_URL());
                    }
                    try {
                        System.out.println("==============="+oPostData);
                        System.out.println("==============="+sMethodName);
                        Dispatch result = WCMServiceCaller.Call(sServiceId, sMethodName, oPostData, true);
                        count++;
                        if(result!=null){
                            JSONObject rObject = JSONObject.fromObject(result.getResponseText().toString());
                            if (rObject.get("ISSUCCESS").toString().equals("true")){
                                System.out.println("DOCTITLE:"+documentData.getTitle());
                                System.out.println("count:"+count);
                                System.out.println("oldDocid:"+documentData.getManuscriptId());
                                try {
                                    //处理引用文章
                                    String manuscriptId = documentData.getManuscriptId();
                                    if(manuscriptId != null && manuscriptId != ""){
                                        ColumnMapping columnMapping = new ColumnMapping();
                                        columnMapping.ColumnMappingCheck(manuscriptId);
                                    }
                                }catch (Exception ee){
                                    ee.printStackTrace();
                                }
                            }else{
                                String serror = JSON.toJSONString(rObject);
                                System.out.println(serror);
                                outPrint(serror,documentData.getManuscriptId(),count);
                            }
                        }
                    }catch(Exception e) {
                        outPrint("",documentData.getManuscriptId(),count);
                        e.printStackTrace();
                    }
                }

            }
        } catch (Exception e) {
            e.printStackTrace();
            Log_Exception.Error_txt("DataExchangeByChannel方法异常！"+e.getMessage());
        } finally {
        }
    }

        /**
     * 	政务公开
     * @param kpChannelId
     * @param hyChannelId
     */
    public void DataZWGKByChannelByTitle(String kpChannelId,String hyChannelId,String viewName){

        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Log_Exception.Logger_txt("-------Start-------kpChannelId:" + kpChannelId + "--hyChannelId:" + hyChannelId + "---------Start--------");
        String sServiceId = "gov_webdocument";
        String sMethodName = "saveDocumentInOpenData";//自定义视图
        ServiceImplKp serviceImplKp=new ServiceImplKp();
        Annex annex = new Annex();
        try {
            List<Map<String,Object>> allDocInfoFromKPDBdMaps = serviceImplKp.GetAllDocInfoFromKPDB(kpChannelId);
            System.out.println(allDocInfoFromKPDBdMaps);
            if(allDocInfoFromKPDBdMaps!=null){
                int count=0;
                for (Map<String,Object> map : allDocInfoFromKPDBdMaps) {
                    System.out.println("----------------------------"+map+"--------------------------------");
                    Map<String,Object> oPostData=new HashMap<>();
                    oPostData.put("ObjectId", 0);
                    oPostData.put("ChannelId", Integer.parseInt(hyChannelId));// 目标栏目id
                    oPostData.put("CurrUserName", "dev");
                    oPostData.put("isShenhe", "1");
                    oPostData.put("DOCTYPE",CMSConstants.CONTENT_BODY_HTML);
                    DocumentData documentData = new DocumentData(map);
                    System.out.println(documentData);
                    //标题-必填
                    if (documentData.getTitle() != null) {
                        oPostData.put("title",Jsoup.parse(documentData.getTitle()).text() );
                        //通过标题去海云当中查询文章MetaDataID
                        String MetaDataID =  serviceImplKp.getHyMetaDataIDByTitle(viewName,Jsoup.parse(documentData.getTitle()).text(),hyChannelId);
                        if(MetaDataID != null && MetaDataID != ""){
                            oPostData.put("ObjectId",MetaDataID);
                            oPostData.put("MetaDataId",MetaDataID);
                        }
                    }
                    // 内容
                    try {
                        // 内容中图片和附件需要特殊处理
                        if (documentData.getCurrentFilePathHtmlUrl() != null) {
                            String  currentFilePathHtmlUrl = documentData.getCurrentFilePathHtmlUrl();
                            JsoupUtilsView jsoupUtils = new JsoupUtilsView();
                            String html = jsoupUtils.rexStringHtml(currentFilePathHtmlUrl);
                            oPostData.put("UEDITOR", html);
                        } else {
                           oPostData.put("UEDITOR", "&nbsp;");
                        }
                    }catch (Exception e){
                        e.printStackTrace();
                    }
                    //发文字号
                    if (documentData.getC_WJBH() != null) {
                        oPostData.put("docno",documentData.getC_WJBH());
                    }
                    //创建时间
                    if (documentData.getC_FWRQ() != null) {
                        try {
                            Date date1 = new Date(Long.parseLong(documentData.getC_FWRQ()));
                            try {
                                LocalDateTime localDateTime = date1.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
                                LocalDateTime after8Hours = localDateTime.plusHours(8);
                                date1 = Date.from(after8Hours.atZone(ZoneId.systemDefault()).toInstant());
                            }catch (Exception e){
                                e.printStackTrace();
                            }
                            oPostData.put("scrq",simpleDateFormat.format(date1));
                        }catch (Exception e){
                            e.printStackTrace();
                        }
                    }
                    //发布时间
                    if (documentData.getPublishedTime() != null) {
                        Date parse = simpleDateFormat.parse(documentData.getPublishedTime());
                        long pubtime = parse.getTime();
                        Date date1 = new Date(pubtime);
                        try {
                            LocalDateTime localDateTime = date1.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
                            LocalDateTime after8Hours = localDateTime.plusHours(8);
                            date1 = Date.from(after8Hours.atZone(ZoneId.systemDefault()).toInstant());
                        }catch (Exception e){
                        }
                        oPostData.put("DocRelTime", simpleDateFormat.format(date1));
                    }
                    //关键词
                    if (documentData.getKEYWORD() != null) {
                        String keyword = documentData.getKEYWORD();
                        keyword = keyword.replaceAll("<br/>", "");//
                        keyword = keyword.replaceAll("<br>", "");//
                        oPostData.put("DOCKEYWORDS", keyword);
                    }
                    //摘要
                    if (documentData.getMemo() != null) {
                        try {
                            oPostData.put("DOCABSTRACT","");
                        }catch (Exception e){
                            oPostData.put("DOCABSTRACT",documentData.getMemo());
                        }
                    }
                    //旧索引号
                    if (documentData.getC_SYH() != null) {
                        oPostData.put("oldidxid",documentData.getC_SYH());
                    }
                    //来源
                    if (documentData.getB_source() != null) {
                        oPostData.put("SOURCE", documentData.getB_source());
                    }
                    //首页标题
                    if (documentData.getShortTitle() != null) {
                        oPostData.put("SHORTTITLE",Jsoup.parse(documentData.getTitle()).text());
                    }
                    //副标题
                    if (documentData.getSubTitle() != null) {
                        oPostData.put("SUB_TITLE",Jsoup.parse(documentData.getSubTitle()).text());
                    }
                    //公文时效
                    if (documentData.getC_GKSX() != null && documentData.getC_GKSX() != "") {
                        oPostData.put("validity",documentData.getC_GKSX());
                    }
                    //机构分类
                    if (documentData.getC_FBJG()  != null) {
                        String jg = documentData.getC_FBJG();
                        if(jg != null && jg != ""){
                            //查询开普对应发布机构名称的海运的发布机构id
                            String kyid = serviceImplKp.GetKpFPJG(jg);
                            System.out.println("=====kyid======"+kyid);
                            if(kyid != "" && kyid != null){
                                oPostData.put("custcat",kyid);
                            }
                        }else{
                            oPostData.put("old_publish",documentData.getC_FBJG());
                        }
                    }
                    //主题分类
                    if (documentData.getC_FBJG()  != null) {
                        oPostData.put("ztword",documentData.getC_ZTC());
                    }
                    //处理附件
                    try {
                        if (documentData.getManuscriptId() != null) {
                            Map<String, Object> zfggFileInfoByDocId = annex.getZWGKFileInfoByDocId(documentData.getManuscriptId());
                            System.out.println(zfggFileInfoByDocId);
                           /* if(zfggFileInfoByDocId.get("DOCRELPIC") != null){
                                oPostData.put("DOCRELPIC", zfggFileInfoByDocId.get("DOCRELPIC"));
                            }
                            if(zfggFileInfoByDocId.get("DOCATTACHFILEFIELD") != null){
                                oPostData.put("DOCATTACHFILEFIELD", zfggFileInfoByDocId.get("DOCATTACHFILEFIELD"));
                            }
                            if(zfggFileInfoByDocId.get("DOCATTACHPICFIELD") != null){
                                oPostData.put("DOCATTACHPICFIELD", zfggFileInfoByDocId.get("DOCATTACHPICFIELD"));
                            }
                            if(zfggFileInfoByDocId.get("DOCRELAPPENDIX") != null){
                                oPostData.put("DOCRELAPPENDIX", zfggFileInfoByDocId.get("DOCRELAPPENDIX"));
                            }*/
                            String qzbword = zfggFileInfoByDocId.get("qzbword").toString();
                            if(!qzbword.equals("[]")){
                                if(zfggFileInfoByDocId.get("qzbword") != null){
                                    oPostData.put("qzbword", zfggFileInfoByDocId.get("qzbword"));
                                }
                            }
                            String wjyl = zfggFileInfoByDocId.get("wjyl").toString();
                            if(!wjyl.equals("[]")){
                                if(zfggFileInfoByDocId.get("wjyl") != null){
                                    oPostData.put("wjyl", zfggFileInfoByDocId.get("wjyl"));
                                }
                            }

                        }
                    }catch (Exception e){
                        e.printStackTrace();
                    }
                    //查询是否有重定向链接，如果有调用链接视图
                    if (documentData.getREDIRECT_URL() != null && documentData.getREDIRECT_URL() != "") {
                        oPostData.put("DOCTYPE", CMSConstants.CONTENT_BODY_LINK);
                        oPostData.put("DOCLINK", documentData.getREDIRECT_URL());
                    }
                    try {
                        System.out.println("==============="+oPostData);
                        System.out.println("==============="+sMethodName);
                        Dispatch result = WCMServiceCaller.Call(sServiceId, sMethodName, oPostData, true);
                        count++;
                        if(result!=null){
                            JSONObject rObject = JSONObject.fromObject(result.getResponseText().toString());
                            if (rObject.get("ISSUCCESS").toString().equals("true")){
                                System.out.println("DOCTITLE:"+documentData.getTitle());
                                System.out.println("count:"+count);
                                System.out.println("oldDocid:"+documentData.getManuscriptId());
                                try {
                                    //处理引用文章
                                    String manuscriptId = documentData.getManuscriptId();
                                    if(manuscriptId != null && manuscriptId != ""){
                                        ColumnMapping columnMapping = new ColumnMapping();
                                        columnMapping.ColumnMappingCheck(manuscriptId);
                                    }
                                }catch (Exception ee){
                                    ee.printStackTrace();
                                }
                            }else{
                                String serror = JSON.toJSONString(rObject);
                                System.out.println(serror);
                                outPrint(serror,documentData.getManuscriptId(),count);
                            }
                        }
                    }catch(Exception e) {
                        outPrint("",documentData.getManuscriptId(),count);
                        e.printStackTrace();
                    }
                }

            }
        } catch (Exception e) {
            e.printStackTrace();
            Log_Exception.Error_txt("DataExchangeByChannel方法异常！"+e.getMessage());
        } finally {
        }


    }




      /**
     * 	政务公开-只迁移一篇文章
     * @param kpChannelId
     * @param hyChannelId
     */
    public void DataZWGKByChannelOne(String kpChannelId,String hyChannelId,String manuscriptIdStr){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Log_Exception.Logger_txt("-------Start-------kpChannelId:" + kpChannelId + "--hyChannelId:" + hyChannelId + "---------Start--------");
        String sServiceId = "gov_webdocument";
        String sMethodName = "saveDocumentInOpenData";//自定义视图
        ServiceImplKp serviceImplKp=new ServiceImplKp();
        Annex annex = new Annex();
        try {
            List<Map<String,Object>> allDocInfoFromKPDBdMaps = serviceImplKp.GetAllDocInfoFromKPDBOne(kpChannelId,manuscriptIdStr);
            System.out.println(allDocInfoFromKPDBdMaps);
            if(allDocInfoFromKPDBdMaps!=null){
                int count=0;
                for (Map<String,Object> map : allDocInfoFromKPDBdMaps) {
                    System.out.println("----------------------------"+map+"--------------------------------");
                    Map<String,Object> oPostData=new HashMap<>();
                    oPostData.put("ObjectId", 0);
                    oPostData.put("ChannelId", Integer.parseInt(hyChannelId));// 目标栏目id
                    oPostData.put("CurrUserName", "dev");
                    oPostData.put("isShenhe", "1");
                    oPostData.put("DOCTYPE",CMSConstants.CONTENT_BODY_HTML);
                    DocumentData documentData = new DocumentData(map);
                    System.out.println(documentData);
                    //标题-必填
                    if (documentData.getTitle() != null) {
                        oPostData.put("title",Jsoup.parse(documentData.getTitle()).text() );
                    }
                    // 内容
                    try {
                        // 内容中图片和附件需要特殊处理
                        if (documentData.getCurrentFilePathHtmlUrl() != null) {
                            String  currentFilePathHtmlUrl = documentData.getCurrentFilePathHtmlUrl();
                            JsoupUtilsView jsoupUtils = new JsoupUtilsView();
                            String html = jsoupUtils.rexStringHtml(currentFilePathHtmlUrl);
                            oPostData.put("UEDITOR", html);
                        } else {
                            oPostData.put("UEDITOR", "&nbsp;");
                        }
                    }catch (Exception e){
                        e.printStackTrace();
                    }
                    //发文字号
                    if (documentData.getC_WJBH() != null) {
                        oPostData.put("docno",documentData.getC_WJBH());
                    }
                    //创建时间
                    if (documentData.getC_FWRQ() != null) {
                        try {
                            Date date1 = new Date(Long.parseLong(documentData.getC_FWRQ()));
                            try {
                                LocalDateTime localDateTime = date1.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
                                LocalDateTime after8Hours = localDateTime.plusHours(8);
                                date1 = Date.from(after8Hours.atZone(ZoneId.systemDefault()).toInstant());
                            }catch (Exception e){
                                e.printStackTrace();
                            }
                            oPostData.put("scrq",simpleDateFormat.format(date1));
                        }catch (Exception e){
                            e.printStackTrace();
                        }
                    }
                    //发布时间
                    if (documentData.getPublishedTime() != null) {
                        Date parse = simpleDateFormat.parse(documentData.getPublishedTime());
                        long pubtime = parse.getTime();
                        Date date1 = new Date(pubtime);
                        try {
                            LocalDateTime localDateTime = date1.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
                            LocalDateTime after8Hours = localDateTime.plusHours(8);
                            date1 = Date.from(after8Hours.atZone(ZoneId.systemDefault()).toInstant());
                        }catch (Exception e){
                        }
                        oPostData.put("DocRelTime", simpleDateFormat.format(date1));
                    }
                    //关键词
                    if (documentData.getKEYWORD() != null) {
                        String keyword = documentData.getKEYWORD();
                        keyword = keyword.replaceAll("<br/>", "");//
                        keyword = keyword.replaceAll("<br>", "");//
                        oPostData.put("DOCKEYWORDS", keyword);
                    }
                    //摘要
                    if (documentData.getMemo() != null) {
                        try {
                            oPostData.put("DOCABSTRACT","");
                        }catch (Exception e){
                            oPostData.put("DOCABSTRACT",documentData.getMemo());
                        }
                    }
                    //旧索引号
                    if (documentData.getC_SYH() != null) {
                        oPostData.put("oldidxid",documentData.getC_SYH());
                    }
                    //来源
                    if (documentData.getB_source() != null) {
                        oPostData.put("SOURCE", documentData.getB_source());
                    }
                    //首页标题
                    if (documentData.getShortTitle() != null) {
                        oPostData.put("SHORTTITLE",Jsoup.parse(documentData.getTitle()).text());
                    }
                    //副标题
                    if (documentData.getSubTitle() != null) {
                        oPostData.put("SUB_TITLE",Jsoup.parse(documentData.getSubTitle()).text());
                    }
                    //公文时效
                    if (documentData.getC_GKSX() != null && documentData.getC_GKSX() != "") {
                        oPostData.put("validity",documentData.getC_GKSX());
                    }
                    //机构分类
                    if (documentData.getC_FBJG()  != null) {
                        String jg = documentData.getC_FBJG();
                        if(jg != null && jg != ""){
                            //查询开普对应发布机构名称的海运的发布机构id
                            String kyid = serviceImplKp.GetKpFPJG(jg);
                            System.out.println("=====kyid======"+kyid);
                            if(kyid != "" && kyid != null){
                                oPostData.put("custcat",kyid);
                            }
                        }else{
                            oPostData.put("old_publish",documentData.getC_FBJG());
                        }
                    }
                    //主题分类
                    if (documentData.getC_FBJG()  != null) {
                        oPostData.put("ztword",documentData.getC_ZTC());
                    }
                    //处理附件
                    try {
                        if (documentData.getManuscriptId() != null) {
                            Map<String, Object> zfggFileInfoByDocId = annex.getZWGKFileInfoByDocId(documentData.getManuscriptId());
                            System.out.println(zfggFileInfoByDocId);
                           /* if(zfggFileInfoByDocId.get("DOCRELPIC") != null){
                                oPostData.put("DOCRELPIC", zfggFileInfoByDocId.get("DOCRELPIC"));
                            }
                            if(zfggFileInfoByDocId.get("DOCATTACHFILEFIELD") != null){
                                oPostData.put("DOCATTACHFILEFIELD", zfggFileInfoByDocId.get("DOCATTACHFILEFIELD"));
                            }
                            if(zfggFileInfoByDocId.get("DOCATTACHPICFIELD") != null){
                                oPostData.put("DOCATTACHPICFIELD", zfggFileInfoByDocId.get("DOCATTACHPICFIELD"));
                            }
                            if(zfggFileInfoByDocId.get("DOCRELAPPENDIX") != null){
                                oPostData.put("DOCRELAPPENDIX", zfggFileInfoByDocId.get("DOCRELAPPENDIX"));
                            }*/
                            if(zfggFileInfoByDocId.get("qzbword") != null){
                                oPostData.put("qzbword", zfggFileInfoByDocId.get("qzbword"));
                            }
                            if(zfggFileInfoByDocId.get("wjyl") != null){
                                oPostData.put("wjyl", zfggFileInfoByDocId.get("wjyl"));
                            }
                        }
                    }catch (Exception e){
                        e.printStackTrace();
                    }
                    //查询是否有重定向链接，如果有调用链接视图
                    if (documentData.getREDIRECT_URL() != null && documentData.getREDIRECT_URL() != "") {
                        oPostData.put("DOCTYPE", CMSConstants.CONTENT_BODY_LINK);
                        oPostData.put("DOCLINK", documentData.getREDIRECT_URL());
                    }
                    try {
                        System.out.println("==============="+oPostData);
                        System.out.println("==============="+sMethodName);
                        Dispatch result = WCMServiceCaller.Call(sServiceId, sMethodName, oPostData, true);
                        count++;
                        if(result!=null){
                            JSONObject rObject = JSONObject.fromObject(result.getResponseText().toString());
                            if (rObject.get("ISSUCCESS").toString().equals("true")){
                                System.out.println("DOCTITLE:"+documentData.getTitle());
                                System.out.println("count:"+count);
                                System.out.println("oldDocid:"+documentData.getManuscriptId());
                                try {
                                    //处理引用文章
                                    String manuscriptId = documentData.getManuscriptId();
                                    if(manuscriptId != null && manuscriptId != ""){
                                        ColumnMapping columnMapping = new ColumnMapping();
                                        columnMapping.ColumnMappingCheck(manuscriptId);
                                    }
                                }catch (Exception ee){
                                    ee.printStackTrace();
                                }
                            }else{
                                String serror = JSON.toJSONString(rObject);
                                System.out.println(serror);
                                outPrint(serror,documentData.getManuscriptId(),count);
                            }
                        }
                    }catch(Exception e) {
                        outPrint("",documentData.getManuscriptId(),count);
                        e.printStackTrace();
                    }
                }

            }
        } catch (Exception e) {
            e.printStackTrace();
            Log_Exception.Error_txt("DataExchangeByChannel方法异常！"+e.getMessage());
        } finally {
        }
    }
    /**
     * 	政府公报
     * @param kpChannelId
     * @param hyChannelId
     */
    public void DataZFGBByChannel(String kpChannelId,String hyChannelId){
        Log_Exception.Logger_txt("-------Start-------kpChannelId:" + kpChannelId + "--hyChannelId:" + hyChannelId + "---------Start--------");
        String sServiceId = "gov_webdocument";
        String sMethodName = "saveDocumentInOpenData";//自定义视图
        ServiceImplKp serviceImplKp=new ServiceImplKp();
        Annex annex = new Annex();
        try {
            List<Map<String,Object>> allDocInfoFromKPDBdMaps = serviceImplKp.GetAllDocInfoFromKPDB(kpChannelId);
            System.out.println(allDocInfoFromKPDBdMaps);
            if(allDocInfoFromKPDBdMaps!=null){
                int count=0;
                for (Map<String,Object> map : allDocInfoFromKPDBdMaps) {
                    Map<String,Object> oPostData=new HashMap<>();
                    oPostData.put("ObjectId", 0);
                    oPostData.put("ChannelId", Integer.parseInt(hyChannelId));// 目标栏目id
                    oPostData.put("CurrUserName", "dev");
                    oPostData.put("DOCTYPE",CMSConstants.CONTENT_BODY_HTML);
                    DocumentData documentData = new DocumentData(map);
                    oPostData.put("isShenhe", "1");
                    //标题-必填
                    if (documentData.getTitle() != null) {
                        oPostData.put("gbbt", Jsoup.parse(documentData.getTitle()).text());
                    }
                    try {
                        // 内容中图片和附件需要特殊处理
                        if (documentData.getCurrentFilePathHtmlUrl() != null) {
                            String  currentFilePathHtmlUrl = documentData.getCurrentFilePathHtmlUrl();
                            JsoupUtils jsoupUtils = new JsoupUtils();
                            String html = jsoupUtils.rexStringHtml(currentFilePathHtmlUrl);
                            oPostData.put("nrzw", html);
                        } else {
                            oPostData.put("nrzw", "&nbsp;");
                        }
                    }catch (Exception e){
                        e.printStackTrace();
                    }
                    if (documentData.getC_FBJG() != null) {
                        oPostData.put("fwdw", documentData.getC_FBJG());
                    }
                    if (documentData.getPublishedTime()  != null ) {
                        oPostData.put("fbsj", documentData.getPublishedTime());
                    }
                    //关键词
                    if (documentData.getKEYWORD() != null) {
                        String keyword = documentData.getKEYWORD();
                        keyword = keyword.replaceAll("<br/>", "");//
                        keyword = keyword.replaceAll("<br>", "");//
                        oPostData.put("gjc", keyword);
                    }
                    //摘要
                    if (documentData.getMemo() != null) {
                        oPostData.put("DOCABSTRACT", documentData.getMemo());
                    }
                    //旧索引号
                    if (documentData.getC_SYH() != null) {
                        oPostData.put("zy", documentData.getC_SYH());
                    }

                    //副标题
                    if (documentData.getSubTitle() != null) {
                        oPostData.put("fbt",Jsoup.parse(documentData.getSubTitle()).text());
                    }
                    //处理附件
                    try {
                        if (documentData.getManuscriptId() != null) {
                            Map<String, Object> getRelFileInfoByDocId = annex.getZFGGFileInfoByDocId(documentData.getManuscriptId());
                            if( getRelFileInfoByDocId.get("GBFL") != null){
                                oPostData.put("GBFL", getRelFileInfoByDocId.get("GBFL"));
                            }
                        }
                    }catch (Exception e){
                        e.printStackTrace();
                    }
                    //查询是否有重定向链接，如果有调用链接视图
                    if (documentData.getREDIRECT_URL() != null && documentData.getREDIRECT_URL() != "") {
                        oPostData.put("DOCTYPE", CMSConstants.CONTENT_BODY_LINK);
                        oPostData.put("DOCLINK", documentData.getREDIRECT_URL());
                    }
                    try {
                        System.out.println(oPostData);
                        System.out.println(sMethodName);
                        Dispatch result = WCMServiceCaller.Call(sServiceId, sMethodName, oPostData, true);
                        count++;
                        if(result!=null){
                            JSONObject rObject = JSONObject.fromObject(result.getResponseText().toString());
                            if (rObject.get("ISSUCCESS").toString().equals("true")){
                                System.out.println("DOCTITLE:"+documentData.getTitle());
                                System.out.println("count:"+count);
                                System.out.println("oldDocid:"+documentData.getManuscriptId());
                                try {
                                    //处理引用文章
                                    String manuscriptId = documentData.getManuscriptId();
                                    if(manuscriptId != null && manuscriptId != ""){
                                        ColumnMapping columnMapping = new ColumnMapping();
                                        columnMapping.ColumnMappingCheck(manuscriptId);
                                    }
                                }catch (Exception ee){
                                    ee.printStackTrace();
                                }
                            }else{
                                String serror = JSON.toJSONString(rObject);
                                System.out.println(serror);
                                outPrint(serror,documentData.getManuscriptId(),count);
                            }
                        }
                    }catch(Exception e) {
                        outPrint("",documentData.getManuscriptId(),count);
                        e.printStackTrace();
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
            Log_Exception.Error_txt("DataExchangeByChannel error"+e.getMessage());
        } finally {

        }
    }
    /**
     * 	政府公报全真版
     * @param kpChannelId
     * @param hyChannelId
     */
    public void DataZFGBBQZByChannel(String kpChannelId,String hyChannelId){
        Log_Exception.Logger_txt("-------Start-------kpChannelId:" + kpChannelId + "--hyChannelId:" + hyChannelId + "---------Start--------");
        String sServiceId = "gov_webdocument";
        String sMethodName = "saveDocumentInOpenData";//自定义视图
        ServiceImplKp serviceImplKp=new ServiceImplKp();
        Annex annex = new Annex();
        try {
            List<Map<String,Object>> allDocInfoFromKPDBdMaps = serviceImplKp.GetAllDocInfoFromKPDB(kpChannelId);
            System.out.println(allDocInfoFromKPDBdMaps);
            if(allDocInfoFromKPDBdMaps!=null){
                int count=0;
                for (Map<String,Object> map : allDocInfoFromKPDBdMaps) {
                    Map<String,Object> oPostData=new HashMap<>();
                    oPostData.put("ObjectId", 0);
                    oPostData.put("ChannelId", Integer.parseInt(hyChannelId));// 目标栏目id
                    oPostData.put("CurrUserName", "dev");
                    oPostData.put("DOCTYPE",CMSConstants.CONTENT_BODY_HTML);
                    DocumentData documentData = new DocumentData(map);
                    oPostData.put("isShenhe", "1");
                    //标题-必填
                    if (documentData.getTitle() != null) {
                        oPostData.put("title", Jsoup.parse(documentData.getTitle()).text());
                    }
                    //处理附件
                    try {
                        if (documentData.getManuscriptId() != null) {
                            Map<String, Object> getRelFileInfoByDocId = annex.getZFGGQZBFileInfoByDocId(documentData.getManuscriptId());
                            if( getRelFileInfoByDocId.get("qzb") != null){
                                oPostData.put("qzb", getRelFileInfoByDocId.get("qzb"));
                            }
                        }
                    }catch (Exception e){
                        e.printStackTrace();
                    }
                    //查询是否有重定向链接，如果有调用链接视图
                    if (documentData.getREDIRECT_URL() != null && documentData.getREDIRECT_URL() != "") {
                        oPostData.put("DOCTYPE", CMSConstants.CONTENT_BODY_LINK);
                        oPostData.put("DOCLINK", documentData.getREDIRECT_URL());
                    }
                    try {
                        System.out.println(oPostData);
                        Dispatch result = WCMServiceCaller.Call(sServiceId, sMethodName, oPostData, true);
                        count++;
                        if(result!=null){
                            JSONObject rObject = JSONObject.fromObject(result.getResponseText().toString());
                            if (rObject.get("ISSUCCESS").toString().equals("true")){
                                System.out.println("DOCTITLE:"+documentData.getTitle());
                                System.out.println("count:"+count);
                                System.out.println("oldDocid:"+documentData.getManuscriptId());
                                try {
                                    //处理引用文章
                                    String manuscriptId = documentData.getManuscriptId();
                                    if(manuscriptId != null && manuscriptId != ""){
                                        ColumnMapping columnMapping = new ColumnMapping();
                                        columnMapping.ColumnMappingCheck(manuscriptId);
                                    }
                                }catch (Exception ee){
                                    ee.printStackTrace();
                                }
                            }else{
                                String serror = JSON.toJSONString(rObject);
                                System.out.println(serror);
                                outPrint(serror,documentData.getManuscriptId(),count);
                            }
                        }
                    }catch(Exception e) {
                        outPrint("",documentData.getManuscriptId(),count);
                        e.printStackTrace();
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
            Log_Exception.Error_txt("DataExchangeByChannel error"+e.getMessage());
        } finally {

        }
    }
    /**
     * 	政府公报全真版
     * @param kpChannelId
     * @param hyChannelId
     */
    public void DataZFGBBQZByChannelOne(String kpChannelId,String hyChannelId,String manuscriptIdStr){
        Log_Exception.Logger_txt("-------Start-------kpChannelId:" + kpChannelId + "--hyChannelId:" + hyChannelId + "---------Start--------");
        String sServiceId = "gov_webdocument";
        String sMethodName = "saveDocumentInOpenData";//自定义视图
        ServiceImplKp serviceImplKp=new ServiceImplKp();
        Annex annex = new Annex();
        try {
            List<Map<String,Object>> allDocInfoFromKPDBdMaps = serviceImplKp.GetAllDocInfoFromKPDBOne(kpChannelId,manuscriptIdStr);
            System.out.println(allDocInfoFromKPDBdMaps);
            if(allDocInfoFromKPDBdMaps!=null){
                int count=0;
                for (Map<String,Object> map : allDocInfoFromKPDBdMaps) {
                    Map<String,Object> oPostData=new HashMap<>();
                    oPostData.put("ObjectId", 0);
                    oPostData.put("ChannelId", Integer.parseInt(hyChannelId));// 目标栏目id
                    oPostData.put("CurrUserName", "dev");
                    oPostData.put("DOCTYPE",CMSConstants.CONTENT_BODY_HTML);
                    DocumentData documentData = new DocumentData(map);
                    oPostData.put("isShenhe", "1");
                    //标题-必填
                    if (documentData.getTitle() != null) {
                        oPostData.put("title", Jsoup.parse(documentData.getTitle()).text());
                    }
                    //处理附件
                    try {
                        if (documentData.getManuscriptId() != null) {
                            Map<String, Object> getRelFileInfoByDocId = annex.getZFGGQZBFileInfoByDocId(documentData.getManuscriptId());
                            if( getRelFileInfoByDocId.get("qzb") != null){
                                oPostData.put("qzb", getRelFileInfoByDocId.get("qzb"));
                            }
                        }
                    }catch (Exception e){
                        e.printStackTrace();
                    }
                    //查询是否有重定向链接，如果有调用链接视图
                    if (documentData.getREDIRECT_URL() != null && documentData.getREDIRECT_URL() != "") {
                        oPostData.put("DOCTYPE", CMSConstants.CONTENT_BODY_LINK);
                        oPostData.put("DOCLINK", documentData.getREDIRECT_URL());
                    }
                    try {
                        System.out.println(oPostData);
                        Dispatch result = WCMServiceCaller.Call(sServiceId, sMethodName, oPostData, true);
                        count++;
                        if(result!=null){
                            JSONObject rObject = JSONObject.fromObject(result.getResponseText().toString());
                            if (rObject.get("ISSUCCESS").toString().equals("true")){
                                System.out.println("DOCTITLE:"+documentData.getTitle());
                                System.out.println("count:"+count);
                                System.out.println("oldDocid:"+documentData.getManuscriptId());
                                try {
                                    //处理引用文章
                                    String manuscriptId = documentData.getManuscriptId();
                                    if(manuscriptId != null && manuscriptId != ""){
                                        ColumnMapping columnMapping = new ColumnMapping();
                                        columnMapping.ColumnMappingCheck(manuscriptId);
                                    }
                                }catch (Exception ee){
                                    ee.printStackTrace();
                                }
                            }else{
                                String serror = JSON.toJSONString(rObject);
                                System.out.println(serror);
                                outPrint(serror,documentData.getManuscriptId(),count);
                            }
                        }
                    }catch(Exception e) {
                        outPrint("",documentData.getManuscriptId(),count);
                        e.printStackTrace();
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
            Log_Exception.Error_txt("DataExchangeByChannel error"+e.getMessage());
        } finally {

        }
    }


    public void outPrint(String serror,String ManuscriptId,int count){
        try (
                BufferedWriter writer = new BufferedWriter(new FileWriter(ColumnConfig.outPrintFile,true))
        )
        {
            writer.write(serror+","+ManuscriptId+","+count+",");
            writer.newLine(); // 换行
        } catch (IOException e1) {
            e1.printStackTrace();
        }
    }

    public String getJg(String jgmc)
    {

        String code = null;
        List<DemoDataJiGou> list = new ArrayList<>();
        EasyExcel.read(ColumnConfig.fileName, DemoDataJiGou.class, new PageReadListener<DemoDataJiGou>(dataList -> {
            for (DemoDataJiGou demoDataJiGou : dataList) {
                String jgName = demoDataJiGou.getJgName();
                if(jgName != null && jgName != ""){
                    list.add(demoDataJiGou);
                }
            }
        })).sheet().doRead();
        for (DemoDataJiGou demoDataJiGou : list) {
            if(demoDataJiGou.getJgName().equals(jgmc)){
                code = demoDataJiGou.getCode();
            }
        }
        return code;
    }
}
