From f7bb0825bc06b8cea32caa44d2326dde51990e77 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期四, 11 九月 2025 11:10:55 +0800
Subject: [PATCH] feat: 公告

---
 LifePayment/LifePayment.HttpApi/LifePay/LifePayRateController.cs                             |    1 
 LifePayment/LifePayment.Application.Contracts/LifePay/LifePayAnnouncementInput.cs            |   63 +++++
 LifePayment/LifePayment.Application/LifePay/LifePayRateService.cs                            |   31 ++
 LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml                   |   52 ++++
 LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayRateService.cs                 |    2 
 LifePayment/LifePayment.EntityFrameworkCore/LifePaymentServicesDbContext.cs                  |    2 
 LifePayment/LifePayment.Application.Contracts/LifePay/LifePayInput.cs                        |    7 
 LifePayment/LifePayment.Application/LifePaymentServicesApplicationModuleAutoMapperProfile.cs |    3 
 LifePayment/LifePayment.Domain.Shared/Enum/LifePay/LifePayRateChannel.cs                     |   72 +++--
 LifePayment/LifePayment.Domain/LifePay/LifePayAnnouncement.cs                                |   37 +++
 LifePayment/LifePayment.Application.Contracts/LifePay/LifePayRateInput.cs                    |    7 
 LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayAnnouncementService.cs         |   40 +++
 LifePayment/LifePayment.Domain.Shared/Enum/LifePay/LifePayAnnouncement.cs                    |   44 +++
 LifePayment/LifePayment.Domain/LifePay/LifePayRateChannel.cs                                 |    2 
 LifePayment/LifePayment.HttpApi/LifePay/LifePayAnnouncementController.cs                     |   84 +++++++
 LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml                                  |   27 ++
 LifePayment/LifePayment.Application/LifePay/LifePayAnnouncementService.cs                    |  151 ++++++++++++
 LifePayment/LifePayment.Application/LifePay/LifePayService.cs                                |   63 +++--
 18 files changed, 629 insertions(+), 59 deletions(-)

diff --git a/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayAnnouncementService.cs b/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayAnnouncementService.cs
new file mode 100644
index 0000000..a22b78a
--- /dev/null
+++ b/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayAnnouncementService.cs
@@ -0,0 +1,40 @@
+锘縰sing LifePayment.Application.Contracts.LifePay;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.Application.Services;
+using ZeroD.Util;
+
+namespace LifePayment.Application.Contracts;
+
+public interface ILifePayAnnouncementService : IApplicationService
+{
+    /// <summary>
+    /// 鑾峰彇鍏憡鍒嗛〉
+    /// </summary>
+    /// <param name="input"></param>
+    /// <returns></returns>
+    Task<PageOutput<CreateEditLifePayAnnouncementOutput>> GetLifePayAnnouncementPage(GetLifePayAnnouncementPageInput input);
+
+    /// <summary>
+    /// 鏂板缂栬緫鍏憡
+    /// </summary>
+    /// <param name="input"></param>
+    /// <returns></returns>
+    Task<int> CreateOrEditLifePayAnnouncement(CreateEditLifePayAnnouncementInput input);
+
+    /// <summary>
+    /// 鍒犻櫎鍏憡
+    /// </summary>
+    /// <param name="id"></param>
+    /// <returns></returns>
+    Task<int> DeleteLifePayAnnouncement(Guid id);
+
+    /// <summary>
+    /// 鑾峰彇褰撳墠灞曠ず涓殑鍏憡
+    /// </summary>
+    /// <returns></returns>
+    Task<CreateEditLifePayAnnouncementOutput> GetShowingLifePayAnnouncement(GetShowingLifePayAnnouncementInput input);
+}
\ No newline at end of file
diff --git a/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayRateService.cs b/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayRateService.cs
index d76b1a0..79331fa 100644
--- a/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayRateService.cs
+++ b/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayRateService.cs
@@ -47,4 +47,6 @@
     /// <param name="id"></param>
     /// <returns></returns>
     Task<int> DeleteRateChannel(Guid id);
+
+    Task<CreateEditRateChannelOutput> GetRateChannelByCode(string code);
 }
\ No newline at end of file
diff --git a/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayAnnouncementInput.cs b/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayAnnouncementInput.cs
new file mode 100644
index 0000000..3f33199
--- /dev/null
+++ b/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayAnnouncementInput.cs
@@ -0,0 +1,63 @@
+锘縰sing LifePayment.Domain.Shared;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZeroD.Util;
+
+namespace LifePayment.Application.Contracts;
+
+public class CreateEditLifePayAnnouncementInput
+{
+    public Guid? Id { get; set; }
+
+    /// <summary>
+    /// 鍏憡绫诲瀷
+    /// </summary>
+    [Required(ErrorMessage = "鍏憡绫诲瀷鏄繀濉」銆�")]
+    public AnnouncementTypeEnum AnnouncementType { get; set; }
+
+    /// <summary>
+    /// 鐢熸晥鏃ユ湡
+    /// </summary>
+    [Required(ErrorMessage = "鐢熸晥鏃ユ湡鏄繀濉」銆�")]
+    public DateTime StartTime { get; set; }
+
+    /// <summary>
+    /// 鎴鏃ユ湡
+    /// </summary>
+    [Required(ErrorMessage = "鎴鏃ユ湡鏄繀濉」銆�")]
+    public DateTime EndTime { get; set; }
+
+    /// <summary>
+    /// 鍏憡鍐呭
+    /// </summary>
+    [Required(ErrorMessage = "鍏憡鍐呭鏄繀濉」銆�")]
+    public string AnnouncementContent { get; set; }
+}
+
+public class CreateEditLifePayAnnouncementOutput: CreateEditLifePayAnnouncementInput
+{
+    public DateTime CreationTime { get; set; }
+
+    public AnnouncementStatusEnum Status { get; set; }
+}
+
+public class GetLifePayAnnouncementPageInput : PageInput
+{
+    public DateTime? CreationTimeBegin { get; set; }
+    public DateTime? CreationTimeEnd { get; set; }
+
+    public DateTime? StartTime { get; set; }
+
+    public DateTime? EndTime { get; set; }
+
+    public AnnouncementStatusEnum? Status { get; set; }
+}
+
+public class GetShowingLifePayAnnouncementInput
+{
+    public AnnouncementTypeEnum? AnnouncementType { get; set; }
+}
\ No newline at end of file
diff --git a/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayInput.cs b/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayInput.cs
index dcc6ce2..4672d2e 100644
--- a/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayInput.cs
+++ b/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayInput.cs
@@ -887,4 +887,11 @@
 public class QueryLifePayChannlesInput
 {
     public LifePayChannelsStatsEnum? Status { get; set; }
+}
+
+public class GetLifePayRateOutput
+{
+    public decimal SupplierRate { get; set; }
+
+    public decimal Rate { get; set; }
 }
