根据业务和查询条件获取费用明细

usertest
嵇文龙 3 months ago
parent c0fe2d44ed
commit c798a4bfd8

@ -93,5 +93,7 @@ namespace DS.WMS.Core.Fee.Dtos
public class AuditDetailRequest : BizItem
{
public string? QueryCondition { get; set; }
public bool AuditOnly { get; set; }
}
}

@ -27,11 +27,9 @@ namespace DS.WMS.Core.Fee.Interface
/// <summary>
/// 根据查询条件获取费用明细
/// </summary>
/// <param name="id">业务ID</param>
/// <param name="businessType">业务类型</param>
/// <param name="query"></param>
/// <param name="request">请求参数</param>
/// <returns></returns>
Task<DataResult<PendingAuditFee>> GetFeesAsync(long id, BusinessType businessType, string query);
Task<DataResult<PendingAuditFee>> GetFeesAsync(AuditDetailRequest request);
/// <summary>
/// 获取业务相关联的费用统计

@ -5,7 +5,6 @@ using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Fee.Interface;
using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.Flow.Entity;
using DS.WMS.Core.Flow.Interface;
using DS.WMS.Core.Info.Entity;
using DS.WMS.Core.Op.Dtos.TaskInteraction;
@ -53,18 +52,17 @@ namespace DS.WMS.Core.Fee.Method
/// <returns></returns>
public async Task<DataResult<List<FeeAuditBusiness>>> GetListAsync(PageRequest<bool> request)
{
List<FlowInstance>? flowList = null;
long[]? ids = null;
if (request.OtherQueryCondition)
{
flowList = await GetCurrentFlowsQuery(AuditTypes)
.Select(x => new FlowInstance { BusinessId = x.BusinessId, BusinessType = x.BusinessType }).ToListAsync();
ids = await GetCurrentFlowsQuery(AuditTypes).Select(x => x.BusinessId).Distinct().ToArrayAsync();
//没有待审批的列表直接返回不再执行后续查询
if (flowList.Count == 0)
DataResult<List<FeeAuditBusiness>>.PageList(0, null, MultiLanguageConst.DataQuerySuccess);
if (ids.Length == 0)
return DataResult<List<FeeAuditBusiness>>.PageList(0, null, MultiLanguageConst.DataQuerySuccess);
}
var queryList = CreateQuery(flowList);
var queryList = CreateQuery(ids);
if (!request.QueryCondition.IsNullOrEmpty())
{
@ -95,17 +93,16 @@ namespace DS.WMS.Core.Fee.Method
}
//创建各项费用数据的查询并集
internal ISugarQueryable<FeeAuditBusiness> CreateQuery(List<FlowInstance>? additions)
internal ISugarQueryable<FeeAuditBusiness> CreateQuery(params long[]? bsIds)
{
//海运出口
var ids1 = additions?.Where(x => x.BusinessType == BusinessType.OceanShippingExport).Select(x => x.BusinessId).ToArray();
var query1 = TenantDb.Queryable<SeaExport, BusinessFeeStatus, FeeRecord, CodeSource, CodeSourceDetail>((s, b, f, cs, csd) => new JoinQueryInfos(
JoinType.Left, s.Id == b.BusinessId && b.BusinessType == BusinessType.OceanShippingExport,
JoinType.Inner, s.Id == b.BusinessId && b.BusinessType == BusinessType.OceanShippingExport,
JoinType.Inner, s.Id == f.BusinessId && f.BusinessType == BusinessType.OceanShippingExport && AuditStatusArray.Contains(f.FeeStatus),
JoinType.Left, s.SourceId == cs.Id,
JoinType.Left, s.SourceDetailId == csd.Id
))
.WhereIF(ids1 != null && ids1.Length > 0, (s, b, f) => ids1.Contains(f.Id))
.WhereIF(bsIds != null && bsIds.Length > 0, (s, b, f) => bsIds.Contains(f.Id))
.GroupBy(s => s.Id)
.Select((s, b, f, cs, csd) => new FeeAuditBusiness
{
@ -190,18 +187,17 @@ namespace DS.WMS.Core.Fee.Method
/// <returns></returns>
public async Task<DataResult<List<FeeAuditBusiness>>> GetBizListAsync(PageRequest<bool> request)
{
List<FlowInstance> flowList = null;
long[]? ids = null;
if (request.OtherQueryCondition)
{
flowList = await GetCurrentFlowsQuery([TaskBaseTypeEnum.FEE_BUSINESS_AUDIT])
.Select(x => new FlowInstance { BusinessId = x.BusinessId, BusinessType = x.BusinessType }).ToListAsync();
ids = await GetCurrentFlowsQuery(TaskBaseTypeEnum.FEE_BUSINESS_AUDIT).Select(x => x.BusinessId).Distinct().ToArrayAsync();
//没有待审批的列表直接返回不再执行后续查询
if (flowList.Count == 0)
DataResult<List<FeeAuditBusiness>>.PageList(0, null, MultiLanguageConst.DataQuerySuccess);
if (ids.Length == 0)
return DataResult<List<FeeAuditBusiness>>.PageList(0, null, MultiLanguageConst.DataQuerySuccess);
}
var queryList = CreateBizQuery(flowList);
var queryList = CreateBizQuery(ids);
if (!request.QueryCondition.IsNullOrEmpty())
{
@ -233,17 +229,16 @@ namespace DS.WMS.Core.Fee.Method
}
//创建各项业务数据的查询并集
internal ISugarQueryable<FeeAuditBusiness> CreateBizQuery(List<FlowInstance>? additions)
internal ISugarQueryable<FeeAuditBusiness> CreateBizQuery(params long[]? bsIds)
{
//海运出口
var ids1 = additions?.Where(x => x.BusinessType == BusinessType.OceanShippingExport).Select(x => x.BusinessId).ToArray();
var query1 = TenantDb.Queryable<SeaExport, BusinessFeeStatus, FeeRecord, CodeSource, CodeSourceDetail>((s, b, f, cs, csd) => new JoinQueryInfos(
JoinType.Left, s.Id == b.BusinessId && b.BusinessType == BusinessType.OceanShippingExport,
JoinType.Inner, s.Id == b.BusinessId && b.BusinessType == BusinessType.OceanShippingExport,
JoinType.Inner, s.Id == f.BusinessId && f.BusinessType == BusinessType.OceanShippingExport && AuditStatusArray.Contains(f.FeeStatus),
JoinType.Left, s.SourceId == cs.Id,
JoinType.Left, s.SourceDetailId == csd.Id
))
.WhereIF(ids1 != null && ids1.Length > 0, (s, b) => ids1.Contains(s.Id))
.WhereIF(bsIds != null && bsIds.Length > 0, (s, b) => bsIds.Contains(s.Id))
.GroupBy(s => s.Id)
.Select((s, b, f, cs, csd) => new FeeAuditBusiness
{
@ -324,16 +319,14 @@ namespace DS.WMS.Core.Fee.Method
/// <summary>
/// 根据业务和查询条件获取费用明细
/// </summary>
/// <param name="id">业务ID</param>
/// <param name="businessType">业务类型</param>
/// <param name="query">自定义查询条件</param>
/// <param name="request"></param>
/// <returns></returns>
public async Task<DataResult<PendingAuditFee>> GetFeesAsync(long id, BusinessType businessType, string query)
public async Task<DataResult<PendingAuditFee>> GetFeesAsync(AuditDetailRequest request)
{
var pendingAudit = await TenantDb.Queryable<SeaExport>().Where(x => x.Id == id).Select(x => new PendingAuditFee
var pendingAudit = await TenantDb.Queryable<SeaExport>().Where(x => x.Id == request.Id).Select(x => new PendingAuditFee
{
AccountDate = x.AccountDate,
BusinessType = businessType,
BusinessType = request.BusinessType,
Carrier = x.Carrier,
CustomerNo = x.CustomerNo,
CustomerName = x.CustomerName,
@ -348,9 +341,20 @@ namespace DS.WMS.Core.Fee.Method
if (pendingAudit != null)
{
var query1 = TenantDb.Queryable<FeeRecord>().Where(f => f.BusinessId == id && f.BusinessType == businessType && AuditStatusArray.Contains(f.FeeStatus))
long[] ids = [];
if (request.AuditOnly)
{
ids = await GetCurrentFlowsQuery(AuditTypes).Select(x => x.BusinessId).Distinct().ToArrayAsync();
//没有待审批的列表直接返回不再执行后续查询
if (ids.Length == 0)
return DataResult<PendingAuditFee>.Success(pendingAudit, MultiLanguageConst.DataQuerySuccess);
}
var query1 = TenantDb.Queryable<FeeRecord>().Where(f => f.BusinessId == request.Id && f.BusinessType == request.BusinessType)
.InnerJoin<SeaExport>((f, s) => f.BusinessId == s.Id)
.LeftJoin<InfoClient>((f, s, i) => f.CustomerId == i.Id)
.WhereIF(ids.Length > 0, (f, s, i) => ids.Contains(f.Id) && AuditStatusArray.Contains(f.FeeStatus))
.Select((f, s, i) => new FeeAuditItemQuery
{
Id = f.Id,
@ -407,9 +411,9 @@ namespace DS.WMS.Core.Fee.Method
var queryList = TenantDb.UnionAll(new List<ISugarQueryable<FeeAuditItemQuery>> { query1 });
if (!query.IsNullOrEmpty())
if (!request.QueryCondition.IsNullOrEmpty())
{
var whereList = Db.ConfigQuery.Context.Utilities.JsonToConditionalModels(query);
var whereList = Db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
queryList = queryList.Where(whereList);
}
var list = await queryList.Select<AuditItem>().ToListAsync();
@ -607,8 +611,8 @@ namespace DS.WMS.Core.Fee.Method
/// <returns></returns>
public async Task<DataResult> AuditAsync(BizAuditRequest request)
{
var flowList = await GetCurrentFlowsQuery(TaskBaseTypeEnum.FEE_AUDIT).ToListAsync();
var query = CreateQuery(flowList);
var ids = await GetCurrentFlowsQuery(TaskBaseTypeEnum.FEE_AUDIT).Select(x => x.BusinessId).ToArrayAsync();
var query = CreateQuery(ids);
if (!request.QueryCondition.IsNullOrEmpty())
{

@ -264,7 +264,6 @@ namespace DS.WMS.Core.Fee.Method
/// <returns></returns>
protected internal ISugarQueryable<FlowInstance> GetCurrentFlowsQuery(params TaskBaseTypeEnum[] auditTypes)
{
var arr = auditTypes.Select(x => x.ToString());
return Db.Queryable<FlowInstance>().Where(x => x.FlowStatus == FlowStatusEnum.Running
&& SqlFunc.SplitIn(x.MakerList, User.UserId) && auditTypes.Contains(x.AuditType.Value))
.Select(x => new FlowInstance { Id = x.Id, BusinessId = x.BusinessId, BusinessType = x.BusinessType });

@ -2,7 +2,6 @@
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Interface;
using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.Op.Entity;
using Microsoft.AspNetCore.Mvc;
namespace DS.WMS.FeeApi.Controllers
@ -43,7 +42,7 @@ namespace DS.WMS.FeeApi.Controllers
[HttpPost, Route("GetFees")]
public async Task<DataResult<PendingAuditFee>> GetFeesAsync([FromBody] AuditDetailRequest request)
{
return await _auditService.GetFeesAsync(request.Id, request.BusinessType, request.QueryCondition);
return await _auditService.GetFeesAsync(request);
}
/// <summary>

@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Project>
<PropertyGroup>
<_PublishTargetUrl>D:\Publish\DS8\FeeApi</_PublishTargetUrl>
<History>True|2024-09-05T05:57:23.8452431Z||;True|2024-09-05T10:21:34.6675149+08:00||;True|2024-09-05T09:12:44.5610882+08:00||;True|2024-09-04T10:07:38.3707398+08:00||;True|2024-09-04T09:52:47.0574599+08:00||;True|2024-09-03T16:41:23.7516960+08:00||;True|2024-09-03T15:22:31.8718097+08:00||;True|2024-09-03T10:01:09.7656702+08:00||;False|2024-09-03T09:46:46.8956531+08:00||;True|2024-09-02T17:07:41.0268500+08:00||;True|2024-09-02T13:50:22.0203254+08:00||;True|2024-09-02T13:34:23.3441546+08:00||;True|2024-08-30T11:25:14.7431645+08:00||;True|2024-08-29T16:38:26.3491372+08:00||;True|2024-08-29T16:32:31.8580864+08:00||;False|2024-08-29T16:30:41.4763198+08:00||;True|2024-08-09T09:18:05.8484398+08:00||;True|2024-08-09T08:45:38.7858906+08:00||;True|2024-08-05T11:37:07.3133020+08:00||;True|2024-07-24T16:45:58.2272340+08:00||;True|2024-07-24T15:48:52.0128987+08:00||;True|2024-07-23T17:41:01.7494842+08:00||;True|2024-07-23T17:25:11.8773492+08:00||;True|2024-07-23T17:07:16.5460273+08:00||;True|2024-07-22T08:59:23.3235603+08:00||;True|2024-07-12T17:35:11.1225017+08:00||;True|2024-07-11T11:40:17.3581147+08:00||;True|2024-07-04T17:20:50.0175739+08:00||;True|2024-07-02T11:26:14.2092751+08:00||;True|2024-07-02T09:21:51.3513605+08:00||;True|2024-07-01T17:47:56.0407256+08:00||;True|2024-07-01T16:42:55.7374984+08:00||;True|2024-07-01T15:49:58.9266967+08:00||;True|2024-07-01T14:35:48.1117178+08:00||;True|2024-07-01T11:41:52.2969338+08:00||;True|2024-07-01T11:13:02.6561160+08:00||;True|2024-06-28T15:28:43.1470725+08:00||;True|2024-06-28T15:16:20.1999596+08:00||;True|2024-06-28T15:14:56.2534743+08:00||;True|2024-06-28T15:02:41.3033806+08:00||;True|2024-06-28T13:37:28.2462742+08:00||;True|2024-06-28T11:06:30.7400535+08:00||;True|2024-06-26T15:24:17.1939896+08:00||;True|2024-06-26T14:33:06.3530466+08:00||;True|2024-06-26T09:45:24.4055568+08:00||;True|2024-06-25T15:45:57.6052473+08:00||;True|2024-06-25T10:17:17.7408916+08:00||;False|2024-06-25T10:16:23.5639654+08:00||;False|2024-06-25T10:15:28.3857721+08:00||;False|2024-06-25T10:10:59.5536995+08:00||;False|2024-06-25T10:07:10.4050937+08:00||;True|2024-06-24T15:22:18.2672769+08:00||;True|2024-06-24T15:01:04.8153621+08:00||;False|2024-06-24T15:00:29.9618848+08:00||;True|2024-06-24T14:07:19.9401637+08:00||;False|2024-06-24T14:06:36.1250570+08:00||;True|2024-06-21T15:13:57.4273503+08:00||;True|2024-06-21T15:04:37.8218608+08:00||;True|2024-06-21T14:12:48.0266638+08:00||;True|2024-06-21T13:52:30.0950155+08:00||;True|2024-06-20T11:02:42.9508506+08:00||;True|2024-06-19T11:43:01.1899282+08:00||;True|2024-06-19T11:23:01.2938141+08:00||;True|2024-06-18T08:51:21.6222152+08:00||;True|2024-06-17T09:20:35.0804494+08:00||;True|2024-06-17T08:41:58.1319484+08:00||;True|2024-06-17T08:38:09.0137102+08:00||;True|2024-06-14T15:19:45.7395180+08:00||;True|2024-06-14T14:38:49.7094421+08:00||;True|2024-06-14T14:27:39.2815370+08:00||;True|2024-06-14T09:42:21.5397525+08:00||;True|2024-06-13T16:03:39.8475642+08:00||;True|2024-06-13T14:12:10.1725629+08:00||;True|2024-06-13T10:46:52.6971321+08:00||;True|2024-06-11T17:03:44.8328978+08:00||;True|2024-06-06T17:41:51.1810315+08:00||;True|2024-06-06T10:57:27.8273617+08:00||;True|2024-06-04T14:23:21.3742450+08:00||;True|2024-05-31T17:01:42.4717460+08:00||;True|2024-05-31T13:56:03.0734064+08:00||;True|2024-05-31T08:45:52.3549394+08:00||;True|2024-05-30T17:16:32.8907958+08:00||;True|2024-05-30T16:18:06.9957657+08:00||;True|2024-05-29T15:44:18.4051203+08:00||;True|2024-05-29T15:11:03.1518632+08:00||;True|2024-05-29T14:52:26.0823495+08:00||;True|2024-05-29T11:17:20.2245101+08:00||;True|2024-05-29T08:36:28.9569161+08:00||;True|2024-05-28T08:44:31.4427261+08:00||;False|2024-05-28T08:44:02.5254826+08:00||;True|2024-05-27T15:16:32.9413631+08:00||;True|2024-05-27T15:03:42.9803879+08:00||;True|2024-05-27T08:49:54.3933663+08:00||;True|2024-05-27T08:46:13.5862236+08:00||;True|2024-05-23T17:19:32.8154451+08:00||;True|2024-05-23T17:19:01.4587615+08:00||;True|2024-05-22T16:52:42.2166228+08:00||;True|2024-05-22T15:19:49.1773202+08:00||;True|2024-05-22T15:13:31.9485525+08:00||;True|2024-05-22T13:29:02.1355808+08:00||;</History>
<History>True|2024-09-06T01:48:23.4236094Z||;True|2024-09-05T13:57:23.8452431+08:00||;True|2024-09-05T10:21:34.6675149+08:00||;True|2024-09-05T09:12:44.5610882+08:00||;True|2024-09-04T10:07:38.3707398+08:00||;True|2024-09-04T09:52:47.0574599+08:00||;True|2024-09-03T16:41:23.7516960+08:00||;True|2024-09-03T15:22:31.8718097+08:00||;True|2024-09-03T10:01:09.7656702+08:00||;False|2024-09-03T09:46:46.8956531+08:00||;True|2024-09-02T17:07:41.0268500+08:00||;True|2024-09-02T13:50:22.0203254+08:00||;True|2024-09-02T13:34:23.3441546+08:00||;True|2024-08-30T11:25:14.7431645+08:00||;True|2024-08-29T16:38:26.3491372+08:00||;True|2024-08-29T16:32:31.8580864+08:00||;False|2024-08-29T16:30:41.4763198+08:00||;True|2024-08-09T09:18:05.8484398+08:00||;True|2024-08-09T08:45:38.7858906+08:00||;True|2024-08-05T11:37:07.3133020+08:00||;True|2024-07-24T16:45:58.2272340+08:00||;True|2024-07-24T15:48:52.0128987+08:00||;True|2024-07-23T17:41:01.7494842+08:00||;True|2024-07-23T17:25:11.8773492+08:00||;True|2024-07-23T17:07:16.5460273+08:00||;True|2024-07-22T08:59:23.3235603+08:00||;True|2024-07-12T17:35:11.1225017+08:00||;True|2024-07-11T11:40:17.3581147+08:00||;True|2024-07-04T17:20:50.0175739+08:00||;True|2024-07-02T11:26:14.2092751+08:00||;True|2024-07-02T09:21:51.3513605+08:00||;True|2024-07-01T17:47:56.0407256+08:00||;True|2024-07-01T16:42:55.7374984+08:00||;True|2024-07-01T15:49:58.9266967+08:00||;True|2024-07-01T14:35:48.1117178+08:00||;True|2024-07-01T11:41:52.2969338+08:00||;True|2024-07-01T11:13:02.6561160+08:00||;True|2024-06-28T15:28:43.1470725+08:00||;True|2024-06-28T15:16:20.1999596+08:00||;True|2024-06-28T15:14:56.2534743+08:00||;True|2024-06-28T15:02:41.3033806+08:00||;True|2024-06-28T13:37:28.2462742+08:00||;True|2024-06-28T11:06:30.7400535+08:00||;True|2024-06-26T15:24:17.1939896+08:00||;True|2024-06-26T14:33:06.3530466+08:00||;True|2024-06-26T09:45:24.4055568+08:00||;True|2024-06-25T15:45:57.6052473+08:00||;True|2024-06-25T10:17:17.7408916+08:00||;False|2024-06-25T10:16:23.5639654+08:00||;False|2024-06-25T10:15:28.3857721+08:00||;False|2024-06-25T10:10:59.5536995+08:00||;False|2024-06-25T10:07:10.4050937+08:00||;True|2024-06-24T15:22:18.2672769+08:00||;True|2024-06-24T15:01:04.8153621+08:00||;False|2024-06-24T15:00:29.9618848+08:00||;True|2024-06-24T14:07:19.9401637+08:00||;False|2024-06-24T14:06:36.1250570+08:00||;True|2024-06-21T15:13:57.4273503+08:00||;True|2024-06-21T15:04:37.8218608+08:00||;True|2024-06-21T14:12:48.0266638+08:00||;True|2024-06-21T13:52:30.0950155+08:00||;True|2024-06-20T11:02:42.9508506+08:00||;True|2024-06-19T11:43:01.1899282+08:00||;True|2024-06-19T11:23:01.2938141+08:00||;True|2024-06-18T08:51:21.6222152+08:00||;True|2024-06-17T09:20:35.0804494+08:00||;True|2024-06-17T08:41:58.1319484+08:00||;True|2024-06-17T08:38:09.0137102+08:00||;True|2024-06-14T15:19:45.7395180+08:00||;True|2024-06-14T14:38:49.7094421+08:00||;True|2024-06-14T14:27:39.2815370+08:00||;True|2024-06-14T09:42:21.5397525+08:00||;True|2024-06-13T16:03:39.8475642+08:00||;True|2024-06-13T14:12:10.1725629+08:00||;True|2024-06-13T10:46:52.6971321+08:00||;True|2024-06-11T17:03:44.8328978+08:00||;True|2024-06-06T17:41:51.1810315+08:00||;True|2024-06-06T10:57:27.8273617+08:00||;True|2024-06-04T14:23:21.3742450+08:00||;True|2024-05-31T17:01:42.4717460+08:00||;True|2024-05-31T13:56:03.0734064+08:00||;True|2024-05-31T08:45:52.3549394+08:00||;True|2024-05-30T17:16:32.8907958+08:00||;True|2024-05-30T16:18:06.9957657+08:00||;True|2024-05-29T15:44:18.4051203+08:00||;True|2024-05-29T15:11:03.1518632+08:00||;True|2024-05-29T14:52:26.0823495+08:00||;True|2024-05-29T11:17:20.2245101+08:00||;True|2024-05-29T08:36:28.9569161+08:00||;True|2024-05-28T08:44:31.4427261+08:00||;False|2024-05-28T08:44:02.5254826+08:00||;True|2024-05-27T15:16:32.9413631+08:00||;True|2024-05-27T15:03:42.9803879+08:00||;True|2024-05-27T08:49:54.3933663+08:00||;True|2024-05-27T08:46:13.5862236+08:00||;True|2024-05-23T17:19:32.8154451+08:00||;True|2024-05-23T17:19:01.4587615+08:00||;True|2024-05-22T16:52:42.2166228+08:00||;True|2024-05-22T15:19:49.1773202+08:00||;True|2024-05-22T15:13:31.9485525+08:00||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>
Loading…
Cancel
Save