feat: 添加银行功能搭建
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给用户申请银行卡
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Authorize]
|
||||
public Task ApplyingBankCardAsync()
|
||||
{
|
||||
return _bankManager.ApplyingBankCardAsync(CurrentUser.Id.Value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给银行卡提款
|
||||
/// </summary>
|
||||
/// <param name="cardId"></param>
|
||||
/// <returns></returns>
|
||||
[Authorize]
|
||||
public Task DrawMoneyAsync(Guid cardId)
|
||||
{
|
||||
return _bankManager.DrawMoneyAsync(cardId);
|
||||
}
|
||||
/// <summary>
|
||||
/// 给银行卡存款
|
||||
/// </summary>
|
||||
/// <param name="CardId"></param>
|
||||
/// <param name="moneyNum"></param>
|
||||
/// <returns></returns>
|
||||
public Task DepositAsync(Guid CardId, decimal moneyNum)
|
||||
{
|
||||
return _bankManager.DepositAsync(CardId, moneyNum);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 银行卡
|
||||
/// </summary>
|
||||
[SugarTable("BankCard")]
|
||||
public class BankCardEntity : Entity<Guid>, IHasCreationTime
|
||||
{
|
||||
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
|
||||
public override Guid Id { get; protected set; }
|
||||
public DateTime CreationTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户id
|
||||
/// </summary>
|
||||
public Guid UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前存储的钱
|
||||
/// </summary>
|
||||
public decimal StorageMoney { get; set; } = 0;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 最大可存储的钱钱
|
||||
/// </summary>
|
||||
public decimal MaxStorageMoney { get; set; } = 100;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 满期限时间,可空
|
||||
/// </summary>
|
||||
public DateTime? Fullterm { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 银行卡状态
|
||||
/// </summary>
|
||||
public BankCardStateEnum BankCardState { get; set; } = BankCardStateEnum.Unused;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 利息记录
|
||||
/// </summary>
|
||||
[SugarTable("InterestRecords")]
|
||||
public class InterestRecordsEntity : Entity<Guid>, 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; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前汇率值
|
||||
/// </summary>
|
||||
public decimal Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否波动期
|
||||
/// </summary>
|
||||
public bool IsFluctuate { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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() { }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取第三方的值
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private decimal GetThirdPartyValue()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建一个记录
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public InterestRecordsEntity CreateInterestRecords()
|
||||
{
|
||||
return new InterestRecordsEntity();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给用户申请银行卡
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task ApplyingBankCardAsync(Guid userId)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给银行卡提款
|
||||
/// </summary>
|
||||
/// <param name="CardId"></param>
|
||||
/// <returns></returns>
|
||||
public Task DrawMoneyAsync(Guid CardId)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给银行卡存款
|
||||
/// </summary>
|
||||
/// <param name="CardId"></param>
|
||||
/// <param name="moneyNum"></param>
|
||||
/// <returns></returns>
|
||||
public Task DepositAsync(Guid CardId, decimal moneyNum)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user