\ No newline at end of file
diff --git a/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayRateInput.cs b/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayRateInput.cs
index fd93e98..03bcd67 100644
--- a/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayRateInput.cs
+++ b/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayRateInput.cs
@@ -26,7 +26,7 @@
     /// ID
     /// </summary>
     [Required(ErrorMessage = "ID鏄繀濉」銆�")]
-    public int Code { get; set; }
+    public string Code { get; set; }
 
     /// <summary>
     /// 渚涘簲鍟嗘姌鎵�
@@ -61,4 +61,9 @@
 public class QueryRateChannelInput
 {
     public LifePayRateChannelStatus? Status { get; set; }
+
+    /// <summary>
+    /// 鍏呭�肩被鍨�
+    /// </summary>
+    public LifePayOrderTypeEnum? LifePayOrderType { get; set; }
 }
\ No newline at end of file
diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayAnnouncementService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayAnnouncementService.cs
new file mode 100644
index 0000000..968f89e
--- /dev/null
+++ b/LifePayment/LifePayment.Application/LifePay/LifePayAnnouncementService.cs
@@ -0,0 +1,151 @@
+锘縰sing AutoMapper.QueryableExtensions;
+using LifePayment.Application.Contracts;
+using LifePayment.Application.Contracts.LifePay;
+using LifePayment.Domain;
+using LifePayment.Domain.LifePay;
+using LifePayment.Domain.Models;
+using LifePayment.Domain.Shared;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.Application.Services;
+using Volo.Abp.Domain.Repositories;
+using Volo.Abp.ObjectMapping;
+using ZeroD.Util;
+using ZeroD.Util.Fadd;
+
+namespace LifePayment.Application.LifePay;
+
+
+public class LifePayAnnouncementService : ApplicationService, ILifePayAnnouncementService
+{
+    private readonly IRepository<LifePayAnnouncement, Guid> _lifePayAnnouncementRepository;
+
+    public LifePayAnnouncementService(IRepository<LifePayAnnouncement, Guid> lifePayAnnouncementRepository)
+    {
+        _lifePayAnnouncementRepository = lifePayAnnouncementRepository;
+    }
+
+    /// <summary>
+    /// 鑾峰彇鍏憡鍒嗛〉
+    /// </summary>
+    /// <param name="input"></param>
+    /// <returns></returns>
+    public async Task<PageOutput<CreateEditLifePayAnnouncementOutput>> GetLifePayAnnouncementPage(GetLifePayAnnouncementPageInput input)
+    {
+        var currentTime = DateTime.Now;
+        var query = _lifePayAnnouncementRepository
+            .WhereIf(input.CreationTimeBegin.HasValue, x => x.CreationTime >= input.CreationTimeBegin)
+            .WhereIf(input.CreationTimeEnd.HasValue, x => x.CreationTime <= input.CreationTimeEnd)
+            .WhereIf(input.StartTime.HasValue, x => x.StartTime >= input.StartTime)
+            .WhereIf(input.EndTime.HasValue, x => x.EndTime <= input.EndTime)
+            .WhereIf(input.Status.HasValue, x => input.Status.Value == AnnouncementStatusEnum.Wait
+                ? currentTime < x.StartTime
+                    : input.Status.Value == AnnouncementStatusEnum.Showing
+                        ? currentTime >= x.StartTime && currentTime <= x.EndTime
+                        : input.Status.Value == AnnouncementStatusEnum.Stop
+                            ? currentTime > x.EndTime
+                            : false)
+            .Select(x =>
+                    new CreateEditLifePayAnnouncementOutput()
+                    {
+                        Id = x.Id,
+                        AnnouncementType = x.AnnouncementType,
+                        StartTime = x.StartTime,
+                        EndTime = x.EndTime,
+                        AnnouncementContent = x.AnnouncementContent,
+                        CreationTime = x.CreationTime,
+                        Status = GetLifePayAnnouncementStatus(x.StartTime, x.EndTime)
+                    });
+
+        var result = await query.GetPageResult(input.PageModel);
+
+        return result;
+    }
+
+    /// <summary>
+    /// 鏂板缂栬緫鍏憡
+    /// </summary>
+    /// <param name="input"></param>
+    /// <returns></returns>
+    public async Task<int> CreateOrEditLifePayAnnouncement(CreateEditLifePayAnnouncementInput input)
+    {
+        CheckExtensions.IfTrueThrowUserFriendlyException(input.EndTime <= input.StartTime, "鎴鏃ユ湡涓嶈兘浣庝簬鐢熸晥鏃ユ湡");
+
+        bool isExist = await _lifePayAnnouncementRepository.AnyAsync(r => (!input.Id.HasValue||r.Id != input.Id.Value)&&input.AnnouncementType==r.AnnouncementType&&!(input.EndTime < r.StartTime || input.StartTime > r.EndTime));
+        CheckExtensions.IfTrueThrowUserFriendlyException(isExist, "鍚屼竴鏃堕棿娈靛彧鑳藉瓨鍦ㄤ竴鏉″叕鍛�");
+
+
+        if (input.Id.HasValue)
+        {
+            
+            var dto = await _lifePayAnnouncementRepository.FirstOrDefaultAsync(r => r.Id == input.Id.Value);
+            CheckExtensions.IfTrueThrowUserFriendlyException(dto == null, "鏈幏鍙栧埌鍏憡鏁版嵁");
+
+            dto.AnnouncementType = input.AnnouncementType;
+            dto.StartTime = input.StartTime;
+            dto.EndTime = input.EndTime;
+            dto.AnnouncementContent = input.AnnouncementContent;
+        }
+        else
+        {
+            input.Id = Guid.NewGuid();
+            var entity = ObjectMapper.Map<CreateEditLifePayAnnouncementInput, LifePayAnnouncement>(input);
+            await _lifePayAnnouncementRepository.InsertAsync(entity);
+        }
+
+        return Constant.SUCCESS;
+    }
+
+    /// <summary>
+    /// 鍒犻櫎鍏憡
+    /// </summary>
+    /// <param name="id"></param>
+    /// <returns></returns>
+    public async Task<int> DeleteLifePayAnnouncement(Guid id)
+    {
+        await _lifePayAnnouncementRepository.DeleteAsync(s => s.Id == id);
+
+        return Constant.SUCCESS;
+    }
+
+    /// <summary>
+    /// 鑾峰彇褰撳墠灞曠ず涓殑鍏憡
+    /// </summary>
+    /// <returns></returns>
+    public async Task<CreateEditLifePayAnnouncementOutput> GetShowingLifePayAnnouncement(GetShowingLifePayAnnouncementInput input)
+    {
+        DateTime now = DateTime.Now;
+        var announcement = await _lifePayAnnouncementRepository
+            .WhereIf(input.AnnouncementType.HasValue,x=>x.AnnouncementType==input.AnnouncementType)
+            .Where(x => now >= x.StartTime && now <= x.EndTime).OrderBy(r => r.StartTime).FirstOrDefaultAsync();
+        if (announcement == null)
+        {
+            return null;
+        }
+
+        var model = ObjectMapper.Map<LifePayAnnouncement, CreateEditLifePayAnnouncementOutput>(announcement);
+        model.Status = GetLifePayAnnouncementStatus(announcement.StartTime, announcement.EndTime);
+        return model;
+    }
+
+    private static AnnouncementStatusEnum GetLifePayAnnouncementStatus(DateTime startTime, DateTime endTime)
+    {
+        DateTime now = DateTime.Now;
+        if (now < startTime)
+        {
+            return AnnouncementStatusEnum.Wait;
+        }
+        else if (now >= startTime && now <= endTime)
+        {
+            return AnnouncementStatusEnum.Showing;
+        }
+        else
+        {
+            return AnnouncementStatusEnum.Stop;
+        }
+    }
+}
\ No newline at end of file
diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayRateService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayRateService.cs
index d8aca53..c567f61 100644
--- a/LifePayment/LifePayment.Application/LifePay/LifePayRateService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/LifePayRateService.cs
@@ -46,7 +46,10 @@
     /// <returns></returns>
     public async Task<List<CreateEditRateChannelOutput>> GetLifePayRateChannelAllList(QueryRateChannelInput input)
     {
-        return await GetLifePayRateChannelListFilter().WhereIf(input.Status.HasValue, x => x.Status == input.Status).OrderByDescending(r => r.CreationTime).ToListAsync();
+        return await GetLifePayRateChannelListFilter()
+            .WhereIf(input.LifePayOrderType.HasValue, x => x.LifePayOrderType == input.LifePayOrderType)
+            .WhereIf(input.Status.HasValue, x => x.Status == input.Status)
+            .OrderBy(r => r.CreationTime).ToListAsync();
     }
 
     /// <summary>
