From f210a0e0fc0552bfacb2489de099bd512b8e74e7 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期三, 05 十一月 2025 09:03:39 +0800
Subject: [PATCH] 提交
---
Admin.NET/FZCZTB.TSCL.Application/Service/ProcurementComplaint/ProcurementComplaintService.cs | 117 +++++++++++++++++++++++++++++++++++++---------------------
1 files changed, 75 insertions(+), 42 deletions(-)
diff --git a/Admin.NET/FZCZTB.TSCL.Application/Service/ProcurementComplaint/ProcurementComplaintService.cs b/Admin.NET/FZCZTB.TSCL.Application/Service/ProcurementComplaint/ProcurementComplaintService.cs
index ba9bcc3..8d2a0f8 100644
--- a/Admin.NET/FZCZTB.TSCL.Application/Service/ProcurementComplaint/ProcurementComplaintService.cs
+++ b/Admin.NET/FZCZTB.TSCL.Application/Service/ProcurementComplaint/ProcurementComplaintService.cs
@@ -23,6 +23,7 @@
using System.Linq;
using NewLife.Xml;
using AngleSharp.Dom;
+using static Elastic.Clients.Elasticsearch.JoinField;
namespace FZCZTB.TSCL.Application;
/// <summary>
@@ -50,8 +51,8 @@
public async Task<SqlSugarPagedList<ProcurementComplaintOutput>> Page(PageProcurementComplaintInput input)
{
input.Keyword = input.Keyword?.Trim();
- var query = _procurementComplaintRep.AsQueryable()
- .WhereIF(!string.IsNullOrWhiteSpace(input.Keyword), u => u.ProjectCode.Contains(input.Keyword) || u.ProjectName.Contains(input.Keyword) || u.Purchaser.Contains(input.Keyword) || u.ProcurementAgency.Contains(input.Keyword) || u.Complainant.Contains(input.Keyword) || u.ProcurementSupervisionDepartment.Contains(input.Keyword) || u.Url.Contains(input.Keyword))
+ var query = _procurementComplaintRep.AsQueryable().Includes(u => u.Complaints)
+ .WhereIF(!string.IsNullOrWhiteSpace(input.Keyword), u => u.Complaints.Any(uu => uu.ItemDescription.Contains(input.Keyword)))
.WhereIF(!string.IsNullOrWhiteSpace(input.ProjectCode), u => u.ProjectCode.Contains(input.ProjectCode.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.ProjectName), u => u.ProjectName.Contains(input.ProjectName.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Purchaser), u => u.Purchaser.Contains(input.Purchaser.Trim()))
@@ -60,7 +61,22 @@
.WhereIF(!string.IsNullOrWhiteSpace(input.ProcurementSupervisionDepartment), u => u.ProcurementSupervisionDepartment.Contains(input.ProcurementSupervisionDepartment.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Url), u => u.Url.Contains(input.Url.Trim()))
.WhereIF(input.DecisionDateRange?.Length == 2, u => u.DecisionDate >= input.DecisionDateRange[0] && u.DecisionDate <= input.DecisionDateRange[1])
- .Select<ProcurementComplaintOutput>();
+ .WhereIF(input.Status != null && input.Status == PComplaintStatus.Valid, u =>( u.Complaints.Any(uu => uu.HandlingStatus == PComplaintStatus.Valid)))
+ .WhereIF(input.Status != null && input.Status == PComplaintStatus.Rejected, u => ( !u.Complaints.Any(uu=>uu.HandlingStatus== PComplaintStatus.Other||uu.HandlingStatus== PComplaintStatus.Valid||uu.HandlingStatus==null)))
+ .WhereIF(input.Status != null && input.Status == PComplaintStatus.Other, u =>!( u.Complaints.Any(uu=>uu.HandlingStatus== PComplaintStatus.Valid)|| (!u.Complaints.Any(uu => uu.HandlingStatus == PComplaintStatus.Other || uu.HandlingStatus == PComplaintStatus.Valid || uu.HandlingStatus == null))))
+
+ .Select(n => new ProcurementComplaintOutput
+ {
+ Complaints = n.Complaints
+ },true)
+ .Mapper(n =>
+ {
+ n.Status =n.Complaints==null? PComplaintStatus.Other:n.Complaints.Any(x => x.HandlingStatus == PComplaintStatus.Valid) ? PComplaintStatus.Valid :
+ n.Complaints.All(x => x.HandlingStatus == PComplaintStatus.Rejected) ? PComplaintStatus.Rejected : PComplaintStatus.Other ;
+ n.Complaints = null;
+ }
+ );
+
return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize);
}
@@ -73,8 +89,11 @@
[ApiDescriptionSettings(Name = "Detail"), HttpGet]
public async Task<ProcurementComplaint> Detail([FromQuery] QueryByIdProcurementComplaintInput input)
{
- return await _procurementComplaintRep.GetFirstAsync(u => u.Id == input.Id);
+
+ return await _procurementComplaintRep.AsQueryable().Where(x=>x.Id==input.Id).Includes(x=>x.Complaints.OrderBy(xx=>xx.sort).ToList()).FirstAsync();
}
+
+
/// <summary>
/// 澧炲姞鏀垮簻閲囪喘鎶曡瘔鏁版嵁澶勭悊 鉃�
@@ -87,6 +106,13 @@
{
var entity = input.Adapt<ProcurementComplaint>();
entity.Id = Guid.NewGuid();
+ int index = 0;
+ if (entity.Complaints != null)
+ foreach (var item in entity.Complaints)
+ {
+ item.Id = Guid.NewGuid();
+ item.sort = index++;
+ }
return await _sqlSugarClient.InsertNav(entity).Include(x=>x.Complaints).ExecuteCommandAsync();
}
@@ -101,7 +127,14 @@
public async Task Update(UpdateProcurementComplaintInput input)
{
var entity = input.Adapt<ProcurementComplaint>();
- await _procurementComplaintRep.AsUpdateable(entity)
+ int index = 0;
+ if(entity.Complaints!=null)
+ foreach (var item in entity.Complaints)
+ {
+ item.Id = Guid.NewGuid();
+ item.sort= index++;
+ }
+ await _procurementComplaintRep.AsSugarClient().UpdateNav(entity).Include(x=>x.Complaints)
.ExecuteCommandAsync();
}
@@ -167,46 +200,46 @@
/// 瀵煎叆鏀垮簻閲囪喘鎶曡瘔鏁版嵁澶勭悊璁板綍 馃捑
/// </summary>
/// <returns></returns>
- [DisplayName("瀵煎叆鏀垮簻閲囪喘鎶曡瘔鏁版嵁澶勭悊璁板綍")]
- [ApiDescriptionSettings(Name = "Import"), HttpPost, NonUnify, UnitOfWork]
- public IActionResult ImportData([Required] IFormFile file)
- {
- lock (_procurementComplaintImportLock)
- {
- var stream = ExcelHelper.ImportData<ImportProcurementComplaintInput, ProcurementComplaint>(file, (list, markerErrorAction) =>
- {
- _sqlSugarClient.Utilities.PageEach(list, 2048, pageItems =>
- {
+ //[DisplayName("瀵煎叆鏀垮簻閲囪喘鎶曡瘔鏁版嵁澶勭悊璁板綍")]
+ //[ApiDescriptionSettings(Name = "Import"), HttpPost, NonUnify, UnitOfWork]
+ //public IActionResult ImportData([Required] IFormFile file)
+ //{
+ // lock (_procurementComplaintImportLock)
+ // {
+ // var stream = ExcelHelper.ImportData<ImportProcurementComplaintInput, ProcurementComplaint>(file, (list, markerErrorAction) =>
+ // {
+ // _sqlSugarClient.Utilities.PageEach(list, 2048, pageItems =>
+ // {
- // 鏍¢獙骞惰繃婊ゅ繀濉熀鏈被鍨嬩负null鐨勫瓧娈�
- var rows = pageItems.Where(x => {
- return true;
- }).Adapt<List<ProcurementComplaint>>();
+ // // 鏍¢獙骞惰繃婊ゅ繀濉熀鏈被鍨嬩负null鐨勫瓧娈�
+ // var rows = pageItems.Where(x => {
+ // return true;
+ // }).Adapt<List<ProcurementComplaint>>();
- var storageable = _procurementComplaintRep.Context.Storageable(rows)
- .SplitError(it => string.IsNullOrWhiteSpace(it.Item.ProjectCode), "椤圭洰缂栧彿涓嶈兘涓虹┖")
- .SplitError(it => it.Item.ProjectCode?.Length > 50, "椤圭洰缂栧彿闀垮害涓嶈兘瓒呰繃50涓瓧绗�")
- .SplitError(it => string.IsNullOrWhiteSpace(it.Item.ProjectName), "椤圭洰鍚嶇О涓嶈兘涓虹┖")
- .SplitError(it => it.Item.ProjectName?.Length > 200, "椤圭洰鍚嶇О闀垮害涓嶈兘瓒呰繃200涓瓧绗�")
- .SplitError(it => string.IsNullOrWhiteSpace(it.Item.Purchaser), "閲囪喘浜轰笉鑳戒负绌�")
- .SplitError(it => it.Item.Purchaser?.Length > 100, "閲囪喘浜洪暱搴︿笉鑳借秴杩�100涓瓧绗�")
- .SplitError(it => string.IsNullOrWhiteSpace(it.Item.ProcurementAgency), "閲囪喘浠g悊鏈烘瀯涓嶈兘涓虹┖")
- .SplitError(it => it.Item.ProcurementAgency?.Length > 100, "閲囪喘浠g悊鏈烘瀯闀垮害涓嶈兘瓒呰繃100涓瓧绗�")
- .SplitError(it => it.Item.Complainant?.Length > 100, "鎶曡瘔浜洪暱搴︿笉鑳借秴杩�100涓瓧绗�")
- .SplitError(it => it.Item.ProcurementSupervisionDepartment?.Length > 100, "閲囪喘鐩戠潱閮ㄩ棬闀垮害涓嶈兘瓒呰繃100涓瓧绗�")
- .SplitError(it => it.Item.Url?.Length > 255, "绾夸笂鍦板潃闀垮害涓嶈兘瓒呰繃255涓瓧绗�")
- .SplitInsert(_ => true)
- .ToStorage();
+ // var storageable = _procurementComplaintRep.Context.Storageable(rows)
+ // .SplitError(it => string.IsNullOrWhiteSpace(it.Item.ProjectCode), "椤圭洰缂栧彿涓嶈兘涓虹┖")
+ // .SplitError(it => it.Item.ProjectCode?.Length > 50, "椤圭洰缂栧彿闀垮害涓嶈兘瓒呰繃50涓瓧绗�")
+ // .SplitError(it => string.IsNullOrWhiteSpace(it.Item.ProjectName), "椤圭洰鍚嶇О涓嶈兘涓虹┖")
+ // .SplitError(it => it.Item.ProjectName?.Length > 200, "椤圭洰鍚嶇О闀垮害涓嶈兘瓒呰繃200涓瓧绗�")
+ // .SplitError(it => string.IsNullOrWhiteSpace(it.Item.Purchaser), "閲囪喘浜轰笉鑳戒负绌�")
+ // .SplitError(it => it.Item.Purchaser?.Length > 100, "閲囪喘浜洪暱搴︿笉鑳借秴杩�100涓瓧绗�")
+ // .SplitError(it => string.IsNullOrWhiteSpace(it.Item.ProcurementAgency), "閲囪喘浠g悊鏈烘瀯涓嶈兘涓虹┖")
+ // .SplitError(it => it.Item.ProcurementAgency?.Length > 100, "閲囪喘浠g悊鏈烘瀯闀垮害涓嶈兘瓒呰繃100涓瓧绗�")
+ // .SplitError(it => it.Item.Complainant?.Length > 100, "鎶曡瘔浜洪暱搴︿笉鑳借秴杩�100涓瓧绗�")
+ // .SplitError(it => it.Item.ProcurementSupervisionDepartment?.Length > 100, "閲囪喘鐩戠潱閮ㄩ棬闀垮害涓嶈兘瓒呰繃100涓瓧绗�")
+ // .SplitError(it => it.Item.Url?.Length > 255, "绾夸笂鍦板潃闀垮害涓嶈兘瓒呰繃255涓瓧绗�")
+ // .SplitInsert(_ => true)
+ // .ToStorage();
- storageable.AsInsertable.ExecuteCommand();// 涓嶅瓨鍦ㄦ彃鍏�
- storageable.AsUpdateable.ExecuteCommand();// 瀛樺湪鏇存柊
+ // storageable.AsInsertable.ExecuteCommand();// 涓嶅瓨鍦ㄦ彃鍏�
+ // storageable.AsUpdateable.ExecuteCommand();// 瀛樺湪鏇存柊
- // 鏍囪閿欒淇℃伅
- markerErrorAction.Invoke(storageable, pageItems, rows);
- });
- });
+ // // 鏍囪閿欒淇℃伅
+ // markerErrorAction.Invoke(storageable, pageItems, rows);
+ // });
+ // });
- return stream;
- }
- }
+ // return stream;
+ // }
+ //}
}
--
Gitblit v1.9.1