From b826cd87cd20fe372c718acb8a0b9c7fe9b0c89a Mon Sep 17 00:00:00 2001
From: sunpengfei <i@angelzzz.com>
Date: 星期五, 06 六月 2025 13:52:00 +0800
Subject: [PATCH] feat:同步测试数据

---
 LifePayment/LifePayment.Application/LifePayment.Application.csproj                           |    1 
 LifePayment/LifePayment.Host/appsettings.json                                                |   11 
 LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml                   |    6 
 LifePayment/LifePayment.HttpApi/LifePay/SyncController.cs                                    |   33 +
 LifePayment/LifePayment.EntityFrameworkCore/LifePaymentServicesEntityFrameworkCoreModule.cs  |    1 
 LifePayment/LifePayment.Application.Contracts/Sync/SyncLifePayConsumption.cs                 |   32 +
 LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs                                 |    1 
 LifePayment/LifePayment.Application.Contracts/Sync/SyncUser.cs                               |   55 +++
 LifePayment/LifePayment.Application/LifePaymentServicesApplicationModuleAutoMapperProfile.cs |   10 
 LifePayment/LifePayment.Application.Contracts/Sync/SyncLifePayChannlesRake.cs                |   28 +
 LifePayment/LifePayment.Application/Sync/SyncService.cs                                      |  657 ++++++++++++++++++++++++++++++++++++
 LifePayment/LifePayment.Application.Contracts/Sync/SyncLifePayUser.cs                        |   27 +
 LifePayment/LifePayment.Application.Contracts/Sync/SyncLifePayExpensesReceipts.cs            |   28 +
 LifePayment/LifePayment.Application.Contracts/Sync/ISyncService.cs                           |   18 +
 LifePayment/LifePayment.Application.Contracts/Sync/SyncLifePayChannles.cs                    |   27 +
 LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayService.cs                     |    1 
 LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml                                  |    6 
 LifePayment/LifePayment.Application.Contracts/Sync/SyncIdentityUser.cs                       |   44 ++
 LifePayment/LifePayment.Application.Contracts/Sync/SyncLifePayOrder.cs                       |   58 +++
 LifePayment/LifePayment.Application/LifePay/LifePayService.cs                                |    2 
 20 files changed, 1,039 insertions(+), 7 deletions(-)

