cjy 2 weeks ago
commit 9b0d2a1209

2
.gitignore vendored

@ -85,3 +85,5 @@ LinkAttach
/ds-wms-service/DS.WMS.FinanceApi/Properties/PublishProfiles/FolderProfile.pubxml
/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user
/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user
/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user
/ds-wms-service/DS.WMS.FeeApi/Properties/PublishProfiles/FolderProfile1.pubxml.user

@ -64,6 +64,7 @@ namespace DS.WMS.Core.Application.Method
var list = await TenantDb.Queryable<FeeRecord>()
.Where(f => bizIds.Contains(f.BusinessId) && types.Contains(f.BusinessType) && cIds.Contains(f.CustomerId)
&& f.FeeStatus == FeeStatus.AuditPassed)
.Where(inquiry.GetConditionalModels(Db))
.Select(f => new
{
f.BusinessId,

@ -322,6 +322,7 @@ namespace DS.WMS.Core.Application.Method
CustomerAccount = b.Account,
SettlementTypeId = a.SettlementTypeId,
SettlementTypeName = c.StlName,
CreateByName = a.CreateUserName
}, true).FirstAsync();
var result = DataResult<PaymentApplicationDto>.Success(dto);
@ -377,7 +378,9 @@ namespace DS.WMS.Core.Application.Method
x.Vessel,
x.Voyno,
x.Carrier,
x.Forwarder
x.Forwarder,
x.Sale,
x.SaleDeptName,
}).ToListAsync();
foreach (var item in g)
{
@ -395,6 +398,8 @@ namespace DS.WMS.Core.Application.Method
item.Voyage = biz.Voyno;
item.Carrier = biz.Carrier;
item.Forwarder = biz.Forwarder;
item.SaleName = biz.Sale;
item.SaleDeptName = biz.SaleDeptName;
}
}
break;

@ -87,6 +87,11 @@ namespace DS.WMS.Core.Fee.Entity
/// </summary>
public string LedgerAccount { get; set; }
/// <summary>
/// 审核通过/驳回时间
/// </summary>
public DateTime? ApprovalTime { get; set; }
}
}

@ -428,6 +428,7 @@ namespace DS.WMS.Core.Fee.Method
{
info.ReimbursementType = ReimbursementTypeEnums.Approved;
info.ApprovalTime=DateTime.Now;
tenantDb.Updateable(info).ExecuteCommand();
var dtllist = tenantDb.Queryable<FeeReimbursementDetail>().Where(t => t.PId == info.Id).ToList();
@ -449,7 +450,7 @@ namespace DS.WMS.Core.Fee.Method
if (callback.FlowStatus == FlowStatusEnum.Reject)
{
info.ReimbursementType = ReimbursementTypeEnums.Rejected;
info.ApprovalTime = DateTime.Now;
tenantDb.Updateable(info).ExecuteCommand();
@ -556,7 +557,7 @@ namespace DS.WMS.Core.Fee.Method
return DataResult.Success;
}
}
}
}

@ -1,4 +1,5 @@
using DS.WMS.Core.Fee.Entity;
using DS.Module.Core.Enums;
using DS.WMS.Core.Fee.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
@ -298,6 +299,46 @@ namespace DS.WMS.Core.Invoice.Dtos
/// 三种文件税局下载地址 Allfile
/// </summary>
public string? AllFileDownloadPath { get; set; }
/// <summary>
///报销人
/// </summary>
public string Reimburser { get; set; }
/// <summary>
/// 报销单号
/// </summary>
public string ReimbursementId { get; set; }
//付款申请号
//描述
/// <summary>
/// 科目名称
/// </summary>
public string LedgerAccount { get; set; }
/// <summary>
/// 报销事由
/// </summary>
public string Reason { get; set; }
/// <summary>
/// 报销申请时间
/// </summary>
public DateTime? ReimbTime { get; set; }
/// <summary>
/// 审核通过/驳回时间
/// </summary>
public DateTime? ApprovalTime { get; set; }
/// <summary>
/// 报销状态
/// </summary>
public ReimbursementTypeEnums ReimbursementType { get; set; }
}
@ -317,8 +358,41 @@ namespace DS.WMS.Core.Invoice.Dtos
public class GetDetailInfo:InInvoice
{
public List<InInvoiceDetail> Data { get; set; }
/// <summary>
///报销人
/// </summary>
public string Reimburser { get; set; }
/// <summary>
/// 报销单号
/// </summary>
public string ReimbursementId { get; set; }
//付款申请号
//描述
/// <summary>
/// 科目名称
/// </summary>
public string LedgerAccount { get; set; }
/// <summary>
/// 报销事由
/// </summary>
public string Reason { get; set; }
/// <summary>
/// 报销申请时间
/// </summary>
public DateTime? ReimbTime { get; set; }
/// <summary>
/// 审核通过/驳回时间
/// </summary>
public DateTime? ApprovalTime { get; set; }
}
}

@ -10,6 +10,10 @@
/// </summary>
public bool IgnoreSphfwssflhbbm { get; set; } = true;
/// <summary>
/// 是否通过开票平台发送邮件
/// </summary>
public bool sendMail { get; set; } = true;
/// <summary>
/// 请求体
/// </summary>

