From 69fd468746d430cbdb5c63424f6e13a4f98a91fc Mon Sep 17 00:00:00 2001
From: lingling <kety1122@163.com>
Date: 星期二, 18 三月 2025 13:11:25 +0800
Subject: [PATCH] 添加日志

---
 LifePayment/LifePayment.Application.Contracts/Setting/OperateHistoryDto.cs          |   74 +++++++++
 LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml          |   40 +++++
 LifePayment/LifePayment.HttpApi/LifePay/OperateHistoryController.cs                 |   46 +++++
 LifePayment/LifePayment.Domain.Shared/Enum/OperateHistory/OperateHistoryTypeEnum.cs |  153 +++++++++++++++++++
 LifePayment/LifePayment.Domain/Common/OperateHistory.cs                             |   35 ++++
 LifePayment/LifePayment.EntityFrameworkCore/LifePaymentServicesDbContext.cs         |    3 
 LifePayment/LifePayment.Application/Setting/OperateHistoryService.cs                |   75 +++++++++
 LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml                         |   14 +
 LifePayment/LifePayment.Application.Contracts/Setting/IOperateHistoryService.cs     |   17 ++
 9 files changed, 457 insertions(+), 0 deletions(-)

diff --git a/LifePayment/LifePayment.Application.Contracts/Setting/IOperateHistoryService.cs b/LifePayment/LifePayment.Application.Contracts/Setting/IOperateHistoryService.cs
new file mode 100644
index 0000000..1276a73
--- /dev/null
+++ b/LifePayment/LifePayment.Application.Contracts/Setting/IOperateHistoryService.cs
@@ -0,0 +1,17 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.Application.Services;
+using ZeroD.Util;
+
+namespace LifePayment.Application.Contracts
+{
+    public interface IOperateHistoryService : IApplicationService
+    {
+        Task<PageOutput<OperateHistoryDto>> GetOperateHistoryByRelationId(GetOperateHistoryInput input);
+
+        Task<PageOutput<OperateHistoryDto>> GetOperateHistoryByType(QueryOperateHistoryByTypeInput input);
+    }
+}
diff --git a/LifePayment/LifePayment.Application.Contracts/Setting/OperateHistoryDto.cs b/LifePayment/LifePayment.Application.Contracts/Setting/OperateHistoryDto.cs
new file mode 100644
index 0000000..2ec0153
--- /dev/null
+++ b/LifePayment/LifePayment.Application.Contracts/Setting/OperateHistoryDto.cs
@@ -0,0 +1,74 @@
+锘縰sing LifePayment.Domain.Shared;
+using System;
+using ZeroD.Util;
+
+namespace LifePayment.Application.Contracts
+{
+    public class OperateHistoryDto
+    {
+        /// <summary>
+        /// 鍏宠仈鍏崇郴ID
+        /// </summary>
+        public Guid RelationId { get; set; }
+
+        /// <summary>
+        /// 琛ㄥ悕
+        /// </summary>
+        public int? TableType { get; set; }
+
+        /// <summary>
+        /// 鎿嶄綔
+        /// </summary>
+        public string OperateName { get; set; }
+
+        /// <summary>
+        /// 鎿嶄綔鍐呭
+        /// </summary>
+        public string OperateContent { get; set; }
+
+        /// <summary>
+        /// 鎿嶄綔浜�
+        /// </summary>
+        public string CreatorName { get; set; }
+
+        /// <summary>
+        /// 鎿嶄綔鏃堕棿
+        /// </summary>
+        public DateTime CreationTime { get; set; }
+
+        /// <summary>
+        /// 鎿嶄綔缁嗚妭
+        /// </summary>
+        public string OperateDetail { get; set; }
+    }
+
+    public class GetOperateHistoryInput : PageInput
+    {
+        public Guid RelationId { get; set; }
+
+        public string OperateName { get; set; }
+    }
+
+    public class QueryOperateHistoryByTypeInput : PageInput
+    {
+        public Guid TypeId { get; set; }
+
+        public OperateHistoryTypeEnum OperateHistoryType { get; set; }
+    }
+
+    public class CreateOperateHistoryInput
+    {
+        /// <summary>
+        /// 鍏宠仈鍏崇郴ID
+        /// </summary>
+        public Guid RelationId { get; set; }
+
+        public int? TableType { get; set; }
+
+        public string OperateName { get; set; }
+
+        public string OperateContent { get; set; }
+
+        public string CreatorName { get; set; }
+    }
+}
diff --git a/LifePayment/LifePayment.Application/Setting/OperateHistoryService.cs b/LifePayment/LifePayment.Application/Setting/OperateHistoryService.cs
new file mode 100644
index 0000000..6832ba0
--- /dev/null
+++ b/LifePayment/LifePayment.Application/Setting/OperateHistoryService.cs
@@ -0,0 +1,75 @@
+锘縰sing LifePayment.Application.Contracts;
+using LifePayment.Domain.Models;
+using LifePayment.Domain.Shared;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Dynamic.Core;
+using System.Threading.Tasks;
+using Volo.Abp.Application.Services;
+using Volo.Abp.Domain.Repositories;
+using ZeroD.Util;
+
+namespace LifePayment.Application
+{
+    public class OperateHistoryService : ApplicationService, IOperateHistoryService
+    {
+        private readonly IRepository<OperateHistory, Guid> _operateHistory;
+
+        public OperateHistoryService(
+               IRepository<OperateHistory, Guid> operateHistory)
+        {
+            _operateHistory = operateHistory;
+        }
+
+        public async Task<PageOutput<OperateHistoryDto>> GetOperateHistoryByRelationId(GetOperateHistoryInput input)
+        {
+            var query = _operateHistory.Where(r => r.RelationId == input.RelationId)
+                                       .WhereIf(input.OperateName.IsNotNullOrEmpty(), r => r.OperateName == input.OperateName)
+                                       .Select(r => new OperateHistoryDto
+                                       {
+                                           OperateName = r.OperateName,
+                                           RelationId = r.RelationId,
+                                           CreationTime = r.CreationTime,
+                                           CreatorName = r.CreatorName,
+                                           OperateContent = r.OperateContent,
+                                           TableType = r.TableType
+                                       });
+            var result = await query.GetPageResult(input.PageModel);
+
+            return result;
+        }
+
+        public async Task<PageOutput<OperateHistoryDto>> GetOperateHistoryByType(QueryOperateHistoryByTypeInput input)
+        {
+            var query = _operateHistory.AsQueryable();
+
+            switch (input.OperateHistoryType)
+            {
+              
+                case OperateHistoryTypeEnum.AccountManage:
+                    query = query.Where(x => x.UserId == input.TypeId
+                                          && LifePaymentConstant.LogsSpecies.AccountManageOperateNameList.Contains(x.OperateName));
+
+                    break;
+                default:
+                    query = query.Where(x => x.RelationId == input.TypeId);
+
+                    break;
+            }
+
+            var result = await query.Select(r =>
+                                            new OperateHistoryDto
+                                            {
+                                                OperateName = r.OperateName,
+                                                RelationId = r.RelationId,
+                                                CreationTime = r.CreationTime,
+                                                CreatorName = r.CreatorName,
+                                                OperateContent = r.OperateContent,
+                                                TableType = r.TableType
+                                            })
+                                    .GetPageResult(input.PageModel);
+            return result;
+        }
+    }
+}
diff --git a/LifePayment/LifePayment.Domain.Shared/Enum/OperateHistory/OperateHistoryTypeEnum.cs b/LifePayment/LifePayment.Domain.Shared/Enum/OperateHistory/OperateHistoryTypeEnum.cs
new file mode 100644
index 0000000..d96037a
--- /dev/null
+++ b/LifePayment/LifePayment.Domain.Shared/Enum/OperateHistory/OperateHistoryTypeEnum.cs
@@ -0,0 +1,153 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LifePayment.Domain.Shared;
+
+public enum OperateHistoryTypeEnum
+{
+    /// <summary>
+    /// 璁よ瘉鐢ㄦ埛鏃ュ織
+    /// </summary>
+    [Description("璁よ瘉鐢ㄦ埛鏃ュ織")]
+    CertifiedUser = 10,
+
+    /// <summary>
+    /// 骞冲彴鐢ㄦ埛鏃ュ織
+    /// </summary>
+    [Description("骞冲彴鐢ㄦ埛鏃ュ織")]
+    PlatformUser = 11,
+
+    /// <summary>
+    /// 鐢ㄦ埛璁よ瘉瀹℃牳鏃ュ織
+    /// </summary>
+    [Description("鐢ㄦ埛璁よ瘉瀹℃牳鏃ュ織")]
+    UserCertificationAudit = 12,
+
+    /// <summary>
+    /// 鍏憡鏃ュ織
+    /// </summary>
+    [Description("鍏憡鏃ュ織")]
+    SystemNotice = 13,
+
+    /// <summary>
+    /// 璧勮绠$悊鏃ュ織
+    /// </summary>
+    [Description("璧勮绠$悊鏃ュ織")]
+    InformationForManage = 14,
+
+    /// <summary>
+    /// 璧勮瀹℃牳鏃ュ織
+    /// </summary>
+    [Description("璧勮瀹℃牳鏃ュ織")]
+    InformationWaitForCheck = 15,
+
+    /// <summary>
+    /// 閽卞寘寮�鎴锋棩蹇�
+    /// </summary>
+    [Description("閽卞寘寮�鎴锋棩蹇�")]
+    WalletAccountOpen = 16,
+
+    /// <summary>
+    /// 杞处瀹℃牳瀵瑰崟鏃ュ織
+    /// </summary>
+    [Description("杞处瀹℃牳瀵瑰崟鏃ュ織")]
+    WalletSingleTransfer = 17,
+
+    /// <summary>
+    /// 鍏呭�煎鏍�
+    /// </summary>
+    [Description("鍏呭�煎鏍告棩蹇�")]
+    WalletRecharge = 18,
+
+    /// <summary>
+    /// 璐︽埛绠$悊
+    /// </summary>
+    [Description("璐︽埛绠$悊")]
+    AccountManage = 19,
+
+    /// <summary>
+    /// 璁よ瘉绠$悊
+    /// </summary>
+    [Description("璁よ瘉绠$悊")]
+    UserCertificationManage = 20,
+
+    /// <summary>
+    /// 鎵归噺杞处瀹℃牳鏃ュ織
+    /// </summary>
+    [Description("鎵归噺杞处瀹℃牳鏃ュ織")]
+    AuditWalletBatchTransfer = 21,
+
+    /// <summary>
+    /// 琛屼笟鏈烘瀯瀹℃牳鏃ュ織
+    /// </summary>
+    [Description("琛屼笟鏈烘瀯瀹℃牳鏃ュ織")]
+    IndustryBodyAudit = 22,
+
+    /// <summary>
+    /// 琛屼笟閰嶅瀹℃牳鏃ュ織
+    /// </summary>
+    [Description("琛屼笟閰嶅瀹℃牳鏃ュ織")]
+    IndustryMatingAudit = 23,
+
+    /// <summary>
+    /// 鐢叉柟浼佷笟瀹℃牳鏃ュ織
+    /// </summary>
+    [Description("鐢叉柟浼佷笟瀹℃牳鏃ュ織")]
+    FirstPartyCompanyAudit = 24,
+
+    /// <summary>
+    /// 浜鸿祫鍏徃瀹℃牳鏃ュ織
+    /// </summary>
+    [Description("浜鸿祫鍏徃瀹℃牳鏃ュ織")]
+    ParkOrHRAudit = 25,
+
+    /// <summary>
+    /// 琛屼笟鏈烘瀯绠$悊鏃ュ織
+    /// </summary>
+    [Description("琛屼笟鏈烘瀯绠$悊鏃ュ織")]
+    IndustryBodyManage = 26,
+
+    /// <summary>
+    /// 琛屼笟閰嶅绠$悊鏃ュ織
+    /// </summary>
+    [Description("琛屼笟閰嶅绠$悊鏃ュ織")]
+    IndustryMatingManage = 27,
+
+    /// <summary>
+    /// 鐢叉柟浼佷笟绠$悊鏃ュ織
+    /// </summary>
+    [Description("鐢叉柟浼佷笟绠$悊鏃ュ織")]
+    FirstPartyCompanyManage = 28,
+
+    /// <summary>
+    /// 浜鸿祫鍏徃绠$悊鏃ュ織
+    /// </summary>
+    [Description("浜鸿祫鍏徃绠$悊鏃ュ織")]
+    ParkOrHRManage = 29,
+
+    /// <summary>
+    /// 瀹㈡埛绠$悊鏃ュ織
+    /// </summary>
+    [Description("瀹㈡埛绠$悊鏃ュ織")]
+    CustomerManage = 30,
+
+    /// <summary>
+    /// 濂栧姳閰嶇疆鏃ュ織
+    /// </summary>
+    [Description("濂栧姳閰嶇疆鏃ュ織")]
+    ParkRewardManage = 31,
+
+    /// <summary>
+    /// 瀹㈡埛妯℃澘鎿嶄綔鏃ュ織
+    /// </summary>
+    [Description("瀹㈡埛妯℃澘鎿嶄綔鏃ュ織")]
+    CustomerContractTemplate = 32,
+
+    LifePayOrder = 40,
+
+    LifePayChannles = 42,
+}
diff --git a/LifePayment/LifePayment.Domain/Common/OperateHistory.cs b/LifePayment/LifePayment.Domain/Common/OperateHistory.cs
new file mode 100644
index 0000000..1f8c168
--- /dev/null
+++ b/LifePayment/LifePayment.Domain/Common/OperateHistory.cs
@@ -0,0 +1,35 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.Domain.Entities.Auditing;
+
+namespace LifePayment.Domain.Models
+{
+    public class OperateHistory : CreationAuditedEntity<Guid>
+    {
+        /// <summary>
+        /// 鍏宠仈鍏崇郴ID
+        /// </summary>
+        public Guid RelationId { get; set; }
+
+        public int? TableType { get; set; }
+
+        public string OperateName { get; set; }
+
+        public string OperateContent { get; set; }
+
+        public string CreatorName { get; set; }
+
+        /// <summary>
+        /// 鎿嶄綔缁嗚妭
+        /// </summary>
+        public string OperateDetail { get; set; }
+
+        /// <summary>
+        /// 鐢ㄦ埛id
+        /// </summary>
+        public Guid? UserId { get; set; }
+    }
+}
diff --git a/LifePayment/LifePayment.EntityFrameworkCore/LifePaymentServicesDbContext.cs b/LifePayment/LifePayment.EntityFrameworkCore/LifePaymentServicesDbContext.cs
index 9fd8000..15260dc 100644
--- a/LifePayment/LifePayment.EntityFrameworkCore/LifePaymentServicesDbContext.cs
+++ b/LifePayment/LifePayment.EntityFrameworkCore/LifePaymentServicesDbContext.cs
@@ -28,8 +28,11 @@
 
         public virtual DbSet<Role> Roles { get; set; }
 