diff --git a/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayService.cs b/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayService.cs
index 4e9b5fa..4c1373f 100644
--- a/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayService.cs
+++ b/LifePayment/LifePayment.Application.Contracts/LifePay/ILifePayService.cs
@@ -11,7 +11,6 @@
 
 public interface ILifePayService : IApplicationService
 {
-
     /// <summary>
     /// 鑾峰彇鐢佃垂闈㈠��
     /// </summary>
diff --git a/LifePayment/LifePayment.Application.Contracts/Sync/ISyncService.cs b/LifePayment/LifePayment.Application.Contracts/Sync/ISyncService.cs
new file mode 100644
index 0000000..7f803da
--- /dev/null
+++ b/LifePayment/LifePayment.Application.Contracts/Sync/ISyncService.cs
@@ -0,0 +1,18 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.Application.Services;
+
+namespace LifePayment.Application.Contracts
+{
+    public interface ISyncService : IApplicationService
+    {
+        /// <summary>
+        /// 鍚屾娴嬭瘯璁㈠崟鏁版嵁
+        /// </summary>
+        /// <returns></returns>
+       Task<List<string>> SyncFromTest();
+    }
+}
diff --git a/LifePayment/LifePayment.Application.Contracts/Sync/SyncIdentityUser.cs b/LifePayment/LifePayment.Application.Contracts/Sync/SyncIdentityUser.cs
new file mode 100644
index 0000000..76ef01b
--- /dev/null
+++ b/LifePayment/LifePayment.Application.Contracts/Sync/SyncIdentityUser.cs
@@ -0,0 +1,44 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LifePayment.Application.Contracts
+{
+    public class SyncIdentityUser
+    {
+        public Guid Id { get; set; }
+        public Guid? TenantId { get; set; }
+        public Guid? VersionId { get; set; }
+        public string UserName { get; set; }
+        public string NormalizedUserName { get; set; }
+        public string Name { get; set; }
+        public string Surname { get; set; }
+        public string Email { get; set; }
+        public string NormalizedEmail { get; set; }
+        public bool EmailConfirmed { get; set; }
+        public string PasswordHash { get; set; }
+        public string SecurityStamp { get; set; }
+        public bool IsExternal { get; set; }
+        public int Sex { get; set; }
+        public string PhoneNumber { get; set; }
+        public bool PhoneNumberConfirmed { get; set; }
+        public bool TwoFactorEnabled { get; set; }
+        public DateTimeOffset? LockoutEnd { get; set; }
+        public bool LockoutEnabled { get; set; }
+        public int AccessFailedCount { get; set; }
+        public string ClientId { get; set; }
+        public string ExtraProperties { get; set; }
+        public string ConcurrencyStamp { get; set; }
+        public DateTime CreationTime { get; set; }
+        public Guid? CreatorId { get; set; }
+        public DateTime? LastModificationTime { get; set; }
+        public Guid? LastModifierId { get; set; }
+        public bool IsDeleted { get; set; }
+        public Guid? DeleterId { get; set; }
+        public DateTime? DeletionTime { get; set; }
+    }
+}
diff --git a/LifePayment/LifePayment.Application.Contracts/Sync/SyncLifePayChannles.cs b/LifePayment/LifePayment.Application.Contracts/Sync/SyncLifePayChannles.cs
new file mode 100644
index 0000000..7dfd186
--- /dev/null
+++ b/LifePayment/LifePayment.Application.Contracts/Sync/SyncLifePayChannles.cs
@@ -0,0 +1,27 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LifePayment.Application.Contracts.Sync
+{
+    public class SyncLifePayChannles
+    {
+        public Guid Id { get; set; }
+        public string ChannlesName { get; set; }
+        public string ChannlesNum { get; set; }
+        public decimal? ChannlesRate { get; set; }
+        public decimal? ChannlesRakeRate { get; set; }
+        public int? ChannlesType { get; set; }
+        public int? SwitchType { get; set; }
+        public int? Status { get; set; }
+        public DateTime? CreationTime { get; set; }
+        public Guid? CreatorId { get; set; }
+        public DateTime? LastModificationTime { get; set; }
+        public Guid? LastModifierId { get; set; }
+        public bool? IsDeleted { get; set; }
+        public Guid? DeleterId { get; set; }
+        public DateTime? DeletionTime { get; set; }
+    }
+}
diff --git a/LifePayment/LifePayment.Application.Contracts/Sync/SyncLifePayChannlesRake.cs b/LifePayment/LifePayment.Application.Contracts/Sync/SyncLifePayChannlesRake.cs
new file mode 100644
index 0000000..aaaa5a1
--- /dev/null
+++ b/LifePayment/LifePayment.Application.Contracts/Sync/SyncLifePayChannlesRake.cs
@@ -0,0 +1,28 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LifePayment.Application.Contracts
+{
+    public class SyncLifePayChannlesRake
+    {
+        public Guid Id { get; set; }
+        public Guid? UserId { get; set; }
+        public DateTime CreationTime { get; set; }
+        public Guid? CreatorId { get; set; }
+        public DateTime? LastModificationTime { get; set; }
+        public Guid? LastModifierId { get; set; }
+        public bool? IsDeleted { get; set; }
+        public Guid? DeleterId { get; set; }
+        public DateTime? DeletionTime { get; set; }
+        public string ExtraProperties { get; set; }
+        public DateTime? FinishTime { get; set; }
+        public string OrderNo { get; set; }
+        public decimal? PayAmount { get; set; }
+        public decimal? ChannlesRakeRate { get; set; }
+        public decimal? ChannlesRakePrice { get; set; }
+        public string ChannelId { get; set; }
+    }
+}
diff --git a/LifePayment/LifePayment.Application.Contracts/Sync/SyncLifePayConsumption.cs b/LifePayment/LifePayment.Application.Contracts/Sync/SyncLifePayConsumption.cs
new file mode 100644
index 0000000..a2db4b4
--- /dev/null
+++ b/LifePayment/LifePayment.Application.Contracts/Sync/SyncLifePayConsumption.cs
@@ -0,0 +1,32 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LifePayment.Application.Contracts
+{
+    public class SyncLifePayConsumption
+    {
+        public Guid Id { get; set; }
+        public Guid? UserId { get; set; }
+        public DateTime CreationTime { get; set; }
+        public Guid? CreatorId { get; set; }
+        public DateTime? LastModificationTime { get; set; }
+        public Guid? LastModifierId { get; set; }
+        public bool? IsDeleted { get; set; }
+        public Guid? DeleterId { get; set; }
+        public DateTime? DeletionTime { get; set; }
+        public string ExtraProperties { get; set; }
+        public string OrderNo { get; set; }
+        public string AcoolyOrderNo { get; set; }
+        public decimal? Amount { get; set; }
+        public int? ACOOLYStatus { get; set; }
+        public int? FrozenStatus { get; set; }
+        public int? Flow { get; set; }
+        public decimal? DeductionAmount { get; set; }
+        public DateTime? FinishTime { get; set; }
+        public string ChannelId { get; set; }
+        public decimal? FrozenAmount { get; set; }
+    }
+}
\ No newline at end of file
diff --git a/LifePayment/LifePayment.Application.Contracts/Sync/SyncLifePayExpensesReceipts.cs b/LifePayment/LifePayment.Application.Contracts/Sync/SyncLifePayExpensesReceipts.cs
new file mode 100644
index 0000000..bf8f041
--- /dev/null
+++ b/LifePayment/LifePayment.Application.Contracts/Sync/SyncLifePayExpensesReceipts.cs
@@ -0,0 +1,28 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LifePayment.Application.Contracts
+{
+    public class SyncLifePayExpensesReceipts
+    {
+        public Guid Id { get; set; }
+        public Guid? UserId { get; set; }
+        public DateTime? CreationTime { get; set; }
+        public Guid? CreatorId { get; set; }
+        public DateTime? LastModificationTime { get; set; }
+        public Guid? LastModifierId { get; set; }
+        public bool? IsDeleted { get; set; }
+        public Guid? DeleterId { get; set; }
+        public DateTime? DeletionTime { get; set; }
+        public string ExtraProperties { get; set; }
+        public string OrderNo { get; set; }
+        public string OutOrderNo { get; set; }
+        public int? LifePayType { get; set; }
+        public decimal? Amount { get; set; }
+        public int? ExpensesReceiptsType { get; set; }
+        public DateTime? FinishTime { get; set; }
+    }
+}
diff --git a/LifePayment/LifePayment.Application.Contracts/Sync/SyncLifePayOrder.cs b/LifePayment/LifePayment.Application.Contracts/Sync/SyncLifePayOrder.cs
new file mode 100644
index 0000000..250c0d3
--- /dev/null
+++ b/LifePayment/LifePayment.Application.Contracts/Sync/SyncLifePayOrder.cs
@@ -0,0 +1,58 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LifePayment.Application.Contracts
+{
+    public class SyncLifePayOrder
+    {
+        public Guid Id { get; set; }
+        public Guid? UserId { get; set; }
+        public DateTime CreationTime { get; set; }
+        public Guid? CreatorId { get; set; }
+        public DateTime? LastModificationTime { get; set; }
+        public Guid? LastModifierId { get; set; }
+        public bool? IsDeleted { get; set; }
+        public Guid? DeleterId { get; set; }
+        public DateTime? DeletionTime { get; set; }
+        public string ExtraProperties { get; set; }
+        public string ConcurrencyStamp { get; set; }
+        public string PhoneNumber { get; set; }
+        public int? LifePayType { get; set; }
+        public int? LifePayOrderType { get; set; }
+        public string OrderNo { get; set; }
+        public decimal? RechargeAmount { get; set; }
+        public decimal? DiscountAmount { get; set; }
+        public decimal? PayAmount { get; set; }
+        public DateTime? PayTime { get; set; }
+        public int? PayStatus { get; set; }
+        public string OutOrderNo { get; set; }
+        public int? LifePayOrderStatus { get; set; }
+        public DateTime? FinishTime { get; set; }
+        public string RefundCredentialsImgUrl { get; set; }
+        public string OrderParamDetailJsonStr { get; set; }
+        public string OutRequestNo { get; set; }
+        public string ACOOLYOrderNo { get; set; }
+        public string RefundApplyRemark { get; set; }
+        public string RefundCheckRemark { get; set; }
+        public DateTime? RefundTime { get; set; }
+        public Guid? RefundCheckUserId { get; set; }
+        public string ChannelId { get; set; }
+        public DateTime? RefundApplyTime { get; set; }
+        public decimal? PlatformDeductionAmount { get; set; }
+        public int? ACOOLYStatus { get; set; }
+        public decimal? ActualRechargeAmount { get; set; }
+        public int? LifePayRefundStatus { get; set; }
+        public decimal? RefundPrice { get; set; }
+        public string RefundOrderNo { get; set; }
+        public string ElecBillUrl { get; set; }
+        public string RefundElecBillUrl { get; set; }
+        public decimal? ActualReceivedAmount { get; set; }
+        public decimal? PlatformRate { get; set; }
+        public decimal? ChannleRate { get; set; }
+        public decimal? ChannlesRakeRate { get; set; }
+        public decimal? PremiumRate { get; set; }
+    }
+}
diff --git a/LifePayment/LifePayment.Application.Contracts/Sync/SyncLifePayUser.cs b/LifePayment/LifePayment.Application.Contracts/Sync/SyncLifePayUser.cs
new file mode 100644
index 0000000..39b26af
--- /dev/null
+++ b/LifePayment/LifePayment.Application.Contracts/Sync/SyncLifePayUser.cs
@@ -0,0 +1,27 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LifePayment.Application.Contracts.Sync
+{
+    public class SyncLifePayUser
+    {
+        public Guid Id { get; set; }
+        public string PhoneNumber { get; set; }
+        public string OpenId { get; set; }
+        public DateTime? LastLoginTime { get; set; }
+        public DateTime? CreationTime { get; set; }
+        public Guid? CreatorId { get; set; }
+        public DateTime? LastModificationTime { get; set; }
+        public Guid? LastModifierId { get; set; }
+        public bool? IsDeleted { get; set; }
+        public Guid? DeleterId { get; set; }
+        public DateTime? DeletionTime { get; set; }
+        public string UnionId { get; set; }
+        public string CreationChannleNum { get; set; }
+        public string LastLoginChannleNum { get; set; }
+        public string Name { get; set; }
+    }
+}
diff --git a/LifePayment/LifePayment.Application.Contracts/Sync/SyncUser.cs b/LifePayment/LifePayment.Application.Contracts/Sync/SyncUser.cs
new file mode 100644
index 0000000..b0a2399
--- /dev/null
+++ b/LifePayment/LifePayment.Application.Contracts/Sync/SyncUser.cs
@@ -0,0 +1,55 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LifePayment.Application.Contracts
+{
+    public class SyncUser
+    {
+        public Guid Id { get; set; }
+        public string Name { get; set; }
+        public string UserName { get; set; }
+        public string PhoneNumber { get; set; }
+        public int? Type { get; set; }
+        public int AuthType { get; set; }
+        public string ClientId { get; set; }
+        public string OpenId { get; set; }
+        public decimal? Amount { get; set; }
+        public bool? IsLocked { get; set; }
+        public string Remark { get; set; }
+        public DateTime? LastLoginTime { get; set; }
+        public DateTime CreationTime { get; set; }
+        public Guid? CreatorId { get; set; }
+        public DateTime? LastModificationTime { get; set; }
+        public Guid? LastModifierId { get; set; }
+        public bool? IsDeleted { get; set; }
+        public Guid? DeleterId { get; set; }
+        public DateTime? DeletionTime { get; set; }
+        public string EnterpriseName { get; set; }
+        public string Contact { get; set; }
+        public string ContactPhone { get; set; }
+        public string BindEmailAddress { get; set; }
+        public string UserInfoEmailAddress { get; set; }
+        public string AvatarUrl { get; set; }
+        public int? GenderType { get; set; }
+        public string JobTitle { get; set; }
+        public int? ProvinceCode { get; set; }
+        public int? CityCode { get; set; }
+        public int? CountyCode { get; set; }
+        public string ProvinceName { get; set; }
+        public string CityName { get; set; }
+        public string CountyName { get; set; }
+        public string AddressDetail { get; set; }
+        public string WxQrCodeUrl { get; set; }
+        public decimal? AddressLatitude { get; set; }
+        public decimal? AddressLongitude { get; set; }
+        public int? MatchMakingIdentity { get; set; }
+        public string MatchMakingOpenId { get; set; }
+        public string IMTencentUserId { get; set; }
+        public Guid? CompanyOrgId { get; set; }
+        public Guid? DepartmentOrgId { get; set; }
+        public Guid? IndustrialParkId { get; set; }
+    }
+}
diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
index 1edf990..ee425c3 100644
--- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
@@ -10,6 +10,7 @@
 using Newtonsoft.Json;
 using System;
 using System.Collections.Generic;
+using System.Data;
 using System.Linq;
 using System.Linq.Dynamic.Core;
 using System.Threading.Tasks;
@@ -932,7 +933,6 @@
         var amount = CalculateAmount(input.ProductData.ParValue, rate);
 
         var platformRate = await _lifePayRateRepository.FirstOrDefaultAsync(r => r.RateType == LifePayRateTypeEnum.渚涘簲鍟嗘姌鎵d环);
-
 
         var orderInput = new CreateLifePayOrderInput
         {
diff --git a/LifePayment/LifePayment.Application/LifePayment.Application.csproj b/LifePayment/LifePayment.Application/LifePayment.Application.csproj
index 45b57bf..7271182 100644
--- a/LifePayment/LifePayment.Application/LifePayment.Application.csproj
+++ b/LifePayment/LifePayment.Application/LifePayment.Application.csproj
@@ -9,6 +9,7 @@
 	</PropertyGroup>
 
 	<ItemGroup>
+		<PackageReference Include="Dapper" Version="2.1.66" />
 		<PackageReference Include="MailKit" Version="2.10.1" />
 		<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
 			<PrivateAssets>all</PrivateAssets>
diff --git a/LifePayment/LifePayment.Application/LifePaymentServicesApplicationModuleAutoMapperProfile.cs b/LifePayment/LifePayment.Application/LifePaymentServicesApplicationModuleAutoMapperProfile.cs
index abedd35..0babb20 100644
--- a/LifePayment/LifePayment.Application/LifePaymentServicesApplicationModuleAutoMapperProfile.cs
+++ b/LifePayment/LifePayment.Application/LifePaymentServicesApplicationModuleAutoMapperProfile.cs
@@ -1,5 +1,6 @@
 using AutoMapper;
 using LifePayment.Application.Contracts;
+using LifePayment.Application.Contracts.Sync;
 using LifePayment.Domain;
 using LifePayment.Domain.Models;
 
@@ -17,6 +18,15 @@
 
             CreateMap<CreateBackClientUserInput, CreateAccountInput>(MemberList.None);
             #endregion
+
+            CreateMap<SyncIdentityUser, SyncIdentityUser>(MemberList.None);
+            CreateMap<SyncUser, SyncUser>(MemberList.None);
+            CreateMap<SyncLifePayChannles, SyncLifePayChannles>(MemberList.None);
+            CreateMap<SyncLifePayUser, SyncLifePayUser>(MemberList.None);
+            CreateMap<SyncLifePayOrder, SyncLifePayOrder>(MemberList.None);
+            CreateMap<SyncLifePayChannlesRake, SyncLifePayChannlesRake>(MemberList.None);
+            CreateMap<SyncLifePayConsumption, SyncLifePayConsumption>(MemberList.None);
+            CreateMap<SyncLifePayExpensesReceipts, SyncLifePayExpensesReceipts>(MemberList.None);
         }
     }
 }