@ -18,6 +18,7 @@ using DS.WMS.Core.Invoice.Interface;
using DS.WMS.ContainerManagement.Info.Dtos;
using DS.WMS.ContainerManagement.Info.Entity;
using DS.WMS.Core.Fee.Dtos;
using System.Drawing;
namespace DS.WMS.Core.Invoice.Method
{
@ -57,9 +58,19 @@ namespace DS.WMS.Core.Invoice.Method
var result = await tenantDb.Queryable<InInvoice>()
.Where(whereList)
.Where(t => t.OrgId == user.OrgId)
.Select(t => new GetInInvoiceListOutPut
.LeftJoin<FeeReimbursementDetail>((t, d) => t.InvoiceNumber == d.InvoiceNumber)
.LeftJoin<FeeReimbursement>((t, d, r) => d.PId == r.Id)
.Select((t, d, r) => new GetInInvoiceListOutPut
{
Id = t.Id,
ReimbursementId = r.ReimbursementId,
Reimburser = r.Reimburser,
LedgerAccount = r.LedgerAccount,
Reason = r.Reason,
ReimbTime = r.CreateTime,
ApprovalTime = r.ApprovalTime
}, true)
.ToQueryPageAsync(request.PageCondition);
@ -77,10 +88,19 @@ namespace DS.WMS.Core.Invoice.Method
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var Data = await tenantDb.Queryable<InInvoice>()
.Where(t => t.OrgId == user.OrgId && t.Id == request.Id)
.Select(t => new GetDetailInfo()
.LeftJoin<FeeReimbursementDetail>((t, d) => t.InvoiceNumber == d.InvoiceNumber)
.LeftJoin<FeeReimbursement>((t, d, r) => d.PId == r.Id)
.Select((t, d, r) => new GetDetailInfo()
{
Id = t.Id
Id = t.Id,
ReimbursementId = r.ReimbursementId,
Reimburser = r.Reimburser,
LedgerAccount = r.LedgerAccount,
Reason = r.Reason,
ReimbTime = r.CreateTime,
ApprovalTime = r.ApprovalTime
}, true).FirstAsync();
if (Data != null)
{

@ -113,13 +113,21 @@ namespace DS.WMS.Core.Invoice.Method
var order = await TenantDb.Queryable<Entity.Invoice>().Where(x => ids.Contains(x.Id)).FirstAsync();
//如果开票中所属机构为空,则取用户的orgId
var userOrgId = (order.SaleDeptId != null && order.SaleDeptId > 0) ? order.SaleDeptId : User.OrgId;
var orgauthinfo = Db.Queryable<SysOrg>().LeftJoin<SysOrgAuth>((t, a) => t.Id == a.OrgId)
.Where((t, a) => t.Id == order.SaleDeptId)
.Where((t, a) => t.Id == userOrgId)
.Select((t, a) => new
{
a.Key,
a.Secret
}).First();
if (orgauthinfo==null)
{
//未匹配到请求密钥,请检查
return DataResult.Failed("未匹配到请求密钥,请检查");
}
api.DefaultHeaders.Add("USER_KEY", orgauthinfo.Key);
api.DefaultHeaders.Add("USER_SECRET", orgauthinfo.Secret);
@ -173,14 +181,25 @@ namespace DS.WMS.Core.Invoice.Method
//var result = await api.PostAsync<InvoiceResult<InvoiceQuery>>("/api/Invoice/GetInvoiceState", new { guid = sn });
//调用查询API获取发票号
var order = await TenantDb.Queryable<Entity.Invoice>().Where(x => x.SN == sn).FirstAsync();
//如果开票中所属机构为空,则取用户的orgId
var userOrgId = (order.SaleDeptId != null && order.SaleDeptId > 0) ? order.SaleDeptId : User.OrgId;
var orgauthinfo = Db.Queryable<SysOrg>().LeftJoin<SysOrgAuth>((t, a) => t.Id == a.OrgId)
.Where((t, a) => t.Id == order.SaleDeptId)
.Where((t, a) => t.Id == userOrgId)
.Select((t, a) => new
{
a.Key,
a.Secret
}).First();
if (orgauthinfo == null)
{
//未匹配到请求密钥,请检查
return DataResult.Failed("未匹配到请求密钥,请检查");
}
api.DefaultHeaders.Add("USER_KEY", orgauthinfo.Key);
api.DefaultHeaders.Add("USER_SECRET", orgauthinfo.Secret);
var result = await api.PostAsync<InvoiceResult<InvoiceQuery>>(AppSetting.app(new string[] { "InvoiceApi", "BaseUrl" }) + "/api/Invoice/GetInvoiceState", new { guid = sn });

@ -13,6 +13,7 @@ using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Sys.Entity;
using DS.WMS.Core.Sys.Interface;
using Mapster;
using Masuit.Tools.Models;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
@ -248,6 +249,7 @@ namespace DS.WMS.Core.Invoice.Method
x.FeeType,
x.FeeName,
x.ApplyAmount,
x.ExchangeRate,
x.OriginalAmount,
x.Currency,
x.OriginalCurrency,
@ -313,11 +315,11 @@ namespace DS.WMS.Core.Invoice.Method
FeeId = item.FeeId,
FeeName = item.FeeName,
FeeType = item.FeeType,
Currency = invoice.Currency,
OriginalCurrency = item.Currency,
Currency = item.Currency,
OriginalCurrency = item.OriginalCurrency,
ApplyAmount = item.ApplyAmount - item.ProcessedAmount,
OriginalAmount = item.OriginalAmount - item.OriginalProcessedAmount,
ExchangeRate = 1
ExchangeRate = item.ExchangeRate
};
var app = request.Applications.Find(x => x.ApplicationId == item.ApplicationId);
@ -340,21 +342,21 @@ namespace DS.WMS.Core.Invoice.Method
var details2 = invoice.Details.Where(x => x.RefId == app.ApplicationId).OrderBy(x => x.ApplyAmount).ToList();
if (app.AmountRMB.HasValue)
{
result2 = AssignAmount(details2.FindAll(x => x.OriginalCurrency == FeeCurrency.RMB_CODE), app.AmountRMB.Value);
result2 = AssignAmount(details2.FindAll(x => x.Currency == FeeCurrency.RMB_CODE), app.AmountRMB.Value);
if (!result2.Succeeded)
return DataResult<TEntity>.Failed(result2.Message, result2.MultiCode);
}
if (app.AmountUSD.HasValue)
{
result2 = AssignAmount(details2.FindAll(x => x.OriginalCurrency == FeeCurrency.USD_CODE), app.AmountUSD.Value);
result2 = AssignAmount(details2.FindAll(x => x.Currency == FeeCurrency.USD_CODE), app.AmountUSD.Value);
if (!result2.Succeeded)
return DataResult<TEntity>.Failed(result2.Message, result2.MultiCode);
}
if (app.AmountOther.HasValue)
{
result2 = AssignAmount(details2.FindAll(x => x.OriginalCurrency != FeeCurrency.RMB_CODE && x.OriginalCurrency != FeeCurrency.USD_CODE), app.AmountOther.Value);
result2 = AssignAmount(details2.FindAll(x => x.Currency != FeeCurrency.RMB_CODE && x.OriginalCurrency != FeeCurrency.USD_CODE), app.AmountOther.Value);
if (!result2.Succeeded)
return DataResult<TEntity>.Failed(result2.Message, result2.MultiCode);
}
@ -586,7 +588,7 @@ namespace DS.WMS.Core.Invoice.Method
if (invoiceAmount == 0)
return DataResult.Failed("开票金额不能为零");
var totalAmount = details.Sum(x => x.OriginalAmount);
var totalAmount = details.Sum(x => x.OriginalAmount * x.ExchangeRate.GetValueOrDefault());
if (Math.Abs(invoiceAmount) > totalAmount)
return DataResult.Failed("申请开票金额不能大于剩余开票金额");
@ -604,6 +606,11 @@ namespace DS.WMS.Core.Invoice.Method
detail.ApplyAmount = detail.OriginalAmount * detail.ExchangeRate.GetValueOrDefault();
}
}
else
{
foreach (var detail in details)
detail.ApplyAmount = detail.OriginalAmount * detail.ExchangeRate.GetValueOrDefault();
}
return DataResult.Success;
}
@ -620,7 +627,7 @@ namespace DS.WMS.Core.Invoice.Method
return;
invoice.InvoiceDetails ??= [];
var currencies = invoice.Details.Select(x => x.Currency).Distinct();
var currencies = invoice.Details.Select(x => x.OriginalCurrency).Distinct();
var codeList = await TenantDb.Queryable<CodeInvoice>()
.Where(ci => currencies.Contains(ci.DefaultCurrency))
.OrderBy(ci => ci.IsDefault)
@ -636,7 +643,7 @@ namespace DS.WMS.Core.Invoice.Method
foreach (var detail in invoice.Details)
{
var code = codeList.Find(x => x.DefaultCurrency == detail.Currency);
var code = codeList.Find(x => x.DefaultCurrency == detail.OriginalCurrency);
if (code == null || string.IsNullOrEmpty(code.Name))
continue;

@ -249,5 +249,11 @@ namespace DS.WMS.Core.Op.Entity
/// </summary>
[Description("箱管_单程租入业务")]
CM_RentOneWay_In = 108,
/// <summary>
/// 报销单
/// </summary>
[Description("报销单")]
Reimbursement = 200,
}
}