@@ -59,7 +62,7 @@
         CheckExtensions.IfTrueThrowUserFriendlyException(input.SupplierRate < 0.01m, "渚涘簲鍟嗘姌鎵h缃敊璇�");
         CheckExtensions.IfTrueThrowUserFriendlyException(input.PlatformRate < 0.01m, "骞冲彴鎶樻墸璁剧疆閿欒");
         CheckExtensions.IfTrueThrowUserFriendlyException(input.PlatformRate < input.SupplierRate, "骞冲彴鎶樻墸鏃犳硶浣庝簬渚涘簲鍟嗘姌鎵�");
-        bool isExist = await _lifePayRateChannelRepository.AnyAsync(r => r.Code == input.Code);
+        bool isExist = await _lifePayRateChannelRepository.AnyAsync(r => (!input.Id.HasValue || r.Id != input.Id.Value) && r.Code == input.Code);
         CheckExtensions.IfTrueThrowUserFriendlyException(isExist, "ID宸插瓨鍦�");
         if (input.Id.HasValue)
         {
@@ -112,6 +115,30 @@
         return Constant.SUCCESS;
     }
 
+    public async Task<CreateEditRateChannelOutput> GetRateChannelByCode(string code)
+    {
+        var dto = await _lifePayRateChannelRepository.FirstOrDefaultAsync(x => x.Code == code);
+        if (dto == null)
+        {
+            return new CreateEditRateChannelOutput();
+        }
+        else
+        {
+            return new CreateEditRateChannelOutput
+            {
+                Id = dto.Id,
+                LifePayOrderType = dto.LifePayOrderType,
+                RateChannelName = dto.RateChannelName,
+                Code = dto.Code,
+                SupplierRate = dto.SupplierRate,
+                PlatformRate = dto.PlatformRate,
+                Status = dto.Status,
+                Remark = dto.Remark,
+                CreationTime = dto.CreationTime,
+            };
+        }
+    }
+
     private IQueryable<CreateEditRateChannelOutput> GetLifePayRateChannelListFilter()
     {
         var query = from x in _lifePayRateChannelRepository
diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
index b658491..dcbc06f 100644
--- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
@@ -1,5 +1,6 @@
 锘縰sing Alipay.EasySDK.Payment.Common.Models;
 using LifePayment.Application.Contracts;
+using LifePayment.Application.LifePay;
 using LifePayment.Domain;
 using LifePayment.Domain.LifePay;
 using LifePayment.Domain.Models;
@@ -50,6 +51,7 @@
     private readonly IAliPayApi _aliPayApi;
     private readonly IAlipayInterfaceManager _alipayInterfaceManager;
     private readonly IWxPayApi _wxPayApi;
+    private readonly ILifePayRateService _lifePayRateService;
     private readonly WxPayOption _wxPayOptions;
     private readonly InitSetting _initSettingOptions;
 
@@ -77,6 +79,7 @@
                           IRepository<LifePayAccount, Guid> lifePayAccount,
                           IDataFilter dataFilter,
                           IChannelFilter channelFilter,
+                          ILifePayRateService lifePayRateService,
                           IAbpDistributedLock distributedLock)
     {
         _logger = logger;
@@ -101,6 +104,7 @@
         _channelFilter = channelFilter;
         this.distributedLock = distributedLock;
         _operateHistory = operateHistory;
+        _lifePayRateService = lifePayRateService;
     }
 
     #region 鏌ヨ
