Services/TradeService/Domain/Entities/TradeLog.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using Domain.Enums;
using DomainBase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Domain.Entities
{
    public class TradeLog : Entity, IAggregateRoot
    {
        //订单编号
        public Guid OrderId { get; set; }
        public TradeLogState State { get; set; }
        public string OrderNo { get; set; }
        //物流编号
        public Guid? LogisticsId { get; set; }
        public string LogisticsNo { get; set; }
        public Guid OperateUserId { get; set; }
        public string OperateUserName { get; set; }
        //记录时间
        public DateTime TradeDate { get; set; }
        //记录事件
        public string TradeLogValue { get; set; }
        /// <summary>
        /// 创建交易流水
        /// </summary>
        /// <param name="orderId"></param>
        /// <param name="orderNo"></param>
        /// <param name="logisticsId"></param>
        /// <param name="tradeLogValue"></param>
        public void CreateTradeLog(TradeLogState State, Guid orderId, string orderNo, Guid? logisticsId, string logisticsNo, Guid operateUserId, string operateUserName)
        {

            TradeDate = DateTime.Now;
            this.State = State;
            if (orderId == Guid.Empty)
                throw new DomainException("订单号不存在!");
            OrderId = orderId;
            if (string.IsNullOrEmpty(orderNo))
                throw new DomainException("订单编号不能为空!");
            OrderNo = orderNo;
            if (logisticsId != null && logisticsId != Guid.Empty)
            {
                LogisticsId = logisticsId;
                if (string.IsNullOrEmpty(logisticsNo))
                    throw new DomainException("物流编号不能为空!");
                LogisticsNo = logisticsNo;
            }
            OperateUserId = operateUserId;
            if (OperateUserId == Guid.Empty)
                OperateUserName = "[系统]";
            else if (string.IsNullOrEmpty(operateUserName))
                throw new DomainException("操作人员不能为空!");
            else
                OperateUserName = $"用户[{operateUserName}]";
            TradeLogValue = CreateTradeLogValueByState();
        }
        /// <summary>
后面还有 22 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。