@ -55,7 +55,6 @@ namespace DS.WMS.Core.Settlement.Dtos
/// </summary>
public decimal InvoiceAmount { get; set; }
/// <summary>
/// 原始金额
/// </summary>
@ -71,6 +70,26 @@ namespace DS.WMS.Core.Settlement.Dtos
/// </summary>
public decimal? USDApplyAmount { get; set; }
/// <summary>
/// RMB结算金额
/// </summary>
public decimal? RMBStlAmount { get; set; }
/// <summary>
/// USD结算金额
/// </summary>
public decimal? USDStlAmount { get; set; }
/// <summary>
/// RMB未结金额
/// </summary>
public decimal? RMBStlRestAmount { get; set; }
/// <summary>
/// USD未结金额
/// </summary>
public decimal? USDStlRestAmount { get; set; }
/// <summary>
/// 申请日期
/// </summary>

@ -43,7 +43,7 @@ namespace DS.WMS.Core.Settlement.Interface
/// </summary>
/// <param name="id">申请单ID</param>
/// <returns></returns>
Task<DataResult<List<PaymentApplicationDetailDto>>> GetApplicationDetailsAsync(long id);
Task<DataResult<List<PaymentApplicationDetailDto>>> GetApplicationDetailsAsync(long id, string currency);
/// <summary>
/// 获取费用明细

@ -42,8 +42,8 @@ namespace DS.WMS.Core.Settlement.Interface
/// <summary>
/// 根据业务编号及类型获取该票业务的币别
/// </summary>
/// <param name="items">业务ID与业务类型</param>
/// <param name="inquiry">业务ID与业务类型</param>
/// <returns></returns>
Task<DataResult<List<FeeClient>>> GetCurrenciesAsync(List<FeeClient> items);
Task<DataResult<List<FeeClient>>> GetCurrenciesAsync(DetailInquiry inquiry);
}
}