@@ -1086,11 +1090,14 @@
         && x.OrderParamDetailJsonStr.Contains(input.ProductData.Phone)).AnyAsync();
         CheckExtensions.IfTrueThrowUserFriendlyException(repeatOrder, "鎮ㄦ湁鍚屾埛鍙疯鍗曟鍦ㄥ厖鍊间腑锛岃鍕块噸澶嶅厖鍊�");
 
-        var rate = await GetLifePayRate(channle, LifePayRateTypeEnum.榛樿璇濊垂鎶樻墸);
+        var rateChannel = await GetLifePayRate(channle,input.ProductData.IspCode);
+        //骞冲彴鎶樻墸
+        var rate = rateChannel.Rate;
 
         var amount = CalculateAmount(input.ProductData.ParValue, rate);
 
-        var platformRate = await _lifePayRateRepository.FirstOrDefaultAsync(r => r.RateType == LifePayRateTypeEnum.渚涘簲鍟嗘姌鎵d环);
+        //渚涘簲鍟嗘姌鎵d环
+        var platformRate = rateChannel.SupplierRate;
 
         var orderInput = new CreateLifePayOrderInput
         {
@@ -1106,8 +1113,8 @@
             DiscountAmount = amount.DiscountAmount,
             RechargeAmount = amount.RechargeAmount,
             ChannelId = channle.ChannlesNum,
-            PlatformRate = platformRate.Rate,
-            PlatformDeductionAmount = amount.RechargeAmount * platformRate.Rate / 100,
+            PlatformRate = platformRate,
+            PlatformDeductionAmount = amount.RechargeAmount * platformRate / 100,
             ChannleRate = rate,
             ChannlesRakeRate = channle.ChannlesRakeRate,
         };
@@ -1140,16 +1147,13 @@
          && x.OrderParamDetailJsonStr.Contains(input.ProductData.ElectricAccount)).AnyAsync();
         CheckExtensions.IfTrueThrowUserFriendlyException(repeatOrder, "鎮ㄦ湁鍚屾埛鍙疯鍗曟鍦ㄥ厖鍊间腑锛岃鍕块噸澶嶅厖鍊�");
 
+        var rateChannel = await GetLifePayRate(channle, input.ProductData.ElectricType);
+        //骞冲彴鎶樻墸
+        var rate = rateChannel.Rate;
 
-        var rate = await GetLifePayRate(channle, LifePayRateTypeEnum.榛樿鐢佃垂鎶樻墸);
         var amount = CalculateAmount(input.ProductData.ParValue, rate);
