Beispiel #1
0
        protected List <LongGangResult> GetUnits(object[] objs)
        {
            List <LongGangResult> list = new List <LongGangResult>();

            foreach (object obj in objs)
            {
                Dictionary <string, object> dic = (Dictionary <string, object>)obj;
                LongGangResult info             = new LongGangResult();
                info.UnitName = Convert.ToString(dic["tbrName"]);
                try
                {
                    info.Xh = Convert.ToInt32(dic["tbrSequence"]);
                }
                catch { }
                try
                {
                    info.Win = Convert.ToString(dic["dePiaoShu"]);
                }
                catch { }
                try
                {
                    info.TbDate = ToolHtml.GetDateTimeByLong(Convert.ToInt64(dic["tbTime"])).ToString();
                }
                catch { }
                try
                {
                    info.Piao = Convert.ToString(dic["dePiaoShu"]);
                }
                catch { }
                try
                {
                    info.Code = Convert.ToString(dic["tbrTouPiaoBH"]);
                }
                catch { }
                try
                {
                    info.BidMoney = Convert.ToString(dic["tbBaoJia"]);
                }
                catch { }
                try
                {
                    info.BidStatus = Convert.ToString(dic["zhongBiaoZhuangTai"]);
                }
                catch { }
                try
                {
                    info.IsNo = Convert.ToString(dic["jinJiFangShi"]) == "2" ? "是" : "否";
                }
                catch { }
                try
                {
                    info.Ming = Convert.ToString(dic["tbrSequence"]);
                }
                catch { }
                list.Add(info);
            }
            return(list);
        }
Beispiel #2
0
        public static List <PrjResult> GetPrjResultBid(object[] obj)
        {
            List <PrjResult> list = new List <PrjResult>();

            for (int i = 0; i < obj.Length; i++)
            {
                Dictionary <string, object> jsonDtl = (Dictionary <string, object>)obj[i];
                PrjResult result = new PrjResult();
                try
                {
                    result.Xh = Convert.ToInt32(jsonDtl["tbrSequence"]);
                }
                catch { return(list); }
                result.Name = Convert.ToString(jsonDtl["tbrName"]);
                try
                {
                    result.Date = Convert.ToString(jsonDtl["tbTime"]);
                }
                catch { }
                if (!string.IsNullOrEmpty(result.Date))
                {
                    result.Date = ToolHtml.GetDateTimeByLong(long.Parse(result.Date)).ToString();
                }
                result.IsBid = Convert.ToString(jsonDtl["zhongBiaoZhuangTai"]);
                if (result.IsBid == "0" || string.IsNullOrEmpty(result.IsBid))
                {
                    result.IsBid = "<input type='checkbox' disabled=true/>";
                }
                else
                {
                    result.IsBid = "<input type='checkbox'  checked=true disabled=true/>";
                }
                list.Add(result);
            }
            return(list.OrderBy(x => x.Xh).ToList());
        }
Beispiel #3
0
        protected override IList ExecuteCrawl(bool crawlAll)
        {
            IList  list     = new List <InviteInfo>();
            int    sqlCount = 0;
            string html     = string.Empty;

            try
            {
                html = this.ToolWebSite.GetHtmlByUrl(this.SiteUrl + this.MaxCount);
            }
            catch { return(null); }
            int startIndex = html.IndexOf("{");
            int endIndex   = html.LastIndexOf("}");

            html = html.Substring(startIndex, (endIndex + 1) - startIndex);
            JavaScriptSerializer        serializer  = new JavaScriptSerializer();
            Dictionary <string, object> smsTypeJson = (Dictionary <string, object>)serializer.DeserializeObject(html);

            object[] objvalues = smsTypeJson["rows"] as object[];
            foreach (object objValue in objvalues)
            {
                Dictionary <string, object> dic = (Dictionary <string, object>)objValue;
                string code = string.Empty, buildUnit = string.Empty, prjName = string.Empty, prjAddress = string.Empty, inviteCtx = string.Empty, inviteType = string.Empty, specType = string.Empty, beginDate = string.Empty, endDate = string.Empty, remark = string.Empty, inviteCon = string.Empty, InfoUrl = string.Empty, CreateTime = string.Empty, msgType = string.Empty, otherType = string.Empty, HtmlTxt = string.Empty;
                code    = Convert.ToString(dic["gcBH"]);
                prjName = Convert.ToString(dic["gcName"]);
                //if (!prjName.Contains("新安翻身小学教学楼防水工程(小型工程)"))
                //    continue;


                beginDate = Convert.ToString(dic["ggStartTime2"]).GetDateRegex();
                string end = Convert.ToString(dic["ggEndTime"]);
                try
                {
                    endDate = ToolHtml.GetDateTimeByLong(Convert.ToInt64(end)).ToString();
                }
                catch { }
                inviteType = Convert.ToString(dic["gcLeiXing2"]);
                InfoUrl    = Convert.ToString(dic["detailUrl"]);
                try
                {
                    string urll = "https://www.szjsjy.com.cn:8001/jyw-ba/jyxx/queryOldOTDataDetail.do?type=1&id=" + dic["gcGuid"];
                    try
                    {
                        HtmlTxt = this.ToolWebSite.GetHtmlByUrl(urll).GetJsString().GetReplace("\\t,\\r,\\n,\"");
                    }
                    catch {  }
                    if (string.IsNullOrWhiteSpace(HtmlTxt))
                    {
                        urll = "https://www.szjsjy.com.cn:8001/jyw-ba/jyxx/showGongGao.do?ggGuid=" + dic["ggGuid"];
                    }

                    HtmlTxt = this.ToolWebSite.GetHtmlByUrl(urll).GetJsString().GetReplace("\\t,\\r,\\n,\"");
                    HtmlTxt = HtmlTxt.GetReplace("},{,maoDian:,html:");

                    if (string.IsNullOrWhiteSpace(HtmlTxt))
                    {
                        urll    = "https://www.szjsjy.com.cn:8001/jyw-ba/jyxx/queryOldOTDataDetail.do?type=1&id=" + dic["gcGuid"];
                        HtmlTxt = this.ToolWebSite.GetHtmlByUrl(urll).GetJsString().GetReplace("\\t,\\r,\\n,\"");
                    }
                }
                catch {
                    //Logger.Error(prjName);
                    continue;
                }
                inviteCtx = HtmlTxt.Replace("</span>", "\r\n").Replace("<br />", "\r\n").Replace("<BR>", "\r\n").Replace("<br/>", "\r\n").ToCtxString();

                prjAddress = inviteCtx.GetAddressRegex();
                buildUnit  = inviteCtx.GetBuildRegex();
                if (string.IsNullOrEmpty(code))
                {
                    code = inviteCtx.GetCodeRegex();
                }
                msgType  = "深圳市建设工程交易中心宝安分中心";
                specType = "建设工程";

                InviteInfo info = ToolDb.GenInviteInfo("广东省", "深圳宝安区工程", "宝安区", string.Empty, code, prjName, prjAddress, buildUnit, beginDate, endDate, inviteCtx, remark, msgType, inviteType, specType, otherType, InfoUrl, HtmlTxt);
                sqlCount++;

                if (ToolDb.SaveEntity(info, this.ExistCompareFields, this.ExistsUpdate, this.ExistsHtlCtx))
                {
                    Parser   parser = new Parser(new Lexer(HtmlTxt));
                    NodeList aNode  = parser.ExtractAllNodesThatMatch(new TagNameFilter("a"));
                    if (aNode != null && aNode.Count > 0)
                    {
                        for (int k = 0; k < aNode.Count; k++)
                        {
                            ATag a = aNode[k] as ATag;
                            if (a.IsAtagAttach())
                            {
                                string link = string.Empty;
                                if (a.Link.ToLower().Contains("http"))
                                {
                                    link = a.Link.Replace("\\", "");

                                    BaseAttach attach = null;
                                    try
                                    {
                                        attach = ToolHtml.GetBaseAttach(link, a.LinkText, info.Id, "SiteManage\\Files\\InviteAttach\\");
                                    }
                                    catch { }
                                    if (attach != null)
                                    {
                                        ToolDb.SaveEntity(attach, "");
                                    }
                                }
                            }
                        }
                    }
                }
                if (!crawlAll && sqlCount >= this.MaxCount)
                {
                    return(list);
                }
            }
            return(list);
        }