@ -12,6 +12,7 @@ using DS.WMS.Core.Settlement.Dtos;
using DS.WMS.Core.Settlement.Entity;
using DS.WMS.Core.Settlement.Interface;
using DS.WMS.Core.Sys.Entity;
using Masuit.Tools.Systems;
using SqlSugar;
namespace DS.WMS.Core.Settlement.Method
@ -39,7 +40,7 @@ namespace DS.WMS.Core.Settlement.Method
var query = TenantDb.Queryable<ApplicationSettlement>().WhereIF(!string.IsNullOrEmpty(request.OtherQueryCondition?.Number), x =>
SqlFunc.Subqueryable<ApplicationDetail>().InnerJoin<FeeRecord>((d, f) => d.RecordId == f.Id && f.BusinessType == BusinessType.OceanShippingExport)
.InnerJoin<SeaExport>((d, f, s) => f.BusinessId == s.Id).Where((d, f, s) =>
s.CustomerNo.Contains(request.OtherQueryCondition.Number) || s.BookingNo.Contains(request.OtherQueryCondition.Number) ||
s.CustomerNo.Contains(request.OtherQueryCondition.Number) || s.BookingNo.Contains(request.OtherQueryCondition.Number) ||
s.MBLNO.Contains(request.OtherQueryCondition.Number) || s.CustomerNum.Contains(request.OtherQueryCondition.Number)).Any())
.Select(x => new ApplicationSettlementDto
{
@ -141,17 +142,30 @@ namespace DS.WMS.Core.Settlement.Method
protected override async Task<List<SettlementDetailGroup>> GetSettlementDetails(long id)
{
var list = await TenantDb.Queryable<PaymentApplication>()
.InnerJoin<ApplicationDetail>((i, d1) => i.Id == d1.ApplicationId)
.InnerJoin<ApplicationDetail>((i, d1, d2) => d1.ApplicationId == d2.RefId)
.Where((i, d1, d2) => d2.ApplicationId == id &&
d2.Category == DetailCategory.PaidApplicationSettlement || d1.Category == DetailCategory.ChargeApplicationSettlement)
.InnerJoin<ApplicationDetail>((i, d1) => i.Id == d1.ApplicationId) //d1=申请明细
.InnerJoin<ApplicationDetail>((i, d1, d2) => d2.DetailId == d1.Id) //d2=结算明细
.Where((i, d1, d2) => d2.ApplicationId == id)
.GroupBy((i, d1, d2) => i.Id)
.Select((i, d1, d2) => new SettlementDetailGroup
{
SettlementAmount = SqlFunc.Subqueryable<ApplicationDetail>().Where(d3 => d3.ApplicationId == i.Id).Sum(d3 => d3.ApplyAmount),
Status = (int)i.Status,
BillNO = i.ApplicationNO,
PaymentDate = i.PaymentDate,
RMBApplyAmount = SqlFunc.Subqueryable<ApplicationDetail>().Where(x => x.ApplicationId == d2.RefId && x.Currency == FeeCurrency.RMB_CODE).Sum(x => x.ApplyAmount),
USDApplyAmount = SqlFunc.Subqueryable<ApplicationDetail>().Where(x => x.ApplicationId == d2.RefId && x.Currency == FeeCurrency.USD_CODE).Sum(x => x.ApplyAmount),
RMBStlAmount = SqlFunc.Subqueryable<ApplicationDetail>().Where(x => x.ApplicationId == i.Id && x.Currency == FeeCurrency.RMB_CODE).Sum(x => x.ApplyAmount),
USDStlAmount = SqlFunc.Subqueryable<ApplicationDetail>().Where(x => x.ApplicationId == i.Id && x.Currency == FeeCurrency.USD_CODE).Sum(x => x.ApplyAmount),
RMBStlRestAmount = SqlFunc.Subqueryable<ApplicationDetail>().Where(x => x.ApplicationId == i.Id && x.Currency == FeeCurrency.RMB_CODE).Sum(x => x.ApplyAmount - x.ProcessedAmount),
USDStlRestAmount = SqlFunc.Subqueryable<ApplicationDetail>().Where(x => x.ApplicationId == i.Id && x.Currency == FeeCurrency.USD_CODE).Sum(x => x.ApplyAmount - x.ProcessedAmount),
//ApplicationNOList = SqlFunc.Subqueryable<PaymentApplication>().Where(a => a.Id == d1.RefId.Value).ToList(a => a.ApplicationNO)
}, true).ToListAsync();
foreach (var item in list)
{
PaymentApplicationStatus status = (PaymentApplicationStatus)item.Status;
item.StatusText = status.GetDescription();
}
return list;
}
@ -186,6 +200,7 @@ namespace DS.WMS.Core.Settlement.Method
FeeType = d.FeeType,
Amount = d.Amount, //总金额
ApplyAmount = d.ApplyAmount, //已结算金额
SettlementAmount = d.ApplyAmount,
RestAmount = d.ApplyAmount - d.ProcessedAmount, //剩余结算金额
CustomerId = d.CustomerId,
CustomerName = d.CustomerName,
@ -279,10 +294,11 @@ namespace DS.WMS.Core.Settlement.Method
/// </summary>
/// <param name="id">申请单ID</param>
/// <returns></returns>
public async Task<DataResult<List<PaymentApplicationDetailDto>>> GetApplicationDetailsAsync(long id)
public async Task<DataResult<List<PaymentApplicationDetailDto>>> GetApplicationDetailsAsync(long id, string currency)
{
var details = await TenantDb.Queryable<ApplicationDetail>().Where(d => d.ApplicationId == id && (d.ApplyAmount - d.ProcessedAmount) != 0)
.InnerJoin<FeeRecord>((d, f) => d.RecordId == f.Id)
.WhereIF(!string.IsNullOrEmpty(currency), x => x.Currency == currency)
.Select((d, f) => new PaymentApplicationDetailDto
{
Id = d.Id,
@ -472,40 +488,42 @@ namespace DS.WMS.Core.Settlement.Method
protected override async Task<ApplicationSettlement> PostSaveAsync(ApplicationSettlement settlement)
{
//回写付费申请的状态
var ids = settlement.Details.Select(x => x.DetailId);
var appIds = await TenantDb.Queryable<ApplicationDetail>().Where(x => ids.Contains(x.Id) && (x.Category == DetailCategory.PaidApplication || x.Category == DetailCategory.ChargeApplication))
.Select(x => x.ApplicationId).ToListAsync();
if (settlement.BillType == SettlementBillType.Payment)
{
var ids = settlement.Details.Select(x => x.DetailId);
var appIds = await TenantDb.Queryable<ApplicationDetail>().Where(x => ids.Contains(x.Id) && x.Category == DetailCategory.PaidApplication)
.Select(x => x.ApplicationId).ToListAsync();
var details = await TenantDb.Queryable<ApplicationDetail>().Where(x => appIds.Contains(x.ApplicationId) && x.Category == DetailCategory.PaidApplication)
.GroupBy(x => x.ApplicationId).Select(x => new
{
x.ApplicationId,
Count = SqlFunc.AggregateCount(x.Id),
ProcessedCount = SqlFunc.Subqueryable<ApplicationDetail>().Where(y => appIds.Contains(y.ApplicationId) &&
y.Category == DetailCategory.PaidApplication && y.OriginalAmount - y.OriginalProcessedAmount == 0).Count()
}).ToListAsync();
var details = await TenantDb.Queryable<ApplicationDetail>().Where(x => appIds.Contains(x.ApplicationId) &&
(x.Category == DetailCategory.PaidApplication || x.Category == DetailCategory.ChargeApplication))
.GroupBy(x => x.ApplicationId).Select(x => new
List<PaymentApplication> applications = [];
foreach (var item in details)
{
x.ApplicationId,
Count = SqlFunc.AggregateCount(x.Id),
ProcessedCount = SqlFunc.Subqueryable<ApplicationDetail>().Where(y => appIds.Contains(y.ApplicationId) &&
(y.Category == DetailCategory.PaidApplication || y.Category == DetailCategory.ChargeApplication) &&
y.OriginalAmount - y.OriginalProcessedAmount == 0).Count()
}).ToListAsync();
if (item.Count == 0 || item.ProcessedCount == 0)
continue;
List<PaymentApplication> applications = [];
foreach (var item in details)
{
if (item.Count == 0 || item.ProcessedCount == 0)
continue;
var entity = new PaymentApplication { Id = item.ApplicationId };
if (item.Count == item.ProcessedCount)
{
entity.Status = PaymentApplicationStatus.SettlementCompleted;
}
else if (item.ProcessedCount != 0)
{
entity.Status = PaymentApplicationStatus.PartialSettlement;
}
var entity = new PaymentApplication { Id = item.ApplicationId };
if (item.Count == item.ProcessedCount)
{
entity.Status = PaymentApplicationStatus.SettlementCompleted;
}
else if (item.ProcessedCount != 0)
{
entity.Status = PaymentApplicationStatus.PartialSettlement;
applications.Add(entity);
}
applications.Add(entity);
await TenantDb.Updateable(applications).UpdateColumns(x => new { x.Status }).ExecuteCommandAsync();
}
await TenantDb.Updateable(applications).UpdateColumns(x => new { x.Status }).ExecuteCommandAsync();
return await base.PostSaveAsync(settlement);
}

@ -7,7 +7,6 @@ using DS.WMS.Core.Application.Entity;
using DS.WMS.Core.Code.Entity;
using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Invoice.Dtos;
using DS.WMS.Core.Invoice.Entity;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Settlement.Dtos;
using DS.WMS.Core.Settlement.Entity;
@ -53,7 +52,7 @@ namespace DS.WMS.Core.Settlement.Method
ETD = x.ETD,
CustomNo = x.CustomNo,
BookingNo = x.BookingNo,
Sale = x.Sale,
AccountDate = x.AccountDate,
Operator = x.Operator,
@ -175,8 +174,7 @@ namespace DS.WMS.Core.Settlement.Method
var cIds = inquiry.Items.Select(x => x.CustomerId).Distinct();
var list = await TenantDb.Queryable<FeeRecord>()
.Where(f => bizIds.Contains(f.BusinessId) && types.Contains(f.BusinessType) && cIds.Contains(f.CustomerId) &&
(f.FeeStatus == FeeStatus.AuditPassed || f.FeeStatus == FeeStatus.PartialSettlement) && (f.Amount - f.SettlementAmount - f.OrderAmount + f.OrderSettlementAmount) != 0)
.Where(f => bizIds.Contains(f.BusinessId) && types.Contains(f.BusinessType) && cIds.Contains(f.CustomerId))
.Where(inquiry.GetConditionalModels(Db))
.Select(f => new FeeItem
{
@ -188,10 +186,10 @@ namespace DS.WMS.Core.Settlement.Method
FeeId = f.FeeId,
FeeName = f.FeeName,
FeeType = f.FeeType,
TotalAmount = f.Amount,
Amount = f.Amount,
Currency = f.Currency,
OriginalRate = f.ExchangeRate,
RestAmount = f.Amount - f.SettlementAmount - f.OrderAmount + f.OrderSettlementAmount,
RestAmount = f.Amount - f.SettlementAmount,
InvoiceAmount = f.InvoiceAmount,
AccTaxRate = f.AccTaxRate,
Remark = f.Remark
@ -210,17 +208,18 @@ namespace DS.WMS.Core.Settlement.Method
/// <summary>
/// 根据业务编号及类型获取该票业务的币别
/// </summary>
/// <param name="items">业务ID与业务类型</param>
/// <param name="inquiry">业务ID与业务类型</param>
/// <returns></returns>
public async Task<DataResult<List<FeeClient>>> GetCurrenciesAsync(List<FeeClient> items)
public async Task<DataResult<List<FeeClient>>> GetCurrenciesAsync(DetailInquiry inquiry)
{
var bizIds = items.Select(x => x.Id).Distinct();
var types = items.Select(x => x.BusinessType).Distinct();
var cIds = items.Select(x => x.CustomerId).Distinct();
var bizIds = inquiry.Items.Select(x => x.Id).Distinct();
var types = inquiry.Items.Select(x => x.BusinessType).Distinct();
var cIds = inquiry.Items.Select(x => x.CustomerId).Distinct();
var list = await TenantDb.Queryable<FeeRecord>()
.Where(f => bizIds.Contains(f.BusinessId) && types.Contains(f.BusinessType) && cIds.Contains(f.CustomerId)
&& (f.FeeStatus == FeeStatus.AuditPassed || f.FeeStatus == FeeStatus.PartialSettlement))
.Where(inquiry.GetConditionalModels(Db))
.Select(f => new
{
f.BusinessId,
@ -230,7 +229,7 @@ namespace DS.WMS.Core.Settlement.Method
f.ExchangeRate
}).ToListAsync();
foreach (var item in items)
foreach (var item in inquiry.Items)
{
item.ExchangeRates = list.Where(x => x.BusinessId == item.Id && x.BusinessType == item.BusinessType && x.CustomerId == item.CustomerId)
.GroupBy(x => x.Currency).Select(x => new CurrencyExchangeRate
@ -240,7 +239,7 @@ namespace DS.WMS.Core.Settlement.Method
}).ToList();
}
return DataResult<List<FeeClient>>.Success(items);
return DataResult<List<FeeClient>>.Success(inquiry.Items);
}
/// <summary>

@ -114,6 +114,9 @@ namespace DS.WMS.Core.Settlement.Method
{
var detailCategory = settlement.Mode == SettlementMode.Payment ? DetailCategory.PaidApplication : DetailCategory.ChargeApplication;
details1 = await TenantDb.Queryable<ApplicationDetail>().Where(x => ids.Contains(x.ApplicationId) && x.Category == detailCategory)
.WhereIF(request.Documents.Any(x => x.SettlementRMB.HasValue), x => x.Currency == FeeCurrency.RMB_CODE)
.WhereIF(request.Documents.Any(x => x.SettlementUSD.HasValue), x => x.Currency == FeeCurrency.USD_CODE)
.WhereIF(request.Documents.Any(x => x.SettlementOther.HasValue), x => x.Currency != FeeCurrency.RMB_CODE && x.Currency != FeeCurrency.USD_CODE)
.Select(x => new ApplicationDetail
{
ApplicationId = settlement.Id,
@ -157,6 +160,9 @@ namespace DS.WMS.Core.Settlement.Method
else if (settlement.Mode == SettlementMode.InvoiceSettlement || settlement.Mode == SettlementMode.PaymentInvoiceSettlement)
{
details1 = await TenantDb.Queryable<ApplicationDetail>().Where(x => ids.Contains(x.ApplicationId) && x.Category == DetailCategory.InvoiceIssuance)
.WhereIF(request.Documents.Any(x => x.SettlementRMB.HasValue), x => x.Currency == FeeCurrency.RMB_CODE)
.WhereIF(request.Documents.Any(x => x.SettlementUSD.HasValue), x => x.Currency == FeeCurrency.USD_CODE)
.WhereIF(request.Documents.Any(x => x.SettlementOther.HasValue), x => x.Currency != FeeCurrency.RMB_CODE && x.Currency != FeeCurrency.USD_CODE)
.Select(x => new ApplicationDetail
{
ApplicationId = settlement.Id,

@ -26,5 +26,10 @@ namespace DS.WMS.Core.TaskInteraction.Dtos
/// 任务描述
/// </summary>
public string? TaskDesc { get; set; }
/// <summary>
/// 忽略状态检查
/// </summary>
public bool IgnoreStatusCheck { get; set; }
}
}

@ -1,4 +1,6 @@
using DS.Module.Core;
using DS.Module.Core.Enums;
using DS.WMS.Core.Application.Entity;
using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.Flow.Entity;
using DS.WMS.Core.TaskInteraction.Dtos;
@ -34,12 +36,12 @@ namespace DS.WMS.Core.TaskInteraction.Method
DataResult result = DataResult.Success;
var tasks = tasksList.FindAll(x => x.TaskStatus == TaskStatusEnum.Create);
//var task2 = tasksList.FindAll(x => x.TaskStatus == TaskStatusEnum.Complete);
var task2 = tasksList.FindAll(x => x.TaskStatus == TaskStatusEnum.Complete);
await TenantDb.Ado.BeginTranAsync();
try
{
//状态待审核的任务
if (tasksList.Count > 0)
if (tasks.Count > 0)
{
var flowIds = tasks.Select(x => x.FlowId.Value);
var flowInstances = await Db.Queryable<FlowInstance>().Where(x => flowIds.Contains(x.Id)).ToListAsync();
@ -72,21 +74,48 @@ namespace DS.WMS.Core.TaskInteraction.Method
}
}
////已完成审核的任务
//if (task2.Count > 0)
//{
// switch (request.TaskType)
// {
// case TaskBaseTypeEnum.APPLICATION_PAYMENT_AUDIT:
// break;
//已完成审核的任务
if (task2.Count > 0)
{
foreach (var task in task2)
{
result = await SetTaskStatusAsync(new TaskUpdateRequest
{
BusinessId = task.BusinessId,
BusinessType = task.BusinessType,
TaskTypeName = task.TaskType.ToString(),
RejectReason = request.Remark,
TaskStatus = TaskStatusEnum.Pending,
TaskDesc = request.Remark,
IgnoreStatusCheck = true
}, false);
if (!result.Succeeded)
return result;
}
var ids = task2.Select(x => x.BusinessId);
switch (request.TaskType)
{
case TaskBaseTypeEnum.APPLICATION_PAYMENT_AUDIT:
await TenantDb.Updateable<PaymentApplication>().Where(x => ids.Contains(x.Id))
.SetColumns(x => x.Status == PaymentApplicationStatus.AuditRejected)
.SetColumns(x => x.Reason == request.Remark)
.ExecuteCommandAsync();
break;
// case TaskBaseTypeEnum.APPLICATION_INVOICE_AUDIT:
// break;
case TaskBaseTypeEnum.APPLICATION_INVOICE_AUDIT:
await TenantDb.Updateable<InvoiceApplication>().Where(x => ids.Contains(x.Id))
.SetColumns(x => x.Status == InvoiceApplicationStatus.AuditRejected)
.SetColumns(x => x.Reason == request.Remark)
.ExecuteCommandAsync();
break;
// default:
// return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
// }
//}
default:
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.BusinessNotSupported));
}
}
await TenantDb.Ado.CommitTranAsync();
return result;

@ -453,7 +453,7 @@ namespace DS.WMS.Core.TaskInteraction.Method
BusinessTask task = await GetQuery(request.BusinessId, request.BusinessType, request.TaskType).FirstAsync();
if (task == null)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskNotExists));
if (task.TaskStatus == TaskStatusEnum.Complete)
if (task.TaskStatus == TaskStatusEnum.Complete && !request.IgnoreStatusCheck)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskCompleted));
if (request.TaskStatus == TaskStatusEnum.Complete && await TenantDb.Queryable<BusinessTask>().AnyAsync(x => x.ParentId == task.Id && x.TaskStatus != request.TaskStatus))
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.UnfinishedItems));
@ -1108,7 +1108,8 @@ namespace DS.WMS.Core.TaskInteraction.Method
BusinessId = callback.BusinessId,
BusinessType = callback.BusinessType,
TaskTypeName = GetRejectedType(callback.AuditType.Value).ToString(),
RecvUserIdList = [task.CreateBy] //通知任务发起人
RecvUserIdList = [task.CreateBy], //通知任务发起人
TaskDescription = remark,
};
//创建驳回任务以进行通知
await CreateTaskAsync(request, false);

@ -85,12 +85,12 @@ namespace DS.WMS.FeeApi.Controllers
/// <summary>
/// 根据业务编号及类型获取该票业务的币别
/// </summary>
/// <param name="items">业务ID与业务类型</param>
/// <param name="inquiry">业务ID与业务类型</param>
/// <returns></returns>
[HttpPost, Route("GetCurrencies")]
public async Task<DataResult<List<FeeClient>>> GetCurrenciesAsync([FromBody] List<FeeClient> items)
public async Task<DataResult<List<FeeClient>>> GetCurrenciesAsync([FromBody] DetailInquiry inquiry)
{
return await _service.GetCurrenciesAsync(items);
return await _service.GetCurrenciesAsync(inquiry);
}
/// <summary>

@ -74,11 +74,12 @@ namespace DS.WMS.FeeApi.Controllers
/// 获取付费申请的费用明细
/// </summary>
/// <param name="id">付费申请单ID</param>
/// <param name="currency">费用币别(可空)</param>
/// <returns></returns>
[HttpGet, Route("GetApplicationDetailsById")]
public async Task<DataResult<List<PaymentApplicationDetailDto>>> GetApplicationDetailsAsync(long id)
public async Task<DataResult<List<PaymentApplicationDetailDto>>> GetApplicationDetailsAsync([FromQuery] long id, [FromQuery] string currency = null)
{
return await _service.GetApplicationDetailsAsync(id);
return await _service.GetApplicationDetailsAsync(id, currency);
}
/// <summary>

@ -1,7 +1,10 @@
using DS.Module.Core;
using AngleSharp.Dom;
using DS.Module.Core;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Interface;
using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.Invoice.Dtos;
using DS.WMS.Core.Sys.Entity;
using DS.WMS.Core.TaskPlat.Dtos;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
@ -140,5 +143,7 @@ namespace DS.WMS.FeeApi.Controllers
//11钉钉配置相关接口
}
}

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<_PublishTargetUrl>D:\Publish\DS8\FeeApi</_PublishTargetUrl>
<History>True|2024-11-06T11:01:27.9483417Z||;True|2024-11-06T18:55:18.2364740+08:00||;True|2024-11-06T17:27:38.2731683+08:00||;True|2024-11-06T16:15:44.1540206+08:00||;True|2024-11-06T12:00:32.4812370+08:00||;True|2024-11-06T11:20:40.3736064+08:00||;True|2024-11-06T10:10:34.5300344+08:00||;True|2024-11-06T09:40:38.5643842+08:00||;True|2024-11-05T19:07:36.6125691+08:00||;True|2024-11-05T18:46:33.8702047+08:00||;True|2024-11-05T18:42:41.4519018+08:00||;True|2024-11-05T18:16:03.1698058+08:00||;True|2024-11-05T11:48:07.5089999+08:00||;True|2024-11-04T17:39:07.1315345+08:00||;True|2024-11-04T17:32:28.9239052+08:00||;True|2024-11-04T15:49:58.6422421+08:00||;True|2024-11-04T15:39:25.1892907+08:00||;True|2024-11-04T15:21:49.7395112+08:00||;True|2024-11-04T11:26:53.4821041+08:00||;True|2024-11-04T11:19:48.8467193+08:00||;True|2024-11-04T11:01:39.9398452+08:00||;True|2024-11-04T10:30:55.0743204+08:00||;True|2024-11-02T21:17:44.8575190+08:00||;True|2024-11-02T20:54:29.9931812+08:00||;True|2024-11-02T20:39:20.4100370+08:00||;True|2024-11-02T18:33:41.0724285+08:00||;True|2024-11-02T18:21:55.8561639+08:00||;True|2024-11-02T17:36:24.3401782+08:00||;True|2024-11-02T16:38:03.0054105+08:00||;True|2024-11-02T16:26:26.1698304+08:00||;True|2024-11-02T16:15:20.2872358+08:00||;True|2024-11-02T15:19:14.9663838+08:00||;True|2024-11-02T14:39:47.8808708+08:00||;False|2024-11-02T14:22:04.2841792+08:00||;True|2024-11-02T11:50:48.2452805+08:00||;True|2024-10-29T18:52:12.7978878+08:00||;True|2024-10-29T10:27:49.1623527+08:00||;True|2024-10-25T15:09:27.7029075+08:00||;True|2024-10-25T10:29:26.9218878+08:00||;True|2024-10-22T17:58:39.9582805+08:00||;True|2024-10-21T17:57:21.7047579+08:00||;True|2024-10-21T14:30:54.4520206+08:00||;True|2024-10-21T10:19:05.7405749+08:00||;True|2024-10-18T16:11:05.4049685+08:00||;True|2024-10-18T14:59:49.1162741+08:00||;True|2024-10-16T16:29:15.3185348+08:00||;True|2024-10-16T14:12:58.1754214+08:00||;True|2024-10-16T14:08:06.5805581+08:00||;True|2024-10-16T11:55:29.8273176+08:00||;True|2024-10-15T17:39:40.4090324+08:00||;True|2024-10-15T17:06:43.0181578+08:00||;True|2024-10-15T15:07:38.9601925+08:00||;True|2024-10-12T13:33:32.4412583+08:00||;True|2024-10-11T17:00:54.0916209+08:00||;True|2024-10-11T10:54:50.3307087+08:00||;True|2024-10-11T10:45:07.8181500+08:00||;True|2024-10-11T10:40:44.2066046+08:00||;True|2024-10-11T10:21:25.7226983+08:00||;True|2024-10-11T10:09:05.5257478+08:00||;True|2024-10-10T14:58:29.1228618+08:00||;True|2024-10-10T14:05:59.4501659+08:00||;True|2024-10-10T11:08:58.9765455+08:00||;True|2024-10-08T17:59:07.5583287+08:00||;True|2024-09-27T19:01:59.6945760+08:00||;True|2024-09-27T18:45:48.2812860+08:00||;True|2024-09-27T18:10:25.5697467+08:00||;True|2024-09-27T17:39:06.3169139+08:00||;True|2024-09-27T17:30:14.1043193+08:00||;True|2024-09-27T16:02:09.0703159+08:00||;True|2024-09-27T15:53:05.1789245+08:00||;True|2024-09-27T15:32:52.1934490+08:00||;True|2024-09-27T13:51:24.9197626+08:00||;True|2024-09-27T13:48:17.2817346+08:00||;True|2024-09-27T11:51:46.8193040+08:00||;True|2024-09-27T10:58:33.1059648+08:00||;True|2024-09-27T10:37:35.0336563+08:00||;False|2024-09-27T10:31:52.6302264+08:00||;True|2024-09-26T19:50:15.5513195+08:00||;True|2024-09-26T19:47:14.0781788+08:00||;True|2024-09-26T19:01:26.5428388+08:00||;True|2024-09-26T18:35:28.7455319+08:00||;True|2024-09-26T18:24:30.8084807+08:00||;True|2024-09-26T18:20:47.3005460+08:00||;True|2024-09-26T18:04:39.8012913+08:00||;True|2024-09-26T17:48:13.8526872+08:00||;True|2024-09-26T16:08:20.1746970+08:00||;True|2024-09-26T16:01:01.1501975+08:00||;False|2024-09-26T16:00:34.1516745+08:00||;True|2024-09-26T14:33:03.4007570+08:00||;True|2024-09-25T19:14:27.8906774+08:00||;True|2024-09-25T18:57:40.1435131+08:00||;True|2024-09-25T17:38:44.0915841+08:00||;True|2024-09-25T15:33:58.4630618+08:00||;True|2024-09-25T15:10:31.3022063+08:00||;False|2024-09-25T14:14:40.9640545+08:00||;True|2024-09-25T10:09:32.2558600+08:00||;True|2024-09-25T09:59:17.1525160+08:00||;False|2024-09-25T09:57:58.7265103+08:00||;False|2024-09-25T09:53:36.7732713+08:00||;False|2024-09-24T18:40:10.0166224+08:00||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>