-        var platformRate = await _lifePayRateRepository.FirstOrDefaultAsync(r => r.RateType == LifePayRateTypeEnum.渚涘簲鍟嗘姌鎵d环);
-
-        //TODO 鐩稿叧鍗曢」鎶樻墸璋冭妭鍔熻兘鏈笂绾� 鐩墠閽堝鎯呭喌涓存椂鍐欐
-        if (input.ProductData.ElectricType == "guowang")
-        {
-            platformRate.Rate = 95;
-        }
+        //渚涘簲鍟嗘姌鎵d环
+        var platformRate = rateChannel.SupplierRate;
 
         var orderInput = new CreateLifePayOrderInput
         {
@@ -1164,8 +1168,8 @@
             DiscountAmount = amount.DiscountAmount,
             RechargeAmount = amount.RechargeAmount,
             ChannelId = channle.ChannlesNum,
-            PlatformRate = platformRate.Rate,
-            PlatformDeductionAmount = amount.RechargeAmount * platformRate.Rate / 100,
+            PlatformRate = platformRate,
+            PlatformDeductionAmount = amount.RechargeAmount * platformRate / 100,
             ChannleRate = rate,
             ChannlesRakeRate = channle.ChannlesRakeRate,
         };
@@ -1198,12 +1202,14 @@
         && x.OrderParamDetailJsonStr.Contains(input.ProductData.GasAccount)).AnyAsync();
         CheckExtensions.IfTrueThrowUserFriendlyException(repeatOrder, "鎮ㄦ湁鍚屾埛鍙疯鍗曟鍦ㄥ厖鍊间腑锛岃鍕块噸澶嶅厖鍊�");
 
-
-        var rate = await GetLifePayRate(channle, LifePayRateTypeEnum.榛樿鐕冩皵鎶樻墸);
+        var rateChannel = await GetLifePayRate(channle, input.ProductData.GasOrgType);
+        //骞冲彴鎶樻墸
+        var rate = rateChannel.Rate;
 
         var amount = CalculateAmount(input.ProductData.ParValue, rate);
 
-        var platformRate = await _lifePayRateRepository.FirstOrDefaultAsync(r => r.RateType == LifePayRateTypeEnum.渚涘簲鍟嗘姌鎵d环);
+        //渚涘簲鍟嗘姌鎵d环
+        var platformRate = rateChannel.SupplierRate;
 
         var orderInput = new CreateLifePayOrderInput
         {
@@ -1219,8 +1225,8 @@
             DiscountAmount = amount.DiscountAmount,
             RechargeAmount = amount.RechargeAmount,
             ChannelId = channle.ChannlesNum,
-            PlatformRate = platformRate.Rate,
-            PlatformDeductionAmount = amount.RechargeAmount * platformRate.Rate / 100,
+            PlatformRate = platformRate,
+            PlatformDeductionAmount = amount.RechargeAmount * platformRate / 100,
             ChannleRate = rate,
             ChannlesRakeRate = channle.ChannlesRakeRate,
         };
@@ -1923,6 +1929,7 @@
                 dto.PromoterId = promoter.Id;
             }
 
+            //TODO 鍚庣画闇�瑕佷慨鏀� 鐜板湪鐨勪緵搴斿晢鎶樻墸浠锋牴鎹繍钀ュ晢涓嶅悓 閰嶇疆涓嶅悓 涓嶆槸缁熶竴閰嶇疆浜�
             var rate = await _lifePayRateRepository.FirstOrDefaultAsync(it => it.RateType == LifePayRateTypeEnum.渚涘簲鍟嗘姌鎵d环);
             CheckExtensions.IfTrueThrowUserFriendlyException(rate != null && input.ChannlesRate < rate.Rate, "娓犻亾鎶樻墸鏃犳硶浣庝簬渚涘簲鍟嗘姌鎵�");
 
@@ -2455,18 +2462,24 @@
         };
     }
 
-    public async Task<decimal> GetLifePayRate(CreateEditPayChannelsInput channel, LifePayRateTypeEnum lifePayRateType)
+    public async Task<GetLifePayRateOutput> GetLifePayRate(CreateEditPayChannelsInput channel, string code)
     {
+        var rateChannel = await _lifePayRateService.GetRateChannelByCode(code);
+            CheckExtensions.IfTrueThrowUserFriendlyException(rateChannel.Id.IsEmpty(), "鏈厤缃姌鎵�");
         if (channel == null)
         {
-            var rate = await GetRate();
-            CheckExtensions.IfTrueThrowUserFriendlyException(rate.IsNullOrEmpty(), "鏈厤缃姌鎵�");
-            var result = rate.FirstOrDefault(x => x.RateType == lifePayRateType).Rate;
-            return result;
+            return new GetLifePayRateOutput
+            {
+                Rate = rateChannel.PlatformRate,
+                SupplierRate = rateChannel.SupplierRate
+            };
         }
         else
         {
-            return channel.ChannlesRate;
+            return new GetLifePayRateOutput {
+                Rate= channel.ChannlesRate,
+                SupplierRate = rateChannel.SupplierRate
+            };
         }
     }
 
diff --git a/LifePayment/LifePayment.Application/LifePaymentServicesApplicationModuleAutoMapperProfile.cs b/LifePayment/LifePayment.Application/LifePaymentServicesApplicationModuleAutoMapperProfile.cs
index 2b5b250..5054020 100644
--- a/LifePayment/LifePayment.Application/LifePaymentServicesApplicationModuleAutoMapperProfile.cs
+++ b/LifePayment/LifePayment.Application/LifePaymentServicesApplicationModuleAutoMapperProfile.cs
@@ -43,6 +43,9 @@
             CreateMap<LogFrontInput, LogFrontRecord>(MemberList.None);
 
             CreateMap<CreateEditRateChannelInput, LifePayRateChannel>(MemberList.None);
+
+            CreateMap<CreateEditLifePayAnnouncementInput, LifePayAnnouncement>(MemberList.None);
+            CreateMap<LifePayAnnouncement, CreateEditLifePayAnnouncementOutput>(MemberList.None);
         }
     }
 }