Beispiel #4
0
        protected override IList ExecuteCrawl(bool crawlAll)
        {
            IList list = new ArrayList();

            //取得页码
            string html = string.Empty;

            try
            {
                DateTime time = ToolHtml.GetDateTimeByLong(1509517250628);
                DateTime dt24 = DateTime.Now.ToUniversalTime();
                string   b    = ToolHtml.GetDateTimeLong(dt24).ToString();
                html = this.ToolWebSite.GetHtmlByUrl(SiteUrl + b, Encoding.Default);
            }
            catch (Exception ex)
            {
                Logger.Error(ex.ToString());
            }
            Parser parser  = new Parser(new Lexer(html));
            int    pageInt = 1;


            JavaScriptSerializer serializer = new JavaScriptSerializer();

            object[] objs  = (object[])serializer.DeserializeObject(html);
            object[] items = objs[1] as object[];
            Dictionary <string, object> smsTypeJson = items[0] as Dictionary <string, object>;
            string a    = Convert.ToString(smsTypeJson["page_all"]);
            int    page = int.Parse(a);

            pageInt = page / 18 + 1;
            parser.Reset();
            for (int i = 1; i <= pageInt; i++)
            {
                if (i > 1)
                {
                    try
                    {
                        string lian = "http://www.nmgp.gov.cn/category/category-ajax.php?type_name=3&byf_page=" + i + "&fun=cggg&_=1509441711785";
                        html = this.ToolWebSite.GetHtmlByUrl(lian, Encoding.UTF8);
                    }
                    catch (Exception ex)
                    {
                        Logger.Error("分页");
                        continue;
                    }
                }

                parser = new Parser(new Lexer(html));
                JavaScriptSerializer        serializer1  = new JavaScriptSerializer();
                object[]                    objd         = (object[])serializer.DeserializeObject(html);
                object[]                    items1       = objd[0] as object[];
                Dictionary <string, object> smsTypeJson1 = items1[0] as Dictionary <string, object>;
                foreach (KeyValuePair <string, object> obj in smsTypeJson)
                {
                    object[] array = objd[0] as object[];
                    foreach (object arrValue in array)
                    {
                        string prjName = string.Empty, buildUnit = string.Empty, bidUnit = string.Empty, bidMoney = string.Empty,
                                    code = string.Empty, bidDate = string.Empty, beginDate = string.Empty, endDate = string.Empty,
                                    bidType = string.Empty, specType = string.Empty, InfoUrl = string.Empty, msgType = string.Empty,
                                    bidCtx = string.Empty, prjAddress = string.Empty, remark = string.Empty, prjMgr = string.Empty,
                                    otherType = string.Empty, HtmlTxt = string.Empty, strHtml = string.Empty;
                        Dictionary <string, object> dic = (Dictionary <string, object>)arrValue;
                        endDate = Convert.ToString(dic["ENDDATE"]).GetDateRegex("yyyy-MM-dd");
                        prjName = Convert.ToString(dic["TITLE"]);
                        string xu = Convert.ToString(dic["wp_mark_id"]);
                        InfoUrl = "http://www.nmgp.gov.cn/ay_post/post.php?tb_id=3&p_id=" + xu;
                        string htmldtl = string.Empty;
                        try
                        {
                            htmldtl = this.ToolWebSite.GetHtmlByUrl(this.ToolWebSite.UrlEncode(InfoUrl), Encoding.UTF8).Replace("&nbsp;", "");
                        }
                        catch (Exception)
                        {
                            continue;
                        }
                        Regex regexHtml = new Regex(@"<script[^<]*</script>|<\?xml[^/]*/>");
                        htmldtl = regexHtml.Replace(htmldtl, "");
                        Parser   parserdtl     = new Parser(new Lexer(htmldtl));
                        Parser   dtlparserHTML = new Parser(new Lexer(htmldtl));
                        NodeList nodesDtl      = dtlparserHTML.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("div"), new HasAttributeFilter("id", "center")));
                        if (nodesDtl != null && nodesDtl.Count > 0)
                        {
                            Parser   begDate = new Parser(new Lexer(nodesDtl.ToHtml()));
                            NodeList begNode = begDate.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("div"), new HasAttributeFilter("id", "center")));
                            if (begNode != null && begNode.Count > 0)
                            {
                                beginDate = begNode.AsString().GetDateRegex("yyyy年MM月dd日");
                            }
                            begDate.Reset();
                            NodeList dtlTable = begDate.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("table"), new HasAttributeFilter("border", "1")));
                            if (dtlTable != null && dtlTable.Count > 0)
                            {
                                TableTag tableDtl = dtlTable[0] as TableTag;
                                if (tableDtl.RowCount > 2)
                                {
                                    string ctx = tableDtl.Rows[2].ToPlainTextString();
                                    bidUnit  = ctx.GetRegexBegEnd("供应商:", ";");
                                    bidMoney = ctx.GetRegexBegEnd("中标金额:", "。").GetMoney();
                                }
                                if (bidMoney == "0" && tableDtl.RowCount > 4)
                                {
                                    string ctx = tableDtl.Rows[4].ToPlainTextString();
                                    bidUnit  = ctx.GetRegexBegEnd("供应商:", ";");
                                    bidMoney = ctx.GetRegexBegEnd("中标金额:", "。").GetMoney();
                                }
                                if (bidMoney == "0" && tableDtl.RowCount > 6)
                                {
                                    string ctx = tableDtl.Rows[6].ToPlainTextString();
                                    bidUnit  = ctx.GetRegexBegEnd("供应商:", ";");
                                    bidMoney = ctx.GetRegexBegEnd("中标金额:", "。").GetMoney();
                                }
                                if (bidMoney == "0" && tableDtl.RowCount > 8)
                                {
                                    string ctx = tableDtl.Rows[8].ToPlainTextString();
                                    bidUnit  = ctx.GetRegexBegEnd("供应商:", ";");
                                    bidMoney = ctx.GetRegexBegEnd("中标金额:", "。").GetMoney();
                                }
                                if (bidMoney == "0" && tableDtl.RowCount > 10)
                                {
                                    string ctx = tableDtl.Rows[10].ToPlainTextString();
                                    bidUnit  = ctx.GetRegexBegEnd("供应商:", ";");
                                    bidMoney = ctx.GetRegexBegEnd("中标金额:", "。").GetMoney();
                                }
                                if (bidMoney == "0" && tableDtl.RowCount > 12)
                                {
                                    string ctx = tableDtl.Rows[12].ToPlainTextString();
                                    bidUnit  = ctx.GetRegexBegEnd("供应商:", ";");
                                    bidMoney = ctx.GetRegexBegEnd("中标金额:", "。").GetMoney();
                                }
                            }
                            HtmlTxt = nodesDtl.ToHtml();
                            bidCtx  = HtmlTxt.ToCtxString();

                            code      = bidCtx.GetRegex("批准文件编号,工程编号,项目编号").Replace("无", "");
                            code      = bidCtx.GetRegexBegEnd("批准文件编号:", "二");
                            buildUnit = bidCtx.GetBuildRegex();
                            if (string.IsNullOrEmpty(buildUnit))
                            {
                                buildUnit = bidCtx.GetRegexBegEnd("代理机构名称:", "地址");
                            }
                            prjAddress = bidCtx.GetAddressRegex();
                            if (string.IsNullOrEmpty(prjAddress))
                            {
                                prjAddress = bidCtx.GetRegexBegEnd("地址:", "邮政编码");
                            }


                            msgType  = "内蒙古自治区政府采购中心";
                            specType = "政府采购";
                            bidType  = ToolHtml.GetInviteTypes(prjName);
                            prjName  = ToolDb.GetPrjName(prjName);
                            BidInfo info = ToolDb.GenBidInfo("内蒙古自治区", "内蒙古自治区及盟市", "", string.Empty, code, prjName, buildUnit, beginDate, bidUnit, beginDate, endDate, bidCtx, string.Empty, msgType, bidType, specType, otherType, bidMoney, InfoUrl, prjMgr, HtmlTxt);
                            list.Add(info);
                            if (!crawlAll && list.Count >= this.MaxCount)
                            {
                                return(list);
                            }
                        }
                    }
                }


                //for (int i = 1; i <= pageInt; i++)
                //{
                //    if (i > 1)
                //    {
                //        try
                //        {
                //            html = this.ToolWebSite.GetHtmlByUrl(this.SiteUrl + "&pos=" + i.ToString(), Encoding.Default);
                //        }
                //        catch (Exception ex)
                //        {
                //            Logger.Error(ex.ToString());
                //        }
                //    }
                //    parser = new Parser(new Lexer(html));
                //    NodeList nodes = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("table"), new HasAttributeFilter("class", "recordlist")));
                //    if (nodes != null && nodes.Count > 0)
                //    {
                //        TableTag table = nodes[0] as TableTag;
                //        for (int t = 0; t < table.RowCount; t++)
                //        {
                //            string prjName = string.Empty, buildUnit = string.Empty, bidUnit = string.Empty, bidMoney = string.Empty,
                //                code = string.Empty, bidDate = string.Empty, beginDate = string.Empty, endDate = string.Empty,
                //                bidType = string.Empty, specType = string.Empty, InfoUrl = string.Empty, msgType = string.Empty,
                //                bidCtx = string.Empty, prjAddress = string.Empty, remark = string.Empty, prjMgr = string.Empty,
                //                otherType = string.Empty, HtmlTxt = string.Empty,strHtml=string.Empty;
                //            TableRow tr = table.Rows[t];
                //            endDate = tr.Columns[1].ToPlainTextString().GetDateRegex();
                //            ATag alink = tr.Columns[0].GetATag();
                //            prjName = tr.Columns[0].GetATagValue("title");
                //            InfoUrl = "http://www.nmgp.gov.cn" + alink.Link;
                //            string htmldtl = string.Empty;
                //            try
                //            {
                //                htmldtl = this.ToolWebSite.GetHtmlByUrl(InfoUrl, Encoding.Default).Replace("&nbsp;", "").Trim();
                //            }
                //            catch (Exception ex)
                //            {
                //                continue;
                //            }

                //            Regex regexHtml = new Regex(@"<script[^<]*</script>|<\?xml[^/]*/>");
                //            htmldtl = regexHtml.Replace(htmldtl, "");
                //            Parser parserdtl = new Parser(new Lexer(htmldtl));
                //            Parser dtlparserHTML = new Parser(new Lexer(htmldtl));
                //            NodeList nodesDtl = dtlparserHTML.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("div"), new HasAttributeFilter("id", "hlcms_9")));
                //            if (nodesDtl != null && nodesDtl.Count > 0)
                //            {
                //                Parser begDate = new Parser(new Lexer(nodesDtl.ToHtml()));
                //                NodeList begNode = begDate.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("div"), new HasAttributeFilter("class", "yzhang")));
                //                if (begNode != null && begNode.Count > 0)
                //                {
                //                    beginDate = begNode.AsString().GetDateRegex("yyyy年MM月dd日");
                //                }
                //                begDate.Reset();
                //                NodeList dtlTable = begDate.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("table"), new HasAttributeFilter("cellpadding", "5")));
                //                if (dtlTable != null && dtlTable.Count > 0)
                //                {
                //                    TableTag tableDtl = dtlTable[0] as TableTag;
                //                    if (tableDtl.RowCount > 2)
                //                    {
                //                        string ctx = tableDtl.Rows[2].ToPlainTextString();
                //                        bidUnit = ctx.GetRegexBegEnd("供应商:",";");
                //                        bidMoney = ctx.GetRegexBegEnd("中标金额:","。").GetMoney();
                //                    }
                //                    if (bidMoney == "0"&& tableDtl.RowCount >4)
                //                    {
                //                        string ctx = tableDtl.Rows[4].ToPlainTextString();
                //                        bidUnit = ctx.GetRegexBegEnd("供应商:", ";");
                //                        bidMoney = ctx.GetRegexBegEnd("中标金额:", "。").GetMoney();
                //                    }
                //                    if (bidMoney == "0" && tableDtl.RowCount > 6)
                //                    {
                //                        string ctx = tableDtl.Rows[6].ToPlainTextString();
                //                        bidUnit = ctx.GetRegexBegEnd("供应商:", ";");
                //                        bidMoney = ctx.GetRegexBegEnd("中标金额:", "。").GetMoney();
                //                    }
                //                    if (bidMoney == "0" && tableDtl.RowCount > 8)
                //                    {
                //                        string ctx = tableDtl.Rows[8].ToPlainTextString();
                //                        bidUnit = ctx.GetRegexBegEnd("供应商:", ";");
                //                        bidMoney = ctx.GetRegexBegEnd("中标金额:", "。").GetMoney();
                //                    }
                //                    if (bidMoney == "0" && tableDtl.RowCount > 10)
                //                    {
                //                        string ctx = tableDtl.Rows[10].ToPlainTextString();
                //                        bidUnit = ctx.GetRegexBegEnd("供应商:", ";");
                //                        bidMoney = ctx.GetRegexBegEnd("中标金额:", "。").GetMoney();
                //                    }
                //                    if (bidMoney == "0" && tableDtl.RowCount > 12)
                //                    {
                //                        string ctx = tableDtl.Rows[12].ToPlainTextString();
                //                        bidUnit = ctx.GetRegexBegEnd("供应商:", ";");
                //                        bidMoney = ctx.GetRegexBegEnd("中标金额:", "。").GetMoney();
                //                    }
                //                }
                //                HtmlTxt = nodesDtl.ToHtml();
                //                bidCtx = HtmlTxt.ToCtxString();

                //                code = bidCtx.GetRegex("批准文件编号,工程编号,项目编号",true,50).Replace("无", "");
                //                buildUnit = bidCtx.GetBuildRegex();
                //                if (string.IsNullOrEmpty(buildUnit))
                //                    buildUnit = bidCtx.GetRegex("采购代理机构名称,采购单位名称");
                //                prjAddress = bidCtx.GetAddressRegex();
                //                if (string.IsNullOrEmpty(prjAddress))
                //                    prjAddress = bidCtx.GetRegex("投标地点,开标地点,地址");


                //                msgType = "内蒙古自治区政府采购中心";
                //                specType = "政府采购";
                //                bidType = ToolHtml.GetInviteTypes(prjName);
                //                prjName = ToolDb.GetPrjName(prjName);
                //                BidInfo info = ToolDb.GenBidInfo("内蒙古自治区", "内蒙古自治区及盟市", "", string.Empty, code, prjName, buildUnit, beginDate, bidUnit, beginDate, endDate, bidCtx, string.Empty, msgType, bidType, specType, otherType, bidMoney, InfoUrl, prjMgr, HtmlTxt);
                //                list.Add(info);
                //                if (!crawlAll && list.Count >= this.MaxCount)
                //                    return list;
                //            }
                //        }
                //    }
            }
            return(list);
        }
        protected override IList ExecuteCrawl(bool crawlAll)
        {
            IList  list     = new List <ProjectResult>();
            int    sqlCount = 0;
            string html     = string.Empty;
            List <Dictionary <string, object> > dicFile = new List <Dictionary <string, object> >();

            try
            {
                html = this.ToolWebSite.GetHtmlByUrl(this.SiteUrl + (MaxCount + 20));
            }
            catch { return(null); }
            int startIndex = html.IndexOf("{");
            int endIndex   = html.LastIndexOf("}");

            html = html.Substring(startIndex, (endIndex + 1) - startIndex);
            JavaScriptSerializer        serializer  = new JavaScriptSerializer();
            Dictionary <string, object> smsTypeJson = (Dictionary <string, object>)serializer.DeserializeObject(html);

            foreach (KeyValuePair <string, object> obj in smsTypeJson)
            {
                if (obj.Key == "total")
                {
                    continue;
                }
                object[] array = (object[])obj.Value;

                foreach (object arrValue in array)
                {
                    string Code = string.Empty, prjName = string.Empty, BuildUnit = string.Empty, FinalistsWay = string.Empty, RevStaMethod = string.Empty, SetStaMethod = string.Empty, VoteMethod = string.Empty, RevStaDate = string.Empty, InfoUrl = string.Empty, MsgType = string.Empty, ProjectCtx = string.Empty, HtmlTxt = string.Empty, beginDate = string.Empty, attachFileGroupGuid = string.Empty, dbJieGuoGuid = string.Empty, ggGuid = string.Empty, bdGuid = string.Empty, gcLeiXing = string.Empty, zbrName = string.Empty, zhongBiaoJia = string.Empty, jsonHtml = string.Empty;
                    Dictionary <string, object> dic = (Dictionary <string, object>)arrValue;
                    Code    = Convert.ToString(dic["bdBH"]);
                    prjName = Convert.ToString(dic["bdName"]);
                    //if (!prjName.Contains("茅洲河(光明新区)水环境综合整治工程项目(水景观")) continue;

                    beginDate    = Convert.ToString(dic["createTime2"]);
                    InfoUrl      = Convert.ToString(dic["detailUrl"]);
                    dbJieGuoGuid = Convert.ToString(dic["dbJieGuoGuid"]);
                    ggGuid       = Convert.ToString(dic["ggGuid"]);
                    bdGuid       = Convert.ToString(dic["bdGuid"]);
                    gcLeiXing    = Convert.ToString(dic["gcLeiXing"]);
                    //zbrName = Convert.ToString(dic["zbrName"]);
                    zhongBiaoJia = Convert.ToString(dic["zhongBiaoJia"]).GetMoney();

                    string crawlUrl = "https://www.szjsjy.com.cn:8001/jyw/queryOldDataDetail.do?type=9&id=" + Code;
                    try
                    {
                        jsonHtml = this.ToolWebSite.GetHtmlByUrl(crawlUrl).GetJsString().GetReplace("\\t,\\r,\\n,\"");
                    }
                    catch { }
                    if (!jsonHtml.Contains("<div") || string.IsNullOrEmpty(jsonHtml))
                    {
                        try
                        {
                            if (string.IsNullOrEmpty(jsonHtml))
                            {
                                crawlUrl = "https://www.szjsjy.com.cn:8001/jyw/queryDbJieGuoByGuid.do?guid=" + Convert.ToString(dic["dbJieGuoGuid"]);
                                jsonHtml = this.ToolWebSite.GetHtmlByUrl(crawlUrl).GetJsString().GetReplace("\\t,\\r,\\n,\"").GetReplace(":RMB:", ":");
                            }

                            string strHtml = PrjResultStr(jsonHtml);//.Replace("A,B,C","")
                            JavaScriptSerializer        serializerNew  = new JavaScriptSerializer();
                            Dictionary <string, object> smsTypeJsonNew = null;
                            try
                            {
                                smsTypeJsonNew = (Dictionary <string, object>)serializer.DeserializeObject(strHtml);
                            }
                            catch
                            {
                                try
                                {
                                    strHtml        = PrjResultStr(jsonHtml, true);
                                    smsTypeJsonNew = (Dictionary <string, object>)serializer.DeserializeObject(strHtml);
                                }
                                catch
                                {
                                    try
                                    {
                                        strHtml        = GetPrjResultDtl(strHtml);
                                        smsTypeJsonNew = (Dictionary <string, object>)serializer.DeserializeObject(strHtml);
                                    }
                                    catch { }
                                }
                            }
                            string ggBdGuid = string.Empty, dbBanFa = string.Empty, piaoJueBanFa = string.Empty, dbTime = string.Empty, isChouQian = string.Empty,
                                   chouQianRuWeiFangShi = string.Empty, rwFangShi = string.Empty, zbName = string.Empty, tongYongZhongBiaoJia = string.Empty,
                                   isDuiWaiGongShi = string.Empty, isYiYiTime = string.Empty, Lxr = string.Empty, LxDh = string.Empty, jsDw = string.Empty,
                                   ggMc = string.Empty, bdBh = string.Empty, ggShiXiangGuid = string.Empty,
                                   isHeSuan = string.Empty, gongQi = string.Empty, isTiJiaoDbwy = string.Empty, isXuYaoZuJianDbwyh = string.Empty;

                            Dictionary <string, object> bd = (Dictionary <string, object>)smsTypeJsonNew["bd"];
                            Dictionary <string, object> gc = (Dictionary <string, object>)bd["gc"];
                            try { ggShiXiangGuid = bd["ggShiXiangGuid"].ToString(); }
                            catch { }
                            try { ggMc = bd["bdName"].ToString(); }
                            catch { }
                            try { bdBh = bd["bdBH"].ToString(); }
                            catch { }
                            try { ggBdGuid = smsTypeJsonNew["ggBdGuid"].ToString(); }
                            catch { }
                            try { dbBanFa = smsTypeJsonNew["dbBanFa"].ToString(); }
                            catch
                            {
                                try { dbBanFa = bd["dbBanFa"].ToString(); }
                                catch { }
                            }
                            try { piaoJueBanFa = smsTypeJsonNew["piaoJueBanFa"].ToString(); }
                            catch { }
                            try { dbTime = smsTypeJsonNew["dbTime"].ToString(); dbTime = ToolHtml.GetDateTimeByLong(long.Parse(dbTime)).ToString(); }
                            catch { }
                            try { isChouQian = smsTypeJsonNew["isChouQian"].ToString(); }
                            catch { }
                            try { chouQianRuWeiFangShi = smsTypeJsonNew["chouQianRuWeiFangShi"].ToString(); }
                            catch { }
                            try { rwFangShi = smsTypeJsonNew["rwFangShi"].ToString(); }
                            catch { }
                            try { zbName = smsTypeJsonNew["zbName"].ToString(); }
                            catch { }
                            try { tongYongZhongBiaoJia = smsTypeJsonNew["tongYongZhongBiaoJia"].ToString(); }
                            catch { }
                            try { isDuiWaiGongShi = smsTypeJsonNew["isDuiWaiGongShi"].ToString(); }
                            catch { }
                            try { isYiYiTime = smsTypeJsonNew["isYiYiTime"].ToString(); }
                            catch { }
                            try { isHeSuan = smsTypeJsonNew["isHeSuan"].ToString(); }
                            catch { }
                            try { gongQi = smsTypeJsonNew["gongQi"].ToString(); }
                            catch { }
                            try { isTiJiaoDbwy = smsTypeJsonNew["isTiJiaoDbwy"].ToString(); }
                            catch { }
                            try { isXuYaoZuJianDbwyh = smsTypeJsonNew["isXuYaoZuJianDbwyh"].ToString(); }
                            catch { }
                            try { Lxr = gc["jingBanRenName"].ToString(); }
                            catch { try { Lxr = gc["lianXiRenName"].ToString(); } catch { } }
                            try { LxDh = gc["lianXiRenMobile"].ToString(); }
                            catch { try { LxDh = gc["lianXiRenPhone"].ToString(); } catch { } }
                            try { jsDw = gc["zbRName"].ToString(); }
                            catch { }
                            try { attachFileGroupGuid = smsTypeJsonNew["attachFileGroupGuid"].ToString(); }
                            catch { }
                            if (dbBanFa.IsNumber())
                            {
                                dbBanFa = "无";
                            }
                            string dtlHtml = string.Empty;
                            string dtlUrl  = "https://www.szjsjy.com.cn:8001/jyw/jyw/dbResult_View.do?bdGuid=" + ggGuid;
                            try
                            {
                                dtlHtml = this.ToolWebSite.GetHtmlByUrl(dtlUrl).GetJsString().GetReplace("\\t,\\r,\\n,\"");
                                if (string.IsNullOrEmpty(dtlHtml) || dtlHtml.Length < 10)
                                {
                                    dtlUrl  = "https://www.szjsjy.com.cn:8001/jyw/queryPmxtTbrListGs.do?dbGuid=" + ggGuid;
                                    dtlHtml = this.ToolWebSite.GetHtmlByUrl(dtlUrl).GetJsString().GetReplace("\\t,\\r,\\n,\"");
                                }
                            }
                            catch { Logger.Error(prjName); continue; }
                            if (!string.IsNullOrEmpty(dtlHtml) && dtlHtml.Length > 10)
                            {
                                HtmlTxt = dtlHtml;
                                Parser   parserNew = new Parser(new Lexer(HtmlTxt));
                                NodeList tableNode = parserNew.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("table"), new HasAttributeFilter("class", "de_tab1")));
                                if (tableNode != null && tableNode.Count > 0)
                                {
                                    HtmlTxt = tableNode.AsHtml();
                                    HtmlTxt = HtmlTxt.GetReplace("<td  id=ggName>&nbsp;</td>", "<td  id=\"ggName\">&nbsp;" + ggMc + "</td>");
                                    HtmlTxt = HtmlTxt.GetReplace("<td id=bdBH>&nbsp;</td>", "<td  id=\"bdBH\">&nbsp;" + bdBh + "</td>");
                                    HtmlTxt = HtmlTxt.GetReplace("<td id=bdName>&nbsp;</td>", "<td  id=\"bdName\">&nbsp;" + ggMc + "</td>");
                                    HtmlTxt = HtmlTxt.GetReplace("<td id=zbRName>&nbsp;</td>", "<td  id=\"zbRName\">&nbsp;" + jsDw + "</td>");
                                    HtmlTxt = HtmlTxt.GetReplace("<td id=zbName>&nbsp;</td>", "<td  id=\"zbName\">&nbsp;" + zbName + "</td>");
                                    HtmlTxt = HtmlTxt.GetReplace("<td id=dbTime>&nbsp;</td>", "<td  id=\"dbTime\">&nbsp;" + dbTime + "</td>");
                                    HtmlTxt = HtmlTxt.GetReplace("<td id=rwfs>&nbsp;</td>", "<td  id=\"rwfs\">&nbsp;" + rwFangShi + "</td>");
                                    HtmlTxt = HtmlTxt.GetReplace("<td id=dbBanFa>&nbsp;</td>", "<td  id=\"dbBanFa\">&nbsp;" + dbBanFa + "</td>");
                                    HtmlTxt = HtmlTxt.GetReplace("<td id=lianXiRenName>&nbsp;</td>", "<td  id=\"lianXiRenName\">&nbsp;" + Lxr + "</td>");
                                    HtmlTxt = HtmlTxt.GetReplace("<td id=lianXiRenPhone>&nbsp;</td>", "<td  id=\"lianXiRenName\">&nbsp;" + LxDh + "</td>");

                                    string resultUrl  = "https://www.szjsjy.com.cn:8001/jyw/queryTbrListByBdGuidAndGgGuidForGs.do";
                                    string jsonResult = string.Empty;
                                    try
                                    {
                                        NameValueCollection nvc = this.ToolWebSite.GetNameValueCollection(new string[] { "bdGuid", "ggGuid" }, new string[] { bdGuid, ggShiXiangGuid });
                                        jsonResult = this.ToolWebSite.GetHtmlByUrl(resultUrl, nvc).GetJsString().GetReplace("\\t,\\r,\\n,\"");

                                        if (string.IsNullOrEmpty(jsonResult) || jsonResult.Length <= 10)
                                        {
                                            nvc        = this.ToolWebSite.GetNameValueCollection(new string[] { "bdGuid", "ggGuid" }, new string[] { bdGuid, ggGuid });
                                            jsonResult = this.ToolWebSite.GetHtmlByUrl(resultUrl, nvc).GetJsString().GetReplace("\\t,\\r,\\n,\"");
                                        }
                                    }
                                    catch (Exception ex) { Logger.Error(prjName); }
                                    if (!string.IsNullOrEmpty(jsonResult) && jsonResult.Length >= 10)
                                    {
                                        string jiHua_LiXiang_BH = string.Empty, jiHua_LiXiang_BH2 = string.Empty;
                                        try
                                        {
                                            Dictionary <string, object> xm = (Dictionary <string, object>)bd["xm"];
                                            jiHua_LiXiang_BH  = xm["jiHua_LiXiang_BH"].ToString().GetReplace("【", "[").GetReplace("】", "]");
                                            jiHua_LiXiang_BH2 = xm["jiHua_LiXiang_BH"].ToString();
                                        }
                                        catch { }
                                        string tempJson = jsonResult;
                                        if (!string.IsNullOrEmpty(jiHua_LiXiang_BH))
                                        {
                                            tempJson = jsonResult.Replace(jiHua_LiXiang_BH, jiHua_LiXiang_BH2);
                                        }
                                        string dtlTbName = PrjResultStr(tempJson, true);
                                        JavaScriptSerializer serializerDtl = new JavaScriptSerializer();
                                        object[]             dtlObj        = null;
                                        try
                                        {
                                            dtlObj = (object[])serializerDtl.DeserializeObject(dtlTbName);
                                        }
                                        catch
                                        {
                                            try
                                            {
                                                dtlTbName  = dtlTbName.Substring(0, dtlTbName.Length - 2);
                                                dtlTbName += "}}]";
                                                dtlObj     = (object[])serializerDtl.DeserializeObject(dtlTbName);
                                            }
                                            catch
                                            {
                                                try
                                                {
                                                    dtlTbName = dtlTbName.Trim().Replace("},{", "}},{");
                                                    dtlObj    = (object[])serializerDtl.DeserializeObject(dtlTbName);
                                                }
                                                catch
                                                {
                                                    Logger.Error(prjName);
                                                }
                                            }
                                        }

                                        bool isOk = false;

                                        StringBuilder sb = new StringBuilder();
                                        if (dbBanFa.Contains("逐轮票决"))
                                        {
                                            StringBuilder strZlpj = new StringBuilder();

                                            List <PrjResult> prjResluts = LPrjResult.GetPrjZlResult(dtlObj);
                                            IEnumerable <IGrouping <int, PrjResult> > ienums = prjResluts.GroupBy(x => x.lunCiXuHao).OrderBy(x => x.Key);

                                            foreach (IGrouping <int, PrjResult> groups in ienums)
                                            {
                                                strZlpj.AppendFormat("<h3>第{0}大轮投票表</h3>", groups.Key);
                                                strZlpj.Append("<table width='100%' border='0' class='de_tab2'>");
                                                strZlpj.Append("<tr>");
                                                strZlpj.Append("<th style='text-align: left' class='bg_tdtop'>编号</th>");
                                                strZlpj.Append("<th style='text-align: left' class='bg_tdtop'>投标单位</th>");
                                                strZlpj.Append("<th style='text-align: left' class='bg_tdtop'>得票数</th>");
                                                strZlpj.Append("<th style='text-align: left' class='bg_tdtop'>排名</th>");
                                                strZlpj.Append("</tr>");

                                                List <PrjResult> results = groups.ToList().OrderBy(x => x.Bh).ToList();

                                                foreach (PrjResult prj in results)
                                                {
                                                    strZlpj.Append("<tr>");
                                                    strZlpj.Append("<th style='padding: 0px'>" + prj.Bh + "</th>");
                                                    strZlpj.Append("<th style='padding: 0px' class='bg_tdtop'>" + prj.Name + "</th>");
                                                    strZlpj.Append("<th style='padding: 0px' class='bg_tdtop'>" + prj.Mc + "</th>");
                                                    strZlpj.Append("<th style='padding: 0px' class='bg_tdtop'>" + prj.Xh + "</th>");
                                                    strZlpj.Append("</tr>");
                                                    isOk = true;
                                                }

                                                strZlpj.Append("</table>");
                                            }
                                            sb.Append(strZlpj.ToString());
                                        }
                                        else
                                        {
                                            StringBuilder strTmp = new StringBuilder();
                                            strTmp.Append("<table width='100%' border='0' class='de_tab2'>");


                                            switch (dbBanFa)
                                            {
                                            case "直接票决":
                                                strTmp.Append("<tr>");
                                                strTmp.Append("<th style='text-align: left' class='bg_tdtop'>编号</th>");
                                                strTmp.Append("<th style='text-align: left' class='bg_tdtop'>投标单位</th>");
                                                strTmp.Append("<th style='text-align: left' class='bg_tdtop'>取胜次数</th>");
                                                strTmp.Append("<th style='text-align: left' class='bg_tdtop'>排名</th>");
                                                strTmp.Append("</tr>");
                                                List <PrjResult> PrjResults = LPrjResult.GetPrjResult(dtlObj);
                                                foreach (PrjResult prj in PrjResults)
                                                {
                                                    strTmp.Append("<tr>");
                                                    strTmp.Append("<th style='padding: 0px'>" + prj.Bh + "</th>");
                                                    strTmp.Append("<th style='padding: 0px' class='bg_tdtop'>" + prj.Name + "</th>");
                                                    strTmp.Append("<th style='padding: 0px' class='bg_tdtop'>" + prj.Mc + "</th>");
                                                    strTmp.Append("<th style='padding: 0px' class='bg_tdtop'>" + prj.Xh + "</th>");
                                                    strTmp.Append("</tr>");
                                                    isOk = true;
                                                }
                                                break;

                                            default:
                                                strTmp.Append("<tr>");
                                                strTmp.Append("<th style='text-align: left' class='bg_tdtop'>序号</th>");
                                                strTmp.Append("<th style='text-align: left' class='bg_tdtop'>企业名称</th>");
                                                strTmp.Append("<th style='text-align: left' class='bg_tdtop'>投标时间</th>");
                                                strTmp.Append("<th style='text-align: left' class='bg_tdtop'>中标候选人</th>");
                                                strTmp.Append("</tr>");
                                                List <PrjResult> PrjResultBid = LPrjResult.GetPrjResultBid(dtlObj);
                                                foreach (PrjResult prj in PrjResultBid)
                                                {
                                                    strTmp.Append("<tr>");
                                                    strTmp.Append("<th style='padding: 0px'>" + prj.Xh + "</th>");
                                                    strTmp.Append("<th style='padding: 0px' class='bg_tdtop'>" + prj.Name + "</th>");
                                                    strTmp.Append("<th style='padding: 0px' class='bg_tdtop'>" + prj.Date + "</th>");
                                                    strTmp.Append("<th style='padding: 0px' class='bg_tdtop'>" + prj.IsBid + "</th>");
                                                    strTmp.Append("</tr>");
                                                    isOk = true;
                                                }
                                                break;
                                            }
                                            strTmp.Append("</table>");

                                            sb.Append(strTmp.ToString());
                                        }


                                        if (isOk)
                                        {
                                            HtmlTxt += sb;
                                        }
                                    }
                                }
                            }
                        }
                        catch { }
                        if (!string.IsNullOrEmpty(attachFileGroupGuid))
                        {
                            bool          FileOk = false;
                            StringBuilder sb     = new StringBuilder();
                            try
                            {
                                sb.Append("<table id=\"wenJian_List\" width=\"100%\" border=\"0\" class=\"de_tab2\">");
                                sb.Append("<tr>");
                                sb.Append("<td class=\"bg_tdtop\">序号</td>");
                                sb.Append("<td class=\"bg_tdtop\" >文件名</td>");
                                sb.Append("<td class=\"bg_tdtop\">创建时间</td>");
                                sb.Append("</tr>");
                                string url        = "https://www.szjsjy.com.cn:8001/jyw/filegroup/queryByGroupGuidZS.do?groupGuid=" + attachFileGroupGuid;
                                string attachHtml = this.ToolWebSite.GetHtmlByUrl(url);
                                JavaScriptSerializer        newSerializer = new JavaScriptSerializer();
                                Dictionary <string, object> newTypeJson = (Dictionary <string, object>)newSerializer.DeserializeObject(attachHtml);
                                string attachGuid = string.Empty, attachName = string.Empty, createTime = string.Empty;
                                foreach (KeyValuePair <string, object> newObj in newTypeJson)
                                {
                                    object[] newArray = (object[])newObj.Value;
                                    int      row      = 1;
                                    foreach (object newArr in newArray)
                                    {
                                        Dictionary <string, object> newDic = (Dictionary <string, object>)newArr;
                                        try
                                        {
                                            dicFile.Add(newDic);
                                            attachGuid = Convert.ToString(newDic["attachGuid"]);
                                            attachName = Convert.ToString(newDic["attachName"]);
                                            createTime = Convert.ToString(newDic["createTime"]);
                                            if (!string.IsNullOrEmpty(createTime))
                                            {
                                                createTime = ToolHtml.GetDateTimeByLong(long.Parse(createTime)).ToString();
                                            }
                                            string newUrl = "https://www.szjsjy.com.cn:8001/file/downloadFile?fileId=" + attachGuid;
                                            string aTag   = "<a href='" + newUrl + "'  target='_blank'>" + attachName + "</a>";
                                            sb.Append("<tr>");
                                            sb.Append("<td>" + row + "</td>");
                                            sb.Append("<td>" + aTag + "</td>");
                                            sb.Append("<td>" + createTime + "</td>");
                                            sb.Append("</tr>");
                                            row++;
                                            FileOk = true;
                                        }
                                        catch { }
                                    }
                                }
                                sb.Append("</table>");
                            }
                            catch { }
                            if (FileOk)
                            {
                                HtmlTxt += sb.ToString();
                            }
                        }
                    }
                    else
                    {
                        HtmlTxt = jsonHtml;
                        Parser   parserA = new Parser(new Lexer(HtmlTxt));
                        NodeList aNode   = parserA.ExtractAllNodesThatMatch(new TagNameFilter("a"));
                        if (aNode != null && aNode.Count > 0)
                        {
                            for (int i = 0; i < aNode.Count; i++)
                            {
                                ATag aTag = aNode[i] as ATag;
                                if (aTag.IsAtagAttach())
                                {
                                    Dictionary <string, object> fileDic = new Dictionary <string, object>();
                                    fileDic.Add("attachGuid", aTag.Link.GetReplace("\\"));
                                    fileDic.Add("attachName", aTag.LinkText.ToNodeString());
                                    dicFile.Add(fileDic);
                                }
                            }
                        }
                    }
                    ProjectCtx = HtmlTxt.GetReplace("<br />,<br/>,</ br>,</br>", "\r\n").ToCtxString() + "\r\n";
                    Parser   parser  = new Parser(new Lexer(HtmlTxt.GetReplace("th", "td")));
                    NodeList ctxNode = parser.ExtractAllNodesThatMatch(new TagNameFilter("table"));
                    if (ctxNode != null && ctxNode.Count > 0)
                    {
                        string   dtlCtx   = string.Empty;
                        TableTag ctxTable = ctxNode[0] as TableTag;
                        for (int d = 0; d < ctxTable.RowCount; d++)
                        {
                            for (int k = 0; k < ctxTable.Rows[d].ColumnCount; k++)
                            {
                                if ((k + 1) % 2 == 0)
                                {
                                    dtlCtx += ctxTable.Rows[d].Columns[k].ToNodePlainString() + "\r\n";
                                }
                                else
                                {
                                    dtlCtx += ctxTable.Rows[d].Columns[k].ToNodePlainString() + ":";
                                }
                            }
                        }
                        BuildUnit    = dtlCtx.GetRegex("建设单位");
                        FinalistsWay = dtlCtx.GetRegex("入围方式");
                        RevStaMethod = dtlCtx.GetRegex("评标方法");
                        SetStaMethod = dtlCtx.GetRegex("定标方法");
                        VoteMethod   = dtlCtx.GetRegex("票决方法");
                        RevStaDate   = dtlCtx.GetRegex("定标时间").GetDateRegex("yyyy/MM/dd");

                        if (!SetStaMethod.IsChina())
                        {
                            SetStaMethod = "";
                        }
                    }
                    MsgType = "深圳市建设工程交易中心";

                    sqlCount++;
                    if (!crawlAll && sqlCount >= this.MaxCount)
                    {
                        return(list);
                    }

                    ProjectResult info = ToolDb.GetProjectResult("广东省", "深圳市工程", "", Code, prjName, BuildUnit, FinalistsWay, RevStaMethod, SetStaMethod, VoteMethod, RevStaDate, InfoUrl, MsgType, ProjectCtx, HtmlTxt, beginDate);


                    if (prjName.Contains("深圳广电金融中心施工总承包工程"))
                    {
                        string delSql = string.Format("delete from ProjectResult where InfoUrl='{0}'", info.InfoUrl);
                        ToolDb.ExecuteSql(delSql);
                    }

                    if (ToolDb.SaveEntity(info, this.ExistCompareFields, this.ExistsUpdate))
                    {
                        if (this.ExistsUpdate)
                        {
                            object id = ToolDb.ExecuteScalar(string.Format("select Id from ProjectResult where InfoUrl='{0}'", info.InfoUrl));
                            if (id != null)
                            {
                                string sql = string.Format("delete from ProjectResultDtl where SourceId='{0}'", id);
                                ToolDb.ExecuteSql(sql);
                                string sqlAttach = string.Format("delete from BaseAttach where SourceId='{0}'", id);
                                ToolDb.ExecuteSql(sqlAttach);
                            }
                        }
                        if (dicFile.Count > 0)
                        {
                            try
                            {
                                foreach (Dictionary <string, object> newDic in dicFile)
                                {
                                    try
                                    {
                                        string attachGuid = Convert.ToString(newDic["attachGuid"]);
                                        string attachName = Convert.ToString(newDic["attachName"]);
                                        string newUrl     = string.Empty;
                                        if (attachGuid.ToLower().Contains("http"))
                                        {
                                            newUrl = attachGuid;
                                        }
                                        else
                                        {
                                            newUrl = "https://www.szjsjy.com.cn:8001/file/downloadFile?fileId=" + attachGuid;
                                        }


                                        BaseAttach attach = ToolHtml.GetBaseAttach(newUrl, attachName, info.Id, "SiteManage\\Files\\Attach\\");
                                        if (attach == null)
                                        {
                                            attach = ToolHtml.GetBaseAttach(newUrl, attachName, info.Id, "SiteManage\\Files\\Attach\\");
                                        }

                                        if (attach != null)
                                        {
                                            ToolDb.SaveEntity(attach, string.Empty);
                                        }
                                    }
                                    catch
                                    {
                                        continue;
                                    }
                                }
                            }
                            catch { }
                        }

                        //if (ctxNode != null && ctxNode.Count > 1)
                        //{
                        //    TableTag prjTable = ctxNode[1] as TableTag;
                        //    string colName1 = prjTable.Rows[0].Columns[2].ToNodePlainString();
                        //    string colName2 = prjTable.Rows[0].Columns[3].ToNodePlainString();
                        //    for (int c = 2; c < prjTable.RowCount; c++)
                        //    {
                        //        TableRow dr = prjTable.Rows[c];

                        //        string UnitName = string.Empty, BidDate = string.Empty, IsBid = string.Empty, Ranking = string.Empty, WinNumber = string.Empty, TicketNumber = string.Empty;

                        //        UnitName = dr.Columns[1].ToNodePlainString();
                        //        if (colName1.Contains("投标时间") || colName1.Contains("投标日期"))
                        //            BidDate = dr.Columns[2].ToPlainTextString();
                        //        else if (colName1.Contains("得票数"))
                        //            TicketNumber = dr.Columns[2].ToNodePlainString();
                        //        else if (colName1.Contains("取胜次数"))
                        //            WinNumber = dr.Columns[2].ToNodePlainString();
                        //        if (colName2.Contains("排名"))
                        //            Ranking = dr.Columns[3].ToNodePlainString();
                        //        else if (colName2.Contains("中标候选人"))
                        //            IsBid = dr.Columns[3].ToNodePlainString() == "" ? "0" : "1";

                        //        ProjectResultDtl infoDtl = ToolDb.GetProjectResultDtl(info.Id, UnitName, BidDate, IsBid, Ranking, WinNumber, TicketNumber);
                        //        ToolDb.SaveEntity(infoDtl, "SourceId,UnitName", this.ExistsUpdate);
                        //    }
                        //}
                    }
                }
            }
            return(list);
        }
