From 9dc72ef3eee8b543973ba354e79fe677f21c41be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=B7=B3?= <454313500@qq.com> Date: Wed, 13 Mar 2024 18:01:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E9=93=B6=E8=A1=8C?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E6=90=AD=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/Bank/BankService.cs | 53 ++++++++++++++++ .../Enums/BankCardStateEnum.cs | 20 ++++++ .../Entities/Bank/BankCardEntity.cs | 55 +++++++++++++++++ .../Entities/Bank/InterestRecordsEntity.cs | 42 +++++++++++++ .../Managers/BankManager.cs | 61 +++++++++++++++++++ 5 files changed, 231 insertions(+) create mode 100644 Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Bank/BankService.cs create mode 100644 Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/BankCardStateEnum.cs create mode 100644 Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Bank/BankCardEntity.cs create mode 100644 Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Bank/InterestRecordsEntity.cs create mode 100644 Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/BankManager.cs diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Bank/BankService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Bank/BankService.cs new file mode 100644 index 00000000..45b58c76 --- /dev/null +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Bank/BankService.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Volo.Abp.Application.Services; +using Yi.Framework.Bbs.Domain.Managers; + +namespace Yi.Framework.Bbs.Application.Services.Bank +{ + public class BankService : ApplicationService + { + private BankManager _bankManager; + public BankService(BankManager bankManager) + { + _bankManager = bankManager; + } + + /// + /// 给用户申请银行卡 + /// + /// + [Authorize] + public Task ApplyingBankCardAsync() + { + return _bankManager.ApplyingBankCardAsync(CurrentUser.Id.Value); + } + + /// + /// 给银行卡提款 + /// + /// + /// + [Authorize] + public Task DrawMoneyAsync(Guid cardId) + { + return _bankManager.DrawMoneyAsync(cardId); + } + /// + /// 给银行卡存款 + /// + /// + /// + /// + public Task DepositAsync(Guid CardId, decimal moneyNum) + { + return _bankManager.DepositAsync(CardId, moneyNum); + } + + + } +} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/BankCardStateEnum.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/BankCardStateEnum.cs new file mode 100644 index 00000000..9deab4a8 --- /dev/null +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/BankCardStateEnum.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.Framework.Bbs.Domain.Shared.Enums +{ + public enum BankCardStateEnum + { + //闲置 + Unused = 0, + + //等待中 + Wait, + + //存储时间已满 + Full, + } +} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Bank/BankCardEntity.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Bank/BankCardEntity.cs new file mode 100644 index 00000000..accf3343 --- /dev/null +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Bank/BankCardEntity.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using SqlSugar; +using Volo.Abp.Auditing; +using Volo.Abp.Domain.Entities; +using Yi.Framework.Bbs.Domain.Shared.Enums; + +namespace Yi.Framework.Bbs.Domain.Entities.Bank +{ + /// + /// 银行卡 + /// + [SugarTable("BankCard")] + public class BankCardEntity : Entity, IHasCreationTime + { + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)] + public override Guid Id { get; protected set; } + public DateTime CreationTime { get; set; } + + /// + /// 用户id + /// + public Guid UserId { get; set; } + + /// + /// 当前存储的钱 + /// + public decimal StorageMoney { get; set; } = 0; + + + /// + /// 最大可存储的钱钱 + /// + public decimal MaxStorageMoney { get; set; } = 100; + + + /// + /// 满期限时间,可空 + /// + public DateTime? Fullterm { get; set; } + + + + + /// + /// 银行卡状态 + /// + public BankCardStateEnum BankCardState { get; set; } = BankCardStateEnum.Unused; + + + } +} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Bank/InterestRecordsEntity.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Bank/InterestRecordsEntity.cs new file mode 100644 index 00000000..601d3a80 --- /dev/null +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Bank/InterestRecordsEntity.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using SqlSugar; +using Volo.Abp.Auditing; +using Volo.Abp.Domain.Entities; + +namespace Yi.Framework.Bbs.Domain.Entities.Bank +{ + /// + /// 利息记录 + /// + [SugarTable("InterestRecords")] + public class InterestRecordsEntity : Entity, IHasCreationTime + { + public InterestRecordsEntity() + { } + public InterestRecordsEntity(decimal inputValue, bool isFluctuate, decimal oldValue = 0) + { + //这里写好根据数据的值,以及是否要波动期,进行得出真是利息 + + + } + [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)] + public override Guid Id { get; protected set; } + public DateTime CreationTime { get; set; } + + /// + /// 当前汇率值 + /// + public decimal Value { get; set; } + + /// + /// 是否波动期 + /// + public bool IsFluctuate { get; set; } + + + } +} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/BankManager.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/BankManager.cs new file mode 100644 index 00000000..21ffcdaf --- /dev/null +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/BankManager.cs @@ -0,0 +1,61 @@ +using Volo.Abp.Domain.Services; +using Yi.Framework.Bbs.Domain.Entities.Bank; + +namespace Yi.Framework.Bbs.Domain.Managers +{ + public class BankManager : DomainService + { + + public BankManager() { } + + + /// + /// 获取第三方的值 + /// + /// + private decimal GetThirdPartyValue() + { + return 0; + } + + /// + /// 创建一个记录 + /// + /// + public InterestRecordsEntity CreateInterestRecords() + { + return new InterestRecordsEntity(); + } + + /// + /// 给用户申请银行卡 + /// + /// + public Task ApplyingBankCardAsync(Guid userId) + { + return Task.CompletedTask; + } + + /// + /// 给银行卡提款 + /// + /// + /// + public Task DrawMoneyAsync(Guid CardId) + { + return Task.CompletedTask; + } + + /// + /// 给银行卡存款 + /// + /// + /// + /// + public Task DepositAsync(Guid CardId, decimal moneyNum) + { + return Task.CompletedTask; + } + + } +}