From d4431c7e89865a506af8662244004d0baa7ed609 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期三, 11 六月 2025 12:24:15 +0800
Subject: [PATCH] 投诉处理,爬

---
 zhengcaioa/Model/WebCrawler/WebCrawlerContext.cs        |   74 ++++++
 zhengcaioa/Crawler/sichuan/sichuantousuoperation.cs     |  427 +++++++++++++++++++++++++++++++++++
 zhengcaioa/Model/WebCrawler/ProcurementComplaintItem.cs |   20 +
 zhengcaioa/Crawler/sichuan/sichuantousujieshou.cs       |   65 +++++
 zhengcaioa/Crawler/Program.cs                           |   92 ++++---
 zhengcaioa/Model/WebCrawler/ProcurementComplaint.cs     |   26 ++
 6 files changed, 668 insertions(+), 36 deletions(-)

diff --git a/zhengcaioa/Crawler/Program.cs b/zhengcaioa/Crawler/Program.cs
index 8a34395..e7394ab 100644
--- a/zhengcaioa/Crawler/Program.cs
+++ b/zhengcaioa/Crawler/Program.cs
@@ -20,10 +20,12 @@
 
         //public static string connection = @"server=.;database=WebCrawler;uid=sa;pwd=123456;";
         //public static string connection1 = @"server=.;database=zhengcaioa;uid=sa;pwd=123456;";
+        //public static string connection2 = @"server=.;database=FZCZTB;uid=sa;pwd=123456;";
         //public static string api_domain = "http://192.168.0.9:9200";
 
         public static string connection = @"server=172.26.97.184;database=WebCrawler;uid=sa;pwd=Za20222812;";
         public static string connection1 = @"server=172.26.97.184;database=zhengcaioa;uid=sa;pwd=Za20222812;";
+        public static string connection2 = @"server=172.26.97.184;database=FZCZTB;uid=sa;pwd=Za20222812;";
         public static string api_domain = "http://172.26.97.184:9200";
         static void Main(string[] args)
         {
@@ -140,7 +142,7 @@
 
             Program obj = new Program();
             //鏂规硶涓�锛氳皟鐢ㄧ嚎绋嬫墽琛屾柟娉曪紝鍦ㄦ柟娉曚腑瀹炵幇姝诲惊鐜紝姣忎釜寰幆Sleep璁惧畾鏃堕棿
-            Thread thread = new Thread(new ThreadStart(obj.Method1));
+            Thread thread = new Thread(new ThreadStart(obj.Method));
             thread.Start();
 
 
@@ -154,58 +156,76 @@
             Console.WriteLine("Hello World!");
         }
 
-        void Method1()
+        void Method()
         {
             while (true)
             {
-                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
+                //ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                 var dbContextOptionBuilder = new DbContextOptionsBuilder<WebCrawlerContext>();
-                var cccontext = new WebCrawlerContext(dbContextOptionBuilder.UseSqlServer(connection).Options);
+                var cccontext = new WebCrawlerContext(dbContextOptionBuilder.UseSqlServer(connection2).Options);
 
-                var dbContextOptionBuilder1 = new DbContextOptionsBuilder<zhengcaioaContext>();
-                var cccontext1 = new zhengcaioaContext(dbContextOptionBuilder1.UseSqlServer(connection1).Options);
+                //var dbContextOptionBuilder1 = new DbContextOptionsBuilder<zhengcaioaContext>();
+                //var cccontext1 = new zhengcaioaContext(dbContextOptionBuilder1.UseSqlServer(connection1).Options);
 
-                //鑾峰彇鍥涘窛鐨勬斂閲囨暟鎹�
-                sichuanoperation.operations(cccontext, cccontext1);
+                //鑾峰彇鍥涘窛鐨勬姇璇夊鐞嗘暟鎹�
+                sichuantousuoperation.operations(cccontext);
                 //Console.WriteLine("杩欎釜鏆傚仠");
                 Thread.CurrentThread.Join(1000 * 60 * 60 * 2);//闃绘璁惧畾鏃堕棿
             }
         }
 
