From 2cf4f5d28031b3dee9afdbbaf6ac7e45bf0f953e Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Mon, 25 Mar 2024 16:45:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A1=E7=AE=97=E9=87=91?= =?UTF-8?q?=E9=A2=9D=E4=B8=BA0=20=E5=B0=B1=E4=B8=8D=E6=8F=92=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Financial/CalculateService.cs | 45 +++++++++++-------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/IRaCIS.Core.Application/Financial/CalculateService.cs b/IRaCIS.Core.Application/Financial/CalculateService.cs index 30c58f3..5729644 100644 --- a/IRaCIS.Core.Application/Financial/CalculateService.cs +++ b/IRaCIS.Core.Application/Financial/CalculateService.cs @@ -14,6 +14,7 @@ using IRaCIS.Core.Domain.Interfaces; using IRaCIS.Core.Domain.Models; using System.Data; using System.Linq.Dynamic.Core; +using System.Drawing; namespace IRaCIS.Application.Services { @@ -741,25 +742,33 @@ namespace IRaCIS.Application.Services } decimal totalUSD = award + totalNormal;//总费用 - result = AddOrUpdateMonthlyPayment(new PaymentCommand - { - DoctorId = doctor, - Year = param.CalculateMonth.Year, - Month = param.CalculateMonth.Month, - PaymentUSD = totalUSD, - CalculateUser = token, - CalculateTime = DateTime.Now, - ExchangeRate = exchangeRate, - PaymentCNY = exchangeRate * totalUSD, - }); + var paymentyearMonth = new DateTime(param.CalculateMonth.Year, param.CalculateMonth.Month, 1).ToString("yyyy-MM"); + var paymentModel = _paymentRepository.GetAll().FirstOrDefault(t => + t.DoctorId == doctor && t.YearMonth == paymentyearMonth); - - reviewerPaymentUSDList.Add(new ReviewerPaymentUSD { DoctorId = doctor, PaymentUSD = totalUSD, RecordId = result.Data }); - foreach (var detail in paymentDetailList) - { - detail.PaymentId = result.Data; - } - AddOrUpdateMonthlyPaymentDetail(paymentDetailList, result.Data); + // 计算金额为0 就不插入 + if (totalUSD != 0 || paymentModel != null) + { + result = AddOrUpdateMonthlyPayment(new PaymentCommand + { + DoctorId = doctor, + Year = param.CalculateMonth.Year, + Month = param.CalculateMonth.Month, + PaymentUSD = totalUSD, + CalculateUser = token, + CalculateTime = DateTime.Now, + ExchangeRate = exchangeRate, + PaymentCNY = exchangeRate * totalUSD, + }); + reviewerPaymentUSDList.Add(new ReviewerPaymentUSD { DoctorId = doctor, PaymentUSD = totalUSD, RecordId = result.Data }); + foreach (var detail in paymentDetailList) + { + detail.PaymentId = result.Data; + } + AddOrUpdateMonthlyPaymentDetail(paymentDetailList, result.Data); + } + + UpdatePaymentAdjustment(doctor, yearMonth); }