Beispiel #6
0
        protected override IList ExecuteCrawl(bool crawlAll)
        {
            IList  list = new List <NoticeInfo>();
            string html = string.Empty;

            try
            {
                html = this.ToolWebSite.GetHtmlByUrl(this.SiteUrl + (MaxCount + 20));
            }
            catch { return(null); }
            int startIndex = html.IndexOf("{");
            int endIndex   = html.LastIndexOf("}");

            html = html.Substring(startIndex, (endIndex + 1) - startIndex);
            JavaScriptSerializer        serializer  = new JavaScriptSerializer();
            Dictionary <string, object> smsTypeJson = (Dictionary <string, object>)serializer.DeserializeObject(html);

            foreach (KeyValuePair <string, object> obj in smsTypeJson)
            {
                if (obj.Key == "total")
                {
                    continue;
                }
                object[] array = (object[])obj.Value;
                foreach (object arrValue in array)
                {
                    string InfoTitle = string.Empty, InfoType = string.Empty, PublistTime = string.Empty, InfoCtx = string.Empty, InfoUrl = string.Empty, prjCode = string.Empty, buildUnit = string.Empty, htmlTxt = string.Empty, prjType = string.Empty, bgType = string.Empty;
                    Dictionary <string, object> dic = (Dictionary <string, object>)arrValue;
                    prjCode     = Convert.ToString(dic["bdBH"]);
                    InfoTitle   = Convert.ToString(dic["bdName"]);
                    prjType     = Convert.ToString(dic["gcLeiXing2"]);
                    PublistTime = Convert.ToString(dic["faBuTime"]);
                    InfoType    = "资审及业绩公示";
                    InfoUrl     = Convert.ToString(dic["detailUrl"]);
                    try
                    {
                        htmlTxt = this.ToolWebSite.GetHtmlByUrl(InfoUrl).GetJsString().GetReplace("\\t,\\r,\\n,\",{html:,}");
                    }
                    catch { }

                    string dtlUrl = "https://www.szjsjy.com.cn:8001/jyw/queryYeJiById.do", fileUrl = "https://www.szjsjy.com.cn:8001/jyw/queryYeJiFuJianByGGBDGuid.do";

                    string dtlJson = string.Empty, fileJson = string.Empty;
                    try
                    {
                        NameValueCollection dtlNvc = this.ToolWebSite.GetNameValueCollection(new string[] { "guid" }, new string[] { Convert.ToString(dic["pbYeJiGongShiGuid"]) });

                        dtlJson = this.ToolWebSite.GetHtmlByUrl(dtlUrl, dtlNvc);
                    }
                    catch { }
                    List <BaseAttach> listAttach = new List <BaseAttach>();
                    StringBuilder     dtlSb      = new StringBuilder();

                    try
                    {
                        Dictionary <string, object> fileSmsJson   = null;
                        JavaScriptSerializer        dtlSerializer = new JavaScriptSerializer();
                        Dictionary <string, object> dtlSmsJson    = (Dictionary <string, object>)dtlSerializer.DeserializeObject(dtlJson);
                        Dictionary <string, object> yeJiGongShi   = null; //dtlSmsJson["yeJiGongShi"] as Dictionary<string, object>;
                        // Dictionary<string, object> zhaoBiaoFangShi = yeJiGongShi["zhaoBiaoFangShi"] as Dictionary<string, object>;
                        Dictionary <string, object> ggBd = null;          //yeJiGongShi["ggBd"] as Dictionary<string, object>;
                        Dictionary <string, object> bd   = null;          // ggBd["bd"] as Dictionary<string, object>;
                        Dictionary <string, object> gc   = null;          //bd["gc"] as Dictionary<string, object>;
                        Dictionary <string, object> xm   = null;          //bd["xm"] as Dictionary<string, object>;

                        try
                        {
                            yeJiGongShi = dtlSmsJson["yeJiGongShi"] as Dictionary <string, object>;
                            ggBd        = yeJiGongShi["ggBd"] as Dictionary <string, object>;
                            bd          = ggBd["bd"] as Dictionary <string, object>;
                            gc          = bd["gc"] as Dictionary <string, object>;
                            xm          = bd["xm"] as Dictionary <string, object>;
                        }
                        catch { }

                        if (yeJiGongShi != null)
                        {
                            dtlSb.Append("<table>");
                            try
                            {
                                string xm_BH   = Convert.ToString(xm["xm_BH"]);
                                string xm_Name = Convert.ToString(xm["xm_Name"]);
                                dtlSb.Append("<tr>");
                                dtlSb.Append("<td>项目编号:</td>");
                                dtlSb.Append("<td>" + xm_BH + "</td>");
                                dtlSb.Append("<td>项目名称:</td>");
                                dtlSb.Append("<td>" + xm_Name + "</td>");
                                dtlSb.Append("</tr>");
                            }
                            catch { }

                            dtlSb.Append("<tr>");
                            dtlSb.Append("<td>招标项目编号:</td>");
                            dtlSb.Append("<td>" + Convert.ToString(gc["gcBH"]) + "</td>");
                            dtlSb.Append("<td>招标项目名称:</td>");
                            dtlSb.Append("<td>" + Convert.ToString(gc["gcName"]) + "</td>");
                            dtlSb.Append("</tr>");

                            dtlSb.Append("<tr>");
                            dtlSb.Append("<td>标段编号:</td>");
                            dtlSb.Append("<td>" + Convert.ToString(bd["bdBH"]) + "</td>");
                            dtlSb.Append("<td>标段名称:</td>");
                            dtlSb.Append("<td>" + Convert.ToString(bd["bdName"]) + "</td>");
                            dtlSb.Append("</tr>");

                            dtlSb.Append("<tr>");
                            dtlSb.Append("<td>招标方式:</td>");
                            dtlSb.Append("<td>" + Convert.ToString(yeJiGongShi["zhaoBiaoFangShi"]) + "</td>");
                            dtlSb.Append("<td>工程类型:</td>");
                            dtlSb.Append("<td>" + Convert.ToString(yeJiGongShi["gcLeiXing2"]) + "</td>");
                            dtlSb.Append("</tr>");

                            dtlSb.Append("<tr>");
                            dtlSb.Append("<td>建设单位:</td>");
                            dtlSb.Append("<td>" + Convert.ToString(gc["zbRName"]) + "</td>");
                            dtlSb.Append("<td></td>");
                            dtlSb.Append("<td></td>");
                            dtlSb.Append("</tr>");

                            string startDate = Convert.ToString(yeJiGongShi["gongShiStartDate"]);
                            if (!string.IsNullOrWhiteSpace(startDate))
                            {
                                startDate = ToolHtml.GetDateTimeByLong(long.Parse(startDate)).ToString();
                            }
                            string endDate = Convert.ToString(yeJiGongShi["gongShiEndDate"]);
                            if (!string.IsNullOrWhiteSpace(endDate))
                            {
                                endDate = ToolHtml.GetDateTimeByLong(long.Parse(endDate)).ToString();
                            }
                            dtlSb.Append("<tr>");
                            dtlSb.Append("<td>发布开始时间:</td>");
                            dtlSb.Append("<td>" + startDate + "</td>");
                            dtlSb.Append("<td>发布截止时间:</td>");
                            dtlSb.Append("<td>" + endDate + "</td>");
                            dtlSb.Append("</tr>");

                            string gongShiLaiYuan       = Convert.ToString(yeJiGongShi["gongShiLaiYuan"]);
                            string gongShiLaiYuanResult = gongShiLaiYuan == "1" ? "报名环节" : gongShiLaiYuan == "2" ? "资格审查环节" : gongShiLaiYuan == "3" ? "评标环节" : "其他";
                            dtlSb.Append("<tr>");
                            dtlSb.Append("<td>公示环节:</td>");
                            dtlSb.Append("<td>" + gongShiLaiYuanResult + "</td>");
                            dtlSb.Append("<td></td>");
                            dtlSb.Append("<td></td>");
                            dtlSb.Append("</tr>");

                            dtlSb.Append("</table>");
                            string ggBdGuid = Convert.ToString(yeJiGongShi["ggBdGuid"]), pbYeJiGongShiGuid = Convert.ToString(yeJiGongShi["pbYeJiGongShiGuid"]);

                            try
                            {
                                NameValueCollection fileNvc = this.ToolWebSite.GetNameValueCollection(new string[] { "ggBDGuid", "pbYeJiGongShiGuid" }, new string[] { ggBdGuid, pbYeJiGongShiGuid });
                                fileJson = this.ToolWebSite.GetHtmlByUrl(fileUrl, fileNvc);
                            }
                            catch { }
                            JavaScriptSerializer fileSerializer = new JavaScriptSerializer();
                            fileSmsJson = (Dictionary <string, object>)fileSerializer.DeserializeObject(fileJson);
                        }
                        else
                        {
                            try
                            {
                                Uri uri = new Uri(InfoUrl);
                                NameValueCollection param = ToolHtml.GetQueryString(uri.Query);
                                string id   = param["id"];
                                string type = param["type"];
                                NameValueCollection fileNvc = this.ToolWebSite.GetNameValueCollection(new string[] { "id", "type" }, new string[] { id, type });
                                fileJson = this.ToolWebSite.GetHtmlByUrl("https://www.szjsjy.com.cn:8001/jyw/queryOldDataDetail.do", fileNvc);
                            }
                            catch { }
                            JavaScriptSerializer fileSerializer = new JavaScriptSerializer();
                            fileSmsJson = (Dictionary <string, object>)fileSerializer.DeserializeObject(fileJson);
                        }


                        foreach (KeyValuePair <string, object> fileObj in fileSmsJson)
                        {
                            if (fileObj.Key == "list")
                            {
                                object[] fileArray = (object[])fileObj.Value;
                                int      rowIndex  = 1;
                                foreach (object fileValue in fileArray)
                                {
                                    Dictionary <string, object> fileDic = (Dictionary <string, object>)fileValue;
                                    dtlSb.Append("<table>");
                                    dtlSb.Append("<tr>");
                                    dtlSb.Append("<th>序号</th>");
                                    dtlSb.Append("<th>单位名称</th>");
                                    dtlSb.Append("<th>资格文件</th>");
                                    dtlSb.Append("<th>业绩文件</th>");
                                    dtlSb.Append("<th>审查结果</th>");
                                    dtlSb.Append("<th>不合格原因</th>");
                                    dtlSb.Append("</tr>");

                                    dtlSb.Append("<tr>");
                                    dtlSb.Append("<td>" + rowIndex + "</td>");
                                    dtlSb.Append("<td>" + fileDic["DWMC"] + "</td>");
                                    dtlSb.Append("<td>" + fileDic["ZGWJ"] + "</td>");
                                    dtlSb.Append("<td>" + fileDic["YJWJ"] + "</td>");
                                    dtlSb.Append("<td>" + fileDic["IsHeGe"] + "</td>");
                                    dtlSb.Append("<td>" + fileDic["BuHeGeYuanYin"] + "</td>");
                                    dtlSb.Append("</tr>");

                                    BaseAttach item = ToolDb.GenBaseAttach(Convert.ToString(fileDic["ZGWJ"]), "", Convert.ToString(fileDic["ZGWJURL"]));
                                    listAttach.Add(item);
                                    rowIndex++;
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Logger.Error(ex);
                        Logger.Error(InfoTitle);
                    }

                    NoticeInfo info = ToolDb.GenNoticeInfo("广东省", "深圳市工程", string.Empty, string.Empty, InfoTitle, InfoType, dtlSb.ToString().GetReplace("</tr>", "\r\n").ToCtxString(), PublistTime, string.Empty, MsgTypeCosnt.ShenZhenMsgType, InfoUrl, prjCode, buildUnit, string.Empty, string.Empty, prjType, bgType, dtlSb.ToString());
                    list.Add(info);
                    foreach (BaseAttach item in listAttach)
                    {
                        item.SourceID = info.Id;
                        base.AttachList.Add(item);
                    }
                    if (!crawlAll && list.Count >= this.MaxCount)
                    {
                        return(list);
                    }
                }
            }

            return(list);
        }
Beispiel #7
0
        protected override IList ExecuteCrawl(bool crawlAll)
        {
            int   sqlCount = 0;
            IList list     = new List <BidInfo>();

            string html = string.Empty;

            try
            {
                html = this.ToolWebSite.GetHtmlByUrl(this.SiteUrl + this.MaxCount);
            }
            catch { return(null); }
            int startIndex = html.IndexOf("{");
            int endIndex   = html.LastIndexOf("}");

            html = html.Substring(startIndex, (endIndex + 1) - startIndex);
            JavaScriptSerializer        serializer  = new JavaScriptSerializer();
            Dictionary <string, object> smsTypeJson = (Dictionary <string, object>)serializer.DeserializeObject(html);

            foreach (KeyValuePair <string, object> obj in smsTypeJson)
            {
                if (obj.Key == "total")
                {
                    continue;
                }
                object[] array = (object[])obj.Value;
                foreach (object arrValue in array)
                {
                    string prjName = string.Empty,
                                buildUnit = string.Empty, bidUnit = string.Empty,
                                bidMoney = string.Empty, code = string.Empty,
                                bidDate = string.Empty,
                                beginDate = string.Empty,
                                endDate = string.Empty, bidType = string.Empty,
                                specType = string.Empty, InfoUrl = string.Empty,
                                msgType = string.Empty, bidCtx = string.Empty,
                                prjAddress = string.Empty, remark = string.Empty,
                                prjMgr = string.Empty, otherType = string.Empty, HtmlTxt = string.Empty;


                    Dictionary <string, object> dic = (Dictionary <string, object>)arrValue;
                    code      = Convert.ToString(dic["bdBH"]);
                    prjName   = Convert.ToString(dic["bdName"]);
                    beginDate = Convert.ToString(dic["fabuTime2"]);
                    string saveUrl = Convert.ToString(dic["detailUrl"]);
                    //if (!prjName.Contains("一片一路一街一景"))
                    //{
                    //    continue;
                    //}
                    InfoUrl = "https://www.szjsjy.com.cn:8001/jyw-lg/jyxx/queryOldOTDataDetail.do?type=4&id=" + dic["bdBH"];

                    List <Dictionary <string, object> > listAttachs = new List <Dictionary <string, object> >();
                    bool isJson = false;
                    try
                    {
                        HtmlTxt = this.ToolWebSite.GetHtmlByUrl(InfoUrl).GetJsString().GetReplace("\\t,\\r,\\n,\"");
                        if (string.IsNullOrEmpty(HtmlTxt))
                        {
                            isJson = true;
                            string url     = "https://www.szjsjy.com.cn:8001/jyw-lg/jyxx/queryZbgs.do?guid=" + dic["dbZhongBiaoJieGuoGuid"] + "&ggGuid=&bdGuid=";
                            string htmldtl = this.ToolWebSite.GetHtmlByUrl(url);

                            Dictionary <string, object> dtlJsons = (Dictionary <string, object>)serializer.DeserializeObject(htmldtl);

                            buildUnit = Convert.ToString(dtlJsons["zbrAndLht"]);
                            bidUnit   = Convert.ToString(dtlJsons["tbrName"]);
                            bidMoney  = Convert.ToString(dtlJsons["zhongBiaoJE"]);
                            try
                            {
                                bidMoney = (decimal.Parse(bidMoney) / 1000000).ToString();
                            }
                            catch { }
                            prjMgr = Convert.ToString(dtlJsons["xiangMuJiLi"]);

                            Dictionary <string, object> gg = null;
                            try
                            {
                                gg = dtlJsons["gg"] as Dictionary <string, object>;
                            }
                            catch { }
                            Dictionary <string, object> bd = null;
                            Dictionary <string, object> gc = null;
                            Dictionary <string, object> xm = null;
                            try
                            {
                                bd = dtlJsons["bd"] as Dictionary <string, object>;
                            }
                            catch { }
                            try
                            {
                                gc = bd["gc"] as Dictionary <string, object>;
                            }
                            catch { }
                            try
                            {
                                xm = bd["xm"] as Dictionary <string, object>;
                            }
                            catch { }


                            string   htl      = this.ToolWebSite.GetHtmlByUrl(saveUrl);
                            Parser   parser   = new Parser(new Lexer(htl));
                            NodeList nodelist = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("div"), new HasAttributeFilter("class", "right_bg")));
                            if (nodelist != null && nodelist.Count > 0)
                            {
                                HtmlTxt = nodelist.AsHtml();
                                try
                                {
                                    HtmlTxt = HtmlTxt.GetReplace("<span id=\"gcBH\"></span>", "<span id=\"gcBH\">" + code + "</span>");
                                }
                                catch { }
                                try
                                {
                                    HtmlTxt = HtmlTxt.GetReplace("<span id=\"gcName\"></span>", "<span id=\"gcBH\">" + gc["gcName"] + "</span>");
                                }
                                catch { }
                                try
                                {
                                    HtmlTxt = HtmlTxt.GetReplace("<span id=\"bdName\"></span>", "<span id=\"bdName\">" + prjName + "</span>");
                                }
                                catch { }
                                try
                                {
                                    HtmlTxt = HtmlTxt.GetReplace("<span id=\"xmBH\"></span>", "<span id=\"xmBH\">" + xm["xm_BH"] + "</span>");
                                }
                                catch { }
                                try
                                {
                                    HtmlTxt = HtmlTxt.GetReplace("<span id=\"xmName\"></span>", "<span id=\"xmName\">" + xm["xm_Name"] + "</span>");
                                }
                                catch { }
                                try
                                {
                                    long zbgsStartTime = Convert.ToInt64(dtlJsons["zbgsStartTime"]);
                                    HtmlTxt = HtmlTxt.GetReplace("<span id=\"zbgsStartTime\"></span>", "<span id=\"zbgsStartTime\">" + ToolHtml.GetDateTimeByLong(zbgsStartTime) + "</span>");
                                }
                                catch { }
                                try
                                {
                                    HtmlTxt = HtmlTxt.GetReplace("<span id=\"zbRName\"></span>", "<span id=\"zbRName\">" + gc["zbRName"] + "</span>");
                                }
                                catch { }
                                try
                                {
                                    HtmlTxt = HtmlTxt.GetReplace("<span id=\"zbdlJG\"></span>", "<span id=\"zbdlJG\">" + gc["creatorName"] + "</span>");
                                }
                                catch { }
                                try
                                {
                                    HtmlTxt = HtmlTxt.GetReplace("<span id=\"tbrName\"></span>", "<span id=\"tbrName\">" + dtlJsons["tbrName"] + "</span>");
                                }
                                catch { }
                                try
                                {
                                    HtmlTxt = HtmlTxt.GetReplace("<span id=\"zhongBiaoJE\"></span>", "<span id=\"zhongBiaoJE\">" + bidMoney + "万元</span>");
                                }
                                catch { }
                                try
                                {
                                    HtmlTxt = HtmlTxt.GetReplace("<span id=\"zhongBiaoGQ\"></span>", "<span id=\"zhongBiaoGQ\">" + dtlJsons["zhongBiaoGQ"] + "</span>");
                                }
                                catch { }
                                try
                                {
                                    HtmlTxt = HtmlTxt.GetReplace("<span id=\"xiangMuJiLi\"></span>", "<span id=\"xiangMuJiLi\">" + prjMgr + "</span>");
                                }
                                catch { }
                                try
                                {
                                    HtmlTxt = HtmlTxt.GetReplace("<span id=\"ziGeDengJi\"></span>", "<span id=\"ziGeDengJi\">" + dtlJsons["ziGeDengJi"] + "</span>");
                                }
                                catch { }

                                try
                                {
                                    HtmlTxt = HtmlTxt.GetReplace("<span id=\"ziGeZhengShu\"></span>", "<span id=\"ziGeZhengShu\">" + dtlJsons["ziGeZhengShu"] + "</span>");
                                }
                                catch { }
                                try
                                {
                                    string zanding = string.IsNullOrWhiteSpace(Convert.ToString(dtlJsons["isZanDingJinE"])) ? "否" : "是";
                                    HtmlTxt = HtmlTxt.GetReplace("<span id=\"isZanDingJinE\"></span>", "<span id=\"isZanDingJinE\">" + zanding + "</span>");
                                }
                                catch { }
                            }
                            try
                            {
                                string fileUrl  = "https://www.szjsjy.com.cn:8001/jyw-lg/jyxx/filegroup/queryByGroupGuidZS.do?groupGuid=" + dtlJsons["ztbFileGroupGuid"];
                                string fileJson = this.ToolWebSite.GetHtmlByUrl(fileUrl);
                                Dictionary <string, object> fileDic = (Dictionary <string, object>)serializer.DeserializeObject(fileJson);
                                object[] objFile = fileDic["rows"] as object[];

                                foreach (object file in objFile)
                                {
                                    Dictionary <string, object> attach = file as Dictionary <string, object>;
                                    listAttachs.Add(attach);
                                }
                            }
                            catch { }
                        }
                    }
                    catch { continue; }
                    bidCtx = HtmlTxt.Replace("<br />", "\r\n").ToCtxString();

                    if (!isJson)
                    {
                        buildUnit = bidCtx.GetBuildRegex();
                        bidUnit   = bidCtx.GetBidRegex();
                        bidMoney  = bidCtx.GetMoneyRegex();
                        prjMgr    = bidCtx.GetMgrRegex();

                        if (string.IsNullOrEmpty(prjMgr))
                        {
                            prjMgr = bidCtx.GetRegex("项目负责");
                        }
                    }
                    msgType  = "深圳市建设工程交易中心龙岗分中心";
                    specType = "建设工程";
                    bidType  = ToolHtml.GetInviteTypes(prjName);
                    prjName  = ToolDb.GetPrjName(prjName);
                    BidInfo info = ToolDb.GenBidInfo("广东省", "深圳龙岗区工程", "龙岗区", string.Empty, code, prjName, buildUnit, beginDate, bidUnit, beginDate, endDate, bidCtx, string.Empty, msgType, bidType, specType, otherType, bidMoney, saveUrl, prjMgr, HtmlTxt);

                    if (!crawlAll && sqlCount >= this.MaxCount)
                    {
                        return(null);
                    }

                    sqlCount++;
                    if (ToolDb.SaveEntity(info, this.ExistCompareFields, this.ExistsUpdate, this.ExistsHtlCtx))
                    {
                        if (!isJson)
                        {
                            Parser   parser   = new Parser(new Lexer(HtmlTxt));
                            NodeList fileNode = parser.ExtractAllNodesThatMatch(new TagNameFilter("a"));
                            if (fileNode != null && fileNode.Count > 0)
                            {
                                for (int f = 0; f < fileNode.Count; f++)
                                {
                                    ATag tag = fileNode[f] as ATag;
                                    if (tag.IsAtagAttach() || tag.Link.ToLower().Contains("downloadfile"))
                                    {
                                        try
                                        {
                                            BaseAttach attach = null;
                                            string     link   = string.Empty;
                                            if (tag.Link.ToLower().Contains("http"))
                                            {
                                                link = tag.Link;
                                                if (link.StartsWith("\\"))
                                                {
                                                    link = link.Substring(link.IndexOf("\\"), link.Length - link.IndexOf("\\"));
                                                }
                                                if (link.EndsWith("//"))
                                                {
                                                    link = link.Remove(link.LastIndexOf("//"));
                                                }
                                                link = link.GetReplace("\\", "");
                                            }
                                            else
                                            {
                                                link = "https://www.szjsjy.com.cn:8001/" + tag.Link;
                                            }
                                            attach = ToolHtml.GetBaseAttachByUrl(link, tag.LinkText, info.Id, "SiteManage\\Files\\InviteAttach\\");
                                            if (attach != null)
                                            {
                                                ToolDb.SaveEntity(attach, "SourceID,AttachServerPath");
                                            }
                                        }
                                        catch { continue; }
                                    }
                                }
                            }
                        }
                        else if (listAttachs.Count > 0)
                        {
                            foreach (Dictionary <string, object> attach in listAttachs)
                            {
                                BaseAttach attachBase = null;
                                try
                                {
                                    string attachName = Convert.ToString(attach["attachName"]);
                                    string attachId   = Convert.ToString(attach["attachGuid"]);
                                    string link       = "https://www.szjsjy.com.cn:8001/file/downloadFile?fileId=" + attachId;

                                    attachBase = ToolHtml.GetBaseAttach(link, attachName, info.Id, "SiteManage\\Files\\InviteAttach\\");
                                    if (attachBase != null)
                                    {
                                        ToolDb.SaveEntity(attachBase, "SourceID,AttachServerPath");
                                    }
                                }
                                catch { }
                            }
                        }
                    }
                }
            }
            return(list);
        }
Beispiel #8
0
        protected override IList ExecuteCrawl(bool crawlAll)
        {
            this.HttpApi();
            //SetTemp();
            DateTime time = ToolHtml.GetDateTimeByLong(1543593600000);

            string html = string.Empty;
            //string url = "http://web.zjj.sz.gov.cn/HouseOutService/queryFwRentms/getGrQyInfo.json";
            //string url = "http://web.zjj.sz.gov.cn/HouseOutService/queryFwRentms/getApplyers.json";
            string url = "http://web.zjj.sz.gov.cn/HouseOutService/queryFwRentms/getUnitQyInfos.json";
            //string url = "http://web.zjj.sz.gov.cn/HouseOutService/queryFwRentms/getUnitFlatInfos.json";
            //string url = "http://web.zjj.sz.gov.cn/zfxx_jscjn/external/project/info/get?pageIndex=1&pageSize=100";
            string cookies   = string.Empty;
            string publicKey = "bnNfZGF0YTpLSUlmMndLVWJ1RmVyVEhRZWh5WTFyNzNlVEM4VmVTb3p2eFBDanN2VVJRWnExR20xdVduVk1FQnlyK0ZrMEdhcVRGRzFVUUw1dTBDNEpxRWNRSVRra3NOYWgxcFVldnJCbnpTcDJaUnU3THpyNTZsUmhzd09NdHNiZHYxVCtJbGdHdzBEcUZXczJIVVYzZkw0NWFnbldqemt3MHJpVlJ2cEs5MFFiOHBMb1E9";

            string key  = string.Format("{0}{1}{2}{3}", "e02d02ec17a14446a861bbad068c40ef", "440305", "", "1990-01-01");
            string keys = DESEncrypt.GenerateMD5(key);

            //"983f9b3b897c77f27c9bd27837d82f5f"
            //"983f9b3b897c77f27c9bd21837d02f5f"
            keys = keys.Replace("o", "p");
            keys = keys.Replace("i", "t");
            keys = keys.Replace("l", "n");
            keys = keys.Replace("1", "7");
            keys = keys.Replace("0", "8");
            Dictionary <string, string> dic1 = new Dictionary <string, string>();

            dic1.Add("key", keys);
            dic1.Add("belongto", "440305");
            dic1.Add("quart", "");
            dic1.Add("page", "60");
            dic1.Add("timestamp", "1990-01-01");
            string jsonStr = JsonConvert.SerializeObject(dic1);

            string jsonData = string.Empty;

            try
            {
                using (IWebHttpClient httpClient = new WebHttpClient())
                {
                    jsonData = httpClient.PostSync(new Uri(url), jsonStr, publicKey);
                }
            }
            catch (Exception ex)
            {
            }

            Dictionary <string, object> dics = JsonConvert.DeserializeObject <Dictionary <string, object> >(jsonData);

            object oobj = dics["date"];

            Dictionary <string, object> contents = JsonConvert.DeserializeObject <Dictionary <string, object> >(oobj.ToString());

            string str1 = contents["content"].ToString();

            List <Dictionary <string, object> > jsonLists = JsonConvert.DeserializeObject <List <Dictionary <string, object> > >(str1);

            foreach (Dictionary <string, object> keys1 in jsonLists)
            {
                WebPactCorpData model = JsonConvert.DeserializeObject <WebPactCorpData>(JsonConvert.SerializeObject(keys1));
                string          str2  = keys1.ToString();
            }

            string jsonsss = oobj.ToString();

            KeyValuePair <string, object> keyValues = (KeyValuePair <string, object>)oobj;

            Dictionary <string, object> content = (Dictionary <string, object>)dics["date"];

            object[] objs = (object[])content["content"];

            foreach (object obj in objs)
            {
                WebPactCorpData corp = obj as WebPactCorpData;
            }

            WebPactCorp entity = JsonConvert.DeserializeObject <WebPactCorp>(jsonData);

            //using (IWebHttpClient httpClient = new WebHttpClient())
            //{
            //    jsonData = httpClient.GetSync(new Uri(url), publicKey);
            //}

            //html = ToolWeb.GetHtmlByUrl(url, nvc, Encoding.UTF8, true, publicKey, ref cookies);

            IList list     = new List <BidInfo>();
            int   sqlCount = 0;

            try
            {
                html = this.ToolWebSite.GetHtmlByUrl(this.SiteUrl + (this.MaxCount + 20));
            }
            catch { return(null); }

            int startIndex = html.IndexOf("{");
            int endIndex   = html.LastIndexOf("}");

            html = html.Substring(startIndex, (endIndex + 1) - startIndex);
            JavaScriptSerializer        serializer  = new JavaScriptSerializer();
            Dictionary <string, object> smsTypeJson = (Dictionary <string, object>)serializer.DeserializeObject(html);

            foreach (KeyValuePair <string, object> obj in smsTypeJson)
            {
                if (obj.Key == "total")
                {
                    continue;
                }
                object[] array = (object[])obj.Value;
                foreach (object arrValue in array)
                {
                    string prjName = string.Empty, buildUnit = string.Empty, bidUnit = string.Empty, bidMoney = string.Empty, code = string.Empty, bidDate = string.Empty, beginDate = string.Empty, endDate = string.Empty, bidType = string.Empty, specType = string.Empty, InfoUrl = string.Empty, msgType = string.Empty, bidCtx = string.Empty, prjAddress = string.Empty, remark = string.Empty, prjMgr = string.Empty, HtmlTxt = string.Empty;

                    Dictionary <string, object> dic = (Dictionary <string, object>)arrValue;
                    code      = Convert.ToString(dic["bdBH"]);
                    prjName   = Convert.ToString(dic["bdName"]);
                    bidType   = Convert.ToString(dic["gcLeiXing2"]);
                    beginDate = Convert.ToString(dic["fabuTime2"]);
                    try
                    {
                        bidMoney = Convert.ToString(dic["zhongBiaoJE"]).GetMoney();
                    }
                    catch
                    {
                    }
                    string addUrl = Convert.ToString(dic["detailUrl"]);
                    //https://www.szjsjy.com.cn:8001/jyw/queryOldDataDetail.do?type=4&id=158df5f1-73a1-440c-a59b-e4ca1464b4e9
                    InfoUrl = "https://www.szjsjy.com.cn:8001/jyw/queryOldDataDetail.do?type=4&id=" + dic["dbZhongBiaoJieGuoGuid"];

                    try
                    {
                        HtmlTxt = this.ToolWebSite.GetHtmlByUrl(InfoUrl).GetJsString().GetReplace("\\t,\\r,\\n,\"");
                    }
                    catch { }

                    List <Dictionary <string, string> > dicFile = new List <Dictionary <string, string> >();
                    if (string.IsNullOrEmpty(HtmlTxt))
                    {
                        string strHtml = string.Empty;
                        string newUrl  = "https://www.szjsjy.com.cn:8001/jyw/queryZbgs.do?guid=" + dic["dbZhongBiaoJieGuoGuid"] + "&ggGuid=bdGuid=";
                        InfoUrl = Convert.ToString(dic["detailUrl"]);
                        try
                        {
                            HtmlTxt = this.ToolWebSite.GetHtmlByUrl(InfoUrl).GetJsString().GetReplace("\\t,\\r,\\n,\"");
                            strHtml = this.ToolWebSite.GetHtmlByUrl(newUrl).GetJsString();
                        }
                        catch { }

                        if (!string.IsNullOrEmpty(strHtml))
                        {
                            string gcBH = string.Empty, gcName = string.Empty, xmBH = string.Empty, xmName = string.Empty, zbgsStartTime = string.Empty, zbgsEndTime = string.Empty, zbRName = string.Empty, zbdlJG = string.Empty, zbFangShi = string.Empty, bdName = string.Empty, tbrName = string.Empty, zhongBiaoJE = string.Empty, zhongBiaoGQ = string.Empty, xiangMuJiLi = string.Empty, ziGeDengJi = string.Empty, ziGeZhengShu = string.Empty, isZanDingJinE = string.Empty, gcLeiXing = string.Empty, isPLZB = string.Empty, ztbFileGroupGuid = string.Empty;
                            try
                            {
                                Dictionary <string, string> zbfs = new Dictionary <string, string>();
                                zbfs.Add("2", "邀请招标");
                                zbfs.Add("1", "公开招标");
                                zbfs.Add("YuXuanZhaoBiaoZGC", "预选招标子工程");
                                zbfs.Add("GongKaiZhaoBiao", "公开招标");
                                zbfs.Add("5", "预选招标子工程");
                                zbfs.Add("4", "单一来源");
                                zbfs.Add("DanYiLaiYuan", "单一来源");
                                zbfs.Add("YaoQingZhaoBiao", "邀请招标");
                                JavaScriptSerializer        newSerializer = new JavaScriptSerializer();
                                Dictionary <string, object> newTypeJson   = (Dictionary <string, object>)newSerializer.DeserializeObject(strHtml);
                                Dictionary <string, object> bd            = newTypeJson["bd"] as Dictionary <string, object>;
                                Dictionary <string, object> gc            = bd["gc"] as Dictionary <string, object>;
                                ztbFileGroupGuid = Convert.ToString(newTypeJson["ztbFileGroupGuid"]);
                                gcBH             = Convert.ToString(gc["gcBH"]);
                                gcName           = Convert.ToString(gc["gcName"]);
                                Dictionary <string, object> xm = bd["xm"] as Dictionary <string, object>;

                                if (xm != null)
                                {
                                    xmBH   = Convert.ToString(xm["xm_BH"]);
                                    xmName = Convert.ToString(xm["xm_Name"]);
                                }
                                object startTime = newTypeJson["zbgsStartTime"];
                                if (startTime != null)
                                {
                                    zbgsStartTime = ToolHtml.GetDateTimeByLong(Convert.ToInt64(startTime)).ToString("yyyy-MM-dd HH:mm");
                                }

                                object endTime = newTypeJson["zbgsEndTime"];
                                if (endTime != null)
                                {
                                    endDate = zbgsEndTime = ToolHtml.GetDateTimeByLong(Convert.ToInt64(endTime)).ToString("yyyy-MM-dd HH:mm");
                                }

                                buildUnit = zbRName = Convert.ToString(gc["zbRName"]);

                                zbdlJG = Convert.ToString(newTypeJson["zbdlJG"]);

                                zbFangShi = Convert.ToString(gc["zbFangShi"]);
                                if (!string.IsNullOrEmpty(zbFangShi))
                                {
                                    zbFangShi = zbfs[zbFangShi];
                                }
                                bdName  = Convert.ToString(bd["bdName"]);
                                bidUnit = tbrName = Convert.ToString(newTypeJson["tbrName"]);

                                zhongBiaoJE = Convert.ToString(newTypeJson["zhongBiaoJE"]);
                                if (!string.IsNullOrEmpty(zhongBiaoJE))
                                {
                                    try
                                    {
                                        bidMoney = zhongBiaoJE = (decimal.Parse(zhongBiaoJE) / 1000000).ToString();
                                    }
                                    catch { }
                                }
                                else
                                {
                                    try
                                    {
                                        zhongBiaoJE = Convert.ToString(newTypeJson["tongYongZhongBiaoJia"]);
                                        bidMoney    = (zhongBiaoJE + "\r\n").GetMoneyRegex(new string[] { "人民币" });
                                    }
                                    catch { }
                                }
                                zhongBiaoGQ = Convert.ToString(newTypeJson["zhongBiaoGQ"]);
                                prjMgr      = xiangMuJiLi = Convert.ToString(newTypeJson["xiangMuJiLi"]);

                                ziGeDengJi    = Convert.ToString(newTypeJson["ziGeDengJi"]);
                                ziGeZhengShu  = Convert.ToString(newTypeJson["ziGeZhengShu"]);
                                isZanDingJinE = Convert.ToString(newTypeJson["isZanDingJinE"]);
                                gcLeiXing     = Convert.ToString(bd["gcLeiXing"]);
                                isPLZB        = Convert.ToString(gc["isPLZB"]);
                            }
                            catch (Exception ex)
                            {
                                Logger.Error(ex);
                            }

                            Parser   parser  = new Parser(new Lexer(HtmlTxt));
                            NodeList dtlNode = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("div"), new HasAttributeFilter("class", "detail_contect")));
                            if (dtlNode != null && dtlNode.Count > 0)
                            {
                                HtmlTxt = dtlNode.AsHtml();
                                HtmlTxt = HtmlTxt.GetReplace("<span id=gcBH></span>", "<span id=gcBH>" + gcBH + "</span>");
                                HtmlTxt = HtmlTxt.GetReplace("<span id=gcName></span>", "<span id=gcName>" + gcName + "</span>");
                                HtmlTxt = HtmlTxt.GetReplace("<span id=xmBH></span>", "<span id=xmBH>" + xmBH + "</span>");
                                HtmlTxt = HtmlTxt.GetReplace("<span id=xmName></span>", "<span id=xmName>" + xmName + "</span>");
                                HtmlTxt = HtmlTxt.GetReplace("<span id=zbgsStartTime></span>", "<span id=zbgsStartTime>" + zbgsStartTime + "</span>");
                                HtmlTxt = HtmlTxt.GetReplace("<span id=zbgsEndTime></span>", "<span id=zbgsEndTime>" + zbgsEndTime + "</span>");
                                HtmlTxt = HtmlTxt.GetReplace("<span id=zbRName></span>", "<span id=zbRName>" + zbRName + "</span>");
                                HtmlTxt = HtmlTxt.GetReplace("<span id=zbdlJG></span>", "<span id=zbdlJG>" + zbdlJG + "</span>");
                                HtmlTxt = HtmlTxt.GetReplace("<span id=zbFangShi></span>", "<span id=zbFangShi>" + zbFangShi + "</span>");
                                HtmlTxt = HtmlTxt.GetReplace("<span id=bdName></span>", "<span id=bdName>" + bdName + "</span>");
                                HtmlTxt = HtmlTxt.GetReplace("<span id=tbrName></span>", "<span id=tbrName>" + tbrName + "</span>");
                                HtmlTxt = HtmlTxt.GetReplace("<span id=zhongBiaoJE></span>", "<span id=zhongBiaoJE>" + zhongBiaoJE + "</span>");
                                HtmlTxt = HtmlTxt.GetReplace("<span id=zhongBiaoGQ></span>", "<span id=zhongBiaoGQ>" + zhongBiaoGQ + "</span>");
                                HtmlTxt = HtmlTxt.GetReplace("<span id=xiangMuJiLi></span>", "<span id=xiangMuJiLi>" + xiangMuJiLi + "</span>");
                                HtmlTxt = HtmlTxt.GetReplace("<span id=ziGeDengJi></span>", "<span id=ziGeDengJi>" + ziGeDengJi + "</span>");
                                HtmlTxt = HtmlTxt.GetReplace("<span id=ziGeZhengShu></span>", "<span id=ziGeZhengShu>" + ziGeZhengShu + "</span>");
                                HtmlTxt = HtmlTxt.GetReplace("<span id=isZanDingJinE></span>", "<span id=isZanDingJinE>" + isZanDingJinE.ToLower() == "true" ? "是" : "否" + "</span>");
                            }
                            string fileUrl  = "https://www.szjsjy.com.cn:8001/jyw/filegroup/queryByGroupGuidZS.do?groupGuid=" + ztbFileGroupGuid;
                            string fileHtml = string.Empty;
                            try
                            {
                                fileHtml = this.ToolWebSite.GetHtmlByUrl(fileUrl);
                                JavaScriptSerializer        fileSerializer = new JavaScriptSerializer();
                                Dictionary <string, object> fileTypeJson   = (Dictionary <string, object>)fileSerializer.DeserializeObject(fileHtml);
                                foreach (KeyValuePair <string, object> fileObj in fileTypeJson)
                                {
                                    object[] fileArray = (object[])fileObj.Value;
                                    foreach (object fileValue in fileArray)
                                    {
                                        Dictionary <string, object> tempDic = (Dictionary <string, object>)fileValue;
                                        Dictionary <string, string> file    = new Dictionary <string, string>();
                                        file.Add("Name", Convert.ToString(tempDic["attachName"]));
                                        file.Add("Url", Convert.ToString("https://www.szjsjy.com.cn:8001/file/downloadFile?fileId=" + tempDic["attachGuid"]));
                                        dicFile.Add(file);
                                    }
                                }
                            }
                            catch { }
                        }
                    }
                    bidCtx = HtmlTxt.GetReplace("<br />,<br/>,</ br>,</br>", "\r\n").ToCtxString() + "\r\n";
                    if (string.IsNullOrEmpty(buildUnit) && string.IsNullOrEmpty(bidUnit))
                    {
                        bidUnit = bidCtx.GetBidRegex();
                        if (string.IsNullOrEmpty(bidUnit))
                        {
                            bidUnit = bidCtx.Replace(" ", "").GetBidRegex();
                        }
                        if (string.IsNullOrEmpty(bidUnit))
                        {
                            bidUnit = bidCtx.GetRegex("中 标 人");
                        }
                        string money = bidCtx.GetMoneyRegex();
                        if (!string.IsNullOrEmpty(money))
                        {
                            bidMoney = money;
                        }
                        if (string.IsNullOrEmpty(bidMoney) || bidMoney == "0")
                        {
                            bidMoney = bidCtx.GetMoneyRegex();
                        }
                        if (string.IsNullOrEmpty(bidMoney) || bidMoney == "0")
                        {
                            bidMoney = bidCtx.Replace(" ", "").GetMoneyRegex();
                        }
                        if (string.IsNullOrEmpty(bidMoney) || bidMoney == "0")
                        {
                            bidMoney = bidCtx.GetRegex("中 标 价");
                        }

                        prjMgr = bidCtx.GetMgrRegex();
                        if (string.IsNullOrEmpty(prjMgr))
                        {
                            prjMgr = bidCtx.Replace(" ", "").GetMgrRegex();
                        }
                        if (string.IsNullOrEmpty(prjMgr))
                        {
                            prjMgr = bidCtx.GetRegex("项 目 总 监");
                        }

                        buildUnit = bidCtx.GetBuildRegex();
                        if (string.IsNullOrEmpty(buildUnit))
                        {
                            buildUnit = bidCtx.Replace(" ", "").GetBuildRegex();
                        }
                        if (string.IsNullOrEmpty(buildUnit))
                        {
                            buildUnit = bidCtx.GetRegex("建 设 单 位");
                        }
                        prjAddress = bidCtx.GetAddressRegex();
                        if (string.IsNullOrEmpty(prjAddress))
                        {
                            prjAddress = bidCtx.Replace(" ", "").GetAddressRegex();
                        }
                        if (string.IsNullOrEmpty(prjAddress))
                        {
                            prjAddress = bidCtx.GetRegex("工 程 地 址");
                        }
                    }
                    specType = "建设工程";
                    msgType  = "深圳市建设工程交易中心";
                    if (Encoding.Default.GetByteCount(prjMgr) > 50)
                    {
                        prjMgr = "";
                    }
                    if (Encoding.Default.GetByteCount(bidUnit) > 150)
                    {
                        string[] bidUnits = bidUnit.Split(';');
                        bidUnit = bidUnits[0];
                    }
                    if (Encoding.Default.GetByteCount(bidUnit) > 150)
                    {
                        bidUnit = "";
                    }
                    if (prjMgr.Contains("----"))
                    {
                        prjMgr = "";
                    }
                    BidInfo info = ToolDb.GenBidInfo("广东省", "深圳市工程", "", string.Empty, code, prjName, buildUnit, beginDate, bidUnit, beginDate, endDate, bidCtx, string.Empty, msgType, bidType, specType, string.Empty, bidMoney, addUrl, prjMgr, HtmlTxt);
                    sqlCount++;
                    if (ToolDb.SaveEntity(info, this.ExistCompareFields, this.ExistsUpdate))
                    {
                        if (dicFile.Count > 0)
                        {
                            foreach (Dictionary <string, string> file in dicFile)
                            {
                                try
                                {
                                    BaseAttach item = ToolHtml.GetBaseAttach(file["Url"], file["Name"], info.Id, "SiteManage\\Files\\InviteAttach\\");
                                    if (item != null)
                                    {
                                        ToolDb.SaveEntity(item, "SourceID,AttachServerPath");
                                    }
                                }
                                catch { }
                            }
                        }
                    }
                    if (!crawlAll && sqlCount >= this.MaxCount)
                    {
                        return(null);
                    }
                }
            }
            return(list);
        }