\ No newline at end of file
diff --git a/LifePayment/LifePayment.Application/Sync/SyncService.cs b/LifePayment/LifePayment.Application/Sync/SyncService.cs
new file mode 100644
index 0000000..e2c3a83
--- /dev/null
+++ b/LifePayment/LifePayment.Application/Sync/SyncService.cs
@@ -0,0 +1,657 @@
+锘縰sing Castle.Core.Logging;
+using Dapper;
+using LifePayment.Application.Contracts;
+using LifePayment.Application.Contracts.Sync;
+using LifePayment.Domain.LifePay;
+using LifePayment.Domain.Models;
+using Microsoft.EntityFrameworkCore.Metadata.Internal;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.Logging;
+using Nest;
+using NPOI.SS.Formula.Functions;
+using System;
+using System.Collections.Generic;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.Application.Services;
+using Volo.Abp.Domain.Repositories;
+using ZeroD.Util;
+using ZeroD.Util.Fadd;
+
+namespace LifePayment.Application.Sync
+{
+    public class SyncService : ApplicationService, ISyncService
+    {
+        private readonly ILogger<SyncService> logger;
+        private readonly IConfiguration configuration;
+
+        public SyncService(
+            ILogger<SyncService> logger,
+            IConfiguration configuration)
+        {
+            this.logger = logger;
+            this.configuration = configuration;
+        }
+
+        private async Task<List<T>> GetListDataAsync<T>(string connName, string tableName)
+        {
+            var connString = configuration.GetConnectionString(connName);
+            using (var conn = new SqlConnection(connString))
+            {
+                var data = await conn.QueryAsync<T>(@$"
+                    SELECT * FROM [{tableName}]
+                ");
+                return data.ToList();
+            }
+        }
+
+        private async Task<int> InsertLifePayChannles(string connName, SyncLifePayChannles item)
+        {
+            var connString = configuration.GetConnectionString(connName);
+            using (var conn = new SqlConnection(connString))
+            {
+                return await conn.ExecuteAsync(@"
+                    INSERT INTO LifePayChannles (
+                        Id, ChannlesName, ChannlesNum, ChannlesRate, ChannlesRakeRate, 
+                        ChannlesType, SwitchType, Status, CreationTime, CreatorId, 
+                        LastModificationTime, LastModifierId, IsDeleted, DeleterId, 
+                        DeletionTime
+                    ) VALUES (
+                        @Id, @ChannlesName, @ChannlesNum, @ChannlesRate, @ChannlesRakeRate, 
+                        @ChannlesType, @SwitchType, @Status, @CreationTime, @CreatorId, 
+                        @LastModificationTime, @LastModifierId, @IsDeleted, @DeleterId, 
+                        @DeletionTime
+                    )
+                ", item);
+            }
+        }
+
+        private async Task<int> InsertLifePayUser(string connName, SyncLifePayUser item)
+        {
+            var connString = configuration.GetConnectionString(connName);
+            using (var conn = new SqlConnection(connString))
+            {
+                return await conn.ExecuteAsync(@"
+                    INSERT INTO LifePayUser (
+                        Id, PhoneNumber, OpenId, LastLoginTime, CreationTime, 
+                        CreatorId, LastModificationTime, LastModifierId, IsDeleted, 
+                        DeleterId, DeletionTime, UnionId, CreationChannleNum, 
+                        LastLoginChannleNum, Name
+                    ) VALUES (
+                        @Id, @PhoneNumber, @OpenId, @LastLoginTime, @CreationTime, 
+                        @CreatorId, @LastModificationTime, @LastModifierId, @IsDeleted, 
+                        @DeleterId, @DeletionTime, @UnionId, @CreationChannleNum, 
+                        @LastLoginChannleNum, @Name
+                    )
+                ", item);
+            }
+        }
+
+        private async Task<int> InsertLifePayOrder(string connName, SyncLifePayOrder item)
+        {
+            var connString = configuration.GetConnectionString(connName);
+            using (var conn = new SqlConnection(connString))
+            {
+                return await conn.ExecuteAsync(@"
+                    INSERT INTO LifePayOrder (
+                        Id, UserId, CreationTime, CreatorId, LastModificationTime, 
+                        LastModifierId, IsDeleted, DeleterId, DeletionTime, 
+                        ExtraProperties, ConcurrencyStamp, PhoneNumber, LifePayType, 
+                        LifePayOrderType, OrderNo, RechargeAmount, DiscountAmount, 
+                        PayAmount, PayTime, PayStatus, OutOrderNo, LifePayOrderStatus, 
+                        FinishTime, RefundCredentialsImgUrl, OrderParamDetailJsonStr, 
+                        OutRequestNo, ACOOLYOrderNo, RefundApplyRemark, 
+                        RefundCheckRemark, RefundTime, RefundCheckUserId, ChannelId, 
+                        RefundApplyTime, PlatformDeductionAmount, ACOOLYStatus, 
+                        ActualRechargeAmount, LifePayRefundStatus, RefundPrice, 
+                        RefundOrderNo, ElecBillUrl, RefundElecBillUrl, 
+                        ActualReceivedAmount, PlatformRate, ChannleRate, 
+                        ChannlesRakeRate, PremiumRate
+                    ) VALUES (
+                        @Id, @UserId, @CreationTime, @CreatorId, @LastModificationTime, 
+                        @LastModifierId, @IsDeleted, @DeleterId, @DeletionTime, 
+                        @ExtraProperties, @ConcurrencyStamp, @PhoneNumber, @LifePayType, 
+                        @LifePayOrderType, @OrderNo, @RechargeAmount, @DiscountAmount, 
+                        @PayAmount, @PayTime, @PayStatus, @OutOrderNo, @LifePayOrderStatus, 
+                        @FinishTime, @RefundCredentialsImgUrl, @OrderParamDetailJsonStr, 
+                        @OutRequestNo, @ACOOLYOrderNo, @RefundApplyRemark, 
+                        @RefundCheckRemark, @RefundTime, @RefundCheckUserId, @ChannelId, 
+                        @RefundApplyTime, @PlatformDeductionAmount, @ACOOLYStatus, 
+                        @ActualRechargeAmount, @LifePayRefundStatus, @RefundPrice, 
+                        @RefundOrderNo, @ElecBillUrl, @RefundElecBillUrl, 
+                        @ActualReceivedAmount, @PlatformRate, @ChannleRate, 
+                        @ChannlesRakeRate, @PremiumRate
+                    )
+                ", item);
+            }
+        }
+
+        private async Task<int> InsertLifePayChannlesRake(string connName, SyncLifePayChannlesRake item)
+        {
+            var connString = configuration.GetConnectionString(connName);
+            using (var conn = new SqlConnection(connString))
+            {
+                return await conn.ExecuteAsync(@"
+                    INSERT INTO LifePayChannlesRake (
+                        Id, UserId, CreationTime, CreatorId, LastModificationTime, 
+                        LastModifierId, IsDeleted, DeleterId, DeletionTime, 
+                        ExtraProperties, FinishTime, OrderNo, PayAmount, 
+                        ChannlesRakeRate, ChannlesRakePrice, ChannelId
+                    ) VALUES (
+                        @Id, @UserId, @CreationTime, @CreatorId, @LastModificationTime, 
+                        @LastModifierId, @IsDeleted, @DeleterId, @DeletionTime, 
+                        @ExtraProperties, @FinishTime, @OrderNo, @PayAmount, 
+                        @ChannlesRakeRate, @ChannlesRakePrice, @ChannelId
+                    )
+                ", item);
+            }
+        }
+
+        private async Task<int> InsertLifePayConsumption(string connName, SyncLifePayConsumption item)
+        {
+            var connString = configuration.GetConnectionString(connName);
+            using (var conn = new SqlConnection(connString))
+            {
+                return await conn.ExecuteAsync(@"
+                    INSERT INTO LifePayConsumption (
+                        Id, UserId, CreationTime, CreatorId, LastModificationTime, 
+                        LastModifierId, IsDeleted, DeleterId, DeletionTime, 
+                        ExtraProperties, OrderNo, AcoolyOrderNo, Amount, 
+                        ACOOLYStatus, FrozenStatus, Flow, DeductionAmount, 
+                        FinishTime, ChannelId, FrozenAmount
+                    ) VALUES (
+                        @Id, @UserId, @CreationTime, @CreatorId, @LastModificationTime, 
+                        @LastModifierId, @IsDeleted, @DeleterId, @DeletionTime, 
+                        @ExtraProperties, @OrderNo, @AcoolyOrderNo, @Amount, 
+                        @ACOOLYStatus, @FrozenStatus, @Flow, @DeductionAmount, 
+                        @FinishTime, @ChannelId, @FrozenAmount
+                    )
+                ", item);
+            }
+        }
+
+        private async Task<int> InsertLifePayExpensesReceipts(string connName, SyncLifePayExpensesReceipts item)
+        {
+            var connString = configuration.GetConnectionString(connName);
+            using (var conn = new SqlConnection(connString))
+            {
+                return await conn.ExecuteAsync(@"
+                    INSERT INTO LifePayExpensesReceipts (
+                        Id, UserId, CreationTime, CreatorId, LastModificationTime, 
+                        LastModifierId, IsDeleted, DeleterId, DeletionTime, 
+                        ExtraProperties, OrderNo, OutOrderNo, LifePayType, 
+                        Amount, ExpensesReceiptsType, FinishTime
+                    ) VALUES (
+                        @Id, @UserId, @CreationTime, @CreatorId, @LastModificationTime, 
+                        @LastModifierId, @IsDeleted, @DeleterId, @DeletionTime, 
+                        @ExtraProperties, @OrderNo, @OutOrderNo, @LifePayType, 
+                        @Amount, @ExpensesReceiptsType, @FinishTime
+                    )
+                ", item);
+            }
+        }
+
+        private async Task<int> UpdateLifePayChannles(string connName, SyncLifePayChannles item)
+        {
+            var connString = configuration.GetConnectionString(connName);
+            using (var conn = new SqlConnection(connString))
+            {
+                return await conn.ExecuteAsync(@"
+                    UPDATE LifePayChannles
+                    SET 
+                        ChannlesName = @ChannlesName,
+                        ChannlesNum = @ChannlesNum,
+                        ChannlesRate = @ChannlesRate,
+                        ChannlesRakeRate = @ChannlesRakeRate,
+                        ChannlesType = @ChannlesType,
+                        SwitchType = @SwitchType,
+                        Status = @Status,
+                        CreationTime = @CreationTime,
+                        CreatorId = @CreatorId,
+                        LastModificationTime = @LastModificationTime,
+                        LastModifierId = @LastModifierId,
+                        IsDeleted = @IsDeleted,
+                        DeleterId = @DeleterId,
+                        DeletionTime = @DeletionTime
+                    WHERE Id = @Id
+                ", item);
+            }
+        }
+
+        private async Task<int> UpdateLifePayUser(string connName, SyncLifePayUser item)
+        {
+            var connString = configuration.GetConnectionString(connName);
+            using (var conn = new SqlConnection(connString))
+            {
+                return await conn.ExecuteAsync(@"
+                    UPDATE LifePayUser
+                    SET 
+                        PhoneNumber = @PhoneNumber,
+                        OpenId = @OpenId,
+                        LastLoginTime = @LastLoginTime,
+                        CreationTime = @CreationTime,
+                        CreatorId = @CreatorId,
+                        LastModificationTime = @LastModificationTime,
+                        LastModifierId = @LastModifierId,
+                        IsDeleted = @IsDeleted,
+                        DeleterId = @DeleterId,
+                        DeletionTime = @DeletionTime,
+                        UnionId = @UnionId,
+                        CreationChannleNum = @CreationChannleNum,
+                        LastLoginChannleNum = @LastLoginChannleNum,
+                        Name = @Name
+                    WHERE Id = @Id
+                ", item);
+            }
+        }
+
+        private async Task<int> UpdateLifePayOrder(string connName, SyncLifePayOrder item)
+        {
+            var connString = configuration.GetConnectionString(connName);
+            using (var conn = new SqlConnection(connString))
+            {
+                return await conn.ExecuteAsync(@"
+                    UPDATE LifePayOrder
+                    SET 
+                        UserId = @UserId,
+                        CreationTime = @CreationTime,
+                        CreatorId = @CreatorId,
+                        LastModificationTime = @LastModificationTime,
+                        LastModifierId = @LastModifierId,
+                        IsDeleted = @IsDeleted,
+                        DeleterId = @DeleterId,
+                        DeletionTime = @DeletionTime,
+                        ExtraProperties = @ExtraProperties,
+                        ConcurrencyStamp = @ConcurrencyStamp,
+                        PhoneNumber = @PhoneNumber,
+                        LifePayType = @LifePayType,
+                        LifePayOrderType = @LifePayOrderType,
+                        OrderNo = @OrderNo,
+                        RechargeAmount = @RechargeAmount,
+                        DiscountAmount = @DiscountAmount,
+                        PayAmount = @PayAmount,
+                        PayTime = @PayTime,
+                        PayStatus = @PayStatus,
+                        OutOrderNo = @OutOrderNo,
+                        LifePayOrderStatus = @LifePayOrderStatus,
+                        FinishTime = @FinishTime,
+                        RefundCredentialsImgUrl = @RefundCredentialsImgUrl,
+                        OrderParamDetailJsonStr = @OrderParamDetailJsonStr,
+                        OutRequestNo = @OutRequestNo,
+                        ACOOLYOrderNo = @ACOOLYOrderNo,
+                        RefundApplyRemark = @RefundApplyRemark,
+                        RefundCheckRemark = @RefundCheckRemark,
+                        RefundTime = @RefundTime,
+                        RefundCheckUserId = @RefundCheckUserId,
+                        ChannelId = @ChannelId,
+                        RefundApplyTime = @RefundApplyTime,
+                        PlatformDeductionAmount = @PlatformDeductionAmount,
+                        ACOOLYStatus = @ACOOLYStatus,
+                        ActualRechargeAmount = @ActualRechargeAmount,
+                        LifePayRefundStatus = @LifePayRefundStatus,
+                        RefundPrice = @RefundPrice,
+                        RefundOrderNo = @RefundOrderNo,
+                        ElecBillUrl = @ElecBillUrl,
+                        RefundElecBillUrl = @RefundElecBillUrl,
+                        ActualReceivedAmount = @ActualReceivedAmount,
+                        PlatformRate = @PlatformRate,
+                        ChannleRate = @ChannleRate,
+                        ChannlesRakeRate = @ChannlesRakeRate,
+                        PremiumRate = @PremiumRate
+                    WHERE Id = @Id
+                ", item);
+            }
+        }
+
+        private async Task<int> UpdateLifePayChannlesRake(string connName, SyncLifePayChannlesRake item)
+        {
+            var connString = configuration.GetConnectionString(connName);
+            using (var conn = new SqlConnection(connString))
+            {
+                return await conn.ExecuteAsync(@"
+                    UPDATE LifePayChannlesRake
+                    SET 
+                        UserId = @UserId,
+                        CreationTime = @CreationTime,
+                        CreatorId = @CreatorId,
+                        LastModificationTime = @LastModificationTime,
+                        LastModifierId = @LastModifierId,
+                        IsDeleted = @IsDeleted,
+                        DeleterId = @DeleterId,
+                        DeletionTime = @DeletionTime,
+                        ExtraProperties = @ExtraProperties,
+                        FinishTime = @FinishTime,
+                        OrderNo = @OrderNo,
+                        PayAmount = @PayAmount,
+                        ChannlesRakeRate = @ChannlesRakeRate,
+                        ChannlesRakePrice = @ChannlesRakePrice,
+                        ChannelId = @ChannelId
+                    WHERE Id = @Id
+                ", item);
+            }
+        }
+
+        private async Task<int> UpdateLifePayConsumption(string connName, SyncLifePayConsumption item)
+        {
+            var connString = configuration.GetConnectionString(connName);
+            using (var conn = new SqlConnection(connString))
+            {
+                return await conn.ExecuteAsync(@"
+                    UPDATE LifePayConsumption
+                    SET 
+                        UserId = @UserId,
+                        CreationTime = @CreationTime,
+                        CreatorId = @CreatorId,
+                        LastModificationTime = @LastModificationTime,
+                        LastModifierId = @LastModifierId,
+                        IsDeleted = @IsDeleted,
+                        DeleterId = @DeleterId,
+                        DeletionTime = @DeletionTime,
+                        ExtraProperties = @ExtraProperties,
+                        OrderNo = @OrderNo,
+                        AcoolyOrderNo = @AcoolyOrderNo,
+                        Amount = @Amount,
+                        ACOOLYStatus = @ACOOLYStatus,
+                        FrozenStatus = @FrozenStatus,
+                        Flow = @Flow,
+                        DeductionAmount = @DeductionAmount,
+                        FinishTime = @FinishTime,
+                        ChannelId = @ChannelId,
+                        FrozenAmount = @FrozenAmount
+                    WHERE Id = @Id
+                ", item);
+            }
+        }
+
+        private async Task<int> UpdateLifePayExpensesReceipts(string connName, SyncLifePayExpensesReceipts item)
+        {
+            var connString = configuration.GetConnectionString(connName);
+            using (var conn = new SqlConnection(connString))
+            {
+                return await conn.ExecuteAsync(@"
+                    UPDATE LifePayExpensesReceipts
+                    SET 
+                        UserId = @UserId,
+                        CreationTime = @CreationTime,
+                        CreatorId = @CreatorId,
+                        LastModificationTime = @LastModificationTime,
+                        LastModifierId = @LastModifierId,
+                        IsDeleted = @IsDeleted,
+                        DeleterId = @DeleterId,
+                        DeletionTime = @DeletionTime,
+                        ExtraProperties = @ExtraProperties,
+                        OrderNo = @OrderNo,
+                        OutOrderNo = @OutOrderNo,
+                        LifePayType = @LifePayType,
+                        Amount = @Amount,
+                        ExpensesReceiptsType = @ExpensesReceiptsType,
+                        FinishTime = @FinishTime
+                    WHERE Id = @Id
+                ", item);
+            }
+        }
+
+        /// <summary>
+        /// 鍚屾娴嬭瘯璁㈠崟鏁版嵁
+        /// </summary>
+        /// <returns></returns>
+        public async Task<List<string>> SyncFromTest()
+        {
+            var messages = new List<string>();
+            var sourceConnName = "SyncLifePaymentServices";
+            var targetConnName = "LifePaymentServices";
+
+            var sourceLifePayChannlesList = await GetListDataAsync<SyncLifePayChannles>(sourceConnName, "LifePayChannles");
+            var sourceLifePayUserList = await GetListDataAsync<SyncLifePayUser>(sourceConnName, "LifePayUser");
+            var sourceLifePayOrderList = await GetListDataAsync<SyncLifePayOrder>(sourceConnName, "LifePayOrder");
+            var sourceLifePayChannlesRakeList = await GetListDataAsync<SyncLifePayChannlesRake>(sourceConnName, "LifePayChannlesRake");
+            var sourceLifePayConsumptionList = await GetListDataAsync<SyncLifePayConsumption>(sourceConnName, "LifePayConsumption");
+            var sourceLifePayExpensesReceiptsList = await GetListDataAsync<SyncLifePayExpensesReceipts>(sourceConnName, "LifePayExpensesReceipts");
+
+            var targetLifePayChannlesList = await GetListDataAsync<SyncLifePayChannles>(targetConnName, "LifePayChannles");
+            var targetLifePayUserList = await GetListDataAsync<SyncLifePayUser>(targetConnName, "LifePayUser");
+            var targetLifePayOrderList = await GetListDataAsync<SyncLifePayOrder>(targetConnName, "LifePayOrder");
+            var targetLifePayChannlesRakeList = await GetListDataAsync<SyncLifePayChannlesRake>(targetConnName, "LifePayChannlesRake");
+            var targetLifePayConsumptionList = await GetListDataAsync<SyncLifePayConsumption>(targetConnName, "LifePayConsumption");
+            var targetLifePayExpensesReceiptsList = await GetListDataAsync<SyncLifePayExpensesReceipts>(targetConnName, "LifePayExpensesReceipts");
+
+            var dicUserIds = new Dictionary<Guid?, Guid?>();
+            var dicChannleIds = new Dictionary<Guid?, Guid?>();
+            var count = 0;
+            logger.LogInformation($"鍑嗗鍚屾{sourceLifePayUserList.Count}涓敤鎴锋暟鎹�");
+            foreach (var sourceLifePayUser in sourceLifePayUserList)
+            {
+                count++;
+                logger.LogInformation($"姝e湪鍚屾绗瑊count}涓敤鎴凤細{sourceLifePayUser.PhoneNumber}--------------------------------------------------------------------");
+
+                try
+                {
+                    var targetLifePayUser = targetLifePayUserList.FirstOrDefault(it => it.PhoneNumber == sourceLifePayUser.PhoneNumber);
+                    if (targetLifePayUser == null)
+                    {
+                        logger.LogInformation("鏈尮閰嶇浉鍚屾墜鏈哄彿");
+                        targetLifePayUser = targetLifePayUserList.FirstOrDefault(it => it.Id == sourceLifePayUser.Id);
+                    }
+
+                    if (targetLifePayUser == null)
+                    {
+                        targetLifePayUser = new SyncLifePayUser();
+                        ObjectMapper.Map(sourceLifePayUser, targetLifePayUser);
+                        await InsertLifePayUser(targetConnName, targetLifePayUser);
+                        dicUserIds.Add(sourceLifePayUser.Id, targetLifePayUser.Id);
+                        logger.LogInformation("鏈尮閰嶇浉鍚孖d锛屽凡鎻掑叆鐢ㄦ埛");
+                    }
+                    else
+                    {
+                        var updateTargetLifePayUser = new SyncLifePayUser();
+                        ObjectMapper.Map(sourceLifePayUser, updateTargetLifePayUser);
+                        updateTargetLifePayUser.Id = targetLifePayUser.Id;
+                        await UpdateLifePayUser(targetConnName, updateTargetLifePayUser);
+                        targetLifePayUser = updateTargetLifePayUser;
+                        dicUserIds.Add(sourceLifePayUser.Id, targetLifePayUser.Id);
+                        logger.LogInformation("宸叉洿鏂扮敤鎴�");
+                    }
+                }
+                catch (Exception ex)
+                {
+                    messages.Add($"鏈兘鍚屾鐢ㄦ埛锛坽sourceLifePayUser.PhoneNumber}锛夊彂鐢熸湇鍔″櫒寮傚父锛歿ex.Message}");
+                    continue;
+                }
+            }
+
+            foreach (var sourceLifePayChannles in sourceLifePayChannlesList)
+            {
+                try
+                {
+                    var targetLifePayChannles = targetLifePayChannlesList.FirstOrDefault(it => it.ChannlesNum == sourceLifePayChannles.ChannlesNum);
+                    if (targetLifePayChannles == null)
+                    {
+                        logger.LogInformation("鏈尮閰嶇浉鍚岀紪鍙�");
+                        targetLifePayChannles = targetLifePayChannlesList.FirstOrDefault(it => it.Id == sourceLifePayChannles.Id);
+                    }
+
+                    if (targetLifePayChannles == null)
+                    {
+                        targetLifePayChannles = new SyncLifePayChannles();
+                        ObjectMapper.Map(sourceLifePayChannles, targetLifePayChannles);
+                        await InsertLifePayChannles(targetConnName, targetLifePayChannles);
+                        dicChannleIds.Add(sourceLifePayChannles.Id, targetLifePayChannles.Id);
+                        logger.LogInformation($"宸叉彃鍏ユ笭閬擄細{targetLifePayChannles.ChannlesName}");
+                    }
+                    else
+                    {
+                        var updateTargetLifePayChannles = new SyncLifePayChannles();
+                        ObjectMapper.Map(sourceLifePayChannles, updateTargetLifePayChannles);
+                        updateTargetLifePayChannles.Id = targetLifePayChannles.Id;
+                        await UpdateLifePayChannles(targetConnName, updateTargetLifePayChannles);
+                        targetLifePayChannles = updateTargetLifePayChannles;
+                        dicChannleIds.Add(sourceLifePayChannles.Id, targetLifePayChannles.Id);
+                        logger.LogInformation($"宸叉洿鏂版笭閬擄細{targetLifePayChannles.ChannlesName}");
+                    }
+                }
+                catch (Exception ex)
+                {
+                    messages.Add($"鏈兘鍚屾娓犻亾锛坽sourceLifePayChannles.ChannlesName}锛夊彂鐢熸湇鍔″櫒寮傚父锛歿ex.Message}");
+                    continue;
+                }
+            }
+
+            foreach (var sourceLifePayChannlesRake in sourceLifePayChannlesRakeList)
+            {
+                try
+                {
+                    var targetLifePayChannlesRake = targetLifePayChannlesRakeList.FirstOrDefault(it => it.Id == sourceLifePayChannlesRake.Id);
+                    if (targetLifePayChannlesRake == null)
+                    {
+                        targetLifePayChannlesRake = new SyncLifePayChannlesRake();
+                        ObjectMapper.Map(sourceLifePayChannlesRake, targetLifePayChannlesRake);
+                        if (sourceLifePayChannlesRake.UserId.HasValue)
+                        {
+                            targetLifePayChannlesRake.UserId = dicUserIds[sourceLifePayChannlesRake.UserId];
+                        }
+
+                        await InsertLifePayChannlesRake(targetConnName, targetLifePayChannlesRake);
+                        logger.LogInformation($"宸叉彃鍏ュ垎浣o細{targetLifePayChannlesRake.OrderNo}");
+                    }
+                    else
+                    {
+                        targetLifePayChannlesRake = new SyncLifePayChannlesRake();
+                        ObjectMapper.Map(sourceLifePayChannlesRake, targetLifePayChannlesRake);
+                        if (sourceLifePayChannlesRake.UserId.HasValue)
+                        {
+                            targetLifePayChannlesRake.UserId = dicUserIds[sourceLifePayChannlesRake.UserId];
+                        }
+
+                        await UpdateLifePayChannlesRake(targetConnName, targetLifePayChannlesRake);
+                        logger.LogInformation($"宸叉洿鏂板垎浣o細{targetLifePayChannlesRake.OrderNo}");
+                    }
+                }
+                catch (Exception ex)
+                {
+                    messages.Add($"鏈兘鍚屾鍒嗕剑锛坽sourceLifePayChannlesRake.OrderNo}锛夊彂鐢熸湇鍔″櫒寮傚父锛歿ex.Message}");
+                    continue;
+                }
+            }
+
+            foreach (var sourceLifePayChannlesRake in sourceLifePayChannlesRakeList)
+            {
+                try
+                {
+                    var targetLifePayChannlesRake = targetLifePayChannlesRakeList.FirstOrDefault(it => it.Id == sourceLifePayChannlesRake.Id);
+                    if (targetLifePayChannlesRake == null)
+                    {
+                        targetLifePayChannlesRake = new SyncLifePayChannlesRake();
+                        ObjectMapper.Map(sourceLifePayChannlesRake, targetLifePayChannlesRake);
+                        if (sourceLifePayChannlesRake.UserId.HasValue)
+                        {
+                            targetLifePayChannlesRake.UserId = dicUserIds[sourceLifePayChannlesRake.UserId];
+                        }
+
+                        await InsertLifePayChannlesRake(targetConnName, targetLifePayChannlesRake);
+                        logger.LogInformation($"宸叉彃鍏ュ垎浣o細{targetLifePayChannlesRake.OrderNo}");
+                    }
+                    else
+                    {
+                        targetLifePayChannlesRake = new SyncLifePayChannlesRake();
+                        ObjectMapper.Map(sourceLifePayChannlesRake, targetLifePayChannlesRake);
+                        if (sourceLifePayChannlesRake.UserId.HasValue)
+                        {
+                            targetLifePayChannlesRake.UserId = dicUserIds[sourceLifePayChannlesRake.UserId];
+                        }
+
+                        await UpdateLifePayChannlesRake(targetConnName, targetLifePayChannlesRake);
+                        logger.LogInformation($"宸叉洿鏂板垎浣o細{targetLifePayChannlesRake.OrderNo}");
+                    }
+                }
+                catch (Exception ex)
+                {
+                    messages.Add($"鏈兘鍚屾鍒嗕剑锛坽sourceLifePayChannlesRake.OrderNo}锛夊彂鐢熸湇鍔″櫒寮傚父锛歿ex.Message}");
+                    continue;
+                }
+            }
+
+            foreach (var sourceLifePayConsumption in sourceLifePayConsumptionList)
+            {
+                try
+                {
+                    var targetLifePayConsumption = targetLifePayConsumptionList.FirstOrDefault(it => it.Id == sourceLifePayConsumption.Id);
+                    if (targetLifePayConsumption == null)
+                    {
+                        targetLifePayConsumption = new SyncLifePayConsumption();
+                        ObjectMapper.Map(sourceLifePayConsumption, targetLifePayConsumption);
+                        if (sourceLifePayConsumption.UserId.HasValue)
+                        {
+                            targetLifePayConsumption.UserId = dicUserIds[sourceLifePayConsumption.UserId];
+                        }
+
+                        await InsertLifePayConsumption(targetConnName, targetLifePayConsumption);
+                        logger.LogInformation($"宸叉彃鍏ユ秷璐规祦姘达細{targetLifePayConsumption.OrderNo}");
+                    }
+                    else
+                    {
+                        targetLifePayConsumption = new SyncLifePayConsumption();
+                        ObjectMapper.Map(sourceLifePayConsumption, targetLifePayConsumption);
+                        if (sourceLifePayConsumption.UserId.HasValue)
+                        {
+                            targetLifePayConsumption.UserId = dicUserIds[sourceLifePayConsumption.UserId];
+                        }
+
+                        await UpdateLifePayConsumption(targetConnName, targetLifePayConsumption);
+                        logger.LogInformation($"宸叉洿鏂版秷璐规祦姘达細{targetLifePayConsumption.OrderNo}");
+                    }
+                }
+                catch (Exception ex)
+                {
+                    messages.Add($"鏈兘鍚屾娑堣垂娴佹按锛坽sourceLifePayConsumption.OrderNo}锛夊彂鐢熸湇鍔″櫒寮傚父锛歿ex.Message}");
+                    continue;
+                }
+            }
+
+            foreach (var sourceLifePayExpensesReceipts in sourceLifePayExpensesReceiptsList)
+            {
+                try
+                {
+                    if (sourceLifePayExpensesReceipts.FinishTime == DateTime.MinValue)
+                    {
+                        sourceLifePayExpensesReceipts.FinishTime = null;
+                    }
+
+                    var targetLifePayExpensesReceipts = targetLifePayExpensesReceiptsList.FirstOrDefault(it => it.Id == sourceLifePayExpensesReceipts.Id);
+                    if (targetLifePayExpensesReceipts == null)
+                    {
+                        targetLifePayExpensesReceipts = new SyncLifePayExpensesReceipts();
+                        ObjectMapper.Map(sourceLifePayExpensesReceipts, targetLifePayExpensesReceipts);
+                        if (sourceLifePayExpensesReceipts.UserId.HasValue)
+                        {
+                            targetLifePayExpensesReceipts.UserId = dicUserIds[sourceLifePayExpensesReceipts.UserId];
+                        }
+
+                        await InsertLifePayExpensesReceipts(targetConnName, targetLifePayExpensesReceipts);
+                        logger.LogInformation($"宸叉彃鍏ユ敹鏀祦姘达細{targetLifePayExpensesReceipts.OrderNo}");
+                    }
+                    else
+                    {
+                        targetLifePayExpensesReceipts = new SyncLifePayExpensesReceipts();
+                        ObjectMapper.Map(sourceLifePayExpensesReceipts, targetLifePayExpensesReceipts);
+                        if (sourceLifePayExpensesReceipts.UserId.HasValue)
+                        {
+                            targetLifePayExpensesReceipts.UserId = dicUserIds[sourceLifePayExpensesReceipts.UserId];
+                        }
+
+                        await UpdateLifePayExpensesReceipts(targetConnName, targetLifePayExpensesReceipts);
+                        logger.LogInformation($"宸叉洿鏂版敹鏀祦姘达細{targetLifePayExpensesReceipts.OrderNo}");
+                    }
+                }
+                catch (Exception ex)
+                {
+                    messages.Add($"鏈兘鍚屾鏀舵敮娴佹按锛坽sourceLifePayExpensesReceipts.OrderNo}锛夊彂鐢熸湇鍔″櫒寮傚父锛歿ex.Message}");
+                    continue;
+                }
+            }
+
+            return messages;
+        }
+    }
+}
diff --git a/LifePayment/LifePayment.EntityFrameworkCore/LifePaymentServicesEntityFrameworkCoreModule.cs b/LifePayment/LifePayment.EntityFrameworkCore/LifePaymentServicesEntityFrameworkCoreModule.cs
index b5b4765..a50ea6d 100644
--- a/LifePayment/LifePayment.EntityFrameworkCore/LifePaymentServicesEntityFrameworkCoreModule.cs
+++ b/LifePayment/LifePayment.EntityFrameworkCore/LifePaymentServicesEntityFrameworkCoreModule.cs
@@ -15,7 +15,6 @@
                 options.AddDefaultRepositories<ILifePaymentServicesDbContext>(true);
                 options.SetDefaultRepositoryClasses(typeof(LifePaymentServicesRepositoryBase<,>), typeof(LifePaymentServicesRepositoryBase<>));
             });
-
         }
     }
 }
\ No newline at end of file
diff --git a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml b/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
index 64d0581..808abee 100644
--- a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
+++ b/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
@@ -513,6 +513,12 @@
             <param name="input"></param>
             <returns></returns>
         </member>
+        <member name="M:LifePayment.HttpApi.SyncController.SyncFromTest">
+            <summary>
+            鍚屾娴嬭瘯璁㈠崟鏁版嵁
+            </summary>
+            <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 ea4efed..333407d 100644
--- a/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
+++ b/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
@@ -2722,6 +2722,12 @@
             鍏宠仈鍏崇郴ID
             </summary>
         </member>
+        <member name="M:LifePayment.Application.Contracts.ISyncService.SyncFromTest">
+            <summary>
+            鍚屾娴嬭瘯璁㈠崟鏁版嵁
+            </summary>
+            <returns></returns>
+        </member>
         <member name="P:LifePayment.Application.Contracts.CreateBackClientUserInput.Name">
             <summary>
             鍚嶇О
diff --git a/LifePayment/LifePayment.Host/appsettings.json b/LifePayment/LifePayment.Host/appsettings.json
index 2220495..5a2647e 100644
--- a/LifePayment/LifePayment.Host/appsettings.json
+++ b/LifePayment/LifePayment.Host/appsettings.json
@@ -18,10 +18,13 @@
     "OssRoleRan": "acs:ram::1483797030072898:role/boleoss"
   },
   "ConnectionStrings": {
-    "AbpIdentity": "Server=120.26.58.240; Database=Dev_LifePaymentIdentity; User=bole;Password=Bole1472589",
-    "LifePaymentServices": "Server=120.26.58.240; Database=Dev_LifePayment; User=bole;Password=Bole1472589"
-    //"LifePaymentServices": "Server=rm-bp1mt744021h1s6dg4o.sqlserver.rds.aliyuncs.com,2333;Database=Pro_LifePayment;Uid=bole;Pwd=BLwsx123#@!$;",
-    //"AbpIdentity": "Server=rm-bp1mt744021h1s6dg4o.sqlserver.rds.aliyuncs.com,2333;Database=Pro_LifePaymentIdentity;Uid=bole;Pwd=BLwsx123#@!$;"
+    //"AbpIdentity": "Server=120.26.58.240; Database=Dev_LifePaymentIdentity; User=bole;Password=Bole1472589",
+    //"LifePaymentServices": "Server=120.26.58.240; Database=Dev_LifePayment; User=bole;Password=Bole1472589"
+    "LifePaymentServices": "Server=rm-bp1mt744021h1s6dg4o.sqlserver.rds.aliyuncs.com,2333;Database=Dev_LifePayment;Uid=bole;Pwd=Blcs20@%27;",
+    "AbpIdentity": "Server=rm-bp1mt744021h1s6dg4o.sqlserver.rds.aliyuncs.com,2333;Database=Dev_LifePaymentIdentity;Uid=bole;Pwd=Blcs20@%27;",
+
+    "SyncAbpIdentity": "Server=120.26.58.240; Database=Dev_LifePaymentIdentity; User=bole;Password=Bole1472589",
+    "SyncLifePaymentServices": "Server=120.26.58.240; Database=Dev_LifePayment; User=bole;Password=Bole1472589"
   },
 
   "App": {
diff --git a/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs b/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs
index 41bc341..5e4326d 100644
--- a/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs
+++ b/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs
@@ -15,6 +15,7 @@
 using Volo.Abp.AspNetCore.Mvc;
 using Volo.Abp.AspNetCore.WebClientInfo;
 using ZeroD.Util;
+using ZeroD.Util.Fadd;
 
 namespace LifePayment.HttpApi
 {
diff --git a/LifePayment/LifePayment.HttpApi/LifePay/SyncController.cs b/LifePayment/LifePayment.HttpApi/LifePay/SyncController.cs
new file mode 100644
index 0000000..25df9f8
--- /dev/null
+++ b/LifePayment/LifePayment.HttpApi/LifePay/SyncController.cs
@@ -0,0 +1,33 @@
+锘縰sing LifePayment.Application.Contracts;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Volo.Abp.AspNetCore.Mvc;
+
+namespace LifePayment.HttpApi
+{
+    [Route("api/[controller]/[action]")]
+    [ApiController]
+    [Authorize]
+    public class SyncController : AbpController
+    {
+        private readonly ISyncService syncService;
+
+        public SyncController(ISyncService syncService)
+        {
+            this.syncService = syncService;
+        }
+
+        /// <summary>
+        /// 鍚屾娴嬭瘯璁㈠崟鏁版嵁
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        [AllowAnonymous]
+        public Task<List<string>> SyncFromTest()
+        {
+            return syncService.SyncFromTest();
+        }
+    }
+}

--
Gitblit v1.9.1