海运出口列表优化1

dev
cjy 1 week ago
parent c170af43e3
commit 8b0f4f1ce2

@ -120,31 +120,14 @@ public partial class SeaExportService : ISeaExportService
var tenantDb = saasService.GetBizDbScopeById(user.TenantId); var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
//启用海运出口列表可视数据权限 //启用海运出口列表可视数据权限
(ISugarQueryable<SeaExport> query, _) = await commonService.GetVisibleDataRuleFilter<SeaExport>(tenantDb); (ISugarQueryable<SeaExport> query, _) = await commonService.GetVisibleDataRuleFilter<SeaExport>(tenantDb);
////是否分单标识
//var otherConditons = request.GetOtherConditionalModels(db); var partList = await tenantDb.Queryable<SeaExportBillManage>().ToListAsync();
//int isPart = 0;
//if (otherConditons.IsNotNull() && otherConditons.Count > 0)
//{
// foreach (ConditionalModel item in otherConditons)
// {
// if (item.FieldName.ToLower() == "ispart")
// {
// isPart = int.Parse(item.FieldValue);
// }
// }
//}
var partList = tenantDb.Queryable<SeaExportBillManage>().ToList();
var orgList = db.Queryable<SysOrg>().Where(x => x.Status == StatusEnum.Enable);
//序列化查询条件 //序列化查询条件
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition); var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
//var result = tenantDb.Queryable<SeaExport>() //var result = tenantDb.Queryable<SeaExport>()
var statusList = tenantDb.Queryable<BookingStatus>().Select<BookingStatusRes>().ToList(); var statusList = await tenantDb.Queryable<BookingStatus>().Select<BookingStatusRes>().ToListAsync();
var ctnPrices = tenantDb.Queryable<BusinessCtnPrice>().ToList(); var ctnPrices = await tenantDb.Queryable<BusinessCtnPrice>().ToListAsync();
var result = query.Where(a => (a.IsRefund == false && a.IsChangeETD == false)) var result = query.Where(a => (a.IsRefund == false && a.IsChangeETD == false))
.InnerJoin<BusinessFeeStatus>((a, b) => a.Id == b.BusinessId) .InnerJoin<BusinessFeeStatus>((a, b) => a.Id == b.BusinessId)
//.LeftJoin<SysOrg>((a, b, c) => a.SaleOrgId == c.Id, "shippingweb8_dev.sys_org") //.LeftJoin<SysOrg>((a, b, c) => a.SaleOrgId == c.Id, "shippingweb8_dev.sys_org")
@ -152,19 +135,19 @@ public partial class SeaExportService : ISeaExportService
.Select((a, b) => new SeaExportRes() .Select((a, b) => new SeaExportRes()
{ {
//SaleDeptName = c.OrgName, //SaleDeptName = c.OrgName,
QuotePrice = SqlFunc.Subqueryable<BusinessCtnPrice>() //QuotePrice = SqlFunc.Subqueryable<BusinessCtnPrice>()
.Where(s => s.BusinessId == a.Id) // .Where(s => s.BusinessId == a.Id)
.Select(s => s.QuotePrice), // .Select(s => s.QuotePrice),
FloorPrice = SqlFunc.Subqueryable<BusinessCtnPrice>() //FloorPrice = SqlFunc.Subqueryable<BusinessCtnPrice>()
.Where(s => s.BusinessId == a.Id) // .Where(s => s.BusinessId == a.Id)
.Select(s => s.FloorPrice) // .Select(s => s.FloorPrice)
}, },
true)//true表示 其余字段自动映射,根据字段名字 true)//true表示 其余字段自动映射,根据字段名字
//.Select<SeaExportRes>() //.Select<SeaExportRes>()
.MergeTable() .MergeTable()
.Mapper(it => .Mapper(it =>
{ {
it.BookingStatus = statusList.Where(x => x.BusinessId == it.Id).ToList(); //it.BookingStatus = statusList.Where(x => x.BusinessId == it.Id).ToList();
//var ctnPrice = ctnPrices.First(x => x.BusinessId == it.Id); //var ctnPrice = ctnPrices.First(x => x.BusinessId == it.Id);
//it.QuotePrice = ctnPrice?.QuotePrice; //it.QuotePrice = ctnPrice?.QuotePrice;
//it.FloorPrice = ctnPrice?.FloorPrice; //it.FloorPrice = ctnPrice?.FloorPrice;
@ -172,7 +155,6 @@ public partial class SeaExportService : ISeaExportService
//it.StatusLog = //it.StatusLog =
}) })
.Where(whereList); .Where(whereList);
//.ToQueryPageAsync(request.PageCondition);
var list = result.ToList(); var list = result.ToList();
var data = await result.ToQueryPageAsync(request.PageCondition); var data = await result.ToQueryPageAsync(request.PageCondition);
@ -248,6 +230,14 @@ public partial class SeaExportService : ISeaExportService
} }
item.StatusLog = ctnLogs; item.StatusLog = ctnLogs;
item.PartCount = partList.Where(x => x.BusinessId == item.Id).Count(); item.PartCount = partList.Where(x => x.BusinessId == item.Id).Count();
var ctnPrice = ctnPrices.Where(x => x.BusinessId == item.Id).FirstOrDefault();
if (ctnPrice.IsNotNull())
{
item.QuotePrice = ctnPrice.QuotePrice;
item.FloorPrice = ctnPrice.FloorPrice;
}
item.BookingStatus = statusList.Where(x => x.BusinessId == item.Id).ToList();
} }
var res = new SeaExportListRes() var res = new SeaExportListRes()

@ -429,7 +429,7 @@ public class ClientCommonService : IClientCommonService
//var data = new ClientSelectInfoRes(); //var data = new ClientSelectInfoRes();
if (req.BusinessType == BusinessType.OceanShippingExport) if (req.BusinessType == BusinessType.OceanShippingExport)
{ {
var info = tenantDb.Queryable<SeaExport>().First(x => x.Id == req.BusinessId); var info = tenantDb.Queryable<SeaExport>().Filter(null,true).First(x => x.Id == req.BusinessId);
if (info.IsNull()) if (info.IsNull())
{ {
return DataResult<UnitSelectInfoRes>.Failed("业务信息不存在!"); return DataResult<UnitSelectInfoRes>.Failed("业务信息不存在!");

Loading…
Cancel
Save