+
         public virtual DbSet<UserRole> UserRoles { get; set; }
 
+        public virtual DbSet<OperateHistory> OperateHistory { get; set; }
+
         public virtual DbSet<LifePayChannles> LifePayChannles { get; set; }
 
         public virtual DbSet<LifePayAccount> LifePayAccount { get; set; }
diff --git a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml b/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
index 5211c0f..882aa48 100644
--- a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
+++ b/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
@@ -278,6 +278,20 @@
             <param name="input"></param>
             <returns></returns>
         </member>
+        <member name="M:LifePayment.HttpApi.OperateHistoryController.GetOperateHistoryByRelationId(LifePayment.Application.Contracts.GetOperateHistoryInput)">
+            <summary>
+            鏌ヨ鏃ュ織
+            </summary>
+            <param name="input"></param>
+            <returns></returns>
+        </member>
+        <member name="M:LifePayment.HttpApi.OperateHistoryController.GetOperateHistoryByType(LifePayment.Application.Contracts.QueryOperateHistoryByTypeInput)">
+            <summary>
+            鏍规嵁type鏌ヨ鏃ュ織
+            </summary>
+            <param name="input"></param>
+            <returns></returns>
+        </member>
         <member name="M:LifePayment.HttpApi.UserRoleController.CreateBackClientUser(LifePayment.Application.Contracts.CreateBackClientUserInput)">
             <summary>
             鏂板鍚庡彴绠$悊璐︽埛
