Browse Source

添加新属性和字段以支持客户数据更新

在 `NewClientDataQueryDto.cs` 文件中,`OASystem.Domain.Dtos.CRM` 命名空间下,添加了 `Id` 和 `Number` 属性。
在 `Crm_NewClientData.cs` 文件中,`OASystem.Domain.Entities.Customer` 命名空间下,添加了 `lastUpdateUserId` 和 `lastUpdateTime` 字段。
在 `Crm_NewClientData.cs` 文件中,`OASystem.Domain.Entities.Customer` 命名空间下,添加了 `LastUpdateUserId` 和 `LastUpdateTime` 属性,并为其添加了相应的注释和数据库列描述。
在 `NewClientDataView.cs` 文件中,`OASystem.Domain.ViewModels.CRM` 命名空间下,添加了 `NotUpdateDays` 属性,并实现了其计算逻辑。
在 `NewClientDataRepository.cs` 文件中,`OASystem.Infrastructure.Repositories.CRM` 命名空间下,添加了对 `LastUpdateTime` 和 `LastUpdateUserId` 的赋值逻辑。
LEIYI 3 months ago
parent
commit
1957dd6790

+ 2 - 0
OASystem/OASystem.Domain/Dtos/CRM/NewClientDataQueryDto.cs

@@ -100,10 +100,12 @@ namespace OASystem.Domain.Dtos.CRM
         /// 2 修改 
         /// </summary>
         public int Status { get; set; }
+
         /// <summary>
         /// 编号
         /// </summary>
         public int Id { get; set; }
+
         /// <summary>
         /// 序号
         /// </summary>

+ 14 - 0
OASystem/OASystem.Domain/Entities/Customer/Crm_NewClientData.cs

@@ -37,6 +37,8 @@ namespace OASystem.Domain.Entities.Customer
         private int category;
         private int predele;
         private int finlishedDele;
+        private int lastUpdateUserId;
+        private DateTime lastUpdateTime;
 
         /// <summary>
         /// 序号
@@ -197,5 +199,17 @@ namespace OASystem.Domain.Entities.Customer
         [Description("今年已出团")]
         [SugarColumn(IsNullable = true, ColumnDataType = "int")]
         public int FinlishedDele { get => finlishedDele; set => finlishedDele = value; }
+
+        /// <summary>
+        /// 最后更新者Id
+        /// </summary>
+        [SugarColumn(ColumnDescription = "最后更新者Id", IsNullable = true, ColumnDataType = "int")]
+        public int LastUpdateUserId { get => lastUpdateUserId; set => lastUpdateUserId = value; }
+
+        /// <summary>
+        /// 最后更新时间
+        /// </summary>
+        [SugarColumn(ColumnDescription = "最后更新时间", IsNullable = true, ColumnDataType = "DateTime")]
+        public DateTime LastUpdateTime { get => lastUpdateTime; set => lastUpdateTime = value; }
     }
 }

+ 14 - 0
OASystem/OASystem.Domain/ViewModels/CRM/NewClientDataView.cs

@@ -215,6 +215,20 @@ namespace OASystem.Domain.ViewModels.CRM
         /// 归属部门
         /// </summary>
         public dynamic AscribedDepartment { get; set; }
+
+        /// <summary>
+        /// 未更新信息天数
+        /// </summary>
+        public int NotUpdateDays
+        {
+            get
+            {
+                int days = 0;
+                if (LastUpdateTime == DateTime.MinValue) days = DateTime.Now.Subtract(CreateTime).Days;
+                else days = DateTime.Now.Subtract(LastUpdateTime).Days;
+                return days;
+            }
+        }
     }
     /// <summary>
     ///归属人员

+ 2 - 1
OASystem/OASystem.Infrastructure/Repositories/CRM/NewClientDataRepository.cs

@@ -1011,7 +1011,8 @@ namespace OASystem.Infrastructure.Repositories.CRM
             var newClientDataUnEncrypted = _mapper.Map<Crm_NewClientData>(dto);
             newClientDataUnEncrypted.Birthday = BirthdayStr;
             if (newClientDataUnEncrypted.PassportDate == DateTime.MinValue) newClientDataUnEncrypted.PassportDate = null;
-
+            newClientDataUnEncrypted.LastUpdateTime = DateTime.Now;
+            newClientDataUnEncrypted.LastUpdateUserId = dto.CreateUserId;
 
             var newClientDataEncrypted = newClientDataUnEncrypted; 
             EncryptionProcessor.EncryptProperties(newClientDataEncrypted); //加密