From e6d52a389494026490650e48c7c8c499ea5a4b51 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com>
Date: Tue, 27 Feb 2024 17:25:30 +0800
Subject: [PATCH] examples
---
.../SJZY.Track.Application.csproj | 4 ++
.../ProvideServices/TrackQueryService.cs | 10 +++
.../OrderAggregate/IOrderRepository.cs | 7 ++
.../ITrackPullConfigRepository.cs | 6 ++
.../TrackPullConfigEntity.cs | 46 ++++++++++++
.../TrackPullContentConfigEntity.cs | 70 ++++++++++++++++++
src/SJZY.Track.Domain/TransactionHelper.cs | 17 +++++
src/SJZY.Track.Repository/OrderRepository.cs | 5 ++
.../SJZY.Track.Repository.csproj | 2 -
.../Entitys/TrackPullConfigEntity.cs | 47 ------------
.../Services/ITrackPullConfigRepository.cs | 9 ---
.../Services/TrackPullConfigRepository.cs | 14 ----
.../TrackPullConfigRepository.cs | 9 +++
.../Entitys/TrackPullContentConfigEntity.cs | 71 -------------------
.../ITrackPullContentConfigRepository.cs | 9 ---
.../TrackPullContentConfigRepository.cs | 9 ---
16 files changed, 174 insertions(+), 161 deletions(-)
create mode 100644 src/SJZY.Track.Domain/TrackPullAggregate/ITrackPullConfigRepository.cs
create mode 100644 src/SJZY.Track.Domain/TrackPullAggregate/TrackPullConfigEntity.cs
create mode 100644 src/SJZY.Track.Domain/TrackPullAggregate/TrackPullContentConfigEntity.cs
create mode 100644 src/SJZY.Track.Domain/TransactionHelper.cs
delete mode 100644 src/SJZY.Track.Repository/TrackPullConfig/Entitys/TrackPullConfigEntity.cs
delete mode 100644 src/SJZY.Track.Repository/TrackPullConfig/Services/ITrackPullConfigRepository.cs
delete mode 100644 src/SJZY.Track.Repository/TrackPullConfig/Services/TrackPullConfigRepository.cs
create mode 100644 src/SJZY.Track.Repository/TrackPullConfigRepository.cs
delete mode 100644 src/SJZY.Track.Repository/TrackPullContentConfig/Entitys/TrackPullContentConfigEntity.cs
delete mode 100644 src/SJZY.Track.Repository/TrackPullContentConfig/Services/ITrackPullContentConfigRepository.cs
delete mode 100644 src/SJZY.Track.Repository/TrackPullContentConfig/Services/TrackPullContentConfigRepository.cs
diff --git a/src/SJZY.Track.Application/SJZY.Track.Application.csproj b/src/SJZY.Track.Application/SJZY.Track.Application.csproj
index dd4d7e2a..678ee30c 100644
--- a/src/SJZY.Track.Application/SJZY.Track.Application.csproj
+++ b/src/SJZY.Track.Application/SJZY.Track.Application.csproj
@@ -26,4 +26,8 @@
+
+
+
+
diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs
index 4b70ff76..66803064 100644
--- a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs
+++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs
@@ -1,6 +1,7 @@
using SJZY.Track.Domain.OrderAggregate;
using SJZY.Track.Domain.TrackTemplateAggregate;
using SJZY.Track.Application.Dtos.ProvideServices;
+using SJZY.Track.Domain;
using SJZY.Track.Repository.TrackDetails;
namespace SJZY.Track.Application.Services.ProvideServices;
@@ -60,6 +61,15 @@ public class TrackQueryService : ApplicationService
return res;
}
+ public async Task CreateOrder()
+ {
+ using var tran = TransactionHelper.GetReadCommitted();
+ await _orderRepository.InsertAsync(new OrderEntity());
+ await _orderRepository.CreateOrderTemplateAsync(new OrderTemplateEntity());
+
+ tran.Complete();
+ }
+
private void TrackDetailSort(GetTrackOutput item, SortMethod sortMethod)
{
switch (sortMethod)
diff --git a/src/SJZY.Track.Domain/OrderAggregate/IOrderRepository.cs b/src/SJZY.Track.Domain/OrderAggregate/IOrderRepository.cs
index 1dd02831..404224c0 100644
--- a/src/SJZY.Track.Domain/OrderAggregate/IOrderRepository.cs
+++ b/src/SJZY.Track.Domain/OrderAggregate/IOrderRepository.cs
@@ -10,4 +10,11 @@ public interface IOrderRepository : IBasicRepository
///
///
Task> GetOrderTemplatesAsync(List distinctOrderNumbers);
+
+ ///
+ /// 创建订单模板
+ ///
+ ///
+ ///
+ Task CreateOrderTemplateAsync(OrderTemplateEntity templateEntity);
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Domain/TrackPullAggregate/ITrackPullConfigRepository.cs b/src/SJZY.Track.Domain/TrackPullAggregate/ITrackPullConfigRepository.cs
new file mode 100644
index 00000000..5ef232c9
--- /dev/null
+++ b/src/SJZY.Track.Domain/TrackPullAggregate/ITrackPullConfigRepository.cs
@@ -0,0 +1,6 @@
+namespace SJZY.Track.Domain.TrackPullAggregate;
+
+public interface ITrackPullConfigRepository : IBasicRepository
+{
+
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Domain/TrackPullAggregate/TrackPullConfigEntity.cs b/src/SJZY.Track.Domain/TrackPullAggregate/TrackPullConfigEntity.cs
new file mode 100644
index 00000000..090e8078
--- /dev/null
+++ b/src/SJZY.Track.Domain/TrackPullAggregate/TrackPullConfigEntity.cs
@@ -0,0 +1,46 @@
+namespace SJZY.Track.Domain.TrackPullAggregate;
+
+///
+/// 轨迹拉取配置表
+///
+[SugarTable("t_track_pull_config")]
+public class TrackPullConfigEntity : IFullAuditedBasicEntitys
+{
+
+ ///
+ /// 自增主键
+ ///
+ [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)]
+ public int Id { get; set; }
+
+ ///
+ /// 解析方式,1取接口通返参映射后的,2取服务商原返参
+ ///
+ [SugarColumn(ColumnName = "ParseMethod")]
+ public int ParseMethod { get; set; }
+
+ ///
+ /// 服务商拉取频率(分钟)
+ ///
+ [SugarColumn(ColumnName = "PullInterval")]
+ public int PullInterval { get; set; }
+
+ ///
+ /// 服务商id
+ ///
+ [SugarColumn(ColumnName = "ServiceProviderId")]
+ public int ServiceProviderId { get; set; }
+
+ ///
+ /// 子系统id
+ ///
+ [SugarColumn(ColumnName = "SubSystemId")]
+ public int SubSystemId { get; set; }
+
+ ///
+ /// 模板id
+ ///
+ [SugarColumn(ColumnName = "TrackTemplateId")]
+ public int TrackTemplateId { get; set; }
+
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Domain/TrackPullAggregate/TrackPullContentConfigEntity.cs b/src/SJZY.Track.Domain/TrackPullAggregate/TrackPullContentConfigEntity.cs
new file mode 100644
index 00000000..f4194d72
--- /dev/null
+++ b/src/SJZY.Track.Domain/TrackPullAggregate/TrackPullContentConfigEntity.cs
@@ -0,0 +1,70 @@
+namespace SJZY.Track.Domain.TrackPullAggregate;
+
+///
+/// 轨迹拉取内容配置表
+///
+[SugarTable("t_track_pull_content_config")]
+public class TrackPullContentConfigEntity : IFullAuditedBasicEntitys
+{
+
+ ///
+ /// 自增主键
+ ///
+ [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)]
+ public int Id { get; set; }
+
+ ///
+ /// 服务商轨迹代码参数值
+ ///
+ [SugarColumn(ColumnName = "TrackContentCodeValue")]
+ public string TrackContentCodeValue { get; set; }
+
+ ///
+ /// 轨迹内容id
+ ///
+ [SugarColumn(ColumnName = "TrackContentId")]
+ public int TrackContentId { get; set; }
+
+ ///
+ /// 服务商轨迹内容参数值
+ ///
+ [SugarColumn(ColumnName = "TrackContentValue")]
+ public string TrackContentValue { get; set; }
+
+ ///
+ /// 轨迹关键词(正向),多个逗分隔
+ ///
+ [SugarColumn(ColumnName = "TrackKeyword")]
+ public string TrackKeyword { get; set; }
+
+ ///
+ /// 轨迹关键词(反向),多个逗分隔
+ ///
+ [SugarColumn(ColumnName = "TrackKeywordReverse")]
+ public string TrackKeywordReverse { get; set; }
+
+ ///
+ /// 轨迹发生地参数值(主数据枚举)
+ ///
+ [SugarColumn(ColumnName = "TrackPlaceValue")]
+ public int? TrackPlaceValue { get; set; }
+
+ ///
+ /// 轨迹拉取配置id
+ ///
+ [SugarColumn(ColumnName = "TrackPullConfigId")]
+ public int TrackPullConfigId { get; set; }
+
+ ///
+ /// 服务商轨迹状态参数值
+ ///
+ [SugarColumn(ColumnName = "TrackStatusValue")]
+ public string TrackStatusValue { get; set; }
+
+ ///
+ /// 轨迹时区GMT
+ ///
+ [SugarColumn(ColumnName = "TrackTimeZone")]
+ public string TrackTimeZone { get; set; }
+
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Domain/TransactionHelper.cs b/src/SJZY.Track.Domain/TransactionHelper.cs
new file mode 100644
index 00000000..fa8baac4
--- /dev/null
+++ b/src/SJZY.Track.Domain/TransactionHelper.cs
@@ -0,0 +1,17 @@
+using System.Transactions;
+
+namespace SJZY.Track.Domain;
+
+public class TransactionHelper
+{
+ ///
+ /// 获取读已提交级别的事务,记得要释放
+ ///
+ ///
+ public static TransactionScope GetReadCommitted()
+ {
+ return new TransactionScope(TransactionScopeOption.Required,
+ new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted },
+ TransactionScopeAsyncFlowOption.Enabled);
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Repository/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs
index 07793394..7c04dba6 100644
--- a/src/SJZY.Track.Repository/OrderRepository.cs
+++ b/src/SJZY.Track.Repository/OrderRepository.cs
@@ -13,4 +13,9 @@ public class OrderRepository : BasicRepository, IOrderRepository, I
.Select()
.ToListAsync();
}
+
+ public async Task CreateOrderTemplateAsync(OrderTemplateEntity templateEntity)
+ {
+ await Context.Insertable(templateEntity).ExecuteCommandAsync();
+ }
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj b/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj
index 0c731f1e..8752942a 100644
--- a/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj
+++ b/src/SJZY.Track.Repository/SJZY.Track.Repository.csproj
@@ -27,8 +27,6 @@
-
-
diff --git a/src/SJZY.Track.Repository/TrackPullConfig/Entitys/TrackPullConfigEntity.cs b/src/SJZY.Track.Repository/TrackPullConfig/Entitys/TrackPullConfigEntity.cs
deleted file mode 100644
index 5efa67b0..00000000
--- a/src/SJZY.Track.Repository/TrackPullConfig/Entitys/TrackPullConfigEntity.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-namespace SJZY.Track.Repository.TrackPullConfig.Entitys
-{
- ///
- /// 轨迹拉取配置表
- ///
- [SugarTable("t_track_pull_config")]
- public class TrackPullConfigEntity : IFullAuditedBasicEntitys
- {
-
- ///
- /// 自增主键
- ///
- [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)]
- public int Id { get; set; }
-
- ///
- /// 解析方式,1取接口通返参映射后的,2取服务商原返参
- ///
- [SugarColumn(ColumnName = "ParseMethod")]
- public int ParseMethod { get; set; }
-
- ///
- /// 服务商拉取频率(分钟)
- ///
- [SugarColumn(ColumnName = "PullInterval")]
- public int PullInterval { get; set; }
-
- ///
- /// 服务商id
- ///
- [SugarColumn(ColumnName = "ServiceProviderId")]
- public int ServiceProviderId { get; set; }
-
- ///
- /// 子系统id
- ///
- [SugarColumn(ColumnName = "SubSystemId")]
- public int SubSystemId { get; set; }
-
- ///
- /// 模板id
- ///
- [SugarColumn(ColumnName = "TrackTemplateId")]
- public int TrackTemplateId { get; set; }
-
- }
-}
\ No newline at end of file
diff --git a/src/SJZY.Track.Repository/TrackPullConfig/Services/ITrackPullConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullConfig/Services/ITrackPullConfigRepository.cs
deleted file mode 100644
index 646bc6bc..00000000
--- a/src/SJZY.Track.Repository/TrackPullConfig/Services/ITrackPullConfigRepository.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using SJZY.Track.Repository.TrackPullConfig.Entitys;
-
-namespace SJZY.Track.Repository.TrackPullConfig.Services
-{
- public interface ITrackPullConfigRepository : ISimpleClient
- {
-
- }
-}
diff --git a/src/SJZY.Track.Repository/TrackPullConfig/Services/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullConfig/Services/TrackPullConfigRepository.cs
deleted file mode 100644
index f99ae2ce..00000000
--- a/src/SJZY.Track.Repository/TrackPullConfig/Services/TrackPullConfigRepository.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using SJZY.Track.Repository.TrackPullConfig.Entitys;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace SJZY.Track.Repository.TrackPullConfig.Services
-{
- public class TrackPullConfigRepository : BasicRepository, ITrackPullConfigRepository, IScopedDependency
- {
-
- }
-}
diff --git a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs
new file mode 100644
index 00000000..c67087b4
--- /dev/null
+++ b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs
@@ -0,0 +1,9 @@
+using SJZY.Track.Domain.TrackPullAggregate;
+
+namespace SJZY.Track.Repository
+{
+ public class TrackPullConfigRepository : BasicRepository, ITrackPullConfigRepository, IScopedDependency
+ {
+
+ }
+}
diff --git a/src/SJZY.Track.Repository/TrackPullContentConfig/Entitys/TrackPullContentConfigEntity.cs b/src/SJZY.Track.Repository/TrackPullContentConfig/Entitys/TrackPullContentConfigEntity.cs
deleted file mode 100644
index cf3e4b9d..00000000
--- a/src/SJZY.Track.Repository/TrackPullContentConfig/Entitys/TrackPullContentConfigEntity.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-namespace SJZY.Track.Repository.TrackPullContentConfig.Entitys
-{
- ///
- /// 轨迹拉取内容配置表
- ///
- [SugarTable("t_track_pull_content_config")]
- public class TrackPullContentConfigEntity : IFullAuditedBasicEntitys
- {
-
- ///
- /// 自增主键
- ///
- [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)]
- public int Id { get; set; }
-
- ///
- /// 服务商轨迹代码参数值
- ///
- [SugarColumn(ColumnName = "TrackContentCodeValue")]
- public string TrackContentCodeValue { get; set; }
-
- ///
- /// 轨迹内容id
- ///
- [SugarColumn(ColumnName = "TrackContentId")]
- public int TrackContentId { get; set; }
-
- ///
- /// 服务商轨迹内容参数值
- ///
- [SugarColumn(ColumnName = "TrackContentValue")]
- public string TrackContentValue { get; set; }
-
- ///
- /// 轨迹关键词(正向),多个逗分隔
- ///
- [SugarColumn(ColumnName = "TrackKeyword")]
- public string TrackKeyword { get; set; }
-
- ///
- /// 轨迹关键词(反向),多个逗分隔
- ///
- [SugarColumn(ColumnName = "TrackKeywordReverse")]
- public string TrackKeywordReverse { get; set; }
-
- ///
- /// 轨迹发生地参数值(主数据枚举)
- ///
- [SugarColumn(ColumnName = "TrackPlaceValue")]
- public int? TrackPlaceValue { get; set; }
-
- ///
- /// 轨迹拉取配置id
- ///
- [SugarColumn(ColumnName = "TrackPullConfigId")]
- public int TrackPullConfigId { get; set; }
-
- ///
- /// 服务商轨迹状态参数值
- ///
- [SugarColumn(ColumnName = "TrackStatusValue")]
- public string TrackStatusValue { get; set; }
-
- ///
- /// 轨迹时区GMT
- ///
- [SugarColumn(ColumnName = "TrackTimeZone")]
- public string TrackTimeZone { get; set; }
-
- }
-}
\ No newline at end of file
diff --git a/src/SJZY.Track.Repository/TrackPullContentConfig/Services/ITrackPullContentConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullContentConfig/Services/ITrackPullContentConfigRepository.cs
deleted file mode 100644
index 9fce3f8a..00000000
--- a/src/SJZY.Track.Repository/TrackPullContentConfig/Services/ITrackPullContentConfigRepository.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using SJZY.Track.Repository.TrackPullContentConfig.Entitys;
-
-namespace SJZY.Track.Repository.TrackPullContentConfig.Services
-{
- public interface ITrackPullContentConfigRepository : ISimpleClient
- {
-
- }
-}
diff --git a/src/SJZY.Track.Repository/TrackPullContentConfig/Services/TrackPullContentConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullContentConfig/Services/TrackPullContentConfigRepository.cs
deleted file mode 100644
index 05ae7d19..00000000
--- a/src/SJZY.Track.Repository/TrackPullContentConfig/Services/TrackPullContentConfigRepository.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using SJZY.Track.Repository.TrackPullContentConfig.Entitys;
-
-namespace SJZY.Track.Repository.TrackPullContentConfig.Services
-{
- public class TrackPullContentConfigRepository : BasicRepository, ITrackPullContentConfigRepository, IScopedDependency
- {
-
- }
-}