Beispiel #9
0
        protected override IList ExecuteCrawl(bool crawlAll)
        {
            IList  list  = new List <BidInfo>();
            int    count = 0;
            string html  = string.Empty;

            try
            {
                html = this.ToolWebSite.GetHtmlByUrl(SiteUrl, Encoding.UTF8);
            }
            catch { return(null); }
            int startIndex = html.IndexOf("{");
            int endIndex   = html.LastIndexOf("}");

            html = html.Substring(startIndex, (endIndex + 1) - startIndex);
            JavaScriptSerializer        serializer  = new JavaScriptSerializer();
            Dictionary <string, object> smsTypeJson = (Dictionary <string, object>)serializer.DeserializeObject(html);

            object[] objvalues = smsTypeJson["rows"] as object[];
            foreach (object objValue in objvalues)
            {
                string prjName = string.Empty, buildUnit = string.Empty, bidUnit = string.Empty, bidMoney = string.Empty, code = string.Empty,
                            bidDate = string.Empty, beginDate = string.Empty, endDate = string.Empty, bidType = string.Empty, specType = string.Empty, InfoUrl = string.Empty, msgType = string.Empty, bidCtx = string.Empty, prjAddress = string.Empty, remark = string.Empty, prjMgr = string.Empty, otherType = string.Empty, HtmlTxt = string.Empty, area = string.Empty;

                Dictionary <string, object> dic = (Dictionary <string, object>)objValue;
                prjName = Convert.ToString(dic["title"]);
                //if (!prjName.Contains("湖北能源集团鄂州电厂三期2×1050MW超超临界燃煤机组扩建工程金属及压力容器质量检查(安全性能检查)-(二次)"))
                //{
                //    continue;
                //}
                beginDate = Convert.ToString(dic["faBuStartTimeText"]).GetDateRegex();
                bidType   = Convert.ToString(dic["gongChengTypeText"]);
                string foUrl = "http://www.ezztb.gov.cn//jyw/jyw/queryZbgs.do?guid=" + dic["yuanXiTongId"];
                string htmldtl = string.Empty;
                string prName = string.Empty, bdName = string.Empty, xmBh = string.Empty, xmMc = string.Empty,
                       startTime = string.Empty, endTime = string.Empty, zbrAndLht = string.Empty, zbdlJG = string.Empty,
                       zbFangShi = string.Empty, zhongBiaoGQ = string.Empty, ziGeDengJi = string.Empty, ziGeZhengShu = string.Empty;

                try
                {
                    HtmlTxt = this.ToolWebSite.GetHtmlByUrl(foUrl, Encoding.UTF8);
                }
                catch
                {
                    continue;
                }
                JavaScriptSerializer        Newserializer = new JavaScriptSerializer();
                Dictionary <string, object> newTypeJson   = null;
                try
                {
                    newTypeJson = (Dictionary <string, object>)Newserializer.DeserializeObject(HtmlTxt);
                }
                catch
                {
                    continue;
                }
                InfoUrl = "http://www.ezztb.gov.cn/jiaoyixingxi/zbgs_view.html?guid=" + dic["yuanXiTongId"];
                try
                {
                    htmldtl = this.ToolWebSite.GetHtmlByUrl(InfoUrl);
                }
                catch { continue; }
                Dictionary <string, object> dics          = (Dictionary <string, object>)newTypeJson;
                Dictionary <string, object> bd            = dics["bd"] as Dictionary <string, object>;
                Dictionary <string, object> gcx           = bd["gc"] as Dictionary <string, object>;
                Dictionary <string, object> xm            = bd["xm"] as Dictionary <string, object>;

                code         = Convert.ToString(gcx["gcBH"]);
                buildUnit    = Convert.ToString(gcx["zbRName"]);
                bidUnit      = Convert.ToString(dics["tbrName"]);
                prjMgr       = Convert.ToString(dics["xiangMuJiLi"]);
                bidMoney     = Convert.ToString(dics["zhongBiaoJE"]);
                prName       = Convert.ToString(gcx["gcName"]);
                bdName       = Convert.ToString(bd["bdName"]);
                xmBh         = Convert.ToString(xm["xm_BH"]);
                xmMc         = Convert.ToString(xm["xm_Name"]);
                startTime    = Convert.ToString(dics["zbgsStartTime"]);
                startTime    = ToolHtml.GetDateTimeByLong(Convert.ToInt64(startTime)).ToString("yyyy-MM-dd HH:mm");
                endTime      = Convert.ToString(dics["zbgsEndTime"]);
                endTime      = ToolHtml.GetDateTimeByLong(Convert.ToInt64(endTime)).ToString("yyyy-MM-dd HH:mm");
                zbrAndLht    = Convert.ToString(dics["zbrAndLht"]);
                zbdlJG       = Convert.ToString(dics["zbdlJG"]);
                zbFangShi    = Convert.ToString(dics["zbFangShi"]);
                zhongBiaoGQ  = Convert.ToString(dics["zhongBiaoGQ"]);
                ziGeDengJi   = Convert.ToString(dics["ziGeDengJi"]);
                ziGeZhengShu = Convert.ToString(dics["ziGeZhengShu"]);
                HtmlTxt      = ("<table>") + ("<tr><th>招标项目编号:</th><td>" + code + "</td></tr>") +
                               ("<tr><th>招标项目名称:</th><td>" + prName + "</td></tr>") +
                               ("<tr><th>标段名称:</th><td>" + bdName + "</td></tr>") +
                               ("<tr><th>项目编号:</th><td>" + xmBh + "</td></tr>") +
                               ("<tr><th>项目名称:</th><td>" + xmMc + "</td></tr>") +
                               ("<tr><th>公示时间:</th><td>" + startTime + "至" + endTime + "</td></tr>") +
                               ("<tr><th>招标人:</th><td>" + zbrAndLht + "</td></tr>") +
                               ("<tr><th>招标代理机构:</th><td>" + zbdlJG + "</td></tr>") +
                               ("<tr><th>招标方式:</th><td>" + zbFangShi + "</td></tr>") +
                               ("<tr><th>中标人:</th><td>" + bidUnit + "</td></tr>") +
                               ("<tr><th>中标价:</th><td>" + bidMoney + "</td></tr>") +
                               ("<tr><th>中标工期:</th><td>" + zhongBiaoGQ + "</td></tr>") +
                               ("<tr><th>项目经理:</th><td>" + prjMgr + "</td></tr>") +
                               ("<tr><th>资格等级:</th><td>" + ziGeDengJi + "</td></tr>") +
                               ("<tr><th>资格证书:</th><td>" + ziGeZhengShu + "</td></tr>") +
                               ("</table>");
                bidCtx = HtmlTxt.Replace("</td>", "\r\n").ToCtxString();
                try
                {
                    if (Convert.ToDecimal(bidMoney) > 100000)
                    {
                        bidMoney = (decimal.Parse(bidMoney) / 1000000).ToString();
                    }
                }
                catch { }

                msgType   = "鄂州市公共资源交易中心";
                specType  = "政府采购";
                bidType   = prjName.GetInviteBidType();
                buildUnit = buildUnit.Replace(" ", "");
                BidInfo info = ToolDb.GenBidInfo("湖北省", "湖北省及地市", "鄂州市", string.Empty, code, prjName, buildUnit, beginDate, bidUnit, beginDate, endDate, bidCtx, string.Empty, msgType, bidType, specType, otherType, bidMoney, InfoUrl, prjMgr, HtmlTxt);
                list.Add(info);
                count++;
                Parser   parser = new Parser(new Lexer(HtmlTxt));
                NodeList aNode  = parser.ExtractAllNodesThatMatch(new TagNameFilter("a"));
                if (aNode != null && aNode.Count > 0)
                {
                    for (int k = 0; k < aNode.Count; k++)
                    {
                        ATag a = aNode[k] as ATag;
                        if (a.IsAtagAttach())
                        {
                            string link = string.Empty;
                            if (a.Link.ToLower().Contains("http"))
                            {
                                link = a.Link;
                            }
                            else
                            {
                                link = "http://www.ezztb.gov.cn/" + a.Link;
                            }
                            BaseAttach attach = ToolDb.GenBaseAttach(a.LinkText, info.Id, link);
                            base.AttachList.Add(attach);
                        }
                    }
                }
                if (count >= 50)
                {
                    Thread.Sleep(1000 * 60 * 5);
                    count = 0;
                }
                if (!crawlAll && list.Count >= this.MaxCount)
                {
                    return(list);
                }
            }
            return(list);
        }