\ No newline at end of file
diff --git a/LifePayment/LifePayment.Domain.Shared/Enum/LifePay/LifePayAnnouncement.cs b/LifePayment/LifePayment.Domain.Shared/Enum/LifePay/LifePayAnnouncement.cs
new file mode 100644
index 0000000..7284281
--- /dev/null
+++ b/LifePayment/LifePayment.Domain.Shared/Enum/LifePay/LifePayAnnouncement.cs
@@ -0,0 +1,44 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LifePayment.Domain.Shared;
+
+public enum AnnouncementTypeEnum
+{
+    /// <summary>
+    /// 鏅�氬叕鍛�
+    /// </summary>
+    [Description("鏅�氬叕鍛�")]
+    Normal = 10,
+
+    /// <summary>
+    /// 寮圭獥鍏憡
+    /// </summary>
+    [Description("寮圭獥鍏憡")]
+    Dialog = 20,
+}
+
+public enum AnnouncementStatusEnum
+{
+    /// <summary>
+    /// 灞曠ず涓�
+    /// </summary>
+    [Description("灞曠ず涓�")]
+    Showing = 10,
+
+    /// <summary>
+    /// 寰呭睍绀�
+    /// </summary>
+    [Description("寰呭睍绀�")]
+    Wait = 20,
+
+    /// <summary>
+    /// 宸插仠姝�
+    /// </summary>
+    [Description("宸插仠姝�")]
+    Stop = 30,
+}
\ No newline at end of file
diff --git a/LifePayment/LifePayment.Domain.Shared/Enum/LifePay/LifePayRateChannel.cs b/LifePayment/LifePayment.Domain.Shared/Enum/LifePay/LifePayRateChannel.cs
index 97f587d..9d7b27d 100644
--- a/LifePayment/LifePayment.Domain.Shared/Enum/LifePay/LifePayRateChannel.cs
+++ b/LifePayment/LifePayment.Domain.Shared/Enum/LifePay/LifePayRateChannel.cs
@@ -18,35 +18,47 @@
 
 }
 
-public enum LifePayRateChannelCodeEnum 
+//public enum LifePayRateChannelCodeEnum 
+//{
+//    /// <summary>
+//    /// 涓浗绉诲姩
+//    /// </summary>
+//    [Description("liantong")]
+//    涓浗绉诲姩 = 10,
+
+//    /// <summary>
+//    /// 涓浗鑱旈��
+//    /// </summary>
+//    [Description("涓浗鑱旈��")]
+//    涓浗鑱旈�� = 20,
+
+//    /// <summary>
+//    /// 涓浗鐢典俊
+//    /// </summary>
+//    [Description("涓浗鐢典俊")]
+//    涓浗鐢典俊 = 30,
+
+//    /// <summary>
+//    /// 鍥藉鐢电綉
+//    /// </summary>
+//    [Description("鍥藉鐢电綉")]
+//    鍥藉鐢电綉 = 40,
+
+//    /// <summary>
+//    /// 鍗楁柟鐢电綉
+//    /// </summary>
+//    [Description("鍗楁柟鐢电綉")]
+//    鍗楁柟鐢电綉 = 50,
+//}
+
+public static class LifePayRateChannelCode
 {
-    /// <summary>
-    /// 涓浗绉诲姩
-    /// </summary>
-    [Description("涓浗绉诲姩")]
-    涓浗绉诲姩 = 10,
-
-    /// <summary>
-    /// 涓浗鑱旈��
-    /// </summary>
-    [Description("涓浗鑱旈��")]
-    涓浗鑱旈�� = 20,
-
-    /// <summary>
-    /// 涓浗鐢典俊
-    /// </summary>
-    [Description("涓浗鐢典俊")]
-    涓浗鐢典俊 = 30,
-
-    /// <summary>
-    /// 鍥藉鐢电綉
-    /// </summary>
-    [Description("鍥藉鐢电綉")]
-    鍥藉鐢电綉 = 40,
-
-    /// <summary>
-    /// 鍗楁柟鐢电綉
-    /// </summary>
-    [Description("鍗楁柟鐢电綉")]
-    鍗楁柟鐢电綉 = 50,
+    public const string 涓浗绉诲姩 = "yidong"; 
+    public const string 涓浗鑱旈�� = "liantong"; 
+    public const string 涓浗鐢典俊 = "dianxin"; 
+    public const string 鍥藉鐢电綉 = "guowang"; 
+    public const string 鍗楁柟鐢电綉 = "nanwang"; 
+    public const string 涓噧鐕冩皵 = "zhong_ran"; 
+    public const string 鏂板ゥ鐕冩皵 = "xin_ao"; 
+    public const string 鍖椾含鐕冩皵 = "bei_jing"; 
 }