diff --git a/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml b/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
index 0e1ce92..5ce8457 100644
--- a/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
+++ b/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
@@ -1298,6 +1298,46 @@
             绾夸笅鏀粯姹囨鏈�鏅氭椂闂�
             </summary>
         </member>
+        <member name="P:LifePayment.Application.Contracts.OperateHistoryDto.RelationId">
+            <summary>
+            鍏宠仈鍏崇郴ID
+            </summary>
+        </member>
+        <member name="P:LifePayment.Application.Contracts.OperateHistoryDto.TableType">
+            <summary>
+            琛ㄥ悕
+            </summary>
+        </member>
+        <member name="P:LifePayment.Application.Contracts.OperateHistoryDto.OperateName">
+            <summary>
+            鎿嶄綔
+            </summary>
+        </member>
+        <member name="P:LifePayment.Application.Contracts.OperateHistoryDto.OperateContent">
+            <summary>
+            鎿嶄綔鍐呭
+            </summary>
+        </member>
+        <member name="P:LifePayment.Application.Contracts.OperateHistoryDto.CreatorName">
+            <summary>
+            鎿嶄綔浜�
+            </summary>
+        </member>
+        <member name="P:LifePayment.Application.Contracts.OperateHistoryDto.CreationTime">
+            <summary>
+            鎿嶄綔鏃堕棿
+            </summary>
+        </member>
+        <member name="P:LifePayment.Application.Contracts.OperateHistoryDto.OperateDetail">
+            <summary>
+            鎿嶄綔缁嗚妭
+            </summary>
+        </member>
+        <member name="P:LifePayment.Application.Contracts.CreateOperateHistoryInput.RelationId">
+            <summary>
+            鍏宠仈鍏崇郴ID
+            </summary>
+        </member>
         <member name="P:LifePayment.Application.Contracts.CreateBackClientUserInput.Name">
             <summary>
             鍚嶇О