Beispiel #10
0
        protected override IList ExecuteCrawl(bool crawlAll)
        {
            IList  list     = new List <ProjectResult>();
            int    sqlCount = 0;
            string html     = string.Empty;

            try
            {
                html = this.ToolWebSite.GetHtmlByUrl(this.SiteUrl + this.MaxCount);
            }
            catch { return(null); }
            int startIndex = html.IndexOf("{");
            int endIndex   = html.LastIndexOf("}");

            html = html.Substring(startIndex, (endIndex + 1) - startIndex);
            JavaScriptSerializer        serializer  = new JavaScriptSerializer();
            Dictionary <string, object> smsTypeJson = (Dictionary <string, object>)serializer.DeserializeObject(html);

            foreach (KeyValuePair <string, object> obj in smsTypeJson)
            {
                if (obj.Key == "total")
                {
                    continue;
                }
                object[] array = (object[])obj.Value;
                foreach (object arrValue in array)
                {
                    string Code = string.Empty, prjName = string.Empty, BuildUnit = string.Empty,
                                FinalistsWay = string.Empty, RevStaMethod = string.Empty, SetStaMethod = string.Empty,
                                VoteMethod = string.Empty, RevStaDate = string.Empty, InfoUrl = string.Empty, MsgType = string.Empty,
                                Ctx = string.Empty, Html = string.Empty, beginDate = string.Empty;

                    Dictionary <string, object> dic = (Dictionary <string, object>)arrValue;
                    Code      = Convert.ToString(dic["bdBH"]);
                    prjName   = Convert.ToString(dic["bdName"]);
                    beginDate = Convert.ToString(dic["createTime2"]);
                    string dbjieGuoid = Convert.ToString(dic["dbJieGuoGuid"]);
                    string bdId       = Convert.ToString(dic["bdGuid"]);
                    string ggId       = Convert.ToString(dic["ggGuid"]);
                    string detailUrl  = Convert.ToString(dic["detailUrl"]);



                    InfoUrl = "https://www.szjsjy.com.cn:8001/jyw-ba/jyxx/queryOldOTDataDetail.do?type=9&id=" + Code;

                    string attachJson = string.Empty;
                    try
                    {
                        Html = this.ToolWebSite.GetHtmlByUrl(InfoUrl).GetJsString();
                        string temp = Html.GetReplace("\"\"");
                        if (string.IsNullOrWhiteSpace(temp))
                        {
                            InfoUrl = " https://www.szjsjy.com.cn:8001/jyw-ba/jyxx/dbResult_View.do?bdGuid=" + bdId + "&ggGuid=" + ggId + "&dbJieGuoGuid=" + dbjieGuoid;
                            Html    = this.ToolWebSite.GetHtmlByUrl(InfoUrl);
                            string url = "https://www.szjsjy.com.cn:8001/jyw-ba/jyxx/queryDbJieGuoByGuid.do?guid=" + dbjieGuoid;
                            attachJson = this.ToolWebSite.GetHtmlByUrl(url);
                        }
                    }
                    catch { continue; }


                    string gcName = string.Empty, bdName = string.Empty,
                           zbrName = string.Empty, createTime = string.Empty,
                           lxr = string.Empty, lxdh = string.Empty, dbBanFa = string.Empty, piaoJueBanFa = string.Empty;
                    bool   isChouQian = false;
                    string attachId   = string.Empty;
                    string rwFs       = string.Empty;
                    string unitUrl    = string.Empty;
                    string lxrxx      = string.Empty;
                    string lxdhxx     = string.Empty;
                    if (!string.IsNullOrWhiteSpace(attachJson))
                    {
                        JavaScriptSerializer        newSerializer = new JavaScriptSerializer();
                        Dictionary <string, object> newTypeJson   = (Dictionary <string, object>)newSerializer.DeserializeObject(attachJson);
                        Dictionary <string, object> kdInfo        = (Dictionary <string, object>)newTypeJson;
                        Dictionary <string, object> ggbd          = (Dictionary <string, object>)kdInfo["ggbd"];
                        Dictionary <string, object> gc            = (Dictionary <string, object>)ggbd["gc"];
                        Dictionary <string, object> bd            = (Dictionary <string, object>)kdInfo["bd"];
                        Dictionary <string, object> bdgc          = (Dictionary <string, object>)bd["gc"];
                        try
                        {
                            attachId = Convert.ToString(kdInfo["attachFileGroupGuid"]);
                        }
                        catch { }
                        try
                        {
                            string ggGuid = Convert.ToString(kdInfo["ggGuid"]);
                            string bdGuid = Convert.ToString(kdInfo["bdGuid"]);
                            unitUrl = "https://www.szjsjy.com.cn:8001/jyw-ba/jyxx/queryTbrListByBdGuidAndGgGuidForGs.do?bdGuid=" + bdGuid + "&ggGuid=" + ggGuid;
                        }
                        catch { }
                        gcName = Convert.ToString(gc["gcName"]);
                        try
                        {
                            bdName = Convert.ToString(kdInfo["bdName"]);
                        }
                        catch { bdName = gcName; }
                        zbrName    = Convert.ToString(gc["zbRName"]);
                        createTime = Convert.ToString(kdInfo["dbTime"]);
                        createTime = ToolHtml.GetDateTimeByLong(Convert.ToInt64(createTime)).ToString();
                        try
                        {
                            lxr = Convert.ToString(bdgc["lianXiRenName"]);
                        }
                        catch { }
                        try
                        {
                            lxrxx = Convert.ToString(bdgc["jingBanRenName"]);
                        }
                        catch { }
                        try
                        {
                            lxdh = Convert.ToString(bdgc["lianXiRenPhone"]);
                        }
                        catch { }
                        try
                        {
                            lxdhxx = Convert.ToString(bdgc["jingBanRenMobile"]);
                        }
                        catch { }
                        try
                        {
                            rwFs = Convert.ToString(kdInfo["rwFangShi"]);
                        }
                        catch { }
                        try
                        {
                            dbBanFa = Convert.ToString(kdInfo["dbBanFa"]);
                        }
                        catch { }
                        try
                        {
                            piaoJueBanFa = Convert.ToString(kdInfo["piaoJueBanFa"]);
                        }
                        catch { }
                        try
                        {
                            isChouQian = (bool)kdInfo["isChouQian"];
                        }
                        catch { }
                        string surl = " https://www.szjsjy.com.cn:8001/jyw-ba/jyxx/dbResult_View.do?bdGuid=" + bdId + "&ggGuid=" + ggId + "&dbJieGuoGuid=" + dbjieGuoid;
                        attachJson = this.ToolWebSite.GetHtmlByUrl(surl);
                        Html       = attachJson;
                        Parser   parserNew = new Parser(new Lexer(Html));
                        NodeList tableNode = parserNew.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("table"), new HasAttributeFilter("class", "de_tab1")));
                        if (tableNode != null && tableNode.Count > 0)
                        {
                            Html = tableNode.AsHtml();
                            Html = Html.GetReplace("<td  id=\"ggName\">&nbsp;</td>", "<td  id=\"ggName\">&nbsp;" + prjName + "</td>");
                            Html = Html.GetReplace("<td id=\"bdBH\">&nbsp;</td>", "<td id=\"bdBH\">&nbsp;" + Code + "</td>");
                            Html = Html.GetReplace("<td id=\"bdName\">&nbsp;</td>", "<td id=\"bdName\">&nbsp;" + bdName + "</td>");
                            Html = Html.GetReplace("<td id=\"zbRName\">&nbsp;</td>", "<td id=\"zbRName\">&nbsp;" + zbrName + "</td>");
                            Html = Html.GetReplace("<td id=\"dbTime\">&nbsp;</td>", "<td id=\"dbTime\">&nbsp;" + createTime + "</td>");
                            Html = Html.GetReplace("<td id=\"rwfs\">&nbsp;</td>", "<td id=\"rwfs\">&nbsp;" + rwFs + "</td>");
                            Html = Html.GetReplace("<td id=\"dbBanFa\">&nbsp;</td>", "<td id=\"dbBanFa\">&nbsp;" + dbBanFa + "</td>");
                            Html = Html.GetReplace("<td id=\"lianXiRenName\">&nbsp;</td>", "<td id=\"lianXiRenName\">&nbsp;" + lxrxx + "</td>");
                            Html = Html.GetReplace("<td id=\"lianXiRenPhone\">&nbsp;</td>", "<td id=\"lianXiRenPhone\">&nbsp;" + lxdhxx + "</td>");
                            Ctx  = Html.Replace("</tr>", "\r\n").ToCtxString();
                        }
                    }

                    string   resultCtx = string.Empty;
                    Parser   parser    = new Parser(new Lexer(Html.GetReplace("\\\"", "\"").GetReplace("0:00:00", "")));
                    NodeList listNode  = parser.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("table"), new HasAttributeFilter("class", "de_tab1")));
                    if (listNode != null && listNode.Count > 0)
                    {
                        TableTag table = listNode[0] as TableTag;
                        for (int r = 0; r < table.RowCount; r++)
                        {
                            for (int c = 0; c < table.Rows[r].ColumnCount; c++)
                            {
                                string temp = table.Rows[r].Columns[c].ToPlainTextString().GetReplace(":,:");
                                if (c % 2 == 0)
                                {
                                    resultCtx += temp + ":";
                                }
                                else
                                {
                                    resultCtx += temp + "\r\n";
                                }
                            }
                        }
                    }

                    string strTmp = string.Empty;
                    if (!string.IsNullOrEmpty(unitUrl))
                    {
                        string unithtml = string.Empty;
                        try
                        {
                            unithtml = this.ToolWebSite.GetHtmlByUrl(unitUrl);
                        }
                        catch { }
                        object[] unitTypeJson = (object[])serializer.DeserializeObject(unithtml);
                        if (unitTypeJson.Length > 0)
                        {
                            List <LongGangResult> unitLists = this.GetUnits(unitTypeJson);
                            if (isChouQian)
                            {
                                strTmp += "<table width='100%' border='0' class='de_tab2'>";
                                strTmp += "<tr>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>序号</th>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>投标人名称</th>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>投标时间</th>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>中标候选人</th>";
                                strTmp += "</tr>";
                                foreach (LongGangResult unitInfo in unitLists.OrderBy(x => x.Xh))
                                {
                                    strTmp = strTmp + "<tr>";
                                    strTmp = strTmp + "<td style='padding: 0px'>" + unitInfo.Xh + "</td>";
                                    strTmp = strTmp + "<td style='padding: 0px'>" + unitInfo.UnitName + "</td>";
                                    strTmp = strTmp + "<td style='padding: 0px'>" + unitInfo.TbDate + "</td>";
                                    if (unitInfo.BidStatus == "3")
                                    {
                                        strTmp = strTmp + "<td><input type='checkbox'  checked=true disabled=true/></td>";
                                    }
                                    else
                                    {
                                        strTmp = strTmp + "<td><input type='checkbox' disabled=true/></td>";
                                    }
                                    strTmp = strTmp + "</tr>";
                                }
                                strTmp = strTmp + "</table>";
                            }
                            else if (dbBanFa == "其他方法")
                            {
                                strTmp += "<table width='100%' border='0' class='de_tab2'>";
                                strTmp += "<tr>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>序号</th>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>企业名称</th>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>确定中标候选人</th>";
                                strTmp += "</tr>";

                                foreach (LongGangResult unitInfo in unitLists.OrderBy(x => x.Xh))
                                {
                                    strTmp = strTmp + "<tr>";
                                    strTmp = strTmp + "<td style='padding: 0px'>" + unitInfo.Xh + "</td>";
                                    strTmp = strTmp + "<td style='padding: 0px'>" + unitInfo.UnitName + "</td>";
                                    if (unitInfo.BidStatus == "3")
                                    {
                                        strTmp = strTmp + "<td><input type='checkbox'  checked=true disabled=true/></td>";
                                    }
                                    else
                                    {
                                        strTmp = strTmp + "<td><input type='checkbox' disabled=true/></td>";
                                    }
                                    strTmp = strTmp + "</tr>";
                                }
                                strTmp = strTmp + "</table>";
                            }
                            else if (dbBanFa == "逐轮淘汰")
                            {
                                strTmp += "<table width='100%' border='0' class='de_tab2'>";
                                strTmp += "<tr>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>序号</th>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>投标人名称</th>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>投标报价(元)</th>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>投标时间</th>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>是否入围</th>";
                                strTmp += "</tr>";
                                foreach (LongGangResult unitInfo in unitLists.OrderBy(x => x.Xh))
                                {
                                    strTmp = strTmp + "<tr>";
                                    strTmp = strTmp + "<td style='padding: 0px'>" + unitInfo.Xh + "</td>";
                                    strTmp = strTmp + "<td style='padding: 0px'>" + unitInfo.UnitName + "</td>";
                                    strTmp = strTmp + "<td style='padding: 0px'>" + unitInfo.BidMoney + "</td>";
                                    strTmp = strTmp + "<td style='padding: 0px'>" + unitInfo.TbDate + "</td>";
                                    if (unitInfo.IsNo == "是")
                                    {
                                        strTmp = strTmp + "<td><input type='checkbox'  checked=true disabled=true/></td>";
                                    }
                                    else
                                    {
                                        strTmp = strTmp + "<td><input type='checkbox' disabled=true/></td>";
                                    }

                                    strTmp = strTmp + "</tr>";
                                }
                                strTmp = strTmp + "</table>";
                            }
                            else if (dbBanFa == "集体议事法")
                            {
                                strTmp += "<table width='100%' border='0' class='de_tab2'>";
                                strTmp += "<tr>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>序号</th>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>企业名称</th>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>确定中标候选人</th>";
                                strTmp += "</tr>";

                                foreach (LongGangResult unitInfo in unitLists.OrderBy(x => x.Code))
                                {
                                    strTmp = strTmp + "<tr>";
                                    strTmp = strTmp + "<td style='padding: 0px'>" + unitInfo.Code + "</td>";
                                    strTmp = strTmp + "<td style='padding: 0px'>" + unitInfo.UnitName + "</td>";
                                    if (unitInfo.IsNo == "是")
                                    {
                                        strTmp = strTmp + "<td><input type='checkbox'  checked=true disabled=true/></td>";
                                    }
                                    else
                                    {
                                        strTmp = strTmp + "<td><input type='checkbox' disabled=true/></td>";
                                    }
                                    strTmp = strTmp + "</tr>";
                                }
                                strTmp = strTmp + "</table>";
                            }
                            else if (dbBanFa == "价格竞争法")
                            {
                                strTmp += "<table width='100%' border='0' class='de_tab2'>";
                                strTmp += "<tr>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>序号</th>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>企业名称</th>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>确定中标候选人</th>";
                                strTmp += "</tr>";

                                foreach (LongGangResult unitInfo in unitLists.OrderBy(x => x.Xh))
                                {
                                    strTmp = strTmp + "<tr>";
                                    strTmp = strTmp + "<td style='padding: 0px'>" + unitInfo.Xh + "</td>";
                                    strTmp = strTmp + "<td style='padding: 0px'>" + unitInfo.UnitName + "</td>";
                                    if (unitInfo.BidStatus == "3")
                                    {
                                        strTmp = strTmp + "<td><input type='checkbox'  checked=true disabled=true/></td>";
                                    }
                                    else
                                    {
                                        strTmp = strTmp + "<td><input type='checkbox' disabled=true/></td>";
                                    }
                                    strTmp = strTmp + "</tr>";
                                }
                                strTmp = strTmp + "</table>";
                            }
                            else if (piaoJueBanFa == "简单多数法")
                            {
                                strTmp += "<table width='100%' border='0' class='de_tab2'>";
                                strTmp += "<tr>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>编号</th>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>投标单位</th>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>得票数</th>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>排名</th>";
                                strTmp += "</tr>";
                                foreach (LongGangResult unitInfo in unitLists.OrderBy(x => x.Code))
                                {
                                    strTmp = strTmp + "<tr>";
                                    strTmp = strTmp + "<td style='padding: 0px'>" + unitInfo.Code + "</td>";
                                    strTmp = strTmp + "<td style='padding: 0px'>" + unitInfo.UnitName + "</td>";
                                    strTmp = strTmp + "<td style='padding: 0px'>" + unitInfo.Piao + "</td>";
                                    strTmp = strTmp + "<td style='padding: 0px'>" + unitInfo.Xh + "</td>";
                                    strTmp = strTmp + "</tr>";
                                }
                                strTmp = strTmp + "</table>";
                            }
                            else if (piaoJueBanFa == "一对一比较法")
                            {
                                strTmp += "<table width='100%' border='0' class='de_tab2'>";
                                strTmp += "<tr>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>编号</th>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>投标单位</th>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>取胜次数</th>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>排名</th>";
                                strTmp += "</tr>";
                                foreach (LongGangResult unitInfo in unitLists.OrderBy(x => x.Code))
                                {
                                    strTmp = strTmp + "<tr>";
                                    strTmp = strTmp + "<td style='padding: 0px'>" + unitInfo.Code + "</td>";
                                    strTmp = strTmp + "<td style='padding: 0px'>" + unitInfo.UnitName + "</td>";
                                    strTmp = strTmp + "<td style='padding: 0px'>" + unitInfo.Piao + "</td>";
                                    strTmp = strTmp + "<td style='padding: 0px'>" + unitInfo.Xh + "</td>";
                                    strTmp = strTmp + "</tr>";
                                }
                                strTmp = strTmp + "</table>";
                            }
                            else
                            {
                                strTmp += "<table width='100%' border='0' class='de_tab2'>";
                                strTmp += "<tr>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>编号</th>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>投标单位</th>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>取胜次数</th>";
                                strTmp += "<th style='text-align: left' class='bg_tdtop'>排名</th>";
                                strTmp += "</tr>";
                                foreach (LongGangResult unitInfo in unitLists.OrderBy(x => x.Code))
                                {
                                    strTmp = strTmp + "<tr>";
                                    strTmp = strTmp + "<td style='padding: 0px'>" + unitInfo.Code + "</td>";
                                    strTmp = strTmp + "<td style='padding: 0px'>" + unitInfo.UnitName + "</td>";
                                    strTmp = strTmp + "<td style='padding: 0px'>" + unitInfo.Piao + "</td>";
                                    strTmp = strTmp + "<td style='padding: 0px'>" + unitInfo.Xh + "</td>";
                                    strTmp = strTmp + "</tr>";
                                }
                                strTmp = strTmp + "</table>";
                            }
                        }
                    }

                    Ctx       = Html.GetReplace("</tr> ", "\r\n").ToCtxString();
                    BuildUnit = resultCtx.GetRegex("建设单位").GetReplace("&nbsp", "");
                    if (string.IsNullOrEmpty(BuildUnit))
                    {
                        BuildUnit = zbrName;
                    }
                    FinalistsWay = resultCtx.GetRegex("入围方式").GetReplace("&nbsp", "");
                    RevStaMethod = resultCtx.GetRegex("评标方法");
                    SetStaMethod = resultCtx.GetRegex("定标方法").GetReplace("&nbsp", "");
                    VoteMethod   = resultCtx.GetRegex("票决方法");
                    RevStaDate   = resultCtx.GetRegex("定标时间").GetDateRegex();
                    if (string.IsNullOrEmpty(RevStaDate))
                    {
                        RevStaDate = createTime;
                    }

                    if (!string.IsNullOrWhiteSpace(strTmp))
                    {
                        Html += strTmp;
                        Ctx   = Html.GetReplace("</tr> ", "\r\n").ToCtxString();
                    }

                    MsgType = "深圳市建设工程交易中心宝安分中心";

                    ProjectResult info = ToolDb.GetProjectResult("广东省", "深圳宝安区工程", "宝安区", Code, prjName, BuildUnit, FinalistsWay, RevStaMethod, SetStaMethod,
                                                                 VoteMethod, RevStaDate, detailUrl, MsgType, Ctx, Html, beginDate);
                    sqlCount++;

                    if (ToolDb.SaveEntity(info, this.ExistCompareFields, this.ExistsUpdate, this.ExistsHtlCtx))
                    {
                        if (!string.IsNullOrWhiteSpace(attachId))
                        {
                            string url = "https://www.szjsjy.com.cn:8001/jyw-ba/jyxx/filegroup/queryByGroupGuidZS.do?groupGuid=" + attachId;

                            string attachHtml = string.Empty;
                            try
                            {
                                attachHtml = this.ToolWebSite.GetHtmlByUrl(url);
                            }
                            catch { }
                            if (!string.IsNullOrWhiteSpace(attachHtml))
                            {
                                JavaScriptSerializer        newSerializers = new JavaScriptSerializer();
                                Dictionary <string, object> newTypeJsons   = (Dictionary <string, object>)newSerializers.DeserializeObject(attachHtml);
                                Dictionary <string, object> mofo           = (Dictionary <string, object>)newTypeJsons;
                                object[] objs = (object[])mofo["rows"];
                                foreach (object objAttach in objs)
                                {
                                    Dictionary <string, object> attachs = (Dictionary <string, object>)objAttach;
                                    string     attachguid = Convert.ToString(attachs["attachGuid"]);
                                    string     attachName = Convert.ToString(attachs["attachName"]);
                                    string     link       = "https://www.szjsjy.com.cn:8001/file/downloadFile?fileId=" + attachguid;
                                    BaseAttach attach     = ToolHtml.GetBaseAttach(link, attachName, info.Id, "SiteManage\\Files\\Attach\\");
                                    if (attach != null)
                                    {
                                        ToolDb.SaveEntity(attach, "SourceID,AttachServerPath");
                                    }
                                }
                            }
                        }
                        else
                        {
                            parser = new Parser(new Lexer(Html));
                            NodeList fileNode = parser.ExtractAllNodesThatMatch(new TagNameFilter("a"));
                            if (fileNode != null && fileNode.Count > 0)
                            {
                                for (int f = 0; f < fileNode.Count; f++)
                                {
                                    ATag tag = fileNode[f] as ATag;
                                    if (tag.IsAtagAttach() || tag.Link.ToLower().Contains("downloadfile"))
                                    {
                                        try
                                        {
                                            BaseAttach attach = null;
                                            string     link   = string.Empty;
                                            if (tag.Link.ToLower().Contains("http"))
                                            {
                                                link = tag.Link;
                                                if (link.StartsWith("\\"))
                                                {
                                                    link = link.Substring(link.IndexOf("\\"), link.Length - link.IndexOf("\\"));
                                                }
                                                if (link.EndsWith("//"))
                                                {
                                                    link = link.Remove(link.LastIndexOf("//"));
                                                }
                                                link = link.GetReplace("\\", "");
                                            }
                                            else
                                            {
                                                link = "https://www.szjsjy.com.cn:8001/" + tag.Link;
                                            }
                                            attach = ToolHtml.GetBaseAttach(link, tag.LinkText, info.Id, "SiteManage\\Files\\Attach\\");

                                            if (attach != null)
                                            {
                                                ToolDb.SaveEntity(attach, "SourceID,AttachServerPath");
                                            }
                                        }
                                        catch { continue; }
                                    }
                                }
                            }
                        }
                    }
                    if (!crawlAll && sqlCount >= this.MaxCount)
                    {
                        return(null);
                    }
                }
            }
            return(list);
        }