@ -10,6 +10,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.0" />
<PackageReference Include="RabbitMQ.Client" Version="6.8.1" />
</ItemGroup>
<ItemGroup>

@ -0,0 +1,94 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.FeeBillRecvService.Dtos
{
public class FeeBillReadDto
{
/// <summary>
/// 主键
/// </summary>
public string GID { get; set; }
/// <summary>
/// 提单号
/// </summary>
public string BookingBill { get; set; }
/// <summary>
/// 发票号
/// </summary>
public string InvoiceNumber { get; set; }
/// <summary>
/// 费用明细
/// </summary>
public List<FeeBillReadDetailDto> DetailList { get; set; }
}
public class FeeBillReadDetailDto
{
/// <summary>
/// 主键
/// </summary>
public string GID { get; set; }
/// <summary>
/// 费用名称
/// </summary>
public string CostName { get; set; }
/// <summary>
/// 单价
/// </summary>
public Nullable<decimal> UnitPrice { get; set; }
/// <summary>
/// 数量
/// </summary>
public Nullable<decimal> Quantity { get; set; }
/// <summary>
/// 总金额
/// </summary>
public Nullable<decimal> Amount { get; set; }
/// <summary>
/// 计费标准 BILL-按票
/// </summary>
public string FeeStandard { get; set; }
/// <summary>
/// 标题
/// </summary>
public string Tips { get; set; }
/// <summary>
/// 客户费用代码
/// </summary>
public string CustSysCode { get; set; }
/// <summary>
/// 客户费用名称
/// </summary>
public string CustSysName { get; set; }
/// <summary>
/// 币别
/// </summary>
public string CustCurrency { get; set; }
/// <summary>
/// 结算对象
/// </summary>
public string CustSettleFor { get; set; }
/// <summary>
/// 客户计费类型
/// </summary>
public string CustFeeStandard { get; set; }
}
}