-        void Method2()
-        {
-            while (true)
-            {
-                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
-                var dbContextOptionBuilder = new DbContextOptionsBuilder<WebCrawlerContext>();
-                var cccontext = new WebCrawlerContext(dbContextOptionBuilder.UseSqlServer(connection).Options);
+        //void Method1()
+        //{
+        //    while (true)
+        //    {
+        //        ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
+        //        var dbContextOptionBuilder = new DbContextOptionsBuilder<WebCrawlerContext>();
+        //        var cccontext = new WebCrawlerContext(dbContextOptionBuilder.UseSqlServer(connection).Options);
 
-                var dbContextOptionBuilder1 = new DbContextOptionsBuilder<zhengcaioaContext>();
-                var cccontext1 = new zhengcaioaContext(dbContextOptionBuilder1.UseSqlServer(connection1).Options);
+        //        var dbContextOptionBuilder1 = new DbContextOptionsBuilder<zhengcaioaContext>();
+        //        var cccontext1 = new zhengcaioaContext(dbContextOptionBuilder1.UseSqlServer(connection1).Options);
 
-                //鑾峰彇鍥涘窛鐨勬斂閲囨暟鎹�
-                OldSichuanoperation.operations(cccontext, cccontext1);
-                Thread.CurrentThread.Join(1000 * 60 * 60 * 2);//闃绘璁惧畾鏃堕棿
-            }
-        }
+        //        //鑾峰彇鍥涘窛鐨勬斂閲囨暟鎹�
+        //        sichuanoperation.operations(cccontext, cccontext1);
+        //        //Console.WriteLine("杩欎釜鏆傚仠");
+        //        Thread.CurrentThread.Join(1000 * 60 * 60 * 2);//闃绘璁惧畾鏃堕棿
+        //    }
+        //}
+
+        //void Method2()
+        //{
+        //    while (true)
+        //    {
+        //        ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
+        //        var dbContextOptionBuilder = new DbContextOptionsBuilder<WebCrawlerContext>();
+        //        var cccontext = new WebCrawlerContext(dbContextOptionBuilder.UseSqlServer(connection).Options);
+
+        //        var dbContextOptionBuilder1 = new DbContextOptionsBuilder<zhengcaioaContext>();
+        //        var cccontext1 = new zhengcaioaContext(dbContextOptionBuilder1.UseSqlServer(connection1).Options);
+
+        //        //鑾峰彇鍥涘窛鐨勬斂閲囨暟鎹�
+        //        OldSichuanoperation.operations(cccontext, cccontext1);
+        //        Thread.CurrentThread.Join(1000 * 60 * 60 * 2);//闃绘璁惧畾鏃堕棿
+        //    }
+        //}
 
 
-        void Method3()
-        {
-            while (true)
-            {
-                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
-                var dbContextOptionBuilder = new DbContextOptionsBuilder<WebCrawlerContext>();
-                var cccontext = new WebCrawlerContext(dbContextOptionBuilder.UseSqlServer(connection).Options);
+        //void Method3()
+        //{
+        //    while (true)
+        //    {
+        //        ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
+        //        var dbContextOptionBuilder = new DbContextOptionsBuilder<WebCrawlerContext>();
+        //        var cccontext = new WebCrawlerContext(dbContextOptionBuilder.UseSqlServer(connection).Options);
 
-                //var dbContextOptionBuilder1 = new DbContextOptionsBuilder<zhengcaioaContext>();
-                //var cccontext1 = new zhengcaioaContext(dbContextOptionBuilder1.UseSqlServer(connection1).Options);
+        //        //var dbContextOptionBuilder1 = new DbContextOptionsBuilder<zhengcaioaContext>();
+        //        //var cccontext1 = new zhengcaioaContext(dbContextOptionBuilder1.UseSqlServer(connection1).Options);
 
-                //鑾峰彇涓浗鏀块噰缃戠殑鍥涘窛鏀块噰鏁版嵁
-                CcgpSichuanoperation.operations(cccontext);
-                Thread.CurrentThread.Join(1000 * 60 * 10);//闃绘璁惧畾鏃堕棿
-            }
-        }
+        //        //鑾峰彇涓浗鏀块噰缃戠殑鍥涘窛鏀块噰鏁版嵁
+        //        CcgpSichuanoperation.operations(cccontext);
+        //        Thread.CurrentThread.Join(1000 * 60 * 10);//闃绘璁惧畾鏃堕棿
+        //    }
+        //}
 
 
 
