From 7b52260c2a83d23adb5447a9e9848d90b4dc018c Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期五, 20 六月 2025 08:49:09 +0800 Subject: [PATCH] 爬虫 处理处罚 --- zhengcaioa/Model/WebCrawler/WebCrawlerContext.cs | 45 ++++ zhengcaioa/Crawler/sichuan/sichuantousuoperation.cs | 484 ++++++++++++++++++++++++++++++++++++++++++++++++ zhengcaioa/Model/WebCrawler/ADPenalty.cs | 24 ++ zhengcaioa/Crawler/Program.cs | 22 ++ 4 files changed, 569 insertions(+), 6 deletions(-) diff --git a/zhengcaioa/Crawler/Program.cs b/zhengcaioa/Crawler/Program.cs index e7394ab..3f181c0 100644 --- a/zhengcaioa/Crawler/Program.cs +++ b/zhengcaioa/Crawler/Program.cs @@ -146,8 +146,8 @@ thread.Start(); - //Thread thread1 = new Thread(new ThreadStart(obj.Method2)); - //thread1.Start(); + Thread thread1 = new Thread(new ThreadStart(obj.Method2)); + thread1.Start(); //Thread thread2 = new Thread(new ThreadStart(obj.Method3)); @@ -174,6 +174,24 @@ } } + + void Method2() + { + while (true) + { + //ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + var dbContextOptionBuilder = new DbContextOptionsBuilder<WebCrawlerContext>(); + var cccontext = new WebCrawlerContext(dbContextOptionBuilder.UseSqlServer(connection2).Options); + + //var dbContextOptionBuilder1 = new DbContextOptionsBuilder<zhengcaioaContext>(); + //var cccontext1 = new zhengcaioaContext(dbContextOptionBuilder1.UseSqlServer(connection1).Options); + + sichuantousuoperation.operations1(cccontext); + //Console.WriteLine("杩欎釜鏆傚仠"); + Thread.CurrentThread.Join(1000 * 60 * 60 * 2);//闃绘璁惧畾鏃堕棿 + } + } + //void Method1() //{ // while (true) diff --git a/zhengcaioa/Crawler/sichuan/sichuantousuoperation.cs b/zhengcaioa/Crawler/sichuan/sichuantousuoperation.cs index 5ca6cd1..74b1114 100644 --- a/zhengcaioa/Crawler/sichuan/sichuantousuoperation.cs +++ b/zhengcaioa/Crawler/sichuan/sichuantousuoperation.cs @@ -71,7 +71,7 @@ dateTime = DateTime.Now; // 鑾峰彇褰撳墠UTC鏃堕棿鐨凞ateTime瀵硅薄 timestamp = (long)(dateTime - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds; - var askurl = "https://www.ccgp-sichuan.gov.cn/gpcms/rest/web/v2/info/getInfoById?id=" + sichuanjieshoudtl.id +"& _t=" + timestamp; + var askurl = "https://www.ccgp-sichuan.gov.cn/gpcms/rest/web/v2/info/getInfoById?id=" + sichuanjieshoudtl.id +"&_t=" + timestamp; procurementComplaint = new ProcurementComplaint(); procurementComplaint.Id = Id; procurementComplaint.ProjectCode = sichuanjieshoudtl.openTenderCode ?? ""; @@ -253,7 +253,7 @@ } else if (aaaa.IndexOf("閮ㄥ垎鎴愮珛") >= 0) { - HandlingStatuses.Add(3); + HandlingStatuses.Add(1);//3 } else { @@ -296,7 +296,7 @@ } else if (aaaa.IndexOf("閮ㄥ垎鎴愮珛") >= 0) { - HandlingStatuses.Add(3); + HandlingStatuses.Add(1);//3 } else { @@ -404,7 +404,7 @@ { updatetime = new Updatetime(); updatetime.Id = Guid.NewGuid().ToString(); - updatetime.Sheng = "鍥涘窛鐪�"; + updatetime.Sheng = "鍥涘窛鐪佹姇璇夊鐞�"; updatetime.Updatetime1 = DateTime.Now.AddDays(-1); _ccontext.Updatetimes.Add(updatetime); _ccontext.SaveChanges(); @@ -422,6 +422,482 @@ { } + + + } + + + public static void operations1(WebCrawlerContext _ccontext) + { + + + + try + { + //鑾峰彇鏇存柊鏃堕棿 + string operationStartTime = ""; + string operationEndTime = ""; + + Updatetime updatetime = _ccontext.Updatetimes.Where(x => x.Sheng == "鍥涘窛鐪佸鐞嗗缃�").FirstOrDefault(); + if (updatetime != null) + { + operationStartTime = updatetime.Updatetime1.ToString("yyyy-MM-dd"); + operationEndTime = updatetime.Updatetime1.AddMonths(1).ToString("yyyy-MM-dd"); + } + else + { + operationStartTime = DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd"); + operationEndTime = DateTime.Now.ToString("yyyy-MM-dd"); + } + + //缈婚〉淇℃伅 + int currPage = 1; + int pageSize = 10; + //寮�濮嬭闂� 閲囪喘鍏憡 + logg.WriteLog("鍥涘窛鐪佸鐞� 寮�濮嬭幏鍙�", "鍥涘窛鐪佸鐞嗗缃�"); + var parser = new HtmlParser(); + while (true) + { + Thread.CurrentThread.Join(1000 * 5);//闃绘璁惧畾鏃堕棿 + logg.WriteLog(operationStartTime + operationEndTime + currPage.ToString(), "鍥涘窛鐪佸鐞嗗缃�"); + DateTime dateTime = DateTime.Now; // 鑾峰彇褰撳墠UTC鏃堕棿鐨凞ateTime瀵硅薄 + long timestamp = (long)(dateTime - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds; + string address = "https://www.ccgp-sichuan.gov.cn/gpcms/rest/web/v2/info/selectInfoForIndex?title=®ion=&siteId=94c965cc-c55d-4f92-8469-d5875c68bd04&channel=069a8160-27a5-4fc9-9506-3df804023d40&currPage=" + currPage + "&pageSize=" + pageSize + "¬iceType=®ionCode=&cityOrArea=&purchaseManner=&openTenderCode=&purchaser=&agency=&purchaseNature=&operationStartTime=" + operationStartTime + "+00:00:00&operationEndTime=" + operationEndTime + "+00:00:00&_t=" + timestamp;//1748999478170 + //"https://www.ccgp-sichuan.gov.cn/gpcms/rest/web/v2/info/selectInfoForIndex?title=®ion=&siteId=94c965cc-c55d-4f92-8469-d5875c68bd04&channel=78f796dd-fc3d-452e-8033-6309c70fca6f&currPage=1&pageSize=10¬iceType=®ionCode=&cityOrArea=&purchaseManner=&openTenderCode=&purchaser=&agency=&purchaseNature=&operationStartTime=&operationEndTime=&_t=1750293232376" + + sichuantousujieshou sichuan = null; + using (HttpClient client = new HttpClient()) + { + client.Timeout = TimeSpan.FromSeconds(60); + HttpResponseMessage response = client.GetAsync(address).Result; + var res = response.Content.ReadAsStringAsync().Result; + + sichuan = JsonConvert.DeserializeObject<sichuantousujieshou>(res); + } + if (sichuan.data.rows != null && sichuan.data.rows.Count > 0) + { + foreach (var sichuanjieshoudtl in sichuan.data.rows) + { + var Id = Guid.Parse(sichuanjieshoudtl.id); + var aDPenalty = _ccontext.ADPenaltys.Find(Id); + if (aDPenalty != null) + { + continue; + } + + + dateTime = DateTime.Now; // 鑾峰彇褰撳墠UTC鏃堕棿鐨凞ateTime瀵硅薄 + timestamp = (long)(dateTime - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds; + var askurl = "https://www.ccgp-sichuan.gov.cn/gpcms/rest/web/v2/info/getInfoById?id=" + sichuanjieshoudtl.id + "&_t=" + timestamp; + aDPenalty = new ADPenalty(); + aDPenalty.Id = Id; + + aDPenalty.DecisionDate = sichuanjieshoudtl.noticeTime; + aDPenalty.Parties = ""; + aDPenalty.CaseReason = ""; + aDPenalty.DisposalDecision = ""; + + aDPenalty.SupervisionDepartment = sichuanjieshoudtl.author ?? ""; + if (aDPenalty.SupervisionDepartment.Length > 255) + { + aDPenalty.SupervisionDepartment = aDPenalty.SupervisionDepartment.Substring(0, 255); + } + aDPenalty.CreateTime = DateTime.Now; + aDPenalty.UpdateTime = aDPenalty.CreateTime; + aDPenalty.Url = "https://www.ccgp-sichuan.gov.cn/maincms-web/article?type=article&id=" + sichuanjieshoudtl.id; + + Thread.CurrentThread.Join(1000 * 5);//闃绘璁惧畾鏃堕棿 + logg.WriteLog(askurl, "鍥涘窛鐪佸鐞嗗缃�"); + sichuantousujieshoumingxi sichuanjieshou = null; + using (HttpClient client = new HttpClient()) + { + client.Timeout = TimeSpan.FromSeconds(60); + HttpResponseMessage response = client.GetAsync(askurl).Result; + var res = response.Content.ReadAsStringAsync().Result; + + sichuanjieshou = JsonConvert.DeserializeObject<sichuantousujieshoumingxi>(res); + } + + if (sichuanjieshou != null && sichuanjieshou.code == "200" && !string.IsNullOrEmpty(sichuanjieshou.data.content)) + { + var document = parser.ParseDocument(sichuanjieshou.data.content); + // var contentList = document.QuerySelectorAll("span").Where(x=>x.TextContent !="" && !x.InnerHtml.Contains("<span")).ToList(); + + var contentList = document.QuerySelectorAll("p").Where(x => x.TextContent != "").ToList(); + + bool jibenqingkuang = false; + bool chulijieguo = false; + foreach (var content in contentList) + { + var ssss = content.TextContent.Replace(" ", ""); + + if (ssss.IndexOf("褰撲簨浜猴細") >= 0 || ssss.IndexOf("褰撲簨浜�:") >= 0 || ssss.IndexOf("褰撀犱簨聽浜猴細") >= 0 || ssss.IndexOf("褰撀犅犱簨聽聽浜猴細") >= 0 || ssss.IndexOf("褰� 浜� 浜猴細") >= 0 || ssss.IndexOf("鍚嶇О锛�") >= 0 || ssss.IndexOf("鐩稿叧渚涘簲鍟嗭細") >= 0 || ssss.IndexOf("褰撲簨浜猴紙鍗曚綅锛夛細") >= 0) + { + //if (string.IsNullOrEmpty(aDPenalty.Parties)) + //{ + aDPenalty.Parties = ssss.Replace("褰撲簨浜猴細", "").Replace("褰撲簨浜�:", "").Replace("褰撀犱簨聽浜猴細", "").Replace("褰撀犅犱簨聽聽浜猴細", "").Replace("褰� 浜� 浜猴細", "").Replace("鍚嶇О锛�", "").Replace("鐩稿叧渚涘簲鍟嗭細", "").Replace("褰撲簨浜猴紙鍗曚綅锛夛細", "").Trim(); + if (aDPenalty.Parties.Length > 255) + { + aDPenalty.Parties = aDPenalty.Parties.Substring(0, 255); + } + //} + } + + if (ssss.IndexOf("褰撲簨浜�1锛�") >= 0 || ssss.IndexOf("褰撲簨浜�2锛�") >= 0 || ssss.IndexOf("褰撲簨浜�3锛�") >= 0 || ssss.IndexOf("褰撲簨浜�4锛�") >= 0) + { + + aDPenalty.Parties += ssss.Replace("褰撲簨浜�1锛�", "").Replace("褰撲簨浜�2锛�", "").Replace("褰撲簨浜�3锛�", "").Replace("褰撲簨浜�4锛�", "").Trim() + " "; + if (aDPenalty.Parties.Length > 255) + { + aDPenalty.Parties = aDPenalty.Parties.Substring(0, 255); + } + + } + + if (ssss.EndsWith("锛�") || ssss.IndexOf(":") >= 0) + { + if (string.IsNullOrEmpty(aDPenalty.Parties)) + { + aDPenalty.Parties = ssss.Replace("锛�", "").Replace(":", "").Trim(); + if (aDPenalty.Parties.Length > 255) + { + aDPenalty.Parties = aDPenalty.Parties.Substring(0, 255); + } + } + } + + + if (jibenqingkuang) + { + if (string.IsNullOrEmpty(aDPenalty.CaseReason)) + { + aDPenalty.CaseReason = ssss.Trim(); + } + jibenqingkuang = false; + } + + if (ssss.IndexOf("浜屻�� 鍩烘湰鎯呭喌") >= 0 || ssss.IndexOf("浜屻�佸熀鏈儏鍐�") >= 0 || ssss.IndexOf("涓�銆佸彂鐜扮殑闂") >= 0 || ssss.IndexOf("涓�銆� 鍙戠幇鐨勯棶棰�") >= 0 || ssss.IndexOf("涓�銆佹暣鏀逛簨椤�") >= 0 || ssss.IndexOf("涓�銆� 鏁存敼浜嬮」") >= 0 || ssss.IndexOf("涓�銆佸彂鐜扮殑涓昏闂") >= 0 || ssss.IndexOf("涓�銆� 鍙戠幇鐨勪富瑕侀棶棰�") >= 0 || ssss.IndexOf("涓�銆佸瓨鍦ㄩ棶棰�") >= 0 || ssss.IndexOf("涓�銆� 瀛樺湪闂") >= 0) + { + jibenqingkuang = true; + } + + + + if (chulijieguo) + { + if (string.IsNullOrEmpty(aDPenalty.DisposalDecision)) + { + aDPenalty.DisposalDecision = ssss.Trim(); + } + chulijieguo = false; + } + + if (ssss.IndexOf("涓夈�� 澶勭悊缁撴灉") >= 0 || ssss.IndexOf("涓夈�佸鐞嗙粨鏋�") >= 0 || ssss.IndexOf("浜屻�佹暣鏀硅姹�") >= 0 || ssss.IndexOf("浜屻�� 鏁存敼瑕佹眰") >= 0) + { + chulijieguo = true; + } + + + + + + + + + + } + + + if (string.IsNullOrEmpty(aDPenalty.DisposalDecision)) + { + var bbbb = ""; + for (int i = 0; i < contentList.Count; i++) + { + var sssssss = contentList[i].TextContent; + if (i == 0 || sssssss != contentList[i - 1].TextContent) + { + bbbb += sssssss; + } + } + + + aDPenalty.DisposalDecision = bbbb; + } + + + _ccontext.ADPenaltys.Add(aDPenalty); + + + + _ccontext.SaveChanges(); + } + + + + + + } + } + + + if (currPage * pageSize >= sichuan.data.total) + { + break; + } + else + { + currPage += 1; + } + //Thread.CurrentThread.Join(1000 * 10);//闃绘璁惧畾鏃堕棿 + + } + + + logg.WriteLog("鍥涘窛鐪佸鐞� 鑾峰彇瀹屾垚", "鍥涘窛鐪佸鐞嗗缃�"); + + + + + + //缈婚〉淇℃伅 + currPage = 1; + pageSize = 10; + //寮�濮嬭闂� 閲囪喘鍏憡 + logg.WriteLog("鍥涘窛鐪佸缃� 寮�濮嬭幏鍙�", "鍥涘窛鐪佸鐞嗗缃�"); + while (true) + { + Thread.CurrentThread.Join(1000 * 5);//闃绘璁惧畾鏃堕棿 + logg.WriteLog(operationStartTime + operationEndTime + currPage.ToString(), "鍥涘窛鐪佸鐞嗗缃�"); + DateTime dateTime = DateTime.Now; // 鑾峰彇褰撳墠UTC鏃堕棿鐨凞ateTime瀵硅薄 + long timestamp = (long)(dateTime - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds; + string address = "https://www.ccgp-sichuan.gov.cn/gpcms/rest/web/v2/info/selectInfoForIndex?title=®ion=&siteId=94c965cc-c55d-4f92-8469-d5875c68bd04&channel=78f796dd-fc3d-452e-8033-6309c70fca6f&currPage=" + currPage + "&pageSize=" + pageSize + "¬iceType=®ionCode=&cityOrArea=&purchaseManner=&openTenderCode=&purchaser=&agency=&purchaseNature=&operationStartTime=" + operationStartTime + "+00:00:00&operationEndTime=" + operationEndTime + "+00:00:00&_t=" + timestamp;//1748999478170 + //"https://www.ccgp-sichuan.gov.cn/gpcms/rest/web/v2/info/selectInfoForIndex?title=®ion=&siteId=94c965cc-c55d-4f92-8469-d5875c68bd04&channel=78f796dd-fc3d-452e-8033-6309c70fca6f&currPage=1&pageSize=10¬iceType=®ionCode=&cityOrArea=&purchaseManner=&openTenderCode=&purchaser=&agency=&purchaseNature=&operationStartTime=&operationEndTime=&_t=1750293232376" + + sichuantousujieshou sichuan = null; + using (HttpClient client = new HttpClient()) + { + client.Timeout = TimeSpan.FromSeconds(60); + HttpResponseMessage response = client.GetAsync(address).Result; + var res = response.Content.ReadAsStringAsync().Result; + + sichuan = JsonConvert.DeserializeObject<sichuantousujieshou>(res); + } + if (sichuan.data.rows != null && sichuan.data.rows.Count > 0) + { + foreach (var sichuanjieshoudtl in sichuan.data.rows) + { + var Id = Guid.Parse(sichuanjieshoudtl.id); + var aDPenalty = _ccontext.ADPenaltys.Find(Id); + if (aDPenalty != null) + { + continue; + } + + + dateTime = DateTime.Now; // 鑾峰彇褰撳墠UTC鏃堕棿鐨凞ateTime瀵硅薄 + timestamp = (long)(dateTime - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds; + var askurl = "https://www.ccgp-sichuan.gov.cn/gpcms/rest/web/v2/info/getInfoById?id=" + sichuanjieshoudtl.id + "&_t=" + timestamp; + aDPenalty = new ADPenalty(); + aDPenalty.Id = Id; + + aDPenalty.DecisionDate = sichuanjieshoudtl.noticeTime; + aDPenalty.Parties = ""; + aDPenalty.CaseReason = ""; + aDPenalty.DisposalDecision = ""; + + aDPenalty.SupervisionDepartment = sichuanjieshoudtl.author ?? ""; + if (aDPenalty.SupervisionDepartment.Length > 255) + { + aDPenalty.SupervisionDepartment = aDPenalty.SupervisionDepartment.Substring(0, 255); + } + aDPenalty.CreateTime = DateTime.Now; + aDPenalty.UpdateTime = aDPenalty.CreateTime; + aDPenalty.Url = "https://www.ccgp-sichuan.gov.cn/maincms-web/article?type=article&id=" + sichuanjieshoudtl.id; + + Thread.CurrentThread.Join(1000 * 5);//闃绘璁惧畾鏃堕棿 + logg.WriteLog(askurl, "鍥涘窛鐪佸鐞嗗缃�"); + sichuantousujieshoumingxi sichuanjieshou = null; + using (HttpClient client = new HttpClient()) + { + client.Timeout = TimeSpan.FromSeconds(60); + HttpResponseMessage response = client.GetAsync(askurl).Result; + var res = response.Content.ReadAsStringAsync().Result; + + sichuanjieshou = JsonConvert.DeserializeObject<sichuantousujieshoumingxi>(res); + } + + if (sichuanjieshou != null && sichuanjieshou.code == "200" && !string.IsNullOrEmpty(sichuanjieshou.data.content)) + { + var document = parser.ParseDocument(sichuanjieshou.data.content); + // var contentList = document.QuerySelectorAll("span").Where(x=>x.TextContent !="" && !x.InnerHtml.Contains("<span")).ToList(); + + var contentList = document.QuerySelectorAll("p").Where(x => x.TextContent != "").ToList(); + + bool jibenqingkuang = false; + bool chulijieguo = false; + foreach (var content in contentList) + { + var ssss = content.TextContent.Replace(" ", ""); + + if (ssss.IndexOf("褰撲簨浜猴細") >= 0 || ssss.IndexOf("褰撲簨浜�:") >= 0 || ssss.IndexOf("褰撀犱簨聽浜猴細") >= 0 || ssss.IndexOf("褰撀犅犱簨聽聽浜猴細") >= 0 || ssss.IndexOf("褰� 浜� 浜猴細") >= 0 || ssss.IndexOf("鍚嶇О锛�") >= 0 || ssss.IndexOf("鐩稿叧渚涘簲鍟嗭細") >= 0 || ssss.IndexOf("褰撲簨浜猴紙鍗曚綅锛夛細") >= 0 || ssss.IndexOf("琚缃氳�咃細") >= 0) + { + //if (string.IsNullOrEmpty(aDPenalty.Parties)) + //{ + aDPenalty.Parties = ssss.Replace("褰撲簨浜猴細", "").Replace("褰撲簨浜�:", "").Replace("褰撀犱簨聽浜猴細", "").Replace("褰撀犅犱簨聽聽浜猴細", "").Replace("褰� 浜� 浜猴細", "").Replace("鍚嶇О锛�", "").Replace("鐩稿叧渚涘簲鍟嗭細", "").Replace("褰撲簨浜猴紙鍗曚綅锛夛細", "").Replace("琚缃氳�咃細", "").Trim(); + if (aDPenalty.Parties.Length > 255) + { + aDPenalty.Parties = aDPenalty.Parties.Substring(0, 255); + } + //} + } + + if (ssss.IndexOf("褰撲簨浜�1锛�") >= 0 || ssss.IndexOf("褰撲簨浜�2锛�") >= 0 || ssss.IndexOf("褰撲簨浜�3锛�") >= 0 || ssss.IndexOf("褰撲簨浜�4锛�") >= 0) + { + + aDPenalty.Parties += ssss.Replace("褰撲簨浜�1锛�", "").Replace("褰撲簨浜�2锛�", "").Replace("褰撲簨浜�3锛�", "").Replace("褰撲簨浜�4锛�", "").Trim()+" "; + if (aDPenalty.Parties.Length > 255) + { + aDPenalty.Parties = aDPenalty.Parties.Substring(0, 255); + } + + } + + if (ssss.EndsWith("锛�") || ssss.IndexOf(":") >= 0) + { + if (string.IsNullOrEmpty(aDPenalty.Parties)) + { + aDPenalty.Parties = ssss.Replace("锛�", "").Replace(":", "").Trim(); + if (aDPenalty.Parties.Length > 255) + { + aDPenalty.Parties = aDPenalty.Parties.Substring(0, 255); + } + } + } + + + if (jibenqingkuang) + { + if (string.IsNullOrEmpty(aDPenalty.CaseReason)) + { + aDPenalty.CaseReason = ssss.Trim(); + } + jibenqingkuang = false; + } + + if (ssss.IndexOf("浜屻�� 鍩烘湰鎯呭喌") >= 0 || ssss.IndexOf("浜屻�佸熀鏈儏鍐�") >= 0 || ssss.IndexOf("涓�銆� 鍩烘湰鎯呭喌") >= 0 || ssss.IndexOf("涓�銆佸熀鏈儏鍐�") >= 0) + { + jibenqingkuang = true; + } + + + + if (chulijieguo) + { + if (string.IsNullOrEmpty(aDPenalty.DisposalDecision)) + { + aDPenalty.DisposalDecision = ssss.Trim(); + } + chulijieguo = false; + } + + if (ssss.IndexOf("涓夈�� 澶勭綒缁撴灉") >= 0 || ssss.IndexOf("涓夈�佸缃氱粨鏋�") >= 0 || ssss.IndexOf("浜屻�� 澶勭綒缁撴灉") >= 0 || ssss.IndexOf("浜屻�佸缃氱粨鏋�") >= 0) + { + chulijieguo = true; + } + + + + + + + + + + } + + + if (string.IsNullOrEmpty(aDPenalty.DisposalDecision)) + { + var bbbb = ""; + for (int i = 0; i < contentList.Count; i++) + { + var sssssss = contentList[i].TextContent; + if (i == 0 || sssssss != contentList[i - 1].TextContent) + { + bbbb += sssssss; + } + } + + + aDPenalty.DisposalDecision = bbbb; + } + + + _ccontext.ADPenaltys.Add(aDPenalty); + + + + _ccontext.SaveChanges(); + } + + + + + + } + } + + + if (currPage * pageSize >= sichuan.data.total) + { + break; + } + else + { + currPage += 1; + } + //Thread.CurrentThread.Join(1000 * 10);//闃绘璁惧畾鏃堕棿 + + } + + + logg.WriteLog("鍥涘窛鐪佸缃� 鑾峰彇瀹屾垚", "鍥涘窛鐪佸鐞嗗缃�"); + + //淇濆瓨鏈�鍚庢洿鏂版椂闂� + if (updatetime != null) + { + if (updatetime.Updatetime1.AddMonths(1).Date >= DateTime.Now.Date) + { + updatetime.Updatetime1 = DateTime.Now.AddDays(-1); + } + else + { + updatetime.Updatetime1 = updatetime.Updatetime1.AddMonths(1).AddDays(-1); + } + _ccontext.SaveChanges(); + } + else + { + updatetime = new Updatetime(); + updatetime.Id = Guid.NewGuid().ToString(); + updatetime.Sheng = "鍥涘窛鐪佸鐞嗗缃�"; + updatetime.Updatetime1 = DateTime.Now.AddDays(-1); + _ccontext.Updatetimes.Add(updatetime); + _ccontext.SaveChanges(); + } + } + catch (Exception ex) + { + logg.WriteLog(ex.Message, "鍥涘窛鐪佸鐞嗗缃�"); + + logg.WriteLog(ex.StackTrace, "鍥涘窛鐪佸鐞嗗缃�"); + + logg.WriteLog(ex.ToString(), "鍥涘窛鐪佸鐞嗗缃�"); + } + finally + { + + } } } } diff --git a/zhengcaioa/Model/WebCrawler/ADPenalty.cs b/zhengcaioa/Model/WebCrawler/ADPenalty.cs new file mode 100644 index 0000000..89dd366 --- /dev/null +++ b/zhengcaioa/Model/WebCrawler/ADPenalty.cs @@ -0,0 +1,24 @@ +锘縰sing System; +using System.Collections.Generic; + +#nullable disable + +namespace zhengcaioa.Models +{ + public partial class ADPenalty + { + public Guid Id { get; set; } + public DateTime DecisionDate { get; set; } + public string Parties { get; set; } + public string CaseReason { get; set; } + public string DisposalDecision { get; set; } + public string SupervisionDepartment { get; set; } + public string Url { get; set; } + public DateTime? CreateTime { get; set; } + public DateTime? UpdateTime { get; set; } + public long? CreateUserId { get; set; } + public string CreateUserName { get; set; } + public long? UpdateUserId { get; set; } + public string UpdateUserName { get; set; } + } +} diff --git a/zhengcaioa/Model/WebCrawler/WebCrawlerContext.cs b/zhengcaioa/Model/WebCrawler/WebCrawlerContext.cs index 77cde71..190093b 100644 --- a/zhengcaioa/Model/WebCrawler/WebCrawlerContext.cs +++ b/zhengcaioa/Model/WebCrawler/WebCrawlerContext.cs @@ -24,6 +24,8 @@ public virtual DbSet<ProcurementComplaint> ProcurementComplaints { get; set; } public virtual DbSet<ProcurementComplaintItem> ProcurementComplaintItems { get; set; } + public virtual DbSet<ADPenalty> ADPenaltys { get; set; } + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { if (!optionsBuilder.IsConfigured) @@ -261,6 +263,49 @@ }); + + + modelBuilder.Entity<ADPenalty>(entity => + { + entity.ToTable("FBD_ADPenalty"); + + entity.Property(e => e.Id); + + entity.Property(e => e.DecisionDate) + .HasColumnType("datetime"); + + entity.Property(e => e.Parties) + .HasMaxLength(255); + + entity.Property(e => e.CaseReason); + + entity.Property(e => e.CaseReason); + + entity.Property(e => e.SupervisionDepartment) + .HasMaxLength(255); + + entity.Property(e => e.Url) + .HasMaxLength(255); + + entity.Property(e => e.CreateTime) + .HasColumnType("datetime"); + + entity.Property(e => e.UpdateTime) + .HasColumnType("datetime"); + + entity.Property(e => e.CreateUserId) + .HasColumnType("bigint"); + + entity.Property(e => e.UpdateUserId) + .HasColumnType("bigint"); + + entity.Property(e => e.CreateUserName) + .HasMaxLength(64); + + entity.Property(e => e.UpdateUserName) + .HasMaxLength(64); + }); + OnModelCreatingPartial(modelBuilder); } -- Gitblit v1.9.1