@ -41,7 +41,9 @@ builder.Services.AddSaasDbInstall();//分库服务
//应用作为 Windows 服务
//builder.Services.AddWindowsService();
//builder.Services.AddHostedService<WindowsBackgroundService>();
builder.Services.AddHostedService<RecvFeeBillWorker>();
//允许 BackgroundService 中存在未经处理的异常,不停止主机
builder.Services.Configure<HostOptions>(hostOptions =>

@ -0,0 +1,119 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using RabbitMQ.Client;
using RabbitMQ.Client.Events;
namespace DS.WMS.FeeBillRecvService
{
public class RecvFeeBillWorker : BackgroundService
{
private readonly ILogger<RecvFeeBillWorker> _logger;
private IConnection mqConn;
private IModel model;
public RecvFeeBillWorker(ILogger<RecvFeeBillWorker> logger)
{
_logger = logger;
}
public override async Task StartAsync(CancellationToken stoppingToken)
{
try
{
//while (!stoppingToken.IsCancellationRequested)
//{
// _OpServer = new BackgroundJobServer(new BackgroundJobServerOptions
// {
// SchedulePollingInterval = TimeSpan.FromMinutes(1),
// ServerName = "OpWorkService",
// Queues = new[] { "op" }
// });
// await Task.Delay(TimeSpan.FromMinutes(1), stoppingToken);
//}
}
catch (OperationCanceledException ex)
{
Console.WriteLine(ex.ToString());
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
//Environment.Exit(1);
}
}
protected override Task ExecuteAsync(CancellationToken stoppingToken)
{
_logger.LogInformation("启动j账单 ExecuteAsync");
return Task.Run(() =>
{
_logger.LogInformation("BookingAutoService ExecuteAsync RunTask");
//绑定队列
BindMQ();
});
}
private void BindMQ()
{
string ExchangeName = "billcenter.output.ds7new.444c19c1-0bf5-4709-a08b-c9859ca775e6";
string QueueName = $"billcenter.output.ds7new.444c19c1-0bf5-4709-a08b-c9859ca775e6";
ConnectionFactory factory = new ConnectionFactory();
//var repoSysCfg = _serviceScope.ServiceProvider.GetService<SqlSugarRepository<SysConfig>>();
var mqUrl = "amqp://djy_mail:djymailqwe@47.104.207.5:12567/djy_email_parser";
//var mqUrl = repoSysCfg.FirstOrDefault(x => x.Code == "DjyBookingAutoMQUrl")?.Value;
if (string.IsNullOrEmpty(mqUrl))
{
_logger.LogError($"接收订舱自动化消息推送所需MQUrl未配置");
}
else
{
_logger.LogInformation($"准备连接订舱自动化消息队列:{mqUrl}");
factory.Uri = new Uri(mqUrl);
mqConn = factory.CreateConnection("东胜8接收账单邮件解析");
model = mqConn.CreateModel();
model.ExchangeDeclare(ExchangeName, ExchangeType.Topic);
model.QueueDeclare(QueueName, false, false, true, null);
model.QueueBind(QueueName, ExchangeName, "*", null);
var consumer = new EventingBasicConsumer(model);
consumer.Received += (obj, arg) =>
{
var body = arg.Body;
var strBody = Encoding.UTF8.GetString(body.ToArray());
_logger.LogInformation($"收到订舱自动化消息队列:{strBody}");
};
model.BasicConsume(QueueName, true, consumer);
}
}
public override void Dispose()
{
base.Dispose();
//_serviceScope.Dispose();
if (mqConn != null && mqConn.IsOpen)
mqConn.Close();
_logger.LogInformation("BookingAutoService Dispose");
}
private async Task DoWork(CancellationToken cancellationToken)
{
// 这里放你的业务逻辑代码
await Task.CompletedTask;
}
}
}

@ -0,0 +1,22 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"DBInfo": {
"DefaultDbConnId": "1288018625843826688",
"DefaultDbType": 0,
"DefaultDbString": "server=rm-m5e06xxqpa68a68ry5o.mysql.rds.aliyuncs.com;port=3306;uid=rulesengine_admin;pwd=Rule1qaz2wsx!QAZ;database=shippingweb8_dev",
"DBS": [
{
"ConnId": "1288018625843826680",
"DBType": 0,
"Enabled": false,
"HitRate": 40,
"Connection": "server=rm-m5e06xxqpa68a68ry5o.mysql.rds.aliyuncs.com;port=3306;uid=rulesengine_admin;pwd=Rule1qaz2wsx!QAZ;database=shippingweb8_log"
}
]
}
}
Loading…
Cancel
Save