\ No newline at end of file
diff --git a/LifePayment/LifePayment.Domain/LifePay/LifePayAnnouncement.cs b/LifePayment/LifePayment.Domain/LifePay/LifePayAnnouncement.cs
new file mode 100644
index 0000000..92b4d80
--- /dev/null
+++ b/LifePayment/LifePayment.Domain/LifePay/LifePayAnnouncement.cs
@@ -0,0 +1,37 @@
+锘縰sing LifePayment.Domain.Shared;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp;
+using Volo.Abp.Domain.Entities.Auditing;
+
+namespace LifePayment.Domain.LifePay;
+
+public partial class LifePayAnnouncement : FullAuditedEntity<Guid>, IDataUserFilter
+{
+    public LifePayAnnouncement()
+    {
+    }
+
+    /// <summary>
+    /// 鍏憡绫诲瀷
+    /// </summary>
+    public AnnouncementTypeEnum AnnouncementType { get; set; }
+
+    /// <summary>
+    /// 鐢熸晥鏃ユ湡
+    /// </summary>
+    public DateTime StartTime { get; set; }
+
+    /// <summary>
+    /// 鎴鏃ユ湡
+    /// </summary>
+    public DateTime EndTime { get; set; }
+
+    /// <summary>
+    /// 鍏憡鍐呭
+    /// </summary>
+    public string AnnouncementContent { get; set; }
+}
\ No newline at end of file
diff --git a/LifePayment/LifePayment.Domain/LifePay/LifePayRateChannel.cs b/LifePayment/LifePayment.Domain/LifePay/LifePayRateChannel.cs
index 53b1817..9dc2f27 100644
--- a/LifePayment/LifePayment.Domain/LifePay/LifePayRateChannel.cs
+++ b/LifePayment/LifePayment.Domain/LifePay/LifePayRateChannel.cs
@@ -24,7 +24,7 @@
     /// <summary>
     /// ID
     /// </summary>
-    public int Code { get; set; }
+    public string Code { get; set; }
 
     /// <summary>
     /// 渚涘簲鍟嗘姌鎵�
diff --git a/LifePayment/LifePayment.EntityFrameworkCore/LifePaymentServicesDbContext.cs b/LifePayment/LifePayment.EntityFrameworkCore/LifePaymentServicesDbContext.cs
index 75d275d..895d6dd 100644
--- a/LifePayment/LifePayment.EntityFrameworkCore/LifePaymentServicesDbContext.cs
+++ b/LifePayment/LifePayment.EntityFrameworkCore/LifePaymentServicesDbContext.cs
@@ -65,6 +65,8 @@
 
         public virtual DbSet<LifePayRateChannel> LifePayRateChannel { get; set; }
 