diff --git a/LifePayment/LifePayment.HttpApi/LifePay/OperateHistoryController.cs b/LifePayment/LifePayment.HttpApi/LifePay/OperateHistoryController.cs
new file mode 100644
index 0000000..96e2d8f
--- /dev/null
+++ b/LifePayment/LifePayment.HttpApi/LifePay/OperateHistoryController.cs
@@ -0,0 +1,46 @@
+锘縰sing LifePayment.Application.Contracts;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using System.Threading.Tasks;
+using Volo.Abp.AspNetCore.Mvc;
+using Volo.Abp.Uow;
+using ZeroD.Util;
+
+namespace LifePayment.HttpApi
+{
+    [Route("api/[controller]/[action]")]
+    [ApiController]
+    [Authorize]
+    public class OperateHistoryController : AbpController
+    {
+        private readonly IOperateHistoryService _operateHistoryService;
+        public OperateHistoryController(
+               IOperateHistoryService operateHistoryService)
+        {
+            _operateHistoryService = operateHistoryService;
+        }
+        /// <summary>
+        /// 鏌ヨ鏃ュ織
+        /// </summary>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [UnitOfWork(IsDisabled = true)]
+        public async Task<PageOutput<OperateHistoryDto>> GetOperateHistoryByRelationId(GetOperateHistoryInput input)
+        {
+            return await _operateHistoryService.GetOperateHistoryByRelationId(input);
+        }
+
+        /// <summary>
+        /// 鏍规嵁type鏌ヨ鏃ュ織
+        /// </summary>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [UnitOfWork(IsDisabled = true)]
+        public async Task<PageOutput<OperateHistoryDto>> GetOperateHistoryByType(QueryOperateHistoryByTypeInput input)
+        {
+            return await _operateHistoryService.GetOperateHistoryByType(input);
+        }
+    }
+}

--
Gitblit v1.9.1