From 90858c80d9921b555119f41060c1f883f6e6ffc5 Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期四, 26 十二月 2024 12:49:35 +0800 Subject: [PATCH] 提交 --- DocumentServiceAPI.Application/ProjectInfo/Services/ProjectInfoService.cs | 454 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 439 insertions(+), 15 deletions(-) diff --git a/DocumentServiceAPI.Application/ProjectInfo/Services/ProjectInfoService.cs b/DocumentServiceAPI.Application/ProjectInfo/Services/ProjectInfoService.cs index f1ddd59..b54d682 100644 --- a/DocumentServiceAPI.Application/ProjectInfo/Services/ProjectInfoService.cs +++ b/DocumentServiceAPI.Application/ProjectInfo/Services/ProjectInfoService.cs @@ -1,5 +1,6 @@ 锘縰sing AngleSharp.Dom; using AngleSharp.Html.Parser; +using DocumentServiceAPI.Application.DocManage.Dtos; using DocumentServiceAPI.Application.ProjectInfo.Services.Interfaces; using DocumentServiceAPI.Application.ProjectInfo.ViewMode; using DocumentServiceAPI.Application.Repository; @@ -117,7 +118,7 @@ document_ProjectInfo.ProjectUrl = dp.ProjectUrl; var parser = new HtmlParser(); var list11 = new List<AngleSharp.Dom.IElement>(); - if (url.StartsWith("http://www.ccgp.gov.cn")) + if (url.StartsWith("http://www.ccgp.gov.cn")|| url.StartsWith("https://www.ccgp.gov.cn")) { using (HttpClient client = new HttpClient()) { @@ -143,29 +144,49 @@ } } document_ProjectInfo.PurchaseMethod = 0; - if (document_ProjectInfo.ProjectName.IndexOf("鍏紑鎷涙爣")>=0) + if (document_ProjectInfo.ProjectName.IndexOf("鍏紑鎷涙爣") >= 0) { document_ProjectInfo.PurchaseMethod = 3; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("鍏紑鎷涙爣", "").Replace("鍏憡", ""); } else if (document_ProjectInfo.ProjectName.IndexOf("绔炰簤鎬ц皥鍒�") >= 0) { document_ProjectInfo.PurchaseMethod = 4; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("绔炰簤鎬ц皥鍒�", "").Replace("鍏憡", ""); } else if (document_ProjectInfo.ProjectName.IndexOf("鍗曚竴鏉ユ簮") >= 0) { document_ProjectInfo.PurchaseMethod = 5; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("鍗曚竴鏉ユ簮", "").Replace("鍏憡", ""); } else if (document_ProjectInfo.ProjectName.IndexOf("璇环") >= 0) { document_ProjectInfo.PurchaseMethod = 6; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("璇环", "").Replace("鍏憡", ""); } else if (document_ProjectInfo.ProjectName.IndexOf("閭�璇�") >= 0) { document_ProjectInfo.PurchaseMethod = 31; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("閭�璇锋嫑鏍�", "").Replace("鍏憡", ""); + } + else if (document_ProjectInfo.ProjectName.IndexOf("绔炰簤鎬х鍟�") >= 0) + { + document_ProjectInfo.PurchaseMethod = 37; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("绔炰簤鎬х鍟�", "").Replace("鍏憡", ""); + } + else if (document_ProjectInfo.ProjectName.IndexOf("妗嗘灦鍗忚") >= 0) + { + document_ProjectInfo.PurchaseMethod = 38; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("妗嗘灦鍗忚", "").Replace("鍏憡", ""); + } + else if (document_ProjectInfo.ProjectName.IndexOf("姣旈��") >= 0) + { + document_ProjectInfo.PurchaseMethod = 39; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("姣旈��", "").Replace("鍏憡", ""); } - + var vF_detail_content = document.All.Where(m => m.ClassName == "vF_detail_content").FirstOrDefault(); var td = vF_detail_content.QuerySelectorAll("p"); @@ -337,9 +358,35 @@ if (DateTime.TryParse(TenderTimes, out b)) { document_ProjectInfo.TenderTime = b; - document_ProjectInfo.SignupStartTime = b; - document_ProjectInfo.SignupEndTime = b; + } + + + var jiezhishijian = document.All.Where(m => m.HasAttribute("id") && + m.GetAttribute("id").StartsWith("_notice_content_noticePurchaseTime-noticePurchaseTime")).FirstOrDefault(); + + var jiezhishijians = jiezhishijian.QuerySelectorAll("span"); + if (jiezhishijians != null && jiezhishijians.Length > 0) + { + //for (int i = 0; i < jiezhishijians.Length; i++) + //{ + // if (jiezhishijians[i].TextContent.IndexOf("骞�") >= 0 && jiezhishijians[i].TextContent.IndexOf("銆�") < 0) + // { + + // } + //} + if (DateTime.TryParse(jiezhishijians[0].TextContent.Trim(), out b)) + { + document_ProjectInfo.SignupStartTime = b; + + } + + if (DateTime.TryParse(jiezhishijians[1].TextContent.Trim(), out b)) + { + document_ProjectInfo.SignupEndTime = b; + } + } + @@ -347,25 +394,43 @@ if (document_ProjectInfo.ProjectName.IndexOf("鍏紑鎷涙爣") >= 0) { document_ProjectInfo.PurchaseMethod = 3; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("鍏紑鎷涙爣", "").Replace("鍏憡",""); } else if (document_ProjectInfo.ProjectName.IndexOf("绔炰簤鎬ц皥鍒�") >= 0) { document_ProjectInfo.PurchaseMethod = 4; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("绔炰簤鎬ц皥鍒�", "").Replace("鍏憡", ""); } else if (document_ProjectInfo.ProjectName.IndexOf("鍗曚竴鏉ユ簮") >= 0) { document_ProjectInfo.PurchaseMethod = 5; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("鍗曚竴鏉ユ簮", "").Replace("鍏憡", ""); } else if (document_ProjectInfo.ProjectName.IndexOf("璇环") >= 0) { document_ProjectInfo.PurchaseMethod = 6; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("璇环", "").Replace("鍏憡", ""); } else if (document_ProjectInfo.ProjectName.IndexOf("閭�璇�") >= 0) { document_ProjectInfo.PurchaseMethod = 31; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("閭�璇锋嫑鏍�", "").Replace("鍏憡", ""); } - - + else if (document_ProjectInfo.ProjectName.IndexOf("绔炰簤鎬х鍟�") >= 0) + { + document_ProjectInfo.PurchaseMethod = 37; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("绔炰簤鎬х鍟�", "").Replace("鍏憡", ""); + } + else if (document_ProjectInfo.ProjectName.IndexOf("妗嗘灦鍗忚") >= 0) + { + document_ProjectInfo.PurchaseMethod = 38; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("妗嗘灦鍗忚", "").Replace("鍏憡", ""); + } + else if (document_ProjectInfo.ProjectName.IndexOf("姣旈��") >= 0) + { + document_ProjectInfo.PurchaseMethod = 39; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("姣旈��", "").Replace("鍏憡", ""); + } var vF_detail_content = document.All.Where(m => m.LocalName == "div" && @@ -388,9 +453,77 @@ } - + + if (td[i].TextContent.IndexOf("椤圭洰鍚嶇О锛�") >= 0 && td[i].TextContent.IndexOf("銆�") < 0) + { + if (string.IsNullOrEmpty(document_ProjectInfo.ProjectName)) + { + document_ProjectInfo.ProjectName = td[i].TextContent.Replace("椤圭洰鍚嶇О锛�", "").Replace("1锛�", "").Replace("/", "").Trim(); + } + + + + } + + if (td[i].TextContent.IndexOf("閲囪喘鏂瑰紡锛�") >= 0 && td[i].TextContent.IndexOf("銆�") < 0) + { + if (td[i].TextContent.IndexOf("鍏紑鎷涙爣") >= 0) + { + document_ProjectInfo.PurchaseMethod = 3; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("鍏紑鎷涙爣", "").Replace("鍏憡", ""); + } + else if (td[i].TextContent.IndexOf("绔炰簤鎬ц皥鍒�") >= 0) + { + document_ProjectInfo.PurchaseMethod = 4; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("绔炰簤鎬ц皥鍒�", "").Replace("鍏憡", ""); + } + else if (td[i].TextContent.IndexOf("鍗曚竴鏉ユ簮") >= 0) + { + document_ProjectInfo.PurchaseMethod = 5; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("鍗曚竴鏉ユ簮", "").Replace("鍏憡", ""); + } + else if (td[i].TextContent.IndexOf("璇环") >= 0) + { + document_ProjectInfo.PurchaseMethod = 6; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("璇环", "").Replace("鍏憡", ""); + } + else if (td[i].TextContent.IndexOf("閭�璇�") >= 0) + { + document_ProjectInfo.PurchaseMethod = 31; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("閭�璇锋嫑鏍�", "").Replace("鍏憡", ""); + } + else if (td[i].TextContent.IndexOf("绔炰簤鎬х鍟�") >= 0) + { + document_ProjectInfo.PurchaseMethod = 37; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("绔炰簤鎬х鍟�", "").Replace("鍏憡", ""); + } + else if (td[i].TextContent.IndexOf("妗嗘灦鍗忚") >= 0) + { + document_ProjectInfo.PurchaseMethod = 38; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("妗嗘灦鍗忚", "").Replace("鍏憡", ""); + } + else if (td[i].TextContent.IndexOf("姣旈��") >= 0) + { + document_ProjectInfo.PurchaseMethod = 39; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("姣旈��", "").Replace("鍏憡", ""); + } + + + + } + } } + + var txtAgencyManager = document.All.Where(m => m.LocalName == "span" && + m.HasAttribute("id") && + m.GetAttribute("id").StartsWith("_notice_content_projectContact-managerName")).FirstOrDefault(); + if (txtAgencyManager != null) + { + document_ProjectInfo.AgencyManager = txtAgencyManager.TextContent; + } + + var lianxiren = document.All.Where(m => m.LocalName == "div" && m.ClassName == "innercontent").ToList(); foreach (var element in lianxiren) { @@ -475,22 +608,42 @@ if (document_ProjectInfo.ProjectName.IndexOf("鍏紑鎷涙爣") >= 0) { document_ProjectInfo.PurchaseMethod = 3; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("鍏紑鎷涙爣", "").Replace("鍏憡", ""); } else if (document_ProjectInfo.ProjectName.IndexOf("绔炰簤鎬ц皥鍒�") >= 0) { document_ProjectInfo.PurchaseMethod = 4; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("绔炰簤鎬ц皥鍒�", "").Replace("鍏憡", ""); } else if (document_ProjectInfo.ProjectName.IndexOf("鍗曚竴鏉ユ簮") >= 0) { document_ProjectInfo.PurchaseMethod = 5; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("鍗曚竴鏉ユ簮", "").Replace("鍏憡", ""); } else if (document_ProjectInfo.ProjectName.IndexOf("璇环") >= 0) { document_ProjectInfo.PurchaseMethod = 6; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("璇环", "").Replace("鍏憡", ""); } else if (document_ProjectInfo.ProjectName.IndexOf("閭�璇�") >= 0) { document_ProjectInfo.PurchaseMethod = 31; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("閭�璇锋嫑鏍�", "").Replace("鍏憡", ""); + } + else if (document_ProjectInfo.ProjectName.IndexOf("绔炰簤鎬х鍟�") >= 0) + { + document_ProjectInfo.PurchaseMethod = 37; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("绔炰簤鎬х鍟�", "").Replace("鍏憡", ""); + } + else if (document_ProjectInfo.ProjectName.IndexOf("妗嗘灦鍗忚") >= 0) + { + document_ProjectInfo.PurchaseMethod = 38; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("妗嗘灦鍗忚", "").Replace("鍏憡", ""); + } + else if (document_ProjectInfo.ProjectName.IndexOf("姣旈��") >= 0) + { + document_ProjectInfo.PurchaseMethod = 39; + document_ProjectInfo.ProjectName = document_ProjectInfo.ProjectName.Replace("姣旈��", "").Replace("鍏憡", ""); } @@ -1282,16 +1435,16 @@ public List<Document_AptitudeInfo> GetAptitudeInfoByUnitId(int UnitId) { - var result = _db.Queryable<Doc_Info>().Where( x=>x.is_del == false && x.org_id == UnitId).ToList() ;//鎵ц鏌ヨ + var result = _db.Queryable<Doc_Info>().Where( x=>x.is_del == false && x.org_id == UnitId && x.zige_code > 0).OrderBy(x=>x.doc_code).OrderBy(x=>x.sort).ToList() ;//鎵ц鏌ヨ var ids = result.Select(x => x.id).ToArray(); - var file = _db.Queryable<File_Info>().Where(x => ids.Contains(x.doc_id)).ToList();//鎵ц鏌ヨ + var file = _db.Queryable<File_Info>().Where(x => ids.Contains(x.doc_id) && x.status ==1 ).ToList();//鎵ц鏌ヨ var document_AptitudeInfos = new List<Document_AptitudeInfo>(); foreach (var doc_Info in result) { var document_AptitudeInfo = new Document_AptitudeInfo(); - var filesss = file.Where(x => x.doc_id == doc_Info.id).ToList(); + var filesss = file.Where(x => x.doc_id == doc_Info.id).OrderBy(x => x.sort).ToList(); if(filesss!=null && filesss.Count > 0) { @@ -1322,8 +1475,174 @@ document_AptitudeInfo.UnitId = doc_Info.org_id.HasValue ? doc_Info.org_id.Value : 0; ; document_AptitudeInfo.LastUpdateTime = doc_Info.add_time; document_AptitudeInfo.LastUpdateName = ""; - document_AptitudeInfo.AdviseFlag = 1; + document_AptitudeInfo.AdviseFlag = doc_Info.zige_code; ; document_AptitudeInfo.UserId = doc_Info.tenant_code; + + document_AptitudeInfos.Add(document_AptitudeInfo); + } + + //var resultAchievement = _db.Queryable<Doc_Achievement>().Where(x => x.status == 1 && x.tenant_code == UnitId).OrderBy(x=>x.sort).ToList();//鎵ц鏌ヨ + + + //foreach (var achievement in resultAchievement) + //{ + // var document_AptitudeInfo = new Document_AptitudeInfo(); + // document_AptitudeInfo.FilePath = ""; + // document_AptitudeInfo.FileName = ""; + // document_AptitudeInfo.FileSize = 0; + // if (!string.IsNullOrEmpty(achievement.zbtzs_url)) + // { + // document_AptitudeInfo.FilePath += achievement.zbtzs_url; + // document_AptitudeInfo.FileName += "涓爣閫氱煡涔�"; + // document_AptitudeInfo.FileSize += 0 ; + // document_AptitudeInfo.FilePath += ";"; + // document_AptitudeInfo.FileName += ";"; + // } + // if (!string.IsNullOrEmpty(achievement.ht_url)) + // { + // document_AptitudeInfo.FilePath += achievement.ht_url; + // document_AptitudeInfo.FileName += "鍚堝悓"; + // document_AptitudeInfo.FileSize += 0; + // document_AptitudeInfo.FilePath += ";"; + // document_AptitudeInfo.FileName += ";"; + // } + // if (!string.IsNullOrEmpty(achievement.ysbg_url)) + // { + // document_AptitudeInfo.FilePath += achievement.ysbg_url; + // document_AptitudeInfo.FileName += "楠屾敹鎶ュ憡"; + // document_AptitudeInfo.FileSize += 0; + // document_AptitudeInfo.FilePath += ";"; + // document_AptitudeInfo.FileName += ";"; + // } + // if (!string.IsNullOrEmpty(achievement.fkpz_url)) + // { + // document_AptitudeInfo.FilePath += achievement.fkpz_url; + // document_AptitudeInfo.FileName += "浠樻鍑瘉"; + // document_AptitudeInfo.FileSize += 0; + // document_AptitudeInfo.FilePath += ";"; + // document_AptitudeInfo.FileName += ";"; + // } + // if (!string.IsNullOrEmpty(achievement.yhpj_url)) + // { + // document_AptitudeInfo.FilePath += achievement.yhpj_url; + // document_AptitudeInfo.FileName += "鐢ㄦ埛璇勪环"; + // document_AptitudeInfo.FileSize += 0; + // document_AptitudeInfo.FilePath += ";"; + // document_AptitudeInfo.FileName += ";"; + // } + // if (!string.IsNullOrEmpty(achievement.hjzs_url)) + // { + // document_AptitudeInfo.FilePath += achievement.hjzs_url; + // document_AptitudeInfo.FileName += "鑾峰璇佷功"; + // document_AptitudeInfo.FileSize += 0; + // document_AptitudeInfo.FilePath += ";"; + // document_AptitudeInfo.FileName += ";"; + // } + + // if (document_AptitudeInfo.FilePath.EndsWith(";")) + // { + // document_AptitudeInfo.FilePath = document_AptitudeInfo.FilePath.Substring(0, document_AptitudeInfo.FilePath.Length - 1); + // } + + // if (document_AptitudeInfo.FileName.EndsWith(";")) + // { + // document_AptitudeInfo.FileName = document_AptitudeInfo.FileName.Substring(0, document_AptitudeInfo.FileName.Length - 1); + // } + + + // document_AptitudeInfo.AptitudeId = achievement.id; + // document_AptitudeInfo.AptitudeName = achievement.achievement_name; + // document_AptitudeInfo.AptitudeType = achievement.classification_id; + // document_AptitudeInfo.IsUsed = achievement.status; + + + // document_AptitudeInfo.FileVersionNo = ""; + // document_AptitudeInfo.SendTime = achievement.add_time.ToShortDateString(); + // document_AptitudeInfo.UnitId = achievement.tenant_code ; + // document_AptitudeInfo.LastUpdateTime = achievement.add_time; + // document_AptitudeInfo.LastUpdateName = ""; + // document_AptitudeInfo.AdviseFlag = 1; + // document_AptitudeInfo.UserId = achievement.tenant_code; + + // document_AptitudeInfos.Add(document_AptitudeInfo); + //} + + + var resultShebeinengli = _db.Queryable<Doc_Shebeinengli>().Where(x => x.status == 1 && x.tenant_code == UnitId && (x.sbzp_zige > 0 || x.gmht_zige > 0 || x.fp_zige > 0 || x.fkpz_zige > 0 || x.csmp_zige > 0)).OrderBy(x => x.sort).ToList();//鎵ц鏌ヨ + + + foreach (var achievement in resultShebeinengli) + { + var document_AptitudeInfo = new Document_AptitudeInfo(); + document_AptitudeInfo.FilePath = ""; + document_AptitudeInfo.FileName = ""; + document_AptitudeInfo.FileSize = 0; + if (!string.IsNullOrEmpty(achievement.sbzp_url) && achievement.sbzp_zige > 0) + { + document_AptitudeInfo.FilePath += achievement.sbzp_url; + document_AptitudeInfo.FileName += "璁惧鐓х墖"; + document_AptitudeInfo.FileSize += 0; + document_AptitudeInfo.FilePath += ";"; + document_AptitudeInfo.FileName += ";"; + } + if (!string.IsNullOrEmpty(achievement.gmht_url) && achievement.gmht_zige > 0) + { + document_AptitudeInfo.FilePath += achievement.gmht_url; + document_AptitudeInfo.FileName += "璐拱鍚堝悓"; + document_AptitudeInfo.FileSize += 0; + document_AptitudeInfo.FilePath += ";"; + document_AptitudeInfo.FileName += ";"; + } + if (!string.IsNullOrEmpty(achievement.fp_url) && achievement.fp_zige > 0) + { + document_AptitudeInfo.FilePath += achievement.fp_url; + document_AptitudeInfo.FileName += "鍙戠エ"; + document_AptitudeInfo.FileSize += 0; + document_AptitudeInfo.FilePath += ";"; + document_AptitudeInfo.FileName += ";"; + } + if (!string.IsNullOrEmpty(achievement.fkpz_url) && achievement.fkpz_zige > 0) + { + document_AptitudeInfo.FilePath += achievement.fkpz_url; + document_AptitudeInfo.FileName += "浠樻鍑瘉"; + document_AptitudeInfo.FileSize += 0; + document_AptitudeInfo.FilePath += ";"; + document_AptitudeInfo.FileName += ";"; + } + if (!string.IsNullOrEmpty(achievement.csmp_url) && achievement.csmp_zige > 0) + { + document_AptitudeInfo.FilePath += achievement.csmp_url; + document_AptitudeInfo.FileName += "鍙傛暟锛堥摥鐗岋級"; + document_AptitudeInfo.FileSize += 0; + document_AptitudeInfo.FilePath += ";"; + document_AptitudeInfo.FileName += ";"; + } + + + if (document_AptitudeInfo.FilePath.EndsWith(";")) + { + document_AptitudeInfo.FilePath = document_AptitudeInfo.FilePath.Substring(0, document_AptitudeInfo.FilePath.Length - 1); + } + + if (document_AptitudeInfo.FileName.EndsWith(";")) + { + document_AptitudeInfo.FileName = document_AptitudeInfo.FileName.Substring(0, document_AptitudeInfo.FileName.Length - 1); + } + + + document_AptitudeInfo.AptitudeId = achievement.id; + document_AptitudeInfo.AptitudeName = achievement.shebeinengli_name; + document_AptitudeInfo.AptitudeType = achievement.classification_id; + document_AptitudeInfo.IsUsed = achievement.status; + + + document_AptitudeInfo.FileVersionNo = ""; + document_AptitudeInfo.SendTime = achievement.add_time.ToShortDateString(); + document_AptitudeInfo.UnitId = achievement.tenant_code; + document_AptitudeInfo.LastUpdateTime = achievement.add_time; + document_AptitudeInfo.LastUpdateName = ""; + document_AptitudeInfo.AdviseFlag = achievement.zige_code; + document_AptitudeInfo.UserId = achievement.tenant_code; document_AptitudeInfos.Add(document_AptitudeInfo); } @@ -1577,7 +1896,8 @@ public List<Document_DocumentTempletInfo> GetDocumentTempletList() { - var result = _db.Queryable<Document_DocumentTempletInfo>().Where(x => x.IsUsed == 1).ToList();//鎵ц鏌ヨ + var aaa = GetJwtInfo(); + var result = _db.Queryable<Document_DocumentTempletInfo>().Where(x => x.IsUsed == 1 && x.UnitId == aaa.UID).OrderByDescending(x=>x.LastUpdateTime).ToList();//鎵ц鏌ヨ return result; } @@ -1700,7 +2020,7 @@ if(result.Items !=null&& result.Items.Count > 0) { - var doc_Classifications = _db.Queryable<Doc_Classification>().Where(x => x.parent_code == "003").ToList();//鎵ц鏌ヨ + var doc_Classifications = _db.Queryable<Doc_Classification>().Where(x => x.parent_code == "000").ToList();//鎵ц鏌ヨ foreach (var item in result.Items) { var doc_Classification = doc_Classifications.Where(x => x.id == item.Classification).FirstOrDefault(); @@ -1820,7 +2140,7 @@ public List<Doc_Classification> GetDocClassificationList() { - var ret = _db.Queryable<Doc_Classification>().Where(x => x.parent_code =="003" && x.is_system == true).ToList(); + var ret = _db.Queryable<Doc_Classification>().Where(x => x.parent_code =="000" && x.is_system == true).ToList(); return ret; } @@ -2109,5 +2429,109 @@ doc_Classification.sort_id = ret ?? 0; return doc_Classification; } + + + public Doc_Classification GetShebeinengliInfoMaxSortId(int unitId) + { + var ret = _db.Queryable<Doc_Shebeinengli>() + .Where(x => x.tenant_code == unitId) + //.WhereIF(!string.IsNullOrEmpty(doccode), x => x.doc_code == doccode) + .Max(x => x.sort); + + Doc_Classification doc_Classification = new Doc_Classification(); + doc_Classification.sort_id = ret ?? 0; + return doc_Classification; + } + + + public PageResult<Document_DocumentTempletInfoDTO> postDocumentTempletList(DocumentProjectInfoPageSearch page) + { + var aaa = GetJwtInfo(); + + SqlSugar.PageModel pg = new SqlSugar.PageModel(); + pg.PageSize = page.PageSize; + pg.PageIndex = page.PageIndex; + //page.ToEmployeeId = a.EID; + int total = 0; + PageResult<Document_DocumentTempletInfoDTO> result = new PageResult<Document_DocumentTempletInfoDTO>(); + + + + var document_DocumentTempletInfos = _db.Queryable<Document_DocumentTempletInfo> () + .Where(x=>x.UnitId == aaa.UID) + //鏂囦欢鍚嶇О + .WhereIF(!string.IsNullOrEmpty(page.templetName), a => a.TempletName.Contains(page.templetName)) + .WhereIF(page.purchaseMethod !=0, a => a.PurchaseMethod == page.purchaseMethod) + .WhereIF(page.IsUsed>0, a => (page.IsUsed == 1 && a.IsUsed == 1 ) || (page.IsUsed != 1 && a.IsUsed == 2)) + + + + .OrderByDescending(a => a.TempletId).ToPageList(page.PageIndex, page.PageSize, ref total); + + + result.Items = _mapper.Map<List<Document_DocumentTempletInfoDTO>>(document_DocumentTempletInfos); + + if (result.Items != null && result.Items.Count > 0) + { + + foreach (var item in result.Items) + { + if (item.IsUsed == 1) + { + + + + item.isUseName = "鍚敤"; + + item.isUseOp = "鍋滅敤"; + + } + else + { + item.isUseName = "鍋滅敤"; + item.isUseOp = "鍚敤"; + } + + } + } + + result.TotalCount = total; + result.TotalPage = total % page.PageSize == 0 ? total / page.PageSize : total / page.PageSize + 1; + + + + return result; + } + + + public bool GetDeleteDocumentTempletInfo(int ID) + { + _db.Deleteable<Document_DocumentTempletInfo>().Where(x => x.TempletId == ID ).ExecuteCommand(); + + return true; + } + + + public bool SaveDocumentTempletInfo(Document_DocumentTempletInfo dp) + { + if (dp.TempletId > 0) + { + _db.Updateable<Document_DocumentTempletInfo>(dp).ExecuteCommand(); + } + else + { + _db.Insertable<Document_DocumentTempletInfo>(dp).ExecuteCommand(); + } + return true; + } + + + public Document_DocumentTempletInfo GetTempletModelByProjectId(int projiectid) + { + + var aaa = GetJwtInfo(); + var ret = _db.Queryable<Document_DocumentTempletInfo>().Where(x => x.ProjectId == projiectid && x.UnitId == aaa.UID ).First(); + return ret; + } } } -- Gitblit v1.9.1