+        public virtual DbSet<LifePayAnnouncement> LifePayAnnouncement { get; set; }
+
         [UnitOfWork]
         protected override void OnModelCreating(ModelBuilder builder)
         {
diff --git a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml b/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
index d688770..f22aa14 100644
--- a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
+++ b/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
@@ -63,6 +63,33 @@
             </summary>
             <returns></returns>
         </member>
+        <member name="M:LifePayment.HttpApi.LifePayAnnouncementController.GetLifePayAnnouncementPage(LifePayment.Application.Contracts.GetLifePayAnnouncementPageInput)">
+            <summary>
+            鑾峰彇鍏憡鍒嗛〉
+            </summary>
+            <param name="input"></param>
+            <returns></returns>
+        </member>
+        <member name="M:LifePayment.HttpApi.LifePayAnnouncementController.CreateOrEditLifePayAnnouncement(LifePayment.Application.Contracts.CreateEditLifePayAnnouncementInput)">
+            <summary>
+            鏂板缂栬緫鍏憡
+            </summary>
+            <param name="input"></param>
+            <returns></returns>
+        </member>
+        <member name="M:LifePayment.HttpApi.LifePayAnnouncementController.DeleteLifePayAnnouncement(System.Guid)">
+            <summary>
+            鍒犻櫎鍏憡
+            </summary>
+            <param name="id"></param>
+            <returns></returns>
+        </member>
+        <member name="M:LifePayment.HttpApi.LifePayAnnouncementController.GetShowingLifePayAnnouncement(LifePayment.Application.Contracts.GetShowingLifePayAnnouncementInput)">
+            <summary>
+            鑾峰彇褰撳墠灞曠ず涓殑鍏憡
+            </summary>
+            <returns></returns>
+        </member>
         <member name="M:LifePayment.HttpApi.LifePayController.GetTopStatistics(LifePayment.Application.Contracts.TopStatisticsInput)">
             <summary>
             鑾峰彇椤堕儴缁熻鏁版嵁
diff --git a/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml b/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
index 9bc041a..5c5cfe1 100644
--- a/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
+++ b/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
@@ -4,6 +4,33 @@
         <name>LifePayment.Application.Contracts</name>
     </assembly>
     <members>
+        <member name="M:LifePayment.Application.Contracts.ILifePayAnnouncementService.GetLifePayAnnouncementPage(LifePayment.Application.Contracts.GetLifePayAnnouncementPageInput)">
+            <summary>
+            鑾峰彇鍏憡鍒嗛〉
+            </summary>
+            <param name="input"></param>
+            <returns></returns>
+        </member>
+        <member name="M:LifePayment.Application.Contracts.ILifePayAnnouncementService.CreateOrEditLifePayAnnouncement(LifePayment.Application.Contracts.CreateEditLifePayAnnouncementInput)">
+            <summary>
+            鏂板缂栬緫鍏憡
+            </summary>
+            <param name="input"></param>
+            <returns></returns>
+        </member>
+        <member name="M:LifePayment.Application.Contracts.ILifePayAnnouncementService.DeleteLifePayAnnouncement(System.Guid)">
+            <summary>
+            鍒犻櫎鍏憡
+            </summary>
+            <param name="id"></param>
+            <returns></returns>
+        </member>
+        <member name="M:LifePayment.Application.Contracts.ILifePayAnnouncementService.GetShowingLifePayAnnouncement(LifePayment.Application.Contracts.GetShowingLifePayAnnouncementInput)">
+            <summary>
+            鑾峰彇褰撳墠灞曠ず涓殑鍏憡
+            </summary>
+            <returns></returns>
+        </member>
         <member name="M:LifePayment.Application.Contracts.ILifePayRateService.GetLifePayRateChannelPage(ZeroD.Util.PageInput)">
             <summary>
             鑾峰彇鎶樻墸閫氶亾閰嶇疆鍒嗛〉
@@ -339,6 +366,26 @@
             <param name="amount"></param>
             <returns></returns>
             <exception cref="T:Volo.Abp.UserFriendlyException"></exception>
+        </member>
+        <member name="P:LifePayment.Application.Contracts.CreateEditLifePayAnnouncementInput.AnnouncementType">
+            <summary>
+            鍏憡绫诲瀷
+            </summary>
+        </member>
+        <member name="P:LifePayment.Application.Contracts.CreateEditLifePayAnnouncementInput.StartTime">
+            <summary>
+            鐢熸晥鏃ユ湡
+            </summary>
+        </member>
+        <member name="P:LifePayment.Application.Contracts.CreateEditLifePayAnnouncementInput.EndTime">
+            <summary>
+            鎴鏃ユ湡
+            </summary>
+        </member>
+        <member name="P:LifePayment.Application.Contracts.CreateEditLifePayAnnouncementInput.AnnouncementContent">
+            <summary>
+            鍏憡鍐呭
+            </summary>
         </member>
         <member name="P:LifePayment.Application.Contracts.CreateLifePayOrderInput`1.ChannelId">
             <summary>
@@ -2310,6 +2357,11 @@
             閫氱煡鍐呭
             </summary>
         </member>
+        <member name="P:LifePayment.Application.Contracts.LifePay.QueryRateChannelInput.LifePayOrderType">
+            <summary>
+            鍏呭�肩被鍨�
+            </summary>
+        </member>
         <member name="M:LifePayment.Application.Contracts.ILogService.LogFront(LifePayment.Domain.Shared.LogFrontInput)">
             <summary>
             璁板綍鍓嶇鏃ュ織
diff --git a/LifePayment/LifePayment.HttpApi/LifePay/LifePayAnnouncementController.cs b/LifePayment/LifePayment.HttpApi/LifePay/LifePayAnnouncementController.cs
new file mode 100644
index 0000000..1bc3e2f
--- /dev/null
+++ b/LifePayment/LifePayment.HttpApi/LifePay/LifePayAnnouncementController.cs
@@ -0,0 +1,84 @@
+锘縰sing Alipay.AopSdk.F2FPay.Model;
+using LifePayment.Application;
+using LifePayment.Application.Contracts;
+using LifePayment.Application.Contracts.LifePay;
+using LifePayment.Application.LifePay;
+using LifePayment.Domain;
+using LifePayment.Domain.Common;
+using LifePayment.Domain.Shared;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Volo.Abp;
+using Volo.Abp.AspNetCore.Mvc;
+using Volo.Abp.AspNetCore.WebClientInfo;
+using ZeroD.Util;
+using ZeroD.Util.Fadd;
+
+namespace LifePayment.HttpApi
+{
+    [Route("api/[controller]/[action]")]
+    [ApiController]
+    [Authorize]
+    public class LifePayAnnouncementController : AbpController
+    {
+
+        private readonly ILifePayAnnouncementService _lifePayAnnouncementService;
+
+        public LifePayAnnouncementController(
+              ILifePayAnnouncementService lifePayAnnouncementService
+              )
+        {
+            _lifePayAnnouncementService = lifePayAnnouncementService;
+        }
+
+        /// <summary>
+        /// 鑾峰彇鍏憡鍒嗛〉
+        /// </summary>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public async Task<PageOutput<CreateEditLifePayAnnouncementOutput>> GetLifePayAnnouncementPage(GetLifePayAnnouncementPageInput input)
+        {
+            return await _lifePayAnnouncementService.GetLifePayAnnouncementPage(input);
+        }
+
+        /// <summary>
+        /// 鏂板缂栬緫鍏憡
+        /// </summary>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public async Task<int> CreateOrEditLifePayAnnouncement(CreateEditLifePayAnnouncementInput input)
+        {
+            return await _lifePayAnnouncementService.CreateOrEditLifePayAnnouncement(input);
+        }
+
+        /// <summary>
+        /// 鍒犻櫎鍏憡
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        [HttpGet]
+        public async Task<int> DeleteLifePayAnnouncement(Guid id)
+        {
+            return await _lifePayAnnouncementService.DeleteLifePayAnnouncement(id);
+        }
+
+        /// <summary>
+        /// 鑾峰彇褰撳墠灞曠ず涓殑鍏憡
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        [AllowAnonymous]
+        public async Task<CreateEditLifePayAnnouncementOutput> GetShowingLifePayAnnouncement(GetShowingLifePayAnnouncementInput input)
+        {
+            return await _lifePayAnnouncementService.GetShowingLifePayAnnouncement(input);
+        }
+    }
+}
+
diff --git a/LifePayment/LifePayment.HttpApi/LifePay/LifePayRateController.cs b/LifePayment/LifePayment.HttpApi/LifePay/LifePayRateController.cs
index f6dcee8..c653287 100644
--- a/LifePayment/LifePayment.HttpApi/LifePay/LifePayRateController.cs
+++ b/LifePayment/LifePayment.HttpApi/LifePay/LifePayRateController.cs
@@ -52,6 +52,7 @@
         /// <param name="input"></param>
         /// <returns></returns>
         [HttpPost]
+        [AllowAnonymous]
         public async Task<List<CreateEditRateChannelOutput>> GetLifePayRateChannelAllList(QueryRateChannelInput input)
         {
             return await _lifePayRateService.GetLifePayRateChannelAllList(input);

--
Gitblit v1.9.1