260 lines
7.1 KiB
C#
260 lines
7.1 KiB
C#
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Data;
|
|
|
|
namespace YLErp.DBModels
|
|
{
|
|
/// <summary>
|
|
/// 客户授信表
|
|
/// </summary>
|
|
[Table("credit")]
|
|
public class CreditTable : DBModelWithOperator, IDBModelWithCreator
|
|
{
|
|
public const string RoleType = "RoleType";
|
|
public const string ClientType = "ClientType";
|
|
public static string LogClass = "授信";
|
|
|
|
/// <summary>
|
|
/// 客户信息
|
|
/// </summary>
|
|
[DisplayName("客户名称")]
|
|
public int? ClientId { get; set; }
|
|
|
|
/// <summary>
|
|
/// 授信
|
|
/// </summary>
|
|
[DisplayName("授信额度")]
|
|
public double? Credit { get; set; }
|
|
|
|
/// <summary>
|
|
/// 原始授信值(数据库列 original_credit,小写)
|
|
/// </summary>
|
|
[DisplayName("原始授信值")]
|
|
[Column("original_credit")]
|
|
public double? OriginalCredit { get; set; }
|
|
|
|
/// <summary>
|
|
/// 最大授信可用比例(0-1,NULL按1)(数据库列 max_credit_use_ratio,小写)
|
|
/// </summary>
|
|
[DisplayName("最大授信可用比例")]
|
|
[Column("max_credit_use_ratio")]
|
|
public double? MaxCreditUseRatio { get; set; }
|
|
|
|
/// <summary>
|
|
/// 已使用授信(R4,非持久化:授信出入表 Σ(amount),占用记正/释放记负,列表展示用)
|
|
/// </summary>
|
|
[DisplayName("已使用授信")]
|
|
[NotMapped]
|
|
public double? UsedCredit { get; set; }
|
|
|
|
/// <summary>
|
|
/// PFE授信
|
|
/// </summary>
|
|
[DisplayName("PFE授信")]
|
|
public double? PFECredit { get; set; }
|
|
|
|
/// <summary>
|
|
/// IM授信
|
|
/// </summary>
|
|
[DisplayName("IM授信")]
|
|
public double? IMCredit { get; set; }
|
|
|
|
/// <summary>
|
|
/// 最小转账金额/追保额度
|
|
/// </summary>
|
|
[DisplayName("最小转账金额")]
|
|
public double? MarginLimit { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
/// 用户编号
|
|
/// </summary>
|
|
[DisplayName("客户编号")]
|
|
public string ClientNumber { get; set; }
|
|
|
|
/// <summary>
|
|
/// 客户名称
|
|
/// </summary>
|
|
[DisplayName("客户名称")]
|
|
public string ClientName { get; set; }
|
|
|
|
/// <summary>
|
|
/// 授信起始日
|
|
/// </summary>
|
|
[DisplayName("起始日")]
|
|
public DateTime? CreditStartDate { get; set; }
|
|
|
|
/// <summary>
|
|
/// 授信到期日
|
|
/// </summary>
|
|
[DisplayName("到期日")]
|
|
public DateTime? CreditDeadLine { get; set; }
|
|
|
|
[DisplayName("买卖权限")]
|
|
public string BuySellRight { get; set; }
|
|
|
|
/// <summary>
|
|
/// 是否全选
|
|
/// </summary>
|
|
public bool? IsAll { get; set; }
|
|
|
|
/// <summary>
|
|
/// 是否限制交易品种
|
|
/// </summary>
|
|
public bool? IsVariety { get; set; }
|
|
|
|
/// <summary>
|
|
/// 0表示黑名单,1表示白名单(默认为黑名单)
|
|
/// </summary>
|
|
[DisplayName("是否白名单")]
|
|
public int IsWhitelist { get; set; } = 0;
|
|
|
|
[NotMapped]
|
|
public List<string> TradeBuySell
|
|
{
|
|
get
|
|
{
|
|
if (BuySellRight == "买")
|
|
{
|
|
return new List<string> { "买入" };
|
|
}
|
|
else if (BuySellRight == "卖")
|
|
{
|
|
return new List<string> { "卖出" };
|
|
}
|
|
else if (BuySellRight == "买卖")
|
|
{
|
|
return new List<string> { "买入", "卖出" };
|
|
}
|
|
|
|
return new List<string> { "买入" };
|
|
}
|
|
}
|
|
|
|
[DisplayName("角色")]
|
|
public string RoleName { get; set; }
|
|
|
|
[DisplayName("角色")]
|
|
public int? RoleId { get; set; }
|
|
|
|
/// <summary>
|
|
/// 目前有用户和角色
|
|
/// </summary>
|
|
[DisplayName("授信种类")]
|
|
public string Type { get; set; }
|
|
|
|
/// <summary>
|
|
/// 名义本金规模
|
|
/// </summary>
|
|
[DisplayName("名义本金规模")]
|
|
public double? StockEqvNotional { get; set; }
|
|
|
|
/// <summary>
|
|
/// 授信审批规模
|
|
/// </summary>
|
|
[DisplayName("授信审批规模")]
|
|
public double? AuditCredit { get; set; }
|
|
|
|
/// <summary>
|
|
/// 名义本金审批规模
|
|
/// </summary>
|
|
[DisplayName("名义本金审批规模")]
|
|
public double? AuditStockEqvNotional { get; set; }
|
|
|
|
/// <summary>
|
|
/// 抵扣名义本金额度
|
|
/// </summary>
|
|
[DisplayName("抵扣名义本金额度")]
|
|
public double? DeductStockEqvNotional { get; set; }
|
|
|
|
/// <summary>
|
|
/// 资质评级
|
|
/// </summary>
|
|
[DisplayName("资质评级")]
|
|
public string QualificationRating { get; set; }
|
|
|
|
IEnumerable<int> _VarietyIdsInt;
|
|
|
|
[NotMapped]
|
|
public IEnumerable<int> VarietyIdsInt
|
|
{
|
|
get
|
|
{
|
|
if (_VarietyIdsInt == null)
|
|
{
|
|
_VarietyIdsInt = string.IsNullOrEmpty(VarietyId)
|
|
? Enumerable.Empty<int>() : VarietyId.Split(',').Select(v => Convert.ToInt32(v)).ToArray();
|
|
}
|
|
return _VarietyIdsInt;
|
|
}
|
|
}
|
|
|
|
public string ProcessStatus { get; set; }
|
|
|
|
public int ProcessOrderId { get; set; }
|
|
|
|
[DisplayName("开户时间")]
|
|
public DateTime? ProcessOptDate { get; set; }
|
|
|
|
[NotMapped]
|
|
public int? ProcessRoleId { get; set; }
|
|
|
|
[NotMapped]
|
|
public string ProcessRoleName { get; set; }
|
|
|
|
/// <summary>
|
|
/// 品种
|
|
/// </summary>
|
|
[DisplayName("品种")]
|
|
public string VarietyId { get; set; }
|
|
|
|
/// <summary>
|
|
/// 品种名
|
|
/// </summary>
|
|
[DisplayName("品种名")]
|
|
public string VarietyName { get; set; }
|
|
|
|
private string _comments;
|
|
|
|
/// <summary>
|
|
/// 说明
|
|
/// </summary>
|
|
[DisplayName("说明")]
|
|
public string Comments { get { return _comments ?? ""; } set { _comments = value; } }
|
|
|
|
public bool IsFeelingWhiteList => Type == RoleType || IsWhitelist == 1;
|
|
|
|
/// <summary>
|
|
/// 限制交易品种
|
|
/// </summary>
|
|
public bool LimitVariety => Type == RoleType || (Type == ClientType && IsVariety.HasValue && IsVariety.Value);
|
|
|
|
/// <summary>
|
|
/// 创建人ID
|
|
/// </summary>
|
|
[DisplayName("操作人")]
|
|
public int? CreatorId { set; get; }
|
|
|
|
/// <summary>
|
|
/// 创建人名称
|
|
/// </summary>
|
|
[DisplayName("操作人")]
|
|
public string CreatorName { set; get; }
|
|
|
|
/// <summary>
|
|
/// 创建时间
|
|
/// </summary>
|
|
[DisplayName("操作时间")]
|
|
public DateTime? CreateDate { set; get; }
|
|
}
|
|
|
|
[NotMapped]
|
|
public class CreditDto : CreditTable
|
|
{
|
|
/// <summary>
|
|
/// 授信状态
|
|
/// </summary>
|
|
public string ProcessStatusOriginal { get; set; }
|
|
|
|
}
|
|
}
|