소스 검색

表操作记录
新增 字段

leiy 1 년 전
부모
커밋
1053ae4dac

+ 2 - 2
OASystem/OASystem.Api/Controllers/BusinessController.cs

@@ -681,10 +681,10 @@ Where c.ConfListId = {0}", ConfId);
         {
             try
             {
-
                 Crm_TableOperationRecord _TableOperationRecord = new Crm_TableOperationRecord() 
                 {
                     TableName = _dto.TableName,
+                    PortType = _dto.PortType,
                     OperationItem = _dto.OperationItem,
                     DataId = _dto.DataId,
                     CreateUserId = _dto.UserId,
@@ -693,7 +693,7 @@ Where c.ConfListId = {0}", ConfId);
                     IsDel = 0
                 };
 
-                bool _view = await _TableOperationRecordRep._Add(_TableOperationRecord); //币种类型
+                bool _view = await _TableOperationRecordRep._Add(_TableOperationRecord); 
                 if (_view)
                 {
                     return Ok(JsonView(true,"操作成功!"));

+ 25 - 0
OASystem/OASystem.Api/Controllers/MarketCustomerResourcesController.cs

@@ -1,4 +1,5 @@
 using Microsoft.AspNetCore.Mvc;
+using OASystem.API.OAMethodLib;
 using OASystem.Domain.Dtos.CRM;
 using OASystem.Domain.Entities.Customer;
 using OASystem.Infrastructure.Repositories.CRM;
@@ -65,6 +66,10 @@ namespace OASystem.API.Controllers
                 Result resultData = await _clientDataRepository.QueryNewClientData(dto);
                 if (resultData.Code == 0)
                 {
+                    #region 客户资料表操作记录
+                    await GeneralMethod.NewClientOperationRecord(dto.PortType,OperationEnum.NoOperation, dto.UserId, 0, "");
+                    #endregion
+
                     jw = JsonView(true, "查询成功!", resultData.Data);
                 }
                 else
@@ -95,6 +100,9 @@ namespace OASystem.API.Controllers
                 Result resultData = await _clientDataRepository._Details(dto.PortType , dto.Id);
                 if (resultData.Code == 0)
                 {
+                    #region 客户资料表操作记录
+                    await GeneralMethod.NewClientOperationRecord(dto.PortType,OperationEnum.Details, dto.UserId, dto.Id, "");
+                    #endregion
                     jw = JsonView(true, "查询成功!", resultData.Data);
                 }
                 else
@@ -126,6 +134,18 @@ namespace OASystem.API.Controllers
                 {
                     return Ok(JsonView(false, result.Msg));
                 }
+                #region 客户资料操作记录
+                OperationEnum operationEnum = OperationEnum.NoOperation;
+                if (dto.Status == 1)
+                {
+                    operationEnum = OperationEnum.Add;
+                    dto.Id = Convert.ToInt32(result.Data);
+                }
+                else if (dto.Status == 2) operationEnum = OperationEnum.Edit;
+
+                await GeneralMethod.NewClientOperationRecord(dto.PortType,operationEnum, dto.CreateUserId, dto.Id, "");
+                #endregion
+
                 return Ok(JsonView(true, result.Msg));
             }
             catch (Exception)
@@ -148,6 +168,11 @@ namespace OASystem.API.Controllers
             {
                 return Ok(JsonView(false, "删除失败"));
             }
+
+            #region 客户资料表操作记录
+            await GeneralMethod.NewClientOperationRecord(dto.PortType, OperationEnum.Details, dto.DeleteUserId, dto.Id, "");
+            #endregion
+
             return Ok(JsonView(true, "删除成功!"));
         }
 

+ 3 - 2
OASystem/OASystem.Api/OAMethodLib/GeneralMethod.cs

@@ -587,16 +587,18 @@ namespace OASystem.API.OAMethodLib
         /// 新客户资料表
         /// 操作记录添加
         /// </summary>
+        /// <param name="portType"></param>
         /// <param name="operationEnum"></param>
         /// <param name="userId"></param>
         /// <param name="dataId"></param>
         /// <param name="remark"></param>
         /// <returns></returns>
-        public static async Task<bool> NewClientOperationRecordAdd(OperationEnum operationEnum,int userId,int dataId,string remark )
+        public static async Task<bool> NewClientOperationRecord(int portType, OperationEnum operationEnum,int userId,int dataId,string remark )
         {
             Crm_TableOperationRecord _TableOperationRecord = new Crm_TableOperationRecord()
             {
                 TableName = "Crm_NewClientData",
+                PortType = portType,
                 OperationItem = operationEnum,
                 DataId = dataId,
                 CreateUserId = userId,
@@ -606,7 +608,6 @@ namespace OASystem.API.OAMethodLib
 
             bool add = await _tableOperationRecordRep._Add(_TableOperationRecord);
             if (add) return false;
-
             return false;
         }
 

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

@@ -13,6 +13,8 @@ namespace OASystem.Domain.Dtos.CRM
 {
     public class NewClientDataQueryDto:DtoBase
     {
+        public int UserId { get; set; }
+
         /// <summary>
         /// 联系人
         /// </summary>
@@ -55,7 +57,7 @@ namespace OASystem.Domain.Dtos.CRM
         public int Category { get; set; }
 
     }
-    public class NewClientOpDto
+    public class NewClientOpDto:PortDtoBase
     {
         /// <summary>
         /// 操作状态
@@ -196,12 +198,13 @@ namespace OASystem.Domain.Dtos.CRM
     /// </summary>
     public class NewClientDataDetailsDto:PortDtoBase
     {
+        public int UserId { get; set; }
         public int Id { get; set; }
     }
     /// <summary>
     /// 批量指派
     /// </summary>
-    public class BatchAssignmentDto
+    public class BatchAssignmentDto : PortDtoBase
     {
         public int UserId { get; set; }
 

+ 6 - 0
OASystem/OASystem.Domain/Dtos/CRM/TableOperationRecordDto.cs

@@ -28,6 +28,12 @@ namespace OASystem.Domain.Dtos.CRM
         /// </summary>
         public string? TableName { get; set; }
 
+        /// <summary>
+        /// 访问端口 
+        /// 1 WEb 2 安卓 3 苹果
+        /// </summary>
+        public int PortType { get; set; }
+
         /// <summary>
         /// 操作项目
         /// 0 未操作 1浏览列表 2 浏览详情 3 添加 4 修改 5 删除 6 审核 7 上传 8 下载

+ 2 - 1
OASystem/OASystem.Domain/Dtos/DtoBase.cs

@@ -37,8 +37,9 @@ namespace OASystem.Domain.Dtos
     /// <summary>
     /// 删除参数
     /// </summary>
-    public class DelBaseDto
+    public class DelBaseDto:PortDtoBase
     {
+
         /// <summary>
         /// 删除的数据Id
         /// </summary>

+ 6 - 0
OASystem/OASystem.Domain/Entities/Customer/Crm_TableOperationRecord.cs

@@ -20,6 +20,12 @@ namespace OASystem.Domain.Entities.Customer
         [SugarColumn(IsNullable = true, ColumnDataType = "varchar(50)")]
         public string? TableName { get; set; }
 
+        /// <summary>
+        /// 1 Web 2 安卓 3 苹果
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int PortType { get; set; }
+
         /// <summary>
         /// 操作项目
         /// 0 未操作 1浏览列表 2 浏览详情 3 添加 4 修改 5 删除 6 审核 7 上传 8 下载

+ 5 - 0
OASystem/OASystem.Domain/Enums/OperationEnum.cs

@@ -57,5 +57,10 @@ namespace OASystem.Domain.Enums
         /// </summary>
         [Description("下载")]
         Download = 8,
+        /// <summary>
+        /// 批量指派
+        /// </summary>
+        [Description("批量指派")]
+        BatchAssignment = 9,
     }
 }

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

@@ -7,6 +7,7 @@ using OASystem.Domain.Dtos;
 using OASystem.Domain.Dtos.CRM;
 using OASystem.Domain.Entities.Customer;
 using OASystem.Domain.Entities.Resource;
+using OASystem.Domain.Enums;
 using OASystem.Domain.ViewModels.CRM;
 using SqlSugar;
 using System;
@@ -601,7 +602,7 @@ namespace OASystem.Infrastructure.Repositories.CRM
                         }
                         else
                         {
-                            result = new Result() { Code = 0, Msg = "添加成功!"};
+                            result = new Result() { Code = 0, Msg = "添加成功!",Data = id };
                             istrue = true;
                             AddReturnId = id;
                             CommitTran();
@@ -912,6 +913,32 @@ namespace OASystem.Infrastructure.Repositories.CRM
                 var adds = await _sqlSugar.Insertable(_ClientDataAndUsers).ExecuteCommandAsync();
                 if (adds > 0)
                 {
+                    #region 客户资料表操作记录 批量添加
+
+                    List<Crm_TableOperationRecord> _TableOperationRecords = new List<Crm_TableOperationRecord>();
+
+                    foreach (var item in _ClientDataAndUsers)
+                    {
+                        _TableOperationRecords.Add(
+                            new Crm_TableOperationRecord() { 
+                                TableName = "Crm_TableOperationRecord",
+                                PortType = dto.PortType,
+                                OperationItem = OperationEnum.BatchAssignment,
+                                DataId = item.NewClientDataId,
+                                CreateUserId = dto.UserId,
+                                CreateTime = DateTime.Now,
+                                Remark = "",
+                                IsDel = 0
+                            });
+                    }
+
+                    if (_TableOperationRecords.Count > 0)
+                    {
+                        await _sqlSugar.Insertable(_TableOperationRecords).ExecuteCommandAsync();
+                    }
+
+                    #endregion
+
                     AcrionResult.Code = 0;
                     return AcrionResult;
                 }