diff --git a/zhengcaioa/Crawler/sichuan/sichuantousujieshou.cs b/zhengcaioa/Crawler/sichuan/sichuantousujieshou.cs
new file mode 100644
index 0000000..f81459f
--- /dev/null
+++ b/zhengcaioa/Crawler/sichuan/sichuantousujieshou.cs
@@ -0,0 +1,65 @@
+锘縰sing DTO.WebCrawler;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Crawler
+{
+   public class sichuantousujieshou
+    {
+        public string msg { get; set; }
+        public int total { get; set; }
+        public string code { get; set; }
+
+        public Data data;
+    }
+
+    public class Data
+    {
+        public List<sichuantousujieshoudtl> rows;
+        public int total { get; set; }
+    }
+
+
+    public class sichuantousujieshoumingxi
+    {
+        public string msg { get; set; }
+        public int total { get; set; }
+        public string code { get; set; }
+
+        public sichuantousujieshoudtl data;
+    }
+
+    public class sichuantousujieshoudtl
+    {
+        public string id { get; set; }
+        public DateTime noticeTime { get; set; }
+
+        public string regionCode { get; set; }
+
+        public string regionName { get; set; }
+
+        public string complainant { get; set; }
+
+        public string openTenderCode { get; set; }
+
+        public string author { get; set; }
+        
+
+        public string purchaseManner { get; set; }
+
+        public string title { get; set; }
+        public string shorttitle { get; set; }
+        public string pageurl { get; set; }
+
+        public string content { get; set; }
+
+        public string description { get; set; }
+        
+        public string purchaser { get; set; }
+        public string budget { get; set; }
+        public string agency { get; set; }
+        public string agencyCode { get; set; }
+        public DateTime? openTenderTime { get; set; }
+    }
+}
diff --git a/zhengcaioa/Crawler/sichuan/sichuantousuoperation.cs b/zhengcaioa/Crawler/sichuan/sichuantousuoperation.cs
new file mode 100644
index 0000000..5ca6cd1
--- /dev/null
+++ b/zhengcaioa/Crawler/sichuan/sichuantousuoperation.cs
@@ -0,0 +1,427 @@
+锘縰sing AngleSharp.Html.Parser;
+using DTO;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Text;
+using System.Threading;
+using zhengcaioa.Models;
+
+namespace Crawler.sichuan
+{
+   public class sichuantousuoperation
+    {
+        public static string sichuanpageurll = "https://zfcg.scsczt.cn";
+        public static void operations(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=&region=&siteId=94c965cc-c55d-4f92-8469-d5875c68bd04&channel=0df9d47e-c210-4176-bce9-ead9845bf311&currPage=" + currPage + "&pageSize=" + pageSize + "&noticeType=&regionCode=&cityOrArea=&purchaseManner=&openTenderCode=&purchaser=&agency=&purchaseNature=&operationStartTime=" + operationStartTime + "+00:00:00&operationEndTime=" + operationEndTime + "+00:00:00&_t="+ timestamp;//1748999478170
+                    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 procurementComplaint = _ccontext.ProcurementComplaints.Find(Id);
+                            if (procurementComplaint != 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;
+                            procurementComplaint = new ProcurementComplaint();
+                            procurementComplaint.Id = Id;
+                            procurementComplaint.ProjectCode = sichuanjieshoudtl.openTenderCode ?? "";
+                            if (procurementComplaint.ProjectCode.Length > 50)
+                            {
+                                procurementComplaint.ProjectCode = procurementComplaint.ProjectCode.Substring(0, 50);
+                            }
+                            procurementComplaint.ProjectName = "";
+                            procurementComplaint.DecisionDate = sichuanjieshoudtl.noticeTime;
+                            procurementComplaint.Purchaser = "";
+                            procurementComplaint.ProcurementAgency = "";
+                            procurementComplaint.Complainant = sichuanjieshoudtl.complainant ?? "";
+                            if (procurementComplaint.Complainant.Length > 100)
+                            {
+                                procurementComplaint.Complainant = procurementComplaint.Complainant.Substring(0, 100);
+                            }
+                            procurementComplaint.ProcurementSupervisionDepartment = sichuanjieshoudtl.author ?? "";
+                            if (procurementComplaint.ProcurementSupervisionDepartment.Length > 100)
+                            {
+                                procurementComplaint.ProcurementSupervisionDepartment = procurementComplaint.ProcurementSupervisionDepartment.Substring(0, 100);
+                            }
+                            procurementComplaint.CreateTime = DateTime.Now;
+                            procurementComplaint.UpdateTime = procurementComplaint.CreateTime;
+                            procurementComplaint.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();
+
+                                var ItemDescriptions = new List<string>();
+                                var HandlingResults = new List<string>();
+                                var HandlingStatuses = new List<int>();
+
+                                foreach (var content in contentList)
+                                {
+                                    var ssss = content.TextContent.Replace(" ","");
+
+                                    if(ssss.IndexOf("涓�銆侀」鐩紪鍙凤細")>=0|| ssss.IndexOf("涓�銆侀」鐩紪鍙�:") >= 0)
+                                    {
+                                        if (string.IsNullOrEmpty(procurementComplaint.ProjectCode))
+                                        {
+                                            procurementComplaint.ProjectCode = ssss.Replace("涓�銆侀」鐩紪鍙凤細","").Replace("涓�銆侀」鐩紪鍙�:", "").Trim();
+                                            if (procurementComplaint.ProjectCode.Length > 50)
+                                            {
+                                                procurementComplaint.ProjectCode = procurementComplaint.ProjectCode.Substring(0, 50);
+                                            }
+                                        }
+                                    }
+
+                                    if (ssss.IndexOf("浜屻�侀」鐩悕绉帮細") >= 0 || ssss.IndexOf("浜屻�侀」鐩悕绉�:") >= 0)
+                                    {
+                                        if (string.IsNullOrEmpty(procurementComplaint.ProjectName))
+                                        {
+                                            procurementComplaint.ProjectName = ssss.Replace("浜屻�侀」鐩悕绉帮細", "").Replace("浜屻�侀」鐩悕绉�:", "").Trim();
+                                            if (procurementComplaint.ProjectName.Length > 200)
+                                            {
+                                                procurementComplaint.ProjectName = procurementComplaint.ProjectName.Substring(0, 200);
+                                            }
+                                        }
+                                    }
+
+
+                                    if ((ssss.IndexOf("鎶曡瘔浜猴細") >= 0 || ssss.IndexOf("鎶曡瘔浜�:") >= 0) && ssss.IndexOf("琚姇璇変汉锛�") < 0 && ssss.IndexOf("琚姇璇変汉锛�") < 0)
+                                    {
+                                        if (string.IsNullOrEmpty(procurementComplaint.Complainant))
+                                        {
+                                            procurementComplaint.Complainant = ssss.Replace("鎶曡瘔浜猴細", "").Replace("鎶曡瘔浜�:", "").Trim();
+                                            if (procurementComplaint.Complainant.Length > 100)
+                                            {
+                                                procurementComplaint.Complainant = procurementComplaint.Complainant.Substring(0, 100);
+                                            }
+                                        }
+                                    }
+
+                                    if ((ssss.IndexOf("鎶曡瘔浜�1锛�") >= 0 || ssss.IndexOf("鎶曡瘔浜�1:") >= 0) && ssss.IndexOf("琚姇璇変汉1锛�") < 0 && ssss.IndexOf("琚姇璇変汉1锛�") < 0)
+                                    {
+                                        if (string.IsNullOrEmpty(procurementComplaint.Complainant))
+                                        {
+                                            procurementComplaint.Complainant = ssss.Replace("鎶曡瘔浜�1锛�", "").Replace("鎶曡瘔浜�1:", "").Trim();
+                                            if (procurementComplaint.Complainant.Length > 100)
+                                            {
+                                                procurementComplaint.Complainant = procurementComplaint.Complainant.Substring(0, 100);
+                                            }
+                                        }
+                                    }
+
+                                    if (ssss.IndexOf("琚姇璇変汉锛�") >= 0 || ssss.IndexOf("琚姇璇変汉锛�") >= 0)
+                                    {
+                                        if (string.IsNullOrEmpty(procurementComplaint.ProcurementAgency))
+                                        {
+                                            procurementComplaint.ProcurementAgency = ssss.Replace("琚姇璇変汉锛�", "").Replace("琚姇璇変汉:", "").Trim();
+                                            if (procurementComplaint.ProcurementAgency.Length > 100)
+                                            {
+                                                procurementComplaint.ProcurementAgency = procurementComplaint.ProcurementAgency.Substring(0, 100);
+                                            }
+                                        }
+
+                                        if (string.IsNullOrEmpty(procurementComplaint.Purchaser))
+                                        {
+                                            procurementComplaint.Purchaser = ssss.Replace("琚姇璇変汉锛�", "").Replace("琚姇璇変汉:", "").Trim();
+                                            if (procurementComplaint.Purchaser.Length > 100)
+                                            {
+                                                procurementComplaint.Purchaser = procurementComplaint.Purchaser.Substring(0, 100);
+                                            }
+                                        }
+                                    }
+
+
+
+                                    if (ssss.IndexOf("琚姇璇変汉1锛�") >= 0 || ssss.IndexOf("琚姇璇変汉1锛�") >= 0)
+                                    {
+                                        if (string.IsNullOrEmpty(procurementComplaint.Purchaser))
+                                        {
+                                            procurementComplaint.Purchaser = ssss.Replace("琚姇璇変汉1锛�", "").Replace("琚姇璇変汉1:", "").Trim();
+                                            if (procurementComplaint.Purchaser.Length > 100)
+                                            {
+                                                procurementComplaint.Purchaser = procurementComplaint.Purchaser.Substring(0, 100);
+                                            }
+                                        }
+                                    }
+
+
+
+                                    if (ssss.IndexOf("琚姇璇変汉2锛�") >= 0 || ssss.IndexOf("琚姇璇変汉2锛�") >= 0)
+                                    {
+                                        if (string.IsNullOrEmpty(procurementComplaint.ProcurementAgency))
+                                        {
+                                            procurementComplaint.ProcurementAgency = ssss.Replace("琚姇璇変汉2锛�", "").Replace("琚姇璇変汉2:", "").Trim();
+                                            if (procurementComplaint.ProcurementAgency.Length > 100)
+                                            {
+                                                procurementComplaint.ProcurementAgency = procurementComplaint.ProcurementAgency.Substring(0, 100);
+                                            }
+                                        } 
+                                    }
+
+
+
+                                    if (ssss.IndexOf("鎶曡瘔浜嬮」锛�") >= 0)
+                                    {
+                                        var aaaa = ssss.Replace("鎶曡瘔浜嬮」锛�", "").Trim();
+                                        if (ItemDescriptions.Count <= 0)
+                                        {
+                                            if (aaaa.Length > 1000)
+                                            {
+                                                aaaa = aaaa.Substring(0, 1000);
+                                            }
+                                            ItemDescriptions.Add(aaaa);
+                                        }
+                                        else
+                                        {
+                                            if (aaaa.Length > 1000)
+                                            {
+                                                aaaa = aaaa.Substring(0, 1000);
+                                            }
+                                            HandlingResults.Add(aaaa);
+                                            if (aaaa.IndexOf("椹冲洖鎶曡瘔")>=0)
+                                            {
+                                                HandlingStatuses.Add(2);
+                                            }
+                                            else if (aaaa.IndexOf("鎶曡瘔鎴愮珛") >= 0)
+                                            {
+                                                HandlingStatuses.Add(1);
+
+                                            }
+                                            else if (aaaa.IndexOf("閮ㄥ垎鎴愮珛") >= 0)
+                                            {
+                                                HandlingStatuses.Add(3);
+                                            }
+                                            else
+                                            {
+                                                HandlingStatuses.Add(0);
+                                            }
+                                            
+                                        }
+                                    }
+
+
+
+                                    for (int i = 1; i <= 10; i++)
+                                    {
+                                        if (ssss.IndexOf("鎶曡瘔浜嬮」" + i + "锛�") >= 0)
+                                        {
+                                            var aaaa = ssss.Replace("鎶曡瘔浜嬮」" + i + "锛�", "").Trim();
+                                            if (ItemDescriptions.Count < i)
+                                            {
+                                                if (aaaa.Length > 1000)
+                                                {
+                                                    aaaa = aaaa.Substring(0, 1000);
+                                                }
+                                                ItemDescriptions.Add(aaaa);
+                                            }
+                                            else
+                                            {
+                                                if (aaaa.Length > 1000)
+                                                {
+                                                    aaaa = aaaa.Substring(0, 1000);
+                                                }
+                                                HandlingResults.Add(aaaa);
+                                                if (aaaa.IndexOf("椹冲洖鎶曡瘔") >= 0)
+                                                {
+                                                    HandlingStatuses.Add(2);
+                                                }
+                                                else if (aaaa.IndexOf("鎶曡瘔鎴愮珛") >= 0)
+                                                {
+                                                    HandlingStatuses.Add(1);
+
+                                                }
+                                                else if (aaaa.IndexOf("閮ㄥ垎鎴愮珛") >= 0)
+                                                {
+                                                    HandlingStatuses.Add(3);
+                                                }
+                                                else
+                                                {
+                                                    HandlingStatuses.Add(0);
+                                                }
+                                            }
+                                        }
+                                    }
+
+
+                                }
+
+                                if (ItemDescriptions.Count == 0)
+                                {
+                                    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;
+                                        }
+                                    }
+
+                                   // var bbbb = sichuanjieshou.data.description;
+                                    if (bbbb.Length > 1000)
+                                    {
+                                        bbbb = bbbb.Substring(0, 1000);
+                                    }
+                                    ItemDescriptions.Add(bbbb);
+                                }
+                                if (HandlingResults.Count == 0)
+                                {
+                                    HandlingResults.Add("");
+                                    HandlingStatuses.Add(0);
+                                }
+
+
+                                _ccontext.ProcurementComplaints.Add(procurementComplaint);
+
+
+
+                                if (ItemDescriptions.Count > 0)
+                                {
+                                    for (int i = 0; i < ItemDescriptions.Count; i++)
+                                    {
+                                        var procurementComplaintItems = new ProcurementComplaintItem();
+                                        procurementComplaintItems.Id = Guid.NewGuid();
+                                        procurementComplaintItems.ComplaintId = procurementComplaint.Id;
+                                        procurementComplaintItems.ItemDescription = ItemDescriptions[i];
+                                        if (HandlingResults.Count == ItemDescriptions.Count)
+                                        {
+                                            procurementComplaintItems.HandlingResult = HandlingResults[i];
+                                            procurementComplaintItems.HandlingStatus = HandlingStatuses[i];
+                                        }
+                                        else
+                                        {
+                                            procurementComplaintItems.HandlingResult = HandlingResults[0];
+                                            procurementComplaintItems.HandlingStatus = HandlingStatuses[0];
+                                        }
+
+                                        procurementComplaintItems.Sort = (i + 1);
+                                        _ccontext.ProcurementComplaintItems.Add(procurementComplaintItems);
+                                    }
+                                }
+                                _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/ProcurementComplaint.cs b/zhengcaioa/Model/WebCrawler/ProcurementComplaint.cs
new file mode 100644
index 0000000..9ed0ec6
--- /dev/null
+++ b/zhengcaioa/Model/WebCrawler/ProcurementComplaint.cs
@@ -0,0 +1,26 @@
+锘縰sing System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace zhengcaioa.Models
+{
+    public partial class ProcurementComplaint
+    {
+        public Guid Id { get; set; }
+        public string ProjectCode { get; set; }
+        public string ProjectName { get; set; }
+        public DateTime DecisionDate { get; set; }
+        public string Purchaser { get; set; }
+        public string ProcurementAgency { get; set; }
+        public string Complainant { get; set; }
+        public string ProcurementSupervisionDepartment { 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/ProcurementComplaintItem.cs b/zhengcaioa/Model/WebCrawler/ProcurementComplaintItem.cs
new file mode 100644
index 0000000..1a2ec16
--- /dev/null
+++ b/zhengcaioa/Model/WebCrawler/ProcurementComplaintItem.cs
@@ -0,0 +1,20 @@
+锘縰sing System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace zhengcaioa.Models
+{
+    public partial class ProcurementComplaintItem
+    {
+        public Guid Id { get; set; }
+        public Guid ComplaintId { get; set; }
+        public string ItemDescription { get; set; }
+        //1鎴愮珛  2椹冲洖  3 閮ㄥ垎鎴愮珛 0 鍏朵粬
+        public int HandlingStatus { get; set; }
+        public string HandlingResult { get; set; }
+
+        public int? Sort { get; set; }
+        
+    }
+}
diff --git a/zhengcaioa/Model/WebCrawler/WebCrawlerContext.cs b/zhengcaioa/Model/WebCrawler/WebCrawlerContext.cs
index 51e75c2..77cde71 100644
--- a/zhengcaioa/Model/WebCrawler/WebCrawlerContext.cs
+++ b/zhengcaioa/Model/WebCrawler/WebCrawlerContext.cs
@@ -21,6 +21,8 @@
         public virtual DbSet<TProjectDictionary> TProjectDictionaries { get; set; }
         public virtual DbSet<Updatetime> Updatetimes { get; set; }
         public virtual DbSet<ZhengfuProject> ZhengfuProjects { get; set; }
+        public virtual DbSet<ProcurementComplaint> ProcurementComplaints { get; set; }
+        public virtual DbSet<ProcurementComplaintItem> ProcurementComplaintItems { get; set; }
 
         protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
         {
@@ -187,6 +189,78 @@
                     .HasComment("鍏憡鏍囬");
             });
 
+            modelBuilder.Entity<ProcurementComplaint>(entity =>
+            {
+                entity.ToTable("FB_ProcurementComplaints");
+
+                entity.Property(e => e.Id);
+
+                entity.Property(e => e.ProjectCode).HasMaxLength(50);
+
+                entity.Property(e => e.ProjectName)
+                    .HasMaxLength(200);
+
+                entity.Property(e => e.DecisionDate)
+                   .HasColumnType("datetime");
+
+                entity.Property(e => e.Purchaser)
+                   .HasMaxLength(100);
+
+                entity.Property(e => e.ProcurementAgency)
+                  .HasMaxLength(100);
+
+                entity.Property(e => e.Complainant)
+                  .HasMaxLength(100);
+
+                entity.Property(e => e.ProcurementSupervisionDepartment)
+                  .HasMaxLength(100);
+
+                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);
+            });
+
+            modelBuilder.Entity<ProcurementComplaintItem>(entity =>
+            {
+                entity.ToTable("FB_ProcurementComplaintItems");
+
+                entity.Property(e => e.Id);
+
+                entity.Property(e => e.ComplaintId);
+
+                entity.Property(e => e.ItemDescription)
+                    .HasMaxLength(1000);
+
+                entity.Property(e => e.HandlingStatus)
+                    .HasColumnType("int");
+
+                entity.Property(e => e.HandlingResult)
+                  .HasMaxLength(1000);
+
+                entity.Property(e => e.Sort)
+                    .HasColumnType("int")
+                    .HasColumnName("sort");
+
+
+            });
+
             OnModelCreatingPartial(modelBuilder);
         }
 

--
Gitblit v1.9.1