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

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.tonglaozheng.DemoData;
import net.sf.json.JSONObject;

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 StartExcelDataExchange {

	public static void main(String[] args) {
		// since: 3.0.0-beta1
		String fileName = "C:\\Users\\28799\\Desktop\\ccc.xlsx";
		// 这里 需要指定读用哪个class去读，然后读取第一个sheet 文件流会自动关闭
		// 这里默认每次会读取100条数据 然后返回过来 直接调用使用数据就行
		// 具体需要返回多少行可以在`PageReadListener`的构造函数设置
		EasyExcel.read(fileName, DemoData.class, new PageReadListener<DemoData>(dataList -> {
			for (DemoData demoData : dataList) {
				System.out.println(demoData);
				String view = demoData.getView();
				if(view != null && view != ""){
					if(view.equals("1")){
						try {
							StartExcelDataExchange wcm=new StartExcelDataExchange();
							wcm.DataZhiXunByChannel(demoData.getKpChannelId(), demoData.getHyChannelId());
						} catch (Exception e) {
							Log_Exception.Error_txt("StartMethord()方法异常！"+e.getMessage());
						}
					}
					if(view.equals("2")){
						try {
							StartExcelDataExchange wcm=new StartExcelDataExchange();
							wcm.DataZWGKByChannel(demoData.getKpChannelId(), demoData.getHyChannelId());
						} catch (Exception e) {
							Log_Exception.Error_txt("StartMethord()方法异常！"+e.getMessage());
						}
					}
					if(view.equals("3")){
						try {
							StartExcelDataExchange wcm=new StartExcelDataExchange();
							wcm.DataGBByChannel(demoData.getKpChannelId(), demoData.getHyChannelId());
						} catch (Exception e) {
							Log_Exception.Error_txt("StartMethord()方法异常！"+e.getMessage());
						}
					}
					if(view.equals("4")){
						StartExcelDataExchange wcm=new StartExcelDataExchange();
						try {
							wcm.DataGKXXByChannel(demoData.getKpChannelId(), demoData.getHyChannelId());
						} catch (Exception e) {
							Log_Exception.Error_txt("StartMethord()方法异常！"+e.getMessage());
						}
					}
				}
			}
		})).sheet().doRead();

	}

	/**
     * 资讯视图
     * @param wcmChannelId
     * @param hyChannelId
     */
    public void DataZhiXunByChannel(String wcmChannelId,String hyChannelId){
        Log_Exception.Logger_txt("-------Start-------将原栏目id：" + wcmChannelId + "中得数据导入海云平台" + hyChannelId + "---------Start--------");
        String sServiceId = "gov_webdocument";
        String sMethodName = "saveDocumentInWeb";//自定义视图
        ServiceImplWcm wcm=new ServiceImplWcm();
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        try {
            List<Map<String,Object>> oldMaps=wcm.GetAllDocInfoFromOldDB(wcmChannelId, "");
            if(oldMaps!=null){
                int count=0;
                for (Map<String,Object> map : oldMaps) {

                    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);


                    String wcmDocId=map.get("MANUSCRIPT_ID").toString();//文档ID
                    String docTitle=map.get("TITLE").toString();
                    //标题-必填
                    if (docTitle != null) {
                        oPostData.put("DOCTITLE", docTitle);
                    }
                    //副标题
                    if (map.get("SUB_TITLE") != null) {
						oPostData.put("SUBDOCTITLE", map.get("SUB_TITLE"));
					}
					//短标题
					if (map.get("SHORT_TITLE") != null) {
						oPostData.put("SHORTTITLE", map.get("SHORT_TITLE"));
					}
					//关键词
					if (map.get("KEYWORD") != null) {
						String keyword = (String) map.get("KEYWORD");
						keyword = keyword.replaceAll("<br/>", "");//
						keyword = keyword.replaceAll("<br>", "");//
						oPostData.put("DOCKEYWORDS", keyword);
					}
					//发布时间
					if (map.get("PUBLISHED_TIME") != null) {
						long pubtime = Long.parseLong(map.get("PUBLISHED_TIME").toString());
						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){
						}
						String pubtimeStr = simpleDateFormat.format(date1);
						oPostData.put("DOCRELTIME", pubtimeStr);
					}
					//创建时间
					if (map.get("CREATED_TIME") != null) {
						long crtime = Long.parseLong(map.get("CREATED_TIME").toString());
						Date date1 = new Date(crtime);
						String crtimeStr = simpleDateFormat.format(date1);
						oPostData.put("CRTIME", crtimeStr);
					}

					//来源
					if (map.get("B_SOURCE") != null) {
						oPostData.put("DOCSOURCENAME", map.get("B_SOURCE"));
					}

					//摘要
					if (map.get("MEMO") != null) {
						oPostData.put("DOCABSTRACT", map.get("MEMO"));
					}
					//链接地址
/*					if (map.get("DOCLINK") != null) {
						oPostData.put("DOCLINK", map.get("DOCLINK"));
					}*/
					oPostData.put("oldDocid", wcmDocId);
					
					//处理附件
					try {
						Map<String, Object> getRelFileInfoByDocId = wcm.GetRelFileInfoByDocId(wcmDocId);
						oPostData.put("docRelFile", getRelFileInfoByDocId.get("docRelFile"));
						oPostData.put("docRelPic", getRelFileInfoByDocId.get("docRelPic"));
					}catch (Exception e){
						e.printStackTrace();
					}

					try {
						// 内容中图片和附件需要特殊处理
						if (map.get("currentFilePathHtmlUrl") != null) {
							String  currentFilePathHtmlUrl = map.get("currentFilePathHtmlUrl")+"";
							System.out.println(currentFilePathHtmlUrl);
							JsoupUtils jsoupUtils = new JsoupUtils();
							String html = jsoupUtils.rexStringHtml(currentFilePathHtmlUrl);
							System.out.println("================================");
							System.out.println(html);
							oPostData.put("DOCHTMLCON", html);
						} else {
							oPostData.put("DocHtmlCon", "&nbsp;");
							oPostData.put("DOCCONTENT", "&nbsp;");
						}
					}catch (Exception e){
						e.printStackTrace();
					}

					try {
	                    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("==="+count+"======wcmdocid:"+wcmDocId);
	                        }else{
								String serror = JSON.toJSONString(oPostData);
								try (BufferedWriter writer = new BufferedWriter(new FileWriter("D:\\ruoyi\\output.txt",true))) {
									writer.write("==============wcmDocId======"+wcmDocId +"===========count=========="+count);
									writer.newLine(); // 换行
								} catch (IOException e1) {
									e1.printStackTrace();
								}
							}
	                    }
					}catch(Exception e) {
						String serror = JSON.toJSONString(oPostData);
						try (BufferedWriter writer = new BufferedWriter(new FileWriter("D:\\ruoyi\\output.txt",true))) {
							writer.write("==============wcmDocId======"+wcmDocId +"===========count=========="+count);
							writer.newLine(); // 换行
						} catch (IOException e1) {
							e1.printStackTrace();
						}
						e.printStackTrace();
					}
                }
            }
        } catch (Exception e) {
        	e.printStackTrace();
            Log_Exception.Error_txt("DataExchangeByChannel方法异常！"+e.getMessage());
        } finally {

        }
    }

	/*
	政府公告
	* */
	public void DataZWGKByChannel(String wcmChannelId,String hyChannelId){

		Log_Exception.Logger_txt("-------Start-------将原栏目id：" + wcmChannelId + "中得数据导入海云平台" + hyChannelId + "---------Start--------");
		String sServiceId = "gov_webdocument";
		String sMethodName = "saveDocumentInOpenData";//自定义视图
		ServiceImplWcm wcm=new ServiceImplWcm();
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		try {
			List<Map<String,Object>> oldMaps=wcm.GetAllDocInfoFromOldDBAll(wcmChannelId);

			System.out.println(oldMaps);
			if(oldMaps!=null){
				int count=0;
				for (Map<String,Object> map : oldMaps) {
					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);
					String wcmDocId=map.get("MANUSCRIPT_ID").toString();//文档ID
					String docTitle=map.get("TITLE").toString();
					//标题-必填
					if (docTitle != null) {
						oPostData.put("title", docTitle);
					}
					// 索引ID
					// 公文时效
					try {
						// 内容中图片和附件需要特殊处理
						if (map.get("currentFilePathHtmlUrl") != null) {
							String  currentFilePathHtmlUrl = map.get("currentFilePathHtmlUrl")+"";
							JsoupUtils jsoupUtils = new JsoupUtils();
							String html = jsoupUtils.rexStringHtml(currentFilePathHtmlUrl);
							oPostData.put("UEDITOR", html);
						} else {
							oPostData.put("UEDITOR", "&nbsp;");
						}
					}catch (Exception e){
						e.printStackTrace();
					}
					//发文字号
					if (map.get("C_FWRQ") != null) {
						oPostData.put("scrq", map.get("C_FWRQ"));
					}
					//创建时间
					if (map.get("CREATED_TIME") != null) {
						long crtime = Long.parseLong(map.get("CREATED_TIME").toString());
						Date date1 = new Date(crtime);
						String crtimeStr = simpleDateFormat.format(date1);
						oPostData.put("scrq", crtimeStr);
					}

					//发布时间
					if (map.get("PUBLISHED_TIME") != null) {
						long pubtime = Long.parseLong(map.get("PUBLISHED_TIME").toString());
						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){
						}
						String pubtimeStr = simpleDateFormat.format(date1);
						oPostData.put("DocRelTime", pubtimeStr);
					}
					//关键词
					if (map.get("KEYWORD") != null) {
						String keyword = (String) map.get("KEYWORD");
						keyword = keyword.replaceAll("<br/>", "");//
						keyword = keyword.replaceAll("<br>", "");//
						oPostData.put("DOCKEYWORDS", keyword);
					}
					//摘要
					if (map.get("MEMO") != null) {
						oPostData.put("DOCABSTRACT", map.get("MEMO"));
					}
					//旧索引号
					if (map.get("C_SYH") != null) {
						oPostData.put("oldidxid", map.get("C_SYH"));
					}
					//来源
					if (map.get("B_SOURCE") != null) {
						oPostData.put("SOURCE", map.get("B_SOURCE"));
					}
					//处理附件
					try {
						Map<String, Object> getRelFileInfoByDocId = wcm.GetRelFileInfoByDocIdGK(wcmDocId);
						oPostData.put("DOCRELAPPENDIX", getRelFileInfoByDocId.get("DOCATTACHPICFIELD"));
					}catch (Exception e){
						e.printStackTrace();
					}
					//首页标题
					if (map.get("SHORT_TITLE") != null) {
						oPostData.put("SHORTTITLE", map.get("SHORT_TITLE"));
					}
					//副标题
					if (map.get("SUB_TITLE") != null) {
						oPostData.put("SUB_TITLE", map.get("SUB_TITLE"));
					}
					//机构分类
					if (map.get("C_FBJG") != null) {
						String c_fbjg = map.get("C_FBJG").toString();
						String jg = getJg(c_fbjg);
						if(jg != null && jg != ""){
							oPostData.put("custcat", map.get(jg));
						}else{
							oPostData.put("old_publish", map.get("C_FBJG"));
						}
					}
					try {
						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("==="+count+"======wcmdocid:"+wcmDocId);
							}else{
								String serror = JSON.toJSONString(oPostData);
								try (BufferedWriter writer = new BufferedWriter(new FileWriter("D:\\ruoyi\\output.txt",true))) {
									writer.write("==============wcmDocId======"+wcmDocId +"===========count=========="+count);
									writer.newLine(); // 换行
								} catch (IOException e1) {
									e1.printStackTrace();
								}
							}
						}
					}catch(Exception e) {
						String serror = JSON.toJSONString(oPostData);
						try (BufferedWriter writer = new BufferedWriter(new FileWriter("D:\\ruoyi\\output.txt",true))) {
							writer.write("==============wcmDocId======"+wcmDocId +"===========count=========="+count);
							writer.newLine(); // 换行
						} catch (IOException e1) {
							e1.printStackTrace();
						}
						e.printStackTrace();
					}
				}

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

		}

	}

	/*
	* 政府公报
	* */
	public void DataGBByChannel(String wcmChannelId,String hyChannelId){

		Log_Exception.Logger_txt("-------Start-------将原栏目id：" + wcmChannelId + "中得数据导入海云平台" + hyChannelId + "---------Start--------");
		String sServiceId = "gov_webdocument";
		String sMethodName = "saveDocumentInOpenData";//自定义视图
		ServiceImplWcm wcm=new ServiceImplWcm();
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		try {
			List<Map<String,Object>> oldMaps=wcm.GetAllDocInfoFromOldDBAll(wcmChannelId);

			System.out.println(oldMaps);
			if(oldMaps!=null){
				int count=0;
				for (Map<String,Object> map : oldMaps) {
					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);
					String wcmDocId=map.get("MANUSCRIPT_ID").toString();//文档ID
					String docTitle=map.get("TITLE").toString();
					//标题-必填
					oPostData.put("isShenhe", "0");
					if (docTitle != null) {
						oPostData.put("gbbt", docTitle);
					}
					// 索引ID
					// 公文时效
					try {
						// 内容中图片和附件需要特殊处理
						if (map.get("currentFilePathHtmlUrl") != null) {
							String  currentFilePathHtmlUrl = map.get("currentFilePathHtmlUrl")+"";
							JsoupUtils jsoupUtils = new JsoupUtils();
							String html = jsoupUtils.rexStringHtml(currentFilePathHtmlUrl);
							oPostData.put("nrzw", html);
						} else {
							oPostData.put("nrzw", "&nbsp;");
						}
					}catch (Exception e){
						e.printStackTrace();
					}
					if (map.get("C_FBJG") != null) {
						oPostData.put("fwdw", map.get("C_FBJG"));
					}

					//发布时间
					if (map.get("PUBLISHED_TIME") != null) {
						long pubtime = Long.parseLong(map.get("PUBLISHED_TIME").toString());
						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){
						}
						String pubtimeStr = simpleDateFormat.format(date1);
						oPostData.put("fbsj", pubtimeStr);
					}
					//关键词
					if (map.get("KEYWORD") != null) {
						String keyword = (String) map.get("KEYWORD");
						keyword = keyword.replaceAll("<br/>", "");//
						keyword = keyword.replaceAll("<br>", "");//
						oPostData.put("gjc", keyword);
					}
					//摘要
					if (map.get("MEMO") != null) {
						oPostData.put("DOCABSTRACT", map.get("MEMO"));
					}
					//旧索引号
					if (map.get("MEMO") != null) {
						oPostData.put("zy", map.get("MEMO"));
					}

					//副标题
					if (map.get("SUB_TITLE") != null) {
						oPostData.put("fbt", map.get("SUB_TITLE"));
					}

					//处理附件
					try {
						Map<String, Object> getRelFileInfoByDocId = wcm.GetRelFileInfoByDocIdGG(wcmDocId);
						oPostData.put("gbfj", getRelFileInfoByDocId.get("GBFL"));
					}catch (Exception e){
						e.printStackTrace();
					}
					//机构分类

					try {
						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("==="+count+"======wcmdocid:"+wcmDocId);
							}else{
								String serror = JSON.toJSONString(oPostData);
								try (BufferedWriter writer = new BufferedWriter(new FileWriter("D:\\ruoyi\\output.txt",true))) {
									writer.write("==============wcmDocId======"+wcmDocId +"===========count=========="+count);
									writer.newLine(); // 换行
								} catch (IOException e1) {
									e1.printStackTrace();
								}
							}
						}
					}catch(Exception e) {
						String serror = JSON.toJSONString(oPostData);
						try (BufferedWriter writer = new BufferedWriter(new FileWriter("D:\\ruoyi\\output.txt",true))) {
							writer.write("==============wcmDocId======"+wcmDocId +"===========count=========="+count);
							writer.newLine(); // 换行
						} catch (IOException e1) {
							e1.printStackTrace();
						}
						e.printStackTrace();
					}
				}

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

		}

	}


	public void DataGKXXByChannel(String wcmChannelId,String hyChannelId){

		Log_Exception.Logger_txt("-------Start-------将原栏目id：" + wcmChannelId + "中得数据导入海云平台" + hyChannelId + "---------Start--------");
		String sServiceId = "gov_webdocument";
		String sMethodName = "saveDocumentInOpenData";//自定义视图
		ServiceImplWcm wcm=new ServiceImplWcm();
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		try {
			List<Map<String,Object>> oldMaps=wcm.GetAllDocInfoFromOldDBAll(wcmChannelId);

			System.out.println(oldMaps);
			if(oldMaps!=null){
				int count=0;
				for (Map<String,Object> map : oldMaps) {
					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);
					String wcmDocId=map.get("MANUSCRIPT_ID").toString();//文档ID
					String docTitle=map.get("TITLE").toString();
					//标题-必填
					oPostData.put("isShenhe", "0");
					if (docTitle != null) {
						oPostData.put("bt", docTitle);
					}
					// 索引ID
					// 公文时效
					try {
						// 内容中图片和附件需要特殊处理
						if (map.get("currentFilePathHtmlUrl") != null) {
							String  currentFilePathHtmlUrl = map.get("currentFilePathHtmlUrl")+"";
							JsoupUtils jsoupUtils = new JsoupUtils();
							String html = jsoupUtils.rexStringHtml(currentFilePathHtmlUrl);
							oPostData.put("xwnr", html);
						} else {
							oPostData.put("xwnr", "&nbsp;");
						}
					}catch (Exception e){
						e.printStackTrace();
					}

					//发布时间
					if (map.get("PUBLISHED_TIME") != null) {
						long pubtime = Long.parseLong(map.get("PUBLISHED_TIME").toString());
						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){
						}
						String pubtimeStr = simpleDateFormat.format(date1);
						oPostData.put("fbsj", pubtimeStr);
					}
					//处理附件
					try {
						Map<String, Object> getRelFileInfoByDocId = wcm.GetRelFileInfoByDocId(wcmDocId);
						oPostData.put("fj", getRelFileInfoByDocId.get("docRelFile"));
					}catch (Exception e){
						e.printStackTrace();
					}
					//机构分类

					try {
						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("==="+count+"======wcmdocid:"+wcmDocId);
							}else{
								String serror = JSON.toJSONString(oPostData);
								try (BufferedWriter writer = new BufferedWriter(new FileWriter("D:\\ruoyi\\output.txt",true))) {
									writer.write("==============wcmDocId======"+wcmDocId +"===========count=========="+count);
									writer.newLine(); // 换行
								} catch (IOException e1) {
									e1.printStackTrace();
								}
							}
						}
					}catch(Exception e) {
						String serror = JSON.toJSONString(oPostData);
						try (BufferedWriter writer = new BufferedWriter(new FileWriter("D:\\ruoyi\\output.txt",true))) {
							writer.write("==============wcmDocId======"+wcmDocId +"===========count=========="+count);
							writer.newLine(); // 换行
						} catch (IOException e1) {
							e1.printStackTrace();
						}
						e.printStackTrace();
					}
				}

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

		}

	}

	public String getJg(String jgmc)
	{
		String fileName = "C:\\Users\\28799\\Desktop\\b.xlsx";
		String code = null;
		List<DemoDataJiGou> list = new ArrayList<>();
		EasyExcel.read(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;
	}

}