diff --git a/SJZY.Track.Api.sln b/SJZY.Track.Api.sln
index 45fdba01..0c457eb0 100644
--- a/SJZY.Track.Api.sln
+++ b/SJZY.Track.Api.sln
@@ -12,10 +12,19 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0E2537C3-6
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SJZY.Track.Repository", "src\SJZY.Track.Repository\SJZY.Track.Repository.csproj", "{D9CF5706-1972-414F-821E-AA32C13B8570}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SJZY.Track.HttpApi", "src\SJZY.Track.HttpApi\SJZY.Track.HttpApi.csproj", "{390A44FB-0DB5-4B66-86AB-7712DC3030F5}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SJZY.Track.Application.Contract", "src\SJZY.Track.Application.Contract\SJZY.Track.Application.Contract.csproj", "{390A44FB-0DB5-4B66-86AB-7712DC3030F5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SJZY.Track.Test", "test\SJZY.Track.Test\SJZY.Track.Test.csproj", "{3A53539C-4A85-4E5D-A071-7B4B193AB0E0}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SJZY.Track.Domain", "src\SJZY.Track.Domain\SJZY.Track.Domain.csproj", "{073EB297-E752-49AC-BED8-B4AEBAB518F6}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "solution items", "solution items", "{086C7812-46F9-49FD-B490-A769E2C0729E}"
+ ProjectSection(SolutionItems) = preProject
+ common.props = common.props
+ NuGet.Config = NuGet.Config
+ .gitignore = .gitignore
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -42,6 +51,10 @@ Global
{3A53539C-4A85-4E5D-A071-7B4B193AB0E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3A53539C-4A85-4E5D-A071-7B4B193AB0E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3A53539C-4A85-4E5D-A071-7B4B193AB0E0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {073EB297-E752-49AC-BED8-B4AEBAB518F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {073EB297-E752-49AC-BED8-B4AEBAB518F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {073EB297-E752-49AC-BED8-B4AEBAB518F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {073EB297-E752-49AC-BED8-B4AEBAB518F6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -52,9 +65,10 @@ Global
{D9CF5706-1972-414F-821E-AA32C13B8570} = {DAC93270-5A25-40E5-B851-E7CA398DBC31}
{390A44FB-0DB5-4B66-86AB-7712DC3030F5} = {DAC93270-5A25-40E5-B851-E7CA398DBC31}
{3A53539C-4A85-4E5D-A071-7B4B193AB0E0} = {0E2537C3-6EF3-4085-9BD2-CF923E53F82A}
+ {073EB297-E752-49AC-BED8-B4AEBAB518F6} = {DAC93270-5A25-40E5-B851-E7CA398DBC31}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = { 8289A516 - 787C - 4D9D - B972 - E7047BDD206B}
+ SolutionGuid = { 8289A516 - 787C - 4D9D - B972 - E7047BDD206B}
SolutionGuid = {C8AD8123-683D-406E-A8FB-1D0184C19472}
EndGlobalSection
EndGlobal
diff --git a/SJZY.Track.Api.sln.DotSettings b/SJZY.Track.Api.sln.DotSettings
new file mode 100644
index 00000000..2363a683
--- /dev/null
+++ b/SJZY.Track.Api.sln.DotSettings
@@ -0,0 +1,2 @@
+
+ True
\ No newline at end of file
diff --git a/common.props b/common.props
new file mode 100644
index 00000000..492bcb09
--- /dev/null
+++ b/common.props
@@ -0,0 +1,9 @@
+
+
+ latest
+ enable
+ enable
+ $(NoWarn);CS1591;CS0436;NU1803
+
+
+
diff --git a/src/SJZY.Track.Api/Program.cs b/src/SJZY.Track.Api/Program.cs
index a9d373a7..db266046 100644
--- a/src/SJZY.Track.Api/Program.cs
+++ b/src/SJZY.Track.Api/Program.cs
@@ -10,10 +10,10 @@ try
.AddConfigurationContainer()
.AddOptionsFromConfiguration()
.UseSerilogDefault()
- .Host.AddAppSettingsSecretsJson()
+ .Host.AddAppSettingsSecretsJson()
.UseAutofac();
- await builder.AddApplicationAsync();
+ await builder.AddApplicationAsync();
var app = builder.Build();
await app.InitializeApplicationAsync();
@@ -21,5 +21,5 @@ try
}
catch (Exception ex)
{
- Console.WriteLine($"ÏîĿÆô¶¯ʧ°ܣ¬Ò쳣ÐÅϢ£º{ex}");
+ Console.WriteLine($"项目启动失败,异常信息:{ex}");
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Api/SJZY.Track.Api.csproj b/src/SJZY.Track.Api/SJZY.Track.Api.csproj
index 0d485cec..be47c0cf 100644
--- a/src/SJZY.Track.Api/SJZY.Track.Api.csproj
+++ b/src/SJZY.Track.Api/SJZY.Track.Api.csproj
@@ -1,32 +1,26 @@
-
- net7.0
- enable
- enable
- True
- Linux
- ..\..
-
+
-
-
-
-
-
-
+
+ net7.0
+ True
+ Linux
+ ..\..
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
diff --git a/src/SJZY.Track.Api/ApiModule.cs b/src/SJZY.Track.Api/SjzyTrackApiModule.cs
similarity index 87%
rename from src/SJZY.Track.Api/ApiModule.cs
rename to src/SJZY.Track.Api/SjzyTrackApiModule.cs
index f679135d..13d9633a 100644
--- a/src/SJZY.Track.Api/ApiModule.cs
+++ b/src/SJZY.Track.Api/SjzyTrackApiModule.cs
@@ -9,6 +9,7 @@ using SJZY.Expand.ABP.Core.Prometheus;
using SJZY.Expand.ABP.Core.Redis;
using SJZY.Expand.ABP.Core.Swagger;
using SJZY.Track.Application;
+using SJZY.Track.Repository;
using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Serilog;
@@ -17,23 +18,26 @@ using Volo.Abp.Autofac;
using Volo.Abp.Json;
using Volo.Abp.Modularity;
-[assembly: HostingStartup(typeof(SJZY.Expand.ABP.Core.HostingStartup))]
+[assembly: HostingStartup(typeof(HostingStartup))]
+
namespace SJZY.Track.Api
{
[DependsOn(
typeof(AbpAutofacModule),
typeof(SjzyAbpCodeModule),
- typeof(ApplicationModule),
typeof(AbpAspNetCoreMvcModule),
- typeof(AbpAspNetCoreSerilogModule)
+ typeof(AbpAspNetCoreSerilogModule),
+ typeof(SjzyTrackApplicationModule),
+ typeof(SjzyTrackRepositoryModule)
)]
- public class ApiModule : AbpModule
+ public class SjzyTrackApiModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var environment = context.Services.GetHostingEnvironment();
var configuration = context.Services.GetConfiguration();
context.Services.AddSwagger();
+
//过滤器相关配置
context.Services.AddMvc(options =>
{
@@ -47,7 +51,9 @@ namespace SJZY.Track.Api
//Json格式化全局处理
context.Services.Configure(options =>
{
- options.SerializerSettings.ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver();//.DefaultContractResolver();
+ options.SerializerSettings.ContractResolver =
+ new Newtonsoft.Json.Serialization.
+ CamelCasePropertyNamesContractResolver(); //.DefaultContractResolver();
options.SerializerSettings.Converters.Add(new DateTimeJsonConverter("yyyy-MM-dd HH:mm:ss"));
options.SerializerSettings.Converters.Add(new LongJsonConverter());
});
@@ -55,9 +61,7 @@ namespace SJZY.Track.Api
Configure(options => options.OutputDateTimeFormat = "yyyy-MM-dd HH:mm:ss");
Configure(options => { options.IsEnabled = false; });
-
context.Services.AddRedis();
-
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
@@ -77,6 +81,7 @@ namespace SJZY.Track.Api
app.UsePrometheus();
#region 启动提示
+
Console.WriteLine($@"
+-------------------------------------------------------+
| |
@@ -87,8 +92,8 @@ namespace SJZY.Track.Api
| |
+-------------------------------------------------------+
");
+
#endregion
}
}
-
-}
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Api/appsettings.Development.json b/src/SJZY.Track.Api/appsettings.Development.json
index 0856dfd7..671ae998 100644
--- a/src/SJZY.Track.Api/appsettings.Development.json
+++ b/src/SJZY.Track.Api/appsettings.Development.json
@@ -2,13 +2,12 @@
"Environment": "Dev",
"Logging": {
"LogLevel": {
- "Default": "Information",
+ "Default": "Debug",
"Microsoft.AspNetCore": "Warning"
}
},
"ConnectionStrings": {
- "DefaultConnection": "server=mysql-dev.default.svc.cluster.local;Database=sjzy_openapi;Uid=sjzy_dev_user;Pwd=818f83e5;AllowLoadLocalInfile=true;SslMode=None;Charset=utf8mb4;",
- "BICenterConnection": "server=mysql-test.default.svc.cluster.local;Database=sjzy_bi_center;Uid=sjzy_test_user;Pwd=848c1c31;AllowLoadLocalInfile=true;SslMode=None;Charset=utf8mb4;"
+ "DefaultConnection": "server=mysql-dev.default.svc.cluster.local;Database=sjzy_track;Uid=sjzy_dev_user;Pwd=818f83e5;AllowLoadLocalInfile=true;SslMode=None;Charset=utf8mb4;",
},
"Redis": {
"Host": "redis-dev.default.svc.cluster.local:6379",
@@ -60,9 +59,20 @@
"BucketName": "cams3",
"ReturnHttpsUrl": true
},
+ "ElasticSearch": {
+ "NodeUrls": [ "http://elasticsearch-dev.default.svc.cluster.local:9200" ],
+ "LoginName": "elastic",
+ "Password": "afyTgmVb8jq6",
+ "Base64PassPassword": "Basic ZWxhc3RpYzphZnlUZ21WYjhqcTY="
+ },
"RemoteServices": {
"UserCenter": {
"BaseUrl": "http://192.168.80.55:5020/"
+ },
+ "InterfaceForward": {
+ "BaseUrl": "http://192.168.80.55:5041/", //开发环境80.55,测试环境80.57
+ "AppKey": "从接口通应用获取",
+ "AppSecret": "从接口通应用获取"
}
}
}
diff --git a/src/SJZY.Track.Api/appsettings.Test.json b/src/SJZY.Track.Api/appsettings.Test.json
index 825693ce..c62fc382 100644
--- a/src/SJZY.Track.Api/appsettings.Test.json
+++ b/src/SJZY.Track.Api/appsettings.Test.json
@@ -7,8 +7,8 @@
}
},
"ConnectionStrings": {
- "DefaultConnection": "server=192.168.80.84;Database=sjzy_package_setting;Uid=sjzy_test_user;Pwd=848c1c31;AllowLoadLocalInfile=true;SslMode=None;Charset=utf8mb4;",
- "canalView": "server=192.168.80.84;Database=sjzy_data_center;Uid=sjzy_test_user;Pwd=848c1c31;AllowLoadLocalInfile=true;SslMode=None;Charset=utf8mb4;"
+ "DefaultConnection": "server=mysql-test.default.svc.cluster.local;Database=sjzy_track;Uid=sjzy_test_user;Pwd=848c1c31;AllowLoadLocalInfile=true;SslMode=None;Charset=utf8mb4;",
+ "canalView": "server=mysql-test.default.svc.cluster.local;Database=sjzy_track;Uid=sjzy_test_user;Pwd=848c1c31;AllowLoadLocalInfile=true;SslMode=None;Charset=utf8mb4;"
},
"Redis": {
"ConnectionString": "192.168.80.58:6379,abortConnect=false",
diff --git a/src/SJZY.Track.Api/appsettings.json b/src/SJZY.Track.Api/appsettings.json
index 850809ba..d69cb0c1 100644
--- a/src/SJZY.Track.Api/appsettings.json
+++ b/src/SJZY.Track.Api/appsettings.json
@@ -1,20 +1,20 @@
{
"Configuration": {
- "UseLocalConfiguration": true, // 是否使用本地配置文件
- "ConfiguraFileName": "appsettings.Development.json", //指定配置文件名称,开启 UseLocalConfiguration 时生效
+ "UseLocalConfiguration": false, //是否使用本地配置文件
+ "ConfiguraFileName": "appsettings.Development.json", //指定配置文件名称,开启UseLocalConfiguration时生效
"Apollo": {
"AppId": "SJZY.Track.Configuration",
"Env": "DEV",
- "Namespace": "Dev",
+ "Namespace": "Test",
"MetaServer": "http://apollo-service-test-apollo-configservice.apollo.svc.cluster.local:8080",
"ConfigServer": [ "http://apollo-service-test-apollo-configservice.apollo.svc.cluster.local:8080" ]
}
- },
- "Kestrel": {
- "EndPoints": {
- "Http": {
- "Url": "http://*:5056"
- }
+ },
+ "Kestrel": {
+ "EndPoints": {
+ "Http": {
+ "Url": "http://*:5056"
}
}
}
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/DeleteOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/DeleteOrderInput.cs
new file mode 100644
index 00000000..0e318811
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/DeleteOrderInput.cs
@@ -0,0 +1,13 @@
+namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
+
+public class DeleteOrderInput : OrderNoInfo
+{
+}
+
+public class DeleteTrackInput : OrderNoInfo
+{
+ ///
+ /// 轨迹code
+ ///
+ public List TrackCodes { get; set; } = new();
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs
new file mode 100644
index 00000000..3920f5c1
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetOrderDetailsInput.cs
@@ -0,0 +1,90 @@
+using System.Reflection.Metadata.Ecma335;
+
+namespace SJZY.Track.Application.Contract.Dtos.ProvideServices
+{
+ public class GetOrderDetailsInput
+ {
+ ///
+ /// 轨迹订单id
+ ///
+ public int OrderId { get; set; }
+
+ ///
+ /// 子系统id
+ ///
+ public int SubSystemId { get; set; }
+
+ ///
+ /// 轨迹模板Id
+ ///
+ public List? TrackTemplateIds { get; set; } = new List();
+ }
+
+ public class TrackOrderDetailDto
+ {
+ ///
+ /// Id es主键
+ ///
+ public int Id { get; set; }
+
+ ///
+ /// 轨迹订单id
+ ///
+ public int OrderId { set; get; }
+
+ ///
+ /// 轨迹代码
+ ///
+ public string? Code { get; set; }
+
+ ///
+ /// 轨迹内容
+ ///
+ public string? Content { get; set; }
+
+ ///
+ /// 轨迹内容英文
+ ///
+ public string? EnContent { get; set; }
+
+ ///
+ /// 轨迹发生地
+ ///
+ public string? TrackPlace { get; set; }
+
+ ///
+ /// 轨迹发生时间
+ ///
+ public DateTime? TrackTime { get; set; }
+
+ ///
+ /// 轨迹发生时区
+ ///
+ public string? TrackTimeZone { get; set; }
+
+ ///
+ /// 时区的值
+ ///
+ public float TrackTimeZoneValue { get; set; }
+
+ ///
+ /// 是否可删
+ ///
+ public bool IsCanDelete { get; set; }
+
+ ///
+ /// 是否对外
+ ///
+ public bool IsExternal { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public DateTime CreateTime { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ public string? CreateUser { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs
new file mode 100644
index 00000000..81aa553e
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetPageTrackOrderInput.cs
@@ -0,0 +1,117 @@
+namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
+
+public class GetPageTrackOrderInput : PageInfoInput
+{
+ ///
+ /// 子系统id
+ ///
+ public int SubSystemId { get; set; }
+
+ /////
+ ///// 单号
+ /////
+ //public List? OrderNos { get; set; }
+
+ ///
+ /// 单号
+ ///
+ public string? OrderNos { get; set; }
+
+ ///
+ /// 创建时间开始
+ ///
+ public DateTime? CreateTimeStart { get; set; }
+
+ ///
+ /// 创建时间截止
+ ///
+ public DateTime? CreateTimeEnd { get; set; }
+}
+
+///
+/// 轨迹订单Dto
+///
+public class TrackOrderDto
+{
+ ///
+ /// 轨迹订单id
+ ///
+ public int Id { get; set; }
+
+ ///
+ /// 订单类型id
+ ///
+ public int OrderType { get; set; }
+
+ ///
+ /// 订单名称
+ ///
+ public string? OrderTypeName { get; set; }
+
+ ///
+ /// 订单号
+ ///
+ public string? OrderNumber { get; set; }
+
+ ///
+ /// 轨迹模版
+ ///
+ public string? TrackTemplateNames { get; set; }
+
+ ///
+ /// 轨迹模板Id数组
+ ///
+ public List? TrackTemplateIds { get; set; }
+
+ ///
+ /// 客户简称
+ ///
+ public string? CustomerShortName { get; set; }
+
+ ///
+ /// 客户代码
+ ///
+ public string? CustomerCode { get; set; }
+
+ ///
+ /// 订单明细(json)
+ ///
+ public string? OrderDetails { get; set; }
+
+ ///
+ /// 最新轨迹内容
+ ///
+ public string? NewestTrackContent { get; set; }
+
+ ///
+ /// 最新轨迹内容英文
+ ///
+ public string? NewestTrackEnContent { get; set; }
+
+ ///
+ /// 最新轨迹发生地
+ ///
+ public string? NewestTrackPlace { get; set; }
+
+ ///
+ /// 最新轨迹时间
+ ///
+ public DateTime? NewestTrackTime { get; set; }
+
+ ///
+ /// 是否完结
+ ///
+ public bool IsFinish { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public DateTime? CreateTime { get; set; }
+
+ ///
+ /// 子系统
+ ///
+ public string SubSystem { get; set; }
+
+ public int SubSystemId { get; set; }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackInput.cs
new file mode 100644
index 00000000..598ee759
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackInput.cs
@@ -0,0 +1,54 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
+
+public class GetTrackInput
+{
+ ///
+ /// 订单类型
+ ///
+ [Required]
+ [Range(1, int.MaxValue)]
+ public int OrderType { get; set; }
+
+ ///
+ /// 订单号
+ ///
+ public List OrderNos { get; set; } = new();
+
+ ///
+ /// 时区 +8 +8.25 -8.5 -9
+ /// 不传默认+8
+ ///
+ private float? _timeZone;
+
+ public float? TimeZone
+ {
+ get => _timeZone ?? 8;
+ set => _timeZone = value;
+ }
+
+ ///
+ /// 排序方式
+ ///
+ [Required]
+ public SortMethod SortMethod { get; set; }
+}
+
+public enum SortMethod
+{
+ ///
+ /// 按轨迹发生时间排序
+ ///
+ ByTrackTime,
+
+ ///
+ /// 按轨迹发生时间降序
+ ///
+ ByTrackTimeDesc,
+
+ ///
+ /// 按订单模板排序
+ ///
+ ByTemplate
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackOutput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackOutput.cs
new file mode 100644
index 00000000..eda7ecbc
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/GetTrackOutput.cs
@@ -0,0 +1,21 @@
+namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
+
+public class GetTrackOutput
+{
+ ///
+ /// 订单号
+ ///
+ public string OrderNo { get; set; }
+
+ public List TrackDetails { get; set; }
+}
+
+public class TrackDetail
+{
+ public string Code { get; set; }
+ public string Status { get; set; }
+ public string Content { get; set; }
+ public string Location { get; set; }
+ public DateTime Time { get; set; }
+ public float TimeZone { get; set; }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/LinkOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/LinkOrderInput.cs
new file mode 100644
index 00000000..cf3e5b79
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/LinkOrderInput.cs
@@ -0,0 +1,31 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
+
+public class LinkOrderInput
+{
+ ///
+ /// false解绑,true关联
+ ///
+ [Required]
+ public bool IsLink { get; set; }
+
+ ///
+ /// 订单类型,必填
+ ///
+ [Required]
+ public int OrderType { get; set; }
+
+ ///
+ /// 订单号,必填
+ ///
+ [Required]
+ public string OrderNo { get; set; }
+
+ [Required] public int LinkOrderType { get; set; }
+
+ ///
+ /// 关联的单号
+ ///
+ public List LinkOrderNos { get; set; } = new();
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/OrderNoInfo.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/OrderNoInfo.cs
new file mode 100644
index 00000000..eda65e4a
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/OrderNoInfo.cs
@@ -0,0 +1,20 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
+
+public class OrderNoInfo
+{
+ ///
+ /// 订单类型,必填
+ ///
+ [Required]
+ [Range(1, int.MaxValue)]
+ public int OrderType { get; set; }
+
+ ///
+ /// 订单号,必填
+ ///
+ [Required]
+ [MaxLength(100)]
+ public string OrderNo { get; set; } = null!;
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/RefreshTrackInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/RefreshTrackInput.cs
new file mode 100644
index 00000000..4e6e2955
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/RefreshTrackInput.cs
@@ -0,0 +1,9 @@
+namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
+
+public class RefreshTrackInput
+{
+ ///
+ /// 订单号
+ ///
+ public List OrderNos { get; set; } = new();
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs
new file mode 100644
index 00000000..69ad9a0b
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpdateOrderInput.cs
@@ -0,0 +1,54 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
+
+public class UpdateOrderInput : OrderNoInfo
+{
+ ///
+ /// 目的港口
+ ///
+ public string? ArrivalPort { get; set; }
+
+ ///
+ /// 起运港口
+ ///
+ public string? LeavePort { get; set; }
+
+ ///
+ /// 目的国家,必填
+ ///
+ [Required]
+ [MaxLength(200)]
+ public string ArrivalCountry { get; set; } = null!;
+
+ ///
+ /// 起运国家,必填
+ ///
+ [Required]
+ [MaxLength(200)]
+ public string LeaveCountry { get; set; } = null!;
+
+ ///
+ /// 目的城市,必填
+ ///
+ [Required]
+ [MaxLength(200)]
+ public string ArrivalCity { get; set; } = null!;
+
+ ///
+ /// 起运城市,必填
+ ///
+ [Required]
+ [MaxLength(200)]
+ public string LeaveCity { get; set; } = null!;
+
+ ///
+ /// 订单模板(传全量)
+ ///
+ public List? Templates { get; set; } = new();
+
+ ///
+ /// 订单航班信息
+ ///
+ public List? FlightInfos { get; set; } = new();
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertOrderInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertOrderInput.cs
new file mode 100644
index 00000000..91ae6d11
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertOrderInput.cs
@@ -0,0 +1,42 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
+
+public class UpsertOrderInput : UpdateOrderInput
+{
+ ///
+ /// 客户id
+ ///
+ [Required]
+ public int CustomId { get; set; }
+}
+
+public class OrderTemplateInfo
+{
+ ///
+ /// 模板id
+ ///
+ [Required]
+ public int TemplateId { get; set; }
+
+ ///
+ /// 服务商id
+ ///
+ public int? ServiceProviderId { get; set; }
+}
+
+public class OrderFlightInfo
+{
+ ///
+ /// 航班号
+ ///
+ [Required]
+ [MaxLength(50)]
+ public string FlightNo { get; set; }
+
+ ///
+ /// 班期
+ ///
+ [Required]
+ public DateTime FlightDate { get; set; }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertTrackInput.cs b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertTrackInput.cs
new file mode 100644
index 00000000..b62cf77b
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/ProvideServices/UpsertTrackInput.cs
@@ -0,0 +1,47 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
+
+public class UpsertTrackInput : OrderNoInfo
+{
+ ///
+ /// 轨迹内容代码
+ ///
+ [Required]
+ [MaxLength(50)]
+ public string TrackCode { get; set; } = null!;
+
+ ///
+ /// 轨迹发生地
+ ///
+ [Required]
+ [MaxLength(200)]
+ public string TrackPlace { get; set; } = null!;
+
+ ///
+ /// 轨迹发生时间
+ ///
+ [Required]
+ public DateTime? TrackTime { get; set; }
+
+ ///
+ /// 轨迹发生时区
+ ///
+ [Required]
+ [Range(-12, 12)]
+ public float? TrackTimeZone { get; set; }
+}
+
+public class NotNullAttribute : ValidationAttribute
+{
+ protected override ValidationResult IsValid(object value, ValidationContext validationContext)
+ {
+ if (value == null)
+ {
+ return new ValidationResult(ErrorMessage ?? "The field is required.",
+ new[] { validationContext.MemberName });
+ }
+
+ return ValidationResult.Success;
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentInput.cs
new file mode 100644
index 00000000..f13eac46
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentInput.cs
@@ -0,0 +1,108 @@
+namespace SJZY.Track.Application.Contract.Dtos.TrackContents
+{
+ public class EditTrackContentInput
+ {
+ ///
+ /// Id
+ ///
+ public int Id { get; set; }
+
+ ///
+ /// 操作类型
+ ///
+ public OptionType Options { get; set; }
+
+ ///
+ /// 子系统id
+ ///
+ public int SubSystemId { get; set; }
+
+ ///
+ /// 所属轨迹状态id
+ ///
+ public int TrackStatusId { get; set; }
+
+ ///
+ /// 轨迹内容代码
+ ///
+ public string? Code { get; set; }
+
+ ///
+ /// 轨迹内容
+ ///
+ public string? Content { get; set; }
+
+ ///
+ /// 轨迹内容英文
+ ///
+ public string? EnContent { get; set; }
+
+ ///
+ /// 轨迹标记id
+ ///
+ public int TrackFlagId { get; set; }
+
+ ///
+ /// 是否完结
+ ///
+ public bool IsFinish { get; set; }
+ }
+
+ public class GetTrackContentDetailDto
+ {
+ ///
+ /// Id
+ ///
+ public int Id { get; set; }
+
+ ///
+ /// 子系统id
+ ///
+ public int SubSystemId { get; set; }
+
+ ///
+ /// 子系统
+ ///
+ public string SubSystem { get; set; }
+
+ ///
+ /// 所属轨迹状态id
+ ///
+ public int TrackStatusId { get; set; }
+
+ ///
+ /// 所属轨迹状态
+ ///
+ public string TrackStatus { get; set; }
+
+ ///
+ /// 轨迹内容代码
+ ///
+ public string Code { get; set; }
+
+ ///
+ /// 轨迹内容
+ ///
+ public string Content { get; set; }
+
+ ///
+ /// 轨迹内容英文
+ ///
+ public string EnContent { get; set; }
+
+ ///
+ /// 轨迹标记id
+ ///
+ public int TrackFlagId { get; set; }
+
+ ///
+ /// 轨迹标记
+ ///
+ public string TrackFlag { get; set; }
+
+ ///
+ /// 是否完结
+ ///
+ public bool IsFinish { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentMapInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentMapInput.cs
new file mode 100644
index 00000000..e207654d
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/EditTrackContentMapInput.cs
@@ -0,0 +1,41 @@
+namespace SJZY.Track.Application.Contract.Dtos.TrackContents;
+
+public class EditTrackContentMapInput
+{
+ public int? Id { get; set; }
+
+ ///
+ /// 映射子系统id
+ ///
+ public int? MapSubSystemId { get; set; }
+
+ ///
+ /// 映射轨迹内容代码
+ ///
+ public string? MapTrackContentCode { get; set; }
+
+ ///
+ /// 映射轨迹内容id
+ ///
+ public int? MapTrackContentId { get; set; }
+
+ ///
+ /// 操作类型
+ ///
+ public OptionTypeNoNull Options { get; set; }
+
+ ///
+ /// 源子系统id
+ ///
+ public int? SubSystemId { get; set; }
+
+ ///
+ /// 源轨迹内容代码
+ ///
+ public string? TrackContentCode { get; set; }
+
+ ///
+ /// 源轨迹内容id
+ ///
+ public int? TrackContentId { get; set; }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs
new file mode 100644
index 00000000..8c0b6b05
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/TrackContents/GetPageTrackContentInput.cs
@@ -0,0 +1,93 @@
+namespace SJZY.Track.Application.Contract.Dtos.TrackContents
+{
+ public class GetPageTrackContentInput : PageInfoInput
+ {
+ ///
+ /// 子系统id
+ ///
+ public int SubSystemId { get; set; }
+
+ ///
+ /// 关键字
+ ///
+ public string? Keywords { get; set; }
+
+ ///
+ /// 轨迹状态id
+ ///
+ public int TrackStatusId { get; set; }
+
+ ///
+ /// 选中的轨迹内容id
+ ///
+ public List? SelectIds { get; set; }
+ }
+
+ public class GetTrackContentListDto
+ {
+ ///
+ /// Id
+ ///
+ public int Id { get; set; }
+
+ ///
+ /// 子系统
+ ///
+ public string SubSystem { get; set; }
+
+ ///
+ /// 轨迹内容代码
+ ///
+ public string Code { get; set; }
+
+ ///
+ /// 轨迹内容
+ ///
+ public string Content { get; set; }
+
+ ///
+ /// 轨迹内容英文
+ ///
+ public string EnContent { get; set; }
+
+ ///
+ /// 所属状态
+ ///
+ public string TrackStatus { get; set; }
+
+ ///
+ /// 所属节点
+ ///
+ public string Node { get; set; }
+
+ ///
+ /// 轨迹标记
+ ///
+ public string TrackFlag { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public DateTime? CreateTime { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ public string CreateUser { get; set; }
+
+ ///
+ /// 修改时间
+ ///
+ public DateTime? UpdateTime { get; set; }
+
+ ///
+ /// 修改人
+ ///
+ public string UpdateUser { get; set; }
+
+ ///
+ /// 是否完结
+ ///
+ public bool IsFinish { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/EditTrackFlagInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/EditTrackFlagInput.cs
new file mode 100644
index 00000000..49bb942a
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/EditTrackFlagInput.cs
@@ -0,0 +1,68 @@
+namespace SJZY.Track.Application.Contract.Dtos.TrackFlags
+{
+ public class EditTrackFlagInput
+ {
+ ///
+ /// 操作类型
+ ///
+ public OptionType Options { get; set; }
+
+ ///
+ /// Id
+ ///
+ public int Id { get; set; }
+
+ ///
+ /// 子系统id
+ ///
+ public int SubSystemId { get; set; }
+
+ ///
+ /// 标记
+ ///
+ public string? Flag { get; set; }
+
+ ///
+ /// 代码
+ ///
+ public string? Code { get; set; }
+
+ /////
+ ///// 是否完结
+ /////
+ //public bool IsFinish { get; set; }
+ }
+
+ public class GetTrackFlagDetailDto
+ {
+ ///
+ /// Id
+ ///
+ public int Id { get; set; }
+
+ ///
+ /// 子系统id
+ ///
+ public int SubSystemId { get; set; }
+
+ ///
+ /// 子系统
+ ///
+ public string SubSystem { get; set; }
+
+ ///
+ /// 代码
+ ///
+ public string Code { get; set; }
+
+ ///
+ ///
+ ///
+ public string Flag { get; set; }
+
+ /////
+ ///// 是否完结
+ /////
+ //public bool IsFinish { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/GetTrackFlagListDto.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/GetTrackFlagListDto.cs
new file mode 100644
index 00000000..3964caea
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/GetTrackFlagListDto.cs
@@ -0,0 +1,68 @@
+namespace SJZY.Track.Application.Contract.Dtos.TrackFlags
+{
+ public class GetTrackFlagListDto
+ {
+ ///
+ /// Id
+ ///
+ public int Id { get; set; }
+
+ ///
+ /// 子系统
+ ///
+ public string SubSystem { get; set; }
+
+ ///
+ /// 代码
+ ///
+ public string Code { get; set; }
+
+ ///
+ /// 标记
+ ///
+ public string Flag { get; set; }
+
+ /////
+ ///// 是否完结
+ /////
+ //public bool IsFinish { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public DateTime? CreateTime { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ public string CreateUser { get; set; }
+
+ ///
+ /// 修改时间
+ ///
+ public DateTime? UpdateTime { get; set; }
+
+ ///
+ /// 修改人
+ ///
+ public string UpdateUser { get; set; }
+ }
+
+ public class GetPageTrackFlagInput : PageInfoInput
+ {
+ ///
+ /// 子系统id
+ ///
+ public int SubSystemId { get; set; }
+
+ ///
+ /// 选中的轨迹标记id
+ ///
+ public List? SelectIds { get; set; }
+
+ /////
+ ///// 关键字
+ /////
+ //public string Keywords { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackPull/EditTrackPullConfigInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPull/EditTrackPullConfigInput.cs
new file mode 100644
index 00000000..2803a4b3
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPull/EditTrackPullConfigInput.cs
@@ -0,0 +1,71 @@
+namespace SJZY.Track.Application.Contract.Dtos.TrackPull;
+
+public class EditTrackPullConfigInput
+{
+ public int? Id { get; set; }
+
+ ///
+ /// 操作类型
+ ///
+ public OptionTypeNoNull Options { get; set; }
+
+ ///
+ /// 拉取轨迹订单号
+ ///
+ public string? OrderNoName { get; set; }
+
+ ///
+ /// 返参解析对象
+ ///
+ public int? ParseMethod { get; set; }
+
+ ///
+ /// 定时任务(分钟)
+ ///
+ public int? PullInterval { get; set; }
+
+ ///
+ /// 服务商id
+ ///
+ public int? ServiceProviderId { get; set; }
+
+ ///
+ /// 子系统id
+ ///
+ public int? SubSystemId { get; set; }
+
+ ///
+ /// 拉取轨迹时区
+ ///
+ public string? TackTimeZoneName { get; set; }
+
+ ///
+ /// 拉取轨迹内容代码
+ ///
+ public string? TrackContentCodeName { get; set; }
+
+ ///
+ /// 拉取轨迹内容
+ ///
+ public string? TrackContentName { get; set; }
+
+ ///
+ /// 拉取轨迹发生地
+ ///
+ public string? TrackPlaceName { get; set; }
+
+ ///
+ /// 拉取轨迹状态
+ ///
+ public string? TrackStatusName { get; set; }
+
+ ///
+ /// 轨迹模板id
+ ///
+ public int? TrackTemplateId { get; set; }
+
+ ///
+ /// 拉取轨迹发生时间
+ ///
+ public string? TrackTimeName { get; set; }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackPull/UpdateTrackPullContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPull/UpdateTrackPullContentInput.cs
new file mode 100644
index 00000000..6f3c76dd
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPull/UpdateTrackPullContentInput.cs
@@ -0,0 +1,51 @@
+namespace SJZY.Track.Application.Contract.Dtos.TrackPull;
+
+public class UpdateTrackPullContentInput
+{
+ public int Id { get; set; }
+
+ ///
+ /// 服务商轨迹代码参数值
+ ///
+ public string? TrackContentCodeValue { get; set; }
+
+ ///
+ /// 轨迹内容id
+ ///
+ public int TrackContentId { get; set; }
+
+ ///
+ /// 服务商轨迹内容参数值
+ ///
+ public string? TrackContentValue { get; set; }
+
+ ///
+ /// 拉取轨迹关键字(正向)
+ ///
+ public List? TrackKeywords { get; set; }
+
+ ///
+ /// 拉取轨迹关键字(反向)
+ ///
+ public List? TrackKeywordReverses { get; set; }
+
+ ///
+ /// 轨迹发生地参数值
+ ///
+ public int? TrackPlaceValue { get; set; }
+
+ ///
+ /// 轨迹拉取配置id
+ ///
+ public int TrackPullConfigId { get; set; }
+
+ ///
+ /// 服务商轨迹状态参数值
+ ///
+ public string? TrackStatusValue { get; set; }
+
+ ///
+ /// 轨迹时区GMT
+ ///
+ public double? TrackTimeZone { get; set; }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushConfigInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushConfigInput.cs
new file mode 100644
index 00000000..b462f6a4
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushConfigInput.cs
@@ -0,0 +1,81 @@
+namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
+
+public class EditTrackPushConfigInput
+{
+ ///
+ /// 客户id
+ ///
+ public int CustomId { get; set; }
+
+ ///
+ /// 推送扩展字段
+ ///
+ public string? ExpandFieldsName { get; set; }
+
+ public int? Id { get; set; }
+
+ ///
+ /// 是否自动推送
+ ///
+ public bool IsAutoPush { get; set; }
+
+ ///
+ /// 操作类型
+ ///
+ public OptionTypeNoNull Options { get; set; }
+
+ ///
+ /// 推送轨迹订单号
+ ///
+ public string? OrderNoName { get; set; }
+
+ ///
+ /// 服务商id
+ ///
+ public int ServiceProviderId { get; set; }
+
+ ///
+ /// 子系统id
+ ///
+ public int SubSystemId { get; set; }
+
+ ///
+ /// 推送轨迹时区
+ ///
+ public string? TackTimeZoneName { get; set; }
+
+ ///
+ /// 推送轨迹内容代码
+ ///
+ public string? TrackContentCodeName { get; set; }
+
+ ///
+ /// 推送轨迹内容
+ ///
+ public string? TrackContentName { get; set; }
+
+ ///
+ /// 推送轨迹内容英文
+ ///
+ public string? TrackEnContentName { get; set; }
+
+ ///
+ /// 推送轨迹发生地
+ ///
+ public string? TrackPlaceName { get; set; }
+
+ ///
+ /// 推送轨迹状态
+ ///
+ public string? TrackStatusName { get; set; }
+
+ ///
+ /// 轨迹模板id
+ ///
+ public List? TrackTemplateIds { get; set; }
+
+ ///
+ /// 推送轨迹发生时间
+ ///
+ public string? TrackTimeName { get; set; }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushContentInput.cs
new file mode 100644
index 00000000..ec85498a
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/EditTrackPushContentInput.cs
@@ -0,0 +1,61 @@
+namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
+
+public class EditTrackPushContentInput
+{
+ ///
+ /// 扩展字段参数值
+ ///
+ public string? ExpandFieldsValue { get; set; }
+
+ public int? Id { get; set; }
+
+ ///
+ /// 操作类型
+ ///
+ public OptionTypeNoNull Options { get; set; }
+
+ ///
+ /// 推送单号类型
+ ///
+ public int OrderNoType { get; set; }
+
+ ///
+ /// 推送轨迹排序
+ ///
+ public int Sort { get; set; }
+
+ ///
+ /// 轨迹代码参数值
+ ///
+ public string? TrackContentCodeValue { get; set; }
+
+ ///
+ /// 轨迹内容id
+ ///
+ public int TrackContentId { get; set; }
+
+ ///
+ /// 轨迹内容参数值
+ ///
+ public string? TrackContentValue { get; set; }
+
+ ///
+ /// 轨迹内容英文参数值
+ ///
+ public string? TrackEnContentValue { get; set; }
+
+ ///
+ /// 轨迹推送配置id
+ ///
+ public int TrackPushConfigId { get; set; }
+
+ ///
+ /// 轨迹状态参数值
+ ///
+ public string? TrackStatusValue { get; set; }
+
+ ///
+ /// 轨迹时区GMT
+ ///
+ public double? TrackTimeZone { get; set; }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackPush/SortTrackPushContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/SortTrackPushContentInput.cs
new file mode 100644
index 00000000..ed095f3e
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/SortTrackPushContentInput.cs
@@ -0,0 +1,11 @@
+using SJZY.Expand.ABP.Core.PublicMethords;
+
+namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
+
+public class SortTrackPushContentInput
+{
+ ///
+ /// 排序信息
+ ///
+ public List SortInfo { get; set; }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/EditTrackStatusInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/EditTrackStatusInput.cs
new file mode 100644
index 00000000..61a9d98e
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/EditTrackStatusInput.cs
@@ -0,0 +1,40 @@
+namespace SJZY.Track.Application.Contract.Dtos.TrackStatus
+{
+ public class EditTrackStatusInput
+ {
+ ///
+ /// Id
+ ///
+ public int Id { get; set; }
+
+ ///
+ /// 操作类型
+ ///
+ public OptionType Options { get; set; }
+
+ ///
+ /// 子系统id
+ ///
+ public int SubSystemId { get; set; }
+
+ ///
+ /// 所属节点id
+ ///
+ public int NodeId { get; set; }
+
+ ///
+ /// 轨迹状态代码
+ ///
+ public string? Code { get; set; }
+
+ ///
+ /// 轨迹状态
+ ///
+ public string? TrackStatus { get; set; }
+
+ ///
+ /// 轨迹状态英文
+ ///
+ public string? EntrackStatus { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusDetailDto.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusDetailDto.cs
new file mode 100644
index 00000000..fe39c418
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusDetailDto.cs
@@ -0,0 +1,40 @@
+namespace SJZY.Track.Application.Contract.Dtos.TrackStatus
+{
+ public class GetTrackStatusDetailDto
+ {
+ ///
+ /// Id
+ ///
+ public int Id { get; set; }
+
+ ///
+ /// 子系统id
+ ///
+ public int SubSystemId { get; set; }
+
+ ///
+ /// 子系统
+ ///
+ public string SubSystem { get; set; }
+
+ ///
+ /// 节点id
+ ///
+ public int NodeId { get; set; }
+
+ ///
+ /// 所属轨迹状态
+ ///
+ public string TrackStatus { get; set; }
+
+ ///
+ /// 轨迹状态代码
+ ///
+ public string Code { get; set; }
+
+ ///
+ /// 轨迹内容英文
+ ///
+ public string EntrackStatus { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusListDto.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusListDto.cs
new file mode 100644
index 00000000..c505aa72
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/TrackStatus/GetTrackStatusListDto.cs
@@ -0,0 +1,74 @@
+namespace SJZY.Track.Application.Contract.Dtos.TrackStatus
+{
+ public class GetTrackStatusListDto
+ {
+ ///
+ /// Id
+ ///
+ public int Id { get; set; }
+
+ ///
+ /// 子系统
+ ///
+ public string SubSystem { get; set; }
+
+ ///
+ /// 所属节点
+ ///
+ public string Node { get; set; }
+
+ ///
+ /// 所属轨迹状态
+ ///
+ public string TrackStatus { get; set; }
+
+ ///
+ /// 轨迹状态代码
+ ///
+ public string Code { get; set; }
+
+ ///
+ /// 轨迹内容英文
+ ///
+ public string EntrackStatus { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ public string CreateUser { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public DateTime? CreateTime { get; set; }
+
+ ///
+ /// 修改人
+ ///
+ public string UpdateUser { get; set; }
+
+ ///
+ /// 修改时间
+ ///
+ public DateTime? UpdateTime { get; set; }
+ }
+
+
+ public class GetPageTrackStatusInput : PageInfoInput
+ {
+ ///
+ /// 子系统id
+ ///
+ public int SubSystemId { get; set; }
+
+ ///
+ /// 关键字
+ ///
+ public string? Keywords { get; set; }
+
+ ///
+ /// 选中的轨迹状态id
+ ///
+ public List? SelectIds { get; set;}
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/EditTrackTemplateContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/EditTrackTemplateContentInput.cs
new file mode 100644
index 00000000..62ae5922
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/EditTrackTemplateContentInput.cs
@@ -0,0 +1,33 @@
+namespace SJZY.Track.Application.Contract.Dtos.TrackTemplates;
+
+///
+public class EditTrackTemplateContentInput
+{
+ ///
+ /// 操作类型
+ ///
+ public OptionTypeNoNull Options { get; set; }
+
+ ///
+ public int? Id { get; set; }
+
+ ///
+ /// 是否可删
+ ///
+ public bool? IsCanDelete { get; set; }
+
+ ///
+ /// 是否对外
+ ///
+ public bool? IsExternal { get; set; }
+
+ ///
+ /// 轨迹内容id
+ ///
+ public int? TrackContentId { get; set; }
+
+ ///
+ /// 轨迹模板id
+ ///
+ public int? TrackTemplateId { get; set; }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs
new file mode 100644
index 00000000..27d3dfc3
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs
@@ -0,0 +1,28 @@
+namespace SJZY.Track.Application.Contract.Dtos.TrackTemplates
+{
+ ///
+ /// 获取轨迹模版分页输入
+ ///
+ public class GetPageTrackTemplateInput : PageInfoInput
+ {
+ ///
+ /// 子系统id
+ ///
+ public int SubSystemId { get; set; }
+
+ ///
+ /// 关键字
+ ///
+ public string? Keywords { get; set; }
+
+ /////
+ ///// 轨迹模版id,轨迹映射的查询使用
+ /////
+ //public int TrackTemplateId { get; set; }
+
+ ///
+ /// 选中的轨迹模版id
+ ///
+ public List? SelectIds { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetTrackDetailDto.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetTrackDetailDto.cs
new file mode 100644
index 00000000..08f7824d
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/GetTrackDetailDto.cs
@@ -0,0 +1,100 @@
+namespace SJZY.Track.Application.Contract.Dtos.TrackTemplates
+{
+ ///
+ /// 获取轨迹模版详情
+ ///
+ public class GetTrackTemplateDetailDto
+ {
+ ///
+ /// Id
+ ///
+ public int Id { get; set; }
+
+ ///
+ /// 子系统id
+ ///
+ public int SubSystemId { get; set; }
+
+ ///
+ /// 子系统
+ ///
+ public string SubSystem { get; set; }
+
+ ///
+ /// 模版名称
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// 模版代码
+ ///
+ public string Code { get; set; }
+ }
+
+ ///
+ /// 获取轨迹模版列表
+ ///
+ public class GetTrackTemplateListDto
+ {
+ ///
+ /// 轨迹模版id
+ ///
+ public int Id { get; set; }
+
+ ///
+ /// 模板名称
+ ///
+ public string Name { set; get; }
+
+ ///
+ /// 模版代码
+ ///
+ public string Code { get; set; }
+
+ ///
+ /// 所属子系统
+ ///
+ public string SubSystem { set; get; }
+
+ ///
+ /// 子系统id
+ ///
+ public int SubSystemId { set; get; }
+
+ ///
+ /// 创建时间
+ ///
+ public DateTime CreateTime { get; set; }
+ }
+
+ ///
+ /// 编辑轨迹模版
+ ///
+ public class EditTrackTemplateInput
+ {
+ ///
+ /// Id
+ ///
+ public int Id { set; get; }
+
+ ///
+ /// 操作类型
+ ///
+ public OptionType Options { get; set; }
+
+ ///
+ /// 子系统id
+ ///
+ public int SubSystemId { set; get; }
+
+ ///
+ /// 模板名称
+ ///
+ public string? Name { set; get; }
+
+ ///
+ /// 模板代码
+ ///
+ public string? Code { set; get; }
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/SortTrackTemplateContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/SortTrackTemplateContentInput.cs
new file mode 100644
index 00000000..0dbd5155
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/SortTrackTemplateContentInput.cs
@@ -0,0 +1,11 @@
+using SJZY.Expand.ABP.Core.PublicMethords;
+
+namespace SJZY.Track.Application.Contract.Dtos.TrackTemplates;
+
+public class SortTrackTemplateContentInput
+{
+ ///
+ /// 排序信息
+ ///
+ public List SortInfo { get; set; }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Events/TrackDeleteEvent.cs b/src/SJZY.Track.Application.Contract/Events/TrackDeleteEvent.cs
new file mode 100644
index 00000000..eccbe955
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Events/TrackDeleteEvent.cs
@@ -0,0 +1,29 @@
+namespace SJZY.Track.Application.Contract.Events;
+
+public class TrackDeleteEvent
+{
+ ///
+ /// 订单id
+ ///
+ public int OrderId { get; set; }
+
+ ///
+ /// 轨迹代码
+ ///
+ public List TrackCodes { get; set; } = null!;
+
+ ///
+ /// 子系统id
+ ///
+ public int SubSystemId { get; set; }
+
+ ///
+ /// 上游子系统id
+ ///
+ public int UpSubSystemId { get; set; }
+
+ ///
+ /// 已经处理过的订单
+ ///
+ public List Visited { get; set; } = new();
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Events/TrackUpsertEvent.cs b/src/SJZY.Track.Application.Contract/Events/TrackUpsertEvent.cs
new file mode 100644
index 00000000..04f91415
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Events/TrackUpsertEvent.cs
@@ -0,0 +1,36 @@
+using SJZY.Track.Application.Contract.Dtos.ProvideServices;
+
+namespace SJZY.Track.Application.Contract.Events;
+
+public class TrackUpsertEvent : UpsertTrackInput
+{
+ ///
+ /// 订单id
+ ///
+ public int OrderId { get; set; }
+
+ ///
+ /// 客户id
+ ///
+ public int CustomId { get; set; }
+
+ ///
+ /// 子系统id
+ ///
+ public int SubSystemId { get; set; }
+
+ ///
+ /// 订单是否推送完成(异步维护)
+ ///
+ public bool IsPushCompleted { get; set; }
+
+ ///
+ /// 上游子系统id
+ ///
+ public int UpSubSystemId { get; set; }
+
+ ///
+ /// 已经处理过的订单
+ ///
+ public List Visited { get; set; } = new();
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Events/UpdateOrderTrackEvent.cs b/src/SJZY.Track.Application.Contract/Events/UpdateOrderTrackEvent.cs
new file mode 100644
index 00000000..f04cd86c
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Events/UpdateOrderTrackEvent.cs
@@ -0,0 +1,39 @@
+namespace SJZY.Track.Application.Contract.Events;
+
+public class UpdateOrderTrackEvent
+{
+ ///
+ /// 订单Id
+ ///
+ public int OrderId { get; set; }
+
+ ///
+ /// 此次发生的轨迹是否意味完成
+ ///
+ public bool IsCompleted { get; set; }
+
+ ///
+ /// 轨迹内容
+ ///
+ public string TrackContent { get; set; } = null!;
+
+ ///
+ /// 轨迹内容英文
+ ///
+ public string TrackEnContent { get; set; } = null!;
+
+ ///
+ /// 轨迹发生地
+ ///
+ public string TrackPlace { get; set; } = null!;
+
+ ///
+ /// 轨迹发生时间
+ ///
+ public DateTime TrackTime { get; set; }
+
+ ///
+ /// 轨迹时区
+ ///
+ public float TrackTimeZone { get; set; }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/GlobalUsings.cs b/src/SJZY.Track.Application.Contract/GlobalUsings.cs
new file mode 100644
index 00000000..99b0e5e1
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/GlobalUsings.cs
@@ -0,0 +1,4 @@
+// Global using directives
+
+global using SJZY.Expand.ABP.Common.Enums;
+global using SJZY.Expand.ABP.Core.Common.Dto;
\ No newline at end of file
diff --git a/src/SJZY.Track.HttpApi/SJZY.Track.HttpApi.csproj b/src/SJZY.Track.Application.Contract/SJZY.Track.Application.Contract.csproj
similarity index 81%
rename from src/SJZY.Track.HttpApi/SJZY.Track.HttpApi.csproj
rename to src/SJZY.Track.Application.Contract/SJZY.Track.Application.Contract.csproj
index 1d376964..de5d1421 100644
--- a/src/SJZY.Track.HttpApi/SJZY.Track.HttpApi.csproj
+++ b/src/SJZY.Track.Application.Contract/SJZY.Track.Application.Contract.csproj
@@ -1,9 +1,9 @@
+
+
net7.0
- enable
- enable
0.0.2
diff --git a/src/SJZY.Track.Application.Contract/Services/ITrackContentService.cs b/src/SJZY.Track.Application.Contract/Services/ITrackContentService.cs
new file mode 100644
index 00000000..08ce5194
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Services/ITrackContentService.cs
@@ -0,0 +1,5 @@
+namespace SJZY.Track.Application.Contract.Services;
+
+public interface ITrackContentService
+{
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Services/ITrackFlagService.cs b/src/SJZY.Track.Application.Contract/Services/ITrackFlagService.cs
new file mode 100644
index 00000000..a7d780b9
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Services/ITrackFlagService.cs
@@ -0,0 +1,5 @@
+namespace SJZY.Track.Application.Contract.Services;
+
+public interface ITrackFlagService
+{
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Services/ITrackPushCacheService.cs b/src/SJZY.Track.Application.Contract/Services/ITrackPushCacheService.cs
new file mode 100644
index 00000000..04369975
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Services/ITrackPushCacheService.cs
@@ -0,0 +1,18 @@
+namespace SJZY.Track.Application.Contract.Services;
+
+public interface ITrackPushCacheService
+{
+ ///
+ /// 判断客户是否需要推送
+ ///
+ ///
+ ///
+ Task IsPushAsync(int customId);
+
+ ///
+ /// 更新缓存
+ ///
+ ///
+ ///
+ Task UpdateAsync(int customId, bool isPush);
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/Services/ITrackStatusService.cs b/src/SJZY.Track.Application.Contract/Services/ITrackStatusService.cs
new file mode 100644
index 00000000..b350cb93
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Services/ITrackStatusService.cs
@@ -0,0 +1,5 @@
+namespace SJZY.Track.Application.Contract.Services;
+
+public interface ITrackStatusService
+{
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application.Contract/SjzyTrackApplicationContractModule.cs b/src/SJZY.Track.Application.Contract/SjzyTrackApplicationContractModule.cs
new file mode 100644
index 00000000..0da04423
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/SjzyTrackApplicationContractModule.cs
@@ -0,0 +1,10 @@
+using Volo.Abp.Modularity;
+
+namespace SJZY.Track.Application.Contract;
+
+public class SjzyTrackApplicationContractModule : AbpModule
+{
+ public override void PreConfigureServices(ServiceConfigurationContext context)
+ {
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/ApplicationModule.cs b/src/SJZY.Track.Application/ApplicationModule.cs
deleted file mode 100644
index 0fa79af5..00000000
--- a/src/SJZY.Track.Application/ApplicationModule.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-using SJZY.Expand.ABP.Core.Localization;
-using SJZY.LoggerCenter.HttpApi;
-using SJZY.Track.Application.Localization;
-using SJZY.UserCenter.Contracts;
-using SJZY.UserCenter.SharedModel;
-using Volo.Abp.AspNetCore.Mvc;
-using Volo.Abp.AutoMapper;
-using Volo.Abp.FluentValidation;
-using Volo.Abp.Http.Client;
-using Volo.Abp.Localization;
-using Volo.Abp.Modularity;
-using Volo.Abp.VirtualFileSystem;
-
-namespace SJZY.Track.Application
-{
- [DependsOn(
- typeof(AbpAutoMapperModule),
- typeof(RepositoryModule),
- typeof(AbpFluentValidationModule),
- typeof(AbpLocalizationModule),
- typeof(AbpVirtualFileSystemModule),
- typeof(AbpHttpClientModule),
- typeof(LoggerCenterHttpApiModule)
- )]
- public class ApplicationModule : AbpModule
- {
- public override void ConfigureServices(ServiceConfigurationContext context)
- {
- var configuration = context.Services.GetConfiguration();
- Configure(options =>
- {
- options.AddMaps(true);
- });
-
- Configure(options =>
- {
- options.ConventionalControllers.Create(typeof(ApplicationModule).Assembly);//创建动态api
- });
-
-
-
- //添加虚拟文件系统
- Configure(options =>
- {
- options.FileSets.AddEmbedded("SJZY.Track.Application");
- });
-
- //添加多语言
- Configure(options =>
- {
- options.Resources
- .Add("zh")
- .AddBaseTypes(typeof(SjzyBasicLocalization))
- .AddVirtualJson("/Localization/Resources");
- });
-
- //日志中心
- context.Services.AddHttpClientProxies(typeof(LoggerCenterHttpApiModule).Assembly, "LoggerCenter", false);
-
- //用户中心
- context.Services.AddHttpClientProxies(typeof(SjzyUserCenterHttpApiModule).Assembly, "UserCenter", false);
- }
-
- public override void PreConfigureServices(ServiceConfigurationContext context)
- {
- var configuration = context.Services.GetConfiguration();
- PreConfigure(options =>
- {
-
- options.ProxyClientActions.Add(async (remoteName, serviceProvider, httpClient) =>
- {
- //如果设置Token,前端需要传入Token 否则引发异常
- httpClient.SetTokenHeader();
- httpClient.Timeout = TimeSpan.FromMinutes(3);
- await Task.CompletedTask;
- });
- });
- }
-
- }
-}
diff --git a/src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs
deleted file mode 100644
index 563fc396..00000000
--- a/src/SJZY.Track.Application/AutoMapper/AutoMapperProfile.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using AutoMapper;
-using SJZY.Track.Application.Dtos.Demo;
-using SJZY.Track.Repository.Demo.ValueObjects;
-
-namespace SJZY.Track.Application.AutoMapper
-{
- internal class AutoMapperProfile : Profile
- {
- public AutoMapperProfile()
- {
- CreateMap, UnifyPageResultDto>(MemberList.None);
-
- CreateMap(MemberList.None).ReverseMap();
- CreateMap, UnifyPageResultDto>(MemberList.None).ReverseMap();
- /*
- 代码说明:
- MemberList.None的意思是,忽略源对象和目标对象的属性匹配检查,其他可选值:MemberList.Source(检查是否映射了所有源成员)、MemberList.Destination(检查是否映射了所有目标成员)
- .ReverseMap()的意思是配置双向调用关系,既一行代码既支持从 GetDemoListByPageInput -> DemoValueObject 的映射,同时也支持从 DemoValueObject -> GetDemoListByPageInput 的映射
-
-
- 如果对一对模型多次配置规则,会以最后一次为准,配置了这样规则后,最终执行结果是 Name + 444
- CreateMap().ForMember(dest => dest.Description, opt => opt.MapFrom(m => m.Name + "22"));
- CreateMap().ForMember(dest => dest.Description, opt => opt.MapFrom(m => m.Name + "444"));
-
- */
-
- CreateMap(MemberList.None).ReverseMap();
- CreateMap(MemberList.None);
- CreateMap(MemberList.None).ReverseMap();
-
- }
- }
-}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/AutoMapper/DemoAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/DemoAutoMapperProfile.cs
deleted file mode 100644
index 8e04d1ce..00000000
--- a/src/SJZY.Track.Application/AutoMapper/DemoAutoMapperProfile.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-using AutoMapper;
-using SJZY.Expand.ABP.Core.PublicMethords;
-using SJZY.Track.Application.Dtos.Demo;
-
-
-namespace SJZY.Track.Application.AutoMapper
-{
- ///
- /// 稍复杂的配置类
- ///
- internal class DemoAutoMapperProfile : Profile
- {
- public DemoAutoMapperProfile()
- {
- CreateMap(MemberList.None)
- //层级不一致的场景
- .ForMember(dest => dest.QQ, opt => opt.MapFrom(source => source.UserInfo.QQ))
- //数据类型不一致的场景,这里如果不指定映射规则会直接取枚举的key值
- .ForMember(dest => dest.Gender, opt => opt.MapFrom(source => source.Gender.GetDescription()))
- //一些简单计算的场景,酌情使用...
- .ForMember(dest => dest.Age, opt => opt.MapFrom(source => GetAgeByBirthdate(source.UserInfo.BirthDay)))
- //结构不一致的场景
- .ForMember(dest => dest.RoleIds, opt => opt.MapFrom(source => source.UserRoleInputList.Select(m => m.Id).ToArray()))
- //条件映射(这里只是举例,日常开发时sqlsugar在新增时会避开自增主键)
- .ForMember(dest => dest.Id, opt =>
- {
- opt.Condition(src => src.OptionType == OptionType.删除 || src.OptionType == OptionType.修改);
- });
- }
-
- public int GetAgeByBirthdate(DateTime birthdate)
- {
- DateTime now = DateTime.Now;
- int age = now.Year - birthdate.Year;
- if (now.Month < birthdate.Month || (now.Month == birthdate.Month && now.Day < birthdate.Day))
- {
- age--;
- }
- return age < 0 ? 0 : age;
- }
-
- }
-}
diff --git a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs
new file mode 100644
index 00000000..25cb3b57
--- /dev/null
+++ b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs
@@ -0,0 +1,32 @@
+using AutoMapper;
+using SJZY.Track.Application.Contract.Dtos.ProvideServices;
+using SJZY.Track.Domain.Aggregates.OrderAggregate;
+using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
+using SJZY.Track.Domain.Dtos.Order;
+using Volo.Abp.AutoMapper;
+
+namespace SJZY.Track.Application.AutoMapper;
+
+public class OrderAutoMapperProfile : Profile
+{
+ public OrderAutoMapperProfile()
+ {
+ CreateMap(MemberList.None);
+ CreateMap(MemberList.None);
+
+ CreateMap(MemberList.None)
+ .ForMember(dest => dest.ServiceProviderId, opt => opt.MapFrom(m => m.ServiceProviderId ?? 0))
+ .ForMember(dest => dest.TrackTemplateId, opt => opt.MapFrom(m => m.TemplateId));
+ CreateMap(MemberList.None);
+
+ CreateMap(MemberList.None);
+ CreateMap(MemberList.None);
+ CreateMap, UnifyPageResultDto>(MemberList.None);
+ CreateMap(MemberList.None).Ignore(dest => dest.TrackTimeZone)
+ .ForMember(dest => dest.Id, opt => opt.Ignore())
+ .ForMember(dest => dest.Code, opt => opt.MapFrom(m => m.TrackCode))
+ .ForMember(dest => dest.Content, opt => opt.MapFrom(m => m.TrackContent))
+ .ForMember(dest => dest.EnContent, opt => opt.MapFrom(m => m.TrackEnContent))
+ .ForMember(dest => dest.TrackTimeZoneValue, opt => opt.MapFrom(m => m.TrackTimeZone));
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/AutoMapper/TrackAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackAutoMapperProfile.cs
new file mode 100644
index 00000000..b9c185d7
--- /dev/null
+++ b/src/SJZY.Track.Application/AutoMapper/TrackAutoMapperProfile.cs
@@ -0,0 +1,13 @@
+using AutoMapper;
+using SJZY.Track.Application.Contract.Dtos.ProvideServices;
+using SJZY.Track.Application.Contract.Events;
+
+namespace SJZY.Track.Application.AutoMapper;
+
+public class TrackAutoMapperProfile:Profile
+{
+ public TrackAutoMapperProfile()
+ {
+ CreateMap(MemberList.None);
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs
new file mode 100644
index 00000000..77b0c47d
--- /dev/null
+++ b/src/SJZY.Track.Application/AutoMapper/TrackContentAutoMapperProfile.cs
@@ -0,0 +1,22 @@
+using AutoMapper;
+using SJZY.Track.Application.Contract.Dtos.TrackContents;
+using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
+using SJZY.Track.Domain.Dtos.TrackContents;
+
+namespace SJZY.Track.Application.AutoMapper
+{
+ public class TrackContentAutoMapperProfile : Profile
+ {
+ public TrackContentAutoMapperProfile()
+ {
+ CreateMap(MemberList.None)
+ .ForMember(dest => dest.IsCompleted, opt => opt.MapFrom(source => source.IsFinish));
+ CreateMap(MemberList.None);
+ CreateMap(MemberList.None);
+ CreateMap(MemberList.None);
+ CreateMap, UnifyPageResultDto>(
+ MemberList.None);
+ CreateMap(MemberList.None);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/AutoMapper/TrackFlagAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackFlagAutoMapperProfile.cs
new file mode 100644
index 00000000..bf72f035
--- /dev/null
+++ b/src/SJZY.Track.Application/AutoMapper/TrackFlagAutoMapperProfile.cs
@@ -0,0 +1,21 @@
+using AutoMapper;
+using SJZY.Track.Application.Contract.Dtos.TrackFlags;
+using SJZY.Track.Domain.Aggregates.TrackFlagAggregate;
+using SJZY.Track.Domain.Dtos.TrackFlags;
+
+namespace SJZY.Track.Application.AutoMapper
+{
+ public class TrackFlagAutoMapperProfile : Profile
+ {
+ public TrackFlagAutoMapperProfile()
+ {
+ CreateMap(MemberList.None)
+ .ForMember(dest => dest.Name, opt => opt.MapFrom(source => source.Flag));
+ //.ForMember(dest => dest.IsCompleted, opt => opt.MapFrom(source => source.IsFinish));
+ CreateMap(MemberList.None);
+ CreateMap(MemberList.None);
+ CreateMap, UnifyPageResultDto>(MemberList.None);
+ CreateMap(MemberList.None);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs
new file mode 100644
index 00000000..d8dad310
--- /dev/null
+++ b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs
@@ -0,0 +1,19 @@
+using AutoMapper;
+using SJZY.Track.Application.Contract.Dtos.TrackPull;
+using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
+using Volo.Abp.AutoMapper;
+
+namespace SJZY.Track.Application.AutoMapper;
+
+public class TrackPullAutoMapperProfile : Profile
+{
+ public TrackPullAutoMapperProfile()
+ {
+ CreateMap(MemberList.None);
+ CreateMap(MemberList.None).Ignore(dest => dest.Id)
+ .ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => false));
+ CreateMap(MemberList.None)
+ .ForMember(dest => dest.TrackKeyword, opt => opt.MapFrom(src => string.Join(',', src.TrackKeywords)))
+ .ForMember(dest => dest.TrackKeywordReverse, opt => opt.MapFrom(src => string.Join(',', src.TrackKeywordReverses)));
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs
new file mode 100644
index 00000000..3a42d0e4
--- /dev/null
+++ b/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs
@@ -0,0 +1,19 @@
+using AutoMapper;
+using SJZY.Track.Application.Contract.Dtos.TrackPush;
+using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
+using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
+using Volo.Abp.AutoMapper;
+
+namespace SJZY.Track.Application.AutoMapper;
+
+public class TrackPushAutoMapperProfile : Profile
+{
+ public TrackPushAutoMapperProfile()
+ {
+ CreateMap(MemberList.None)
+ .ForMember(dest => dest.TrackTemplateId, opt => opt.MapFrom(source => string.Join(',', source.TrackTemplateIds)));
+ CreateMap(MemberList.None).Ignore(dest => dest.Id)
+ .ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => true));
+ CreateMap(MemberList.None);
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/AutoMapper/TrackStatusAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackStatusAutoMapperProfile.cs
new file mode 100644
index 00000000..49796f47
--- /dev/null
+++ b/src/SJZY.Track.Application/AutoMapper/TrackStatusAutoMapperProfile.cs
@@ -0,0 +1,24 @@
+using AutoMapper;
+using SJZY.Track.Application.Contract.Dtos.TrackStatus;
+using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
+using SJZY.Track.Domain.Dtos.TrackStatus;
+
+namespace SJZY.Track.Application.AutoMapper
+{
+ public class TrackStatusAutoMapperProfile : Profile
+ {
+ public TrackStatusAutoMapperProfile()
+ {
+ CreateMap(MemberList.None)
+ //层级不一致的场景
+ .ForMember(dest => dest.Status, opt => opt.MapFrom(source => source.TrackStatus))
+ .ForMember(dest => dest.EnStatus, opt => opt.MapFrom(source => source.EntrackStatus))
+ .ForMember(dest => dest.Node, opt => opt.MapFrom(source => source.NodeId));
+ CreateMap(MemberList.None);
+ CreateMap(MemberList.None);
+ CreateMap(MemberList.None);
+ CreateMap, UnifyPageResultDto>(MemberList
+ .None);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs
new file mode 100644
index 00000000..36f0e498
--- /dev/null
+++ b/src/SJZY.Track.Application/AutoMapper/TrackTemplateAutoMapperProfile.cs
@@ -0,0 +1,23 @@
+using AutoMapper;
+using SJZY.Track.Application.Contract.Dtos.TrackTemplates;
+using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
+using SJZY.Track.Domain.Dtos.TrackTemplate;
+
+namespace SJZY.Track.Application.AutoMapper;
+
+///
+/// 轨迹模版自动映射
+///
+public class TrackTemplateAutoMapperProfile : Profile
+{
+ public TrackTemplateAutoMapperProfile()
+ {
+ CreateMap(MemberList.None);
+ CreateMap(MemberList.None);
+ CreateMap(MemberList.None);
+ CreateMap(MemberList.None);
+ CreateMap(MemberList.None);
+ CreateMap, UnifyPageResultDto>(MemberList
+ .None);
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Dtos/Demo/ComplexAutomapperDemoInput.cs b/src/SJZY.Track.Application/Dtos/Demo/ComplexAutomapperDemoInput.cs
deleted file mode 100644
index de4bc495..00000000
--- a/src/SJZY.Track.Application/Dtos/Demo/ComplexAutomapperDemoInput.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-namespace SJZY.Track.Application.Dtos.Demo
-{
- ///
- /// automapper 复杂转换样例
- ///
- public class ComplexAutomapperDemoInput
- {
- ///
- /// 编号
- ///
- public int Id { get; set; }
-
- ///
- /// 操作类型
- ///
- public OptionType OptionType { get; set; }
-
- ///
- /// 描述
- ///
- public string Description { get; set; }
-
- ///
- /// 性别
- ///
- public Gender Gender { get; set; }
-
- ///
- /// 用户信息
- ///
- public UserInfoInput UserInfo { get; set; }
-
- ///
- /// 用户角色
- ///
- public List UserRoleInputList { get; set; }
-
- ///
- /// 拓展演示,目前大家共同约定,暂时不使用充血模型
- ///
- ///
- public string GetAddress()
- {
- return "辽宁省沈阳市...";
- }
-
- }
-
- public class ComplexAutomapperDemoOutput
- {
- ///
- /// 编号
- ///
- public int Id { get; set; }
-
- ///
- /// 性别
- ///
- public string Gender { get; set; }
-
- ///
- /// 描述
- ///
- public string Description { get; set; }
-
- ///
- /// 年龄
- ///
- public int Age { get; set; }
-
- ///
- /// qq号码
- ///
- public string QQ { get; set; }
-
- ///
- /// 地址
- ///
- public string Address { get; set; }
-
- ///
- /// 角色编号
- ///
- public int[] RoleIds { get; set; }
- }
-
-
-
-}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Dtos/Demo/DemoDetailInput.cs b/src/SJZY.Track.Application/Dtos/Demo/DemoDetailInput.cs
deleted file mode 100644
index 30da5896..00000000
--- a/src/SJZY.Track.Application/Dtos/Demo/DemoDetailInput.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-namespace SJZY.Track.Application.Dtos.Demo
-{
- public class DemoDetailSaveInput
- {
- ///
- ///
- ///
- public int Id { get; set; }
-
- ///
- /// 姓名
- ///
- public string Name { get; set; }
-
- ///
- /// 年龄
- ///
- public int Age { get; set; }
-
- ///
- /// 描述
- ///
- public string Description { get; set; }
-
- ///
- /// 详情合集
- ///
- public List DemoDetailList { get; set; }
- }
-
- public class DemoDetailInput
- {
- ///
- /// Id
- ///
- public int Id { get; set; }
-
- ///
- /// t_demo.id
- ///
- public int DemoId { get; set; }
-
- ///
- /// 一些说明..
- ///
- public string OtherInfo { get; set; }
- }
-}
diff --git a/src/SJZY.Track.Application/Dtos/Demo/DemoInput.cs b/src/SJZY.Track.Application/Dtos/Demo/DemoInput.cs
deleted file mode 100644
index 13f63049..00000000
--- a/src/SJZY.Track.Application/Dtos/Demo/DemoInput.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-namespace SJZY.Track.Application.Dtos.Demo
-{
- public class DemoInput
- {
- ///
- /// 操作类型
- ///
- public OptionType Option { get; set; }
-
- ///
- ///
- ///
- public int Id { get; set; }
-
- ///
- /// 姓名
- ///
- public string Name { get; set; }
-
- ///
- /// 年龄
- ///
- public int Age { get; set; }
-
- ///
- /// 描述
- ///
- public string Description { get; set; }
-
- //以下两个属性用来说明类型转换
-
- ///
- /// 创建人id
- ///
- public string CreateUserId { get; set; }
-
- ///
- /// 创建时间
- ///
- public string CreateTime { get; set; }
- }
-}
diff --git a/src/SJZY.Track.Application/Dtos/Demo/ExcelImportOuput.cs b/src/SJZY.Track.Application/Dtos/Demo/ExcelImportOuput.cs
deleted file mode 100644
index 46ef9d04..00000000
--- a/src/SJZY.Track.Application/Dtos/Demo/ExcelImportOuput.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace SJZY.Track.Application.Dtos.Demo
-{
- public class ExcelImportOuput
- {
- [MiniExcelLibs.Attributes.ExcelColumnName("姓名")]
- public string Name { get; set; }
-
- [MiniExcelLibs.Attributes.ExcelColumnName("年龄")]
- public int Age { get; set; }
- }
-}
diff --git a/src/SJZY.Track.Application/Dtos/Demo/GetDemoListByPageInput.cs b/src/SJZY.Track.Application/Dtos/Demo/GetDemoListByPageInput.cs
deleted file mode 100644
index 55d86e2c..00000000
--- a/src/SJZY.Track.Application/Dtos/Demo/GetDemoListByPageInput.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace SJZY.Track.Application.Dtos.Demo
-{
- public class GetDemoListByPageInput : PageInfoInput
- {
- ///
- /// 姓名
- ///
- public string Name { get; set; }
- }
-}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Dtos/Demo/GetDemoListByPageOutput.cs b/src/SJZY.Track.Application/Dtos/Demo/GetDemoListByPageOutput.cs
deleted file mode 100644
index 3c5bd96d..00000000
--- a/src/SJZY.Track.Application/Dtos/Demo/GetDemoListByPageOutput.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-namespace SJZY.Track.Application.Dtos.Demo
-{
- public class GetDemoListByPageOutput
- {
- ///
- ///
- ///
- public int Id { get; set; }
-
- ///
- /// 姓名
- ///
- public string Name { get; set; }
-
- ///
- /// 年龄
- ///
- public int Age { get; set; }
-
- ///
- /// 描述
- ///
- public string Description { get; set; }
-
- public DateTime CreateTime { get; set; }
- }
-}
diff --git a/src/SJZY.Track.Application/Dtos/Demo/MyCustomerResultOutput.cs b/src/SJZY.Track.Application/Dtos/Demo/MyCustomerResultOutput.cs
deleted file mode 100644
index 8d6896ac..00000000
--- a/src/SJZY.Track.Application/Dtos/Demo/MyCustomerResultOutput.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace SJZY.Track.Application.Dtos.Demo
-{
- public class MyCustomerResultOutput
- {
- public string Code { get; set; }
-
- public string Message { get; set; }
- }
-}
diff --git a/src/SJZY.Track.Application/Dtos/Demo/OssUploadOutput.cs b/src/SJZY.Track.Application/Dtos/Demo/OssUploadOutput.cs
deleted file mode 100644
index 367d2c54..00000000
--- a/src/SJZY.Track.Application/Dtos/Demo/OssUploadOutput.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-namespace SJZY.Track.Application.Dtos.Demo
-{
- public class OssUploadOutput
- {
- ///
- /// 文件key
- ///
- public string Key { get; set; }
-
- ///
- /// 文件路径
- ///
- public string Url { get; set; }
- }
-}
diff --git a/src/SJZY.Track.Application/Dtos/Demo/SwaggerDemoInput.cs b/src/SJZY.Track.Application/Dtos/Demo/SwaggerDemoInput.cs
deleted file mode 100644
index f521c50e..00000000
--- a/src/SJZY.Track.Application/Dtos/Demo/SwaggerDemoInput.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-using System.ComponentModel;
-using System.Text.Json.Serialization;
-
-namespace SJZY.Track.Application.Dtos.Demo
-{
- public class SwaggerDemoInput
- {
- ///
- /// 年龄
- ///
- /// 18 这里可以写一些初始值
- public int Age { get; set; }
-
- ///
- /// 姓名
- ///
- public string Name { get; set; }
-
- ///
- /// 性别(枚举的展示样例)
- ///
- public Gender Gender { get; set; }
-
- ///
- /// 隐藏属性
- ///
- [JsonIgnore]
- public int MyProperty { get; set; }
- }
-
- public enum Gender
- {
- [Description("纯爷们")]
- 男 = 2,
-
- [Description("大姑娘")]
- 女 = 5,
-
- [Description("你憋问")]
- 未知 = 8
- }
-}
diff --git a/src/SJZY.Track.Application/Dtos/Demo/ValidateExecuteInput.cs b/src/SJZY.Track.Application/Dtos/Demo/ValidateExecuteInput.cs
deleted file mode 100644
index f1c3fc45..00000000
--- a/src/SJZY.Track.Application/Dtos/Demo/ValidateExecuteInput.cs
+++ /dev/null
@@ -1,98 +0,0 @@
-namespace SJZY.Track.Application.Dtos.Demo
-{
- public class ValidateExecuteInput
- {
- ///
- /// 操作类型
- ///
- public OptionType Option { get; set; }
-
- ///
- /// 主键编号
- ///
- public int Id { get; set; }
-
- ///
- /// 雪花ID
- ///
- public long SnowId { get; set; }
-
- ///
- /// 登录账号
- ///
- public string LoginName { get; set; }
-
- ///
- /// 登录密码
- ///
- public string? PassWord { get; set; }
-
- ///
- /// 登录密码确认
- ///
- public string PassWordAgain { get; set; }
-
- ///
- /// 最大金额额度
- ///
- public decimal TotalQuota { get; set; }
-
- ///
- /// 最大数量
- ///
- public int MaxCount { get; set; }
-
- ///
- /// 最小数量
- ///
- public int MiniCount { get; set; }
-
- ///
- /// 用户信息
- ///
- public UserInfoInput UserInfoInput { get; set; }
-
- ///
- /// 用户角色
- ///
- public List UserRoleInputList { get; set; }
-
- }
-
- public class UserInfoInput
- {
- ///
- /// 生日
- ///
- public DateTime BirthDay { get; set; }
-
- ///
- /// qq号码
- ///
- public string QQ { get; set; }
-
- ///
- /// 电子邮箱
- ///
- public string Email { get; set; }
-
- ///
- /// 用户姓名
- ///
- public string UserName { get; set; }
- }
-
-
- public class UserRoleInput
- {
- ///
- /// 角色编号
- ///
- public int Id { get; set; }
-
- ///
- /// 角色名称
- ///
- public string Name { get; set; }
- }
-}
diff --git a/src/SJZY.Track.Application/Dtos/Demo/ValidateExecuteOutput.cs b/src/SJZY.Track.Application/Dtos/Demo/ValidateExecuteOutput.cs
deleted file mode 100644
index 13cede57..00000000
--- a/src/SJZY.Track.Application/Dtos/Demo/ValidateExecuteOutput.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace SJZY.Track.Application.Dtos.Demo
-{
- public class ValidateExecuteOutput
- {
- }
-}
diff --git a/src/SJZY.Track.Application/EventHandlers/InterfaceRelayTrackRefreshEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/InterfaceRelayTrackRefreshEventHandler.cs
new file mode 100644
index 00000000..099b1b99
--- /dev/null
+++ b/src/SJZY.Track.Application/EventHandlers/InterfaceRelayTrackRefreshEventHandler.cs
@@ -0,0 +1,35 @@
+using DotNetCore.CAP;
+using Newtonsoft.Json;
+using SJZY.InterfaceRelay.Application.Contracts;
+using SJZY.Track.Application.Contract.Dtos.ProvideServices;
+using SJZY.Track.Domain.Aggregates.OrderAggregate;
+using SJZY.Track.Domain.Queries;
+using Volo.Abp.DependencyInjection;
+
+namespace SJZY.Track.Application.EventHandlers;
+
+public class InterfaceRelayTrackRefreshEventHandler : ITransientDependency, ICapSubscribe
+{
+ private readonly IOrderRepository _orderRepository;
+ private readonly IProvideQueries _provideQueries;
+
+ public InterfaceRelayTrackRefreshEventHandler(IOrderRepository orderRepository, IProvideQueries provideQueries)
+ {
+ _orderRepository = orderRepository;
+ _provideQueries = provideQueries;
+ }
+
+ [CapSubscribe(GlobalConst.InterfaceRelayTrackRefreshSubscribe)]
+ public async Task ConsumerAsync(InterfaceRelayTrackRefreshEvent @event)
+ {
+ if (@event.RequestParams is List requestParams)
+ {
+ var orderNos = requestParams.Select(x => x.OrderNo).ToList();
+
+ // tips:attach返回的是服务商id,必有
+ var pullContentConfigs = await _provideQueries.GetPullContentConfigsAsync(int.Parse(@event.Attach));
+
+ // 轨迹清洗入库
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/EventHandlers/TrackDeleteEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/TrackDeleteEventHandler.cs
new file mode 100644
index 00000000..55bb5b1d
--- /dev/null
+++ b/src/SJZY.Track.Application/EventHandlers/TrackDeleteEventHandler.cs
@@ -0,0 +1,76 @@
+using DotNetCore.CAP;
+using SJZY.Expand.ABP.Core.Logger;
+using SJZY.Track.Application.Contract.Events;
+using SJZY.Track.Domain.Aggregates.OrderAggregate;
+using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
+using SJZY.Track.Domain.Queries;
+using Volo.Abp.DependencyInjection;
+
+namespace SJZY.Track.Application.EventHandlers;
+
+public class TrackDeleteEventHandler : ITransientDependency, ICapSubscribe
+{
+ private readonly IOrderRepository _orderRepository;
+ private readonly IProvideQueries _provideQueries;
+ private readonly ITrackDetailsRepository _trackDetailsRepository;
+ private readonly ICapPublisher _capPublisher;
+
+ public TrackDeleteEventHandler(IProvideQueries provideQueries, ITrackDetailsRepository trackDetailsRepository,
+ IOrderRepository orderRepository, ICapPublisher capPublisher)
+ {
+ _provideQueries = provideQueries;
+ _trackDetailsRepository = trackDetailsRepository;
+ _orderRepository = orderRepository;
+ _capPublisher = capPublisher;
+ }
+
+ [CapSubscribe(GlobalConst.TrackDeleteSubscribe)]
+ public async Task ConsumerAsync(TrackDeleteEvent @event)
+ {
+ if (@event.Visited.Contains(@event.OrderId))
+ {
+ LogHelper.Error($"轨迹订单循环依赖预警:{@event.Visited.JoinAsString(",")}");
+ return;
+ }
+
+ @event.Visited.Add(@event.OrderId);
+
+ // 不同子系统需要做内容映射
+ if (@event.UpSubSystemId != 0 && @event.UpSubSystemId != @event.SubSystemId)
+ {
+ var mapCodes = await _provideQueries
+ .MapTrackCodesAsync(@event.UpSubSystemId, @event.SubSystemId, @event.TrackCodes.ToArray());
+
+ if (mapCodes.Count == 0)
+ {
+ //throw new BusinessException(message: "订单跨子系统,未配置内容映射,请联系管理员");
+ return;
+ }
+
+ @event.TrackCodes = mapCodes;
+ }
+
+ await DeleteTrackAsync(@event);
+ }
+
+ private async Task DeleteTrackAsync(TrackDeleteEvent @event)
+ {
+ // 删除轨迹
+ await _trackDetailsRepository.DeleteTrackAsync(@event.OrderId, @event.TrackCodes);
+
+ // 根据订单关联关系异步向下刷
+ var linkedOrders = await _orderRepository.GetLinkedOrdersAsync(@event.OrderId);
+ foreach (var linkedOrder in linkedOrders)
+ {
+ var nextEvent = new TrackDeleteEvent
+ {
+ OrderId = linkedOrder.OrderId,
+ TrackCodes = @event.TrackCodes,
+ SubSystemId = linkedOrder.SubSystemId,
+ UpSubSystemId = @event.SubSystemId
+ };
+
+ await _capPublisher.PublishAsync(GlobalConst.TrackDeleteSubscribe, nextEvent);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs
new file mode 100644
index 00000000..29e14bc2
--- /dev/null
+++ b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs
@@ -0,0 +1,143 @@
+using DotNetCore.CAP;
+using SJZY.Expand.ABP.Core.Logger;
+using SJZY.Expand.ABP.Core.PublicMethords;
+using SJZY.Track.Application.Contract.Events;
+using SJZY.Track.Application.Contract.Services;
+using SJZY.Track.Domain.Aggregates.OrderAggregate;
+using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
+using SJZY.Track.Domain.Queries;
+using SJZY.UserCenter.HttpApi.Services;
+using Volo.Abp.DependencyInjection;
+
+namespace SJZY.Track.Application.EventHandlers;
+
+public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
+{
+ private readonly IOrderRepository _orderRepository;
+ private readonly IProvideQueries _provideQueries;
+ private readonly ITrackDetailsRepository _trackDetailsRepository;
+ private readonly ITrackPushCacheService _trackPushCacheService;
+ private readonly ICapPublisher _capPublisher;
+
+ public TrackUpsertEventHandler(IOrderRepository orderRepository, ICapPublisher capPublisher,
+ IProvideQueries provideQueries, ITrackDetailsRepository trackDetailsRepository,
+ ITrackPushCacheService trackPushCacheService)
+ {
+ _orderRepository = orderRepository;
+ _capPublisher = capPublisher;
+ _provideQueries = provideQueries;
+ _trackDetailsRepository = trackDetailsRepository;
+ _trackPushCacheService = trackPushCacheService;
+ }
+
+ [CapSubscribe(GlobalConst.TrackUpsertSubscribe)]
+ public async Task ConsumerAsync(TrackUpsertEvent @event)
+ {
+ if (@event.Visited.Contains(@event.OrderId))
+ {
+ LogHelper.Error($"轨迹订单循环依赖预警:{@event.Visited.JoinAsString(",")}");
+ return;
+ }
+
+ @event.Visited.Add(@event.OrderId);
+
+ // 不同子系统需要做内容映射
+ if (@event.UpSubSystemId != 0 && @event.UpSubSystemId != @event.SubSystemId)
+ {
+ var mapCode = (await _provideQueries
+ .MapTrackCodesAsync(@event.UpSubSystemId, @event.SubSystemId, @event.TrackCode))
+ .FirstOrDefault();
+
+ if (mapCode == default)
+ {
+ // 跨子系统没做映射的轨迹不处理
+ return;
+ }
+
+ @event.TrackCode = mapCode;
+ }
+
+ await UpsertTrackAsync(@event);
+ }
+
+ private async Task UpsertTrackAsync(TrackUpsertEvent @event)
+ {
+ // 不存在则新增轨迹,存在则更新
+ var track = await _trackDetailsRepository.GetFirstOrDefaultAsync(@event.OrderId, @event.TrackCode);
+
+ var orderIsCompleted = false;
+ if (track == default)
+ {
+ // 根据轨迹code在订单模板内容中寻找匹配的
+ var trackContent = await _provideQueries.MatchTrackContentAsync(@event.OrderId, @event.TrackCode);
+ if (trackContent == default)
+ {
+ //throw new BusinessException(message: $"订单:{@event.OrderNo} 所绑定的模板,没有一条内容可以匹配轨迹代码:{@event.TrackCode}");
+ return;
+ }
+
+ orderIsCompleted = trackContent.IsCompleted;
+
+ track = new TrackDetailsIndex
+ {
+ IndexName = $"{GlobalConst.TrackIndex}-{DateTime.Now:yyyy.MM.dd}",
+ OrderId = @event.OrderId,
+ OrderNo = @event.OrderNo,
+ OrderType = @event.OrderType,
+ TrackStatus = trackContent.Status,
+ TrackCode = @event.TrackCode,
+ TrackContent = trackContent.Content,
+ TrackEnContent = trackContent.EnContent,
+ TrackPlace = @event.TrackPlace,
+ TrackTime = @event.TrackTime!.Value,
+ TrackTimeZone = @event.TrackTimeZone!.Value,
+ IsCanDelete = trackContent.IsCanDelete,
+ CreateUser = CurrentUserRequest.CurrentUser.Name,
+ CreateTime = DateTime.Now
+ };
+
+ // todo:推送只做新增的,更新和删除的不做先
+ if (!@event.IsPushCompleted && await _trackPushCacheService.IsPushAsync(@event.CustomId))
+ {
+ //await PushTrack();
+ }
+ }
+ else
+ {
+ track.TrackPlace = @event.TrackPlace;
+ track.TrackTime = @event.TrackTime!.Value;
+ track.TrackTimeZone = @event.TrackTimeZone!.Value;
+ track.UpdateUser = CurrentUserRequest.CurrentUser.Name;
+ track.UpdateTime = DateTime.Now;
+ }
+
+ await _trackDetailsRepository.UpsertAsync(track);
+
+ // 触发订单主表更新事件
+ await _capPublisher.PublishAsync(GlobalConst.UpdateOrderTrackSubscribe, new UpdateOrderTrackEvent
+ {
+ OrderId = track.OrderId,
+ IsCompleted = orderIsCompleted,
+ TrackContent = track.TrackContent,
+ TrackEnContent = track.TrackEnContent,
+ TrackPlace = track.TrackPlace,
+ TrackTime = track.TrackTime,
+ TrackTimeZone = track.TrackTimeZone
+ });
+
+ // 根据订单关联关系异步向下刷
+ var linkedOrders = await _orderRepository.GetLinkedOrdersAsync(@event.OrderId);
+ foreach (var linkedOrder in linkedOrders)
+ {
+ var nextEvent = @event.DeepCopy();
+ nextEvent.OrderId = linkedOrder.OrderId;
+ nextEvent.OrderType = linkedOrder.OrderType;
+ nextEvent.OrderNo = linkedOrder.OrderNo;
+ nextEvent.SubSystemId = linkedOrder.SubSystemId;
+ nextEvent.IsPushCompleted = linkedOrder.IsPushCompleted;
+ nextEvent.CustomId = linkedOrder.CustomId;
+ nextEvent.UpSubSystemId = @event.SubSystemId;
+ await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, nextEvent);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/EventHandlers/UpdateOrderTrackEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/UpdateOrderTrackEventHandler.cs
new file mode 100644
index 00000000..0901b2a0
--- /dev/null
+++ b/src/SJZY.Track.Application/EventHandlers/UpdateOrderTrackEventHandler.cs
@@ -0,0 +1,40 @@
+using DotNetCore.CAP;
+using SJZY.Track.Application.Contract.Events;
+using SJZY.Track.Domain.Aggregates.OrderAggregate;
+using Volo.Abp.DependencyInjection;
+
+namespace SJZY.Track.Application.EventHandlers;
+
+public class UpdateOrderTrackEventHandler : ITransientDependency, ICapSubscribe
+{
+ private readonly IOrderRepository _orderRepository;
+
+ public UpdateOrderTrackEventHandler(IOrderRepository orderRepository)
+ {
+ _orderRepository = orderRepository;
+ }
+
+ [CapSubscribe(GlobalConst.UpdateOrderTrackSubscribe)]
+ public async Task ConsumerAsync(UpdateOrderTrackEvent @event)
+ {
+ var order = await _orderRepository.GetFirstAsync(x => x.Id == @event.OrderId);
+ if (order == default) return;
+
+ if (order.IsCompleted) return;
+ order.LatestTrackContent = @event.TrackContent;
+ order.LatestTrackEnContent = @event.TrackEnContent;
+ order.LatestTrackPlace = @event.TrackPlace;
+ order.LatestTrackTime = @event.TrackTime;
+ order.LatestTrackTimeZone = @event.TrackTimeZone;
+ if (@event.IsCompleted) order.IsCompleted = true;
+ else if (order.LatestTrackTime != null &&
+ order.LatestTrackTime.Value.Subtract(TimeSpan.FromHours(order.LatestTrackTimeZone ?? 0)) >
+ @event.TrackTime.Subtract(TimeSpan.FromHours(@event.TrackTimeZone))) return;
+
+ await _orderRepository.UpdateColumnAsync(order, x => new
+ {
+ x.IsCompleted, x.LatestTrackContent, x.LatestTrackEnContent, x.LatestTrackPlace, x.LatestTrackTime,
+ x.LatestTrackTimeZone
+ });
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/GlobalUsing.cs b/src/SJZY.Track.Application/GlobalUsing.cs
index 23e3b927..e4968bf8 100644
--- a/src/SJZY.Track.Application/GlobalUsing.cs
+++ b/src/SJZY.Track.Application/GlobalUsing.cs
@@ -2,8 +2,7 @@
global using Microsoft.Extensions.DependencyInjection;
global using SJZY.Expand.ABP.Common.Enums;
global using SJZY.Expand.ABP.Core.Common.Dto;
-global using SJZY.Track.Repository;
-global using SJZY.Track.Repository.Demo.Entitys;
global using Volo.Abp;
global using Volo.Abp.Application.Services;
global using Volo.Abp.Validation;
+global using SJZY.Track.Domain;
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Localization/Resources/en.json b/src/SJZY.Track.Application/Localization/Resources/en.json
index 5994b511..c7d369bc 100644
--- a/src/SJZY.Track.Application/Localization/Resources/en.json
+++ b/src/SJZY.Track.Application/Localization/Resources/en.json
@@ -3,6 +3,13 @@
"texts": {
"NotNull1": "{0} is not null",
"NotFindData": "No data found under the specified number",
- "ParameterDemo1": "{0} in {1} to do {2}"
+ "ParameterDemo1": "{0} in {1} to do {2}",
+ "TemplateExist": "The template code already exists under the currently selected subsystem",
+ "TrackContentExist": "The trace code or trace content or trace content in the current subsystem is repeated in English",
+ "TrackStatusExist": "The trajectory status code or trajectory status or trajectory status in English is repeated under the current subsystem",
+ "TrackFlagExist": "Duplicate code or flag in the current subsystem",
+ "IsExistTrackPullConfig": "Track Pull The template has been bound. Delete the track pull before deleting the template",
+ "IsExistTrackStatus": "The trajectory content has been bound to the trajectory status. Delete the trajectory content before deleting the trajectory status",
+ "IsExistTrackFlag": "The track content has been bound to the track mark. Delete the track content before deleting the track mark"
}
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Localization/Resources/zh.json b/src/SJZY.Track.Application/Localization/Resources/zh.json
index 48af2570..38db9ebb 100644
--- a/src/SJZY.Track.Application/Localization/Resources/zh.json
+++ b/src/SJZY.Track.Application/Localization/Resources/zh.json
@@ -3,6 +3,13 @@
"texts": {
"NotFindData": "未找到指定编号下的任何数据!",
"ParameterDemo": "{0}在{1}地方做了{2}动作",
- "ParameterDemo1": "{0}在{1}地方做了{2}动作"
+ "ParameterDemo1": "{0}在{1}地方做了{2}动作",
+ "TemplateExist": "模板代码已存在于当前选择的子系统下",
+ "TrackContentExist": "当前子系统下轨迹代码或轨迹内容或轨迹内容英文重复",
+ "TrackStatusExist": "当前子系统下轨迹状态代码或轨迹状态或轨迹状态英文重复",
+ "TrackFlagExist": "当前子系统下代码或标记重复",
+ "IsExistTrackPullConfig": "轨迹拉取已绑定了该模版,请先删除轨迹拉取再删除该模版",
+ "IsExistTrackStatus": "轨迹内容已经绑定了该轨迹状态,请先删除轨迹内容后再删除该轨迹状态",
+ "IsExistTrackFlag": "轨迹内容已经绑定了该轨迹标记,请先删除轨迹内容后再删除该轨迹标记"
}
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/SJZY.Track.Application.csproj b/src/SJZY.Track.Application/SJZY.Track.Application.csproj
index 37c0357f..d2b2eafd 100644
--- a/src/SJZY.Track.Application/SJZY.Track.Application.csproj
+++ b/src/SJZY.Track.Application/SJZY.Track.Application.csproj
@@ -1,33 +1,26 @@
-
- net7.0
- enable
- True
-
-
+
-
-
-
-
-
+
+ net7.0
+ True
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
diff --git a/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs b/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs
deleted file mode 100644
index 145322ac..00000000
--- a/src/SJZY.Track.Application/Services/Demo/InterFaceDemoService.cs
+++ /dev/null
@@ -1,234 +0,0 @@
-using SJZY.Expand.ABP.Core.Common;
-using SJZY.Track.Application.Dtos.Demo;
-using SJZY.Track.Repository.Demo.Services;
-using SJZY.Track.Repository.Demo.ValueObjects;
-using Volo.Abp.Http.Client.DynamicProxying;
-
-namespace SJZY.Track.Application.Services.Demo
-{
- ///
- /// 接口请求完整样例
- ///
- [ApiExplorerSettings(GroupName = "Demo")]
- public class InterFaceDemoService : ApplicationService
- {
- #region 构造函数
- private readonly IDemoRepository _demoRepository;
- public InterFaceDemoService(IDemoRepository demoRepository)
- {
- _demoRepository = demoRepository;
- }
- #endregion
-
- #region 增删改
- ///
- /// 增删改
- ///
- ///
- ///
- [HttpPost("InterFace/Edit")]
- public async Task Edit(DemoInput input)
- {
- var res = new LongIdBaseDto();
-
- if (input.Option == OptionType.新增)
- {
- var entity = ObjectMapper.Map(input);
- res.Id = await _demoRepository.InsertReturnIdentityAsync(entity);
- }
- else if (input.Option == OptionType.修改 || input.Option == OptionType.删除)
- {
-
- var demoInfo = await _demoRepository.GetById1(input.Id);
- if (demoInfo == null)
- {
- //校验数据是否存在...
- throw new BusinessException(message: "未找到指定编号下的数据");
- }
-
- res.Id = demoInfo.Id;
- if (input.Option == OptionType.删除)
- {
- //await _demoRepository.DeleteAsync(demoInfo); //真删除
-
- //软删除
- demoInfo.IsDeleted = true;
- await _demoRepository.UpdateAsync(demoInfo);
- }
- else
- {
- var entity = ObjectMapper.Map(input, demoInfo);
- await _demoRepository.UpdateAsync(entity);
- }
- }
- return res;
- }
-
- #endregion
-
- #region 局部更新最佳实践
- ///
- /// 局部更新最佳实践
- ///
- ///
- ///
- ///
- [HttpPost("InterFace/UpdatePartColumns")]
- public async Task UpdatePartColumns(DemoInput input)
- {
- var demoInfo = await _demoRepository.GetById1(input.Id);
- if (demoInfo == null)
- {
- //校验数据是否存在...
- throw new BusinessException(message: "未找到指定编号下的数据");
- }
-
- //更新同时忽略某几项参数
- await _demoRepository.UpdatePartColumns(demoInfo);
-
- return new IdBaseDto() { Id = input.Id };
- }
- #endregion
-
- #region 分页查询接口
- ///
- /// 分页查询
- ///
- ///
- ///
- [HttpPost("InterFace/GetListByPage")]
- public async Task> GetListByPage(GetDemoListByPageInput input)
- {
- //分页时返回值统一用 PageResultDto<> 类型
- var list = await _demoRepository.GetListByPage(input.PageSize, input.PageIndex, input.Name);
-
- var res = ObjectMapper.Map, UnifyPageResultDto>(list);
-
- return res;
- }
- #endregion
-
- #region 入参转换
- ///
- /// 入参转换
- ///
- ///
- ///
- [HttpPost("InterFace/InputToValueObject")]
- public async Task> InputToValueObject(GetDemoListByPageInput input)
- {
- var obj = ObjectMapper.Map(input);
- var list = await _demoRepository.InputToValueObject(obj);
-
- var res = ObjectMapper.Map, List>(list);
- return res;
- }
- #endregion
-
- #region 原生sql
-
- ///
- /// 原生sql
- ///
- ///
- ///
- [HttpPost("InterFace/OriginalSql")]
- public async Task> OriginalSql(DemoValueObject obj)
- {
- var list = await _demoRepository.OriginalSql(obj);
- return list;
- }
-
- #endregion
-
- #region 自定义返回结果格式
- ///
- /// 自定义返回结果格式
- ///
- ///
- ///
- [HttpPost("Demo/CustomerResult")]
- [CustomerResult]
- public async Task GetListAsync()
- {
- /*
- 说明:
- 理论上我们有全公司级别的返回值约定,不管是前端调后端,还是后端微服务间的调用,都应完全遵循该规范。
- 但不排除有些特殊情况下,必须要返回自定义格式的场景。
- */
-
- var res = new MyCustomerResultOutput();
- res.Code = "200";
- res.Message = "这是一个自定义返回结果";
-
- return res;
- }
- #endregion
-
- #region 约定类型下返回null
- ///
- /// 约定类型下返回null
- ///
- ///
- ///
- [HttpPost("Demo/ReturnNull")]
- public async Task ReturnNull()
- {
- MyCustomerResultOutput res = null;
- return res;
- }
- #endregion
-
- #region
- ///
- /// 没有返回值
- ///
- ///
- ///
- [HttpPost("Demo/WithoutReturnObject")]
- public async Task WithoutReturnObject()
- {
- return null;
- }
- #endregion
-
- #region 主从关系实体存储
- ///
- /// 主从关系实体存储
- ///
- ///
- ///
- [HttpPost("InterFace/EntityRelationSave")]
- public async Task EntityRelationSave(DemoDetailSaveInput input)
- {
- var obj = ObjectMapper.Map(input);
- var res = await _demoRepository.EntityRelationSave(obj);
-
- return new UnifyResultDto(res);
- }
-
- #endregion
-
- #region 数据缓存
- ///
- /// 数据缓存
- ///
- ///
- ///
- [HttpPost("InterFace/GetDataCache")]
- public async Task GetDataCache(IdBaseDto input)
- {
- var res = await _demoRepository.GetDataCache(input.Id);
- return res;
- }
- #endregion
-
- //[HttpPost("InterFace/AAAA")]
- //public async Task AAAA()
- //{
- // var result = await _httpClientProxy.Service.GetSystemTokenAsync("Track");
-
- // return result;
- //}
- }
-}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs
new file mode 100644
index 00000000..c4a6d1db
--- /dev/null
+++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs
@@ -0,0 +1,100 @@
+using SJZY.Track.Application.Contract.Dtos.ProvideServices;
+using SJZY.Track.Domain.Aggregates.OrderAggregate;
+using SJZY.Track.Domain.Queries;
+
+namespace SJZY.Track.Application.Services.ProvideServices;
+
+///
+/// 订单关联服务
+///
+[ApiExplorerSettings(GroupName = "提供接口")]
+[Route("/ProviderService")]
+public class OrderLinkService : ApplicationService
+{
+ private readonly IOrderRepository _orderRepository;
+ private readonly IBasicQuery _orderLinkQuery;
+
+ public OrderLinkService(IBasicQuery orderLinkQuery, IOrderRepository orderRepository)
+ {
+ _orderLinkQuery = orderLinkQuery;
+ _orderRepository = orderRepository;
+ }
+
+ ///
+ /// 关联订单
+ ///
+ ///
+ ///
+ [HttpPost("Order/Link")]
+ public async Task LinkOrderAsync(LinkOrderInput input)
+ {
+ var orderId = await _orderRepository.GetFirstAsync(x =>
+ x.OrderType == input.OrderType && x.OrderNo == input.OrderNo, x => x.Id);
+ if (orderId == default)
+ {
+ throw new BusinessException(message: $"订单:{input.OrderNo}不存在");
+ }
+
+ //todo:循环关联?
+ if (input.OrderType == input.LinkOrderType)
+ {
+ throw new BusinessException(message: "不能同级关联");
+ }
+
+ if (input.LinkOrderNos.Count < 1 || input.LinkOrderType == 0) return true;
+
+ // 单号去重,去空,去自己
+ input.LinkOrderNos = input.LinkOrderNos
+ .Where(x => !x.IsNullOrWhiteSpace() && x != input.OrderNo)
+ .Distinct().ToList();
+
+ // 解绑
+ if (!input.IsLink) return await UnLinkOrderAsync(input);
+
+ // 关联订单
+ return await DoLinkOrderAsync(input, orderId);
+ }
+
+ private async Task DoLinkOrderAsync(LinkOrderInput input, int orderId)
+ {
+ // 获取已关联的订单
+ var linkOrderNos = await _orderLinkQuery.GetListAsync(x =>
+ x.OrderType == input.OrderType && x.OrderNo == input.OrderNo && x.LinkOrderType == input.LinkOrderType,
+ x => x.LinkOrderNo);
+
+ // 计算出未关联的订单
+ var noLinkOrderNos = input.LinkOrderNos.Except(linkOrderNos);
+
+ // 过滤掉不存在的订单
+ var canLinkOrders = await _orderRepository.GetListAsync(x =>
+ x.OrderType == input.LinkOrderType && noLinkOrderNos.Contains(x.OrderNo),
+ x => new { x.Id, x.OrderNo });
+
+ await _orderRepository.LinkOrderAsync(canLinkOrders.Select(x => new OrderLinkEntity
+ {
+ OrderId = orderId,
+ OrderNo = input.OrderNo,
+ OrderType = input.OrderType,
+ LinkOrderId = x.Id,
+ LinkOrderNo = x.OrderNo,
+ LinkOrderType = input.LinkOrderType
+ }).ToList());
+
+ // todo:补轨迹
+
+ return true;
+ }
+
+ private async Task UnLinkOrderAsync(LinkOrderInput input)
+ {
+ var unLinkIds = await _orderLinkQuery.GetListAsync(x =>
+ x.OrderType == input.OrderType && x.OrderNo == input.OrderNo &&
+ x.LinkOrderType == input.LinkOrderType && input.LinkOrderNos.Contains(x.LinkOrderNo),
+ x => x.Id);
+
+ // real del
+ await _orderRepository.UnLinkByIdsAsync(unLinkIds);
+
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs
new file mode 100644
index 00000000..a021cd41
--- /dev/null
+++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs
@@ -0,0 +1,82 @@
+using SJZY.Track.Application.Contract.Dtos.ProvideServices;
+using SJZY.Track.Domain.Aggregates.OrderAggregate;
+using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
+using SJZY.Track.Domain.Dtos.Order;
+using SJZY.UserCenter.HttpApi.Services;
+
+namespace SJZY.Track.Application.Services.ProvideServices;
+
+///
+/// 订单服务
+///
+[ApiExplorerSettings(GroupName = "提供接口")]
+[Route("/ProviderService")]
+public class OrderService : ApplicationService
+{
+ private readonly IOrderRepository _orderRepository;
+ private readonly ITrackDetailsRepository _trackDetailsRepository;
+
+ public OrderService(IOrderRepository orderRepository,
+ ITrackDetailsRepository trackDetailsRepository
+ )
+ {
+ _orderRepository = orderRepository;
+ _trackDetailsRepository = trackDetailsRepository;
+ }
+
+ ///
+ /// 创建订单,订单已存在则视为更新
+ ///
+ ///
+ ///
+ ///
+ [HttpPost("Order/Upsert")]
+ public async Task UpsertAsync(UpsertOrderInput input)
+ {
+ var order = await _orderRepository.GetFirstAsync(x =>
+ x.OrderType == input.OrderType && x.OrderNo == input.OrderNo);
+ if (order != default)
+ {
+ // 订单已存在则视为更新
+ await UpdateOrderAsync(input, order);
+ return "更新成功";
+ }
+
+ order = ObjectMapper.Map(input);
+ order.SubSystemId = CurrentUserRequest.SubSystemId;
+ order.OrderTemplates = ObjectMapper.Map, List>(input.Templates!);
+ order.OrderFlights = ObjectMapper.Map, List>(input.FlightInfos!);
+
+ await _orderRepository.CreateOrderAsync(order);
+ return "创建成功";
+ }
+
+ ///
+ /// 删除订单
+ ///
+ ///
+ ///
+ ///
+ [HttpPost("Order/Delete")]
+ public async Task DeleteOrderAsync(DeleteOrderInput input)
+ {
+ var orderId = await _orderRepository.GetFirstAsync(x =>
+ x.OrderType == input.OrderType && x.OrderNo == input.OrderNo, x => x.Id);
+ if (orderId == default)
+ {
+ throw new BusinessException(message: $"订单:{input.OrderNo}不存在");
+ }
+
+ await _orderRepository.DeleteOrderAsync(orderId);
+
+ return true;
+ }
+
+ private async Task UpdateOrderAsync(UpdateOrderInput input, OrderEntity order)
+ {
+ order = ObjectMapper.Map(input, order);
+ order.OrderTemplates = ObjectMapper.Map, List>(input.Templates!);
+ order.OrderFlights = ObjectMapper.Map, List>(input.FlightInfos!);
+ await _orderRepository.UpdateOrderAsync(order);
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackPullService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackPullService.cs
new file mode 100644
index 00000000..53cdfd57
--- /dev/null
+++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackPullService.cs
@@ -0,0 +1,57 @@
+using SJZY.InterfaceRelay.Application.Contracts;
+using SJZY.Track.Application.Contract.Dtos.ProvideServices;
+using SJZY.Track.Domain.Aggregates.OrderAggregate;
+using Volo.Abp.Http.Client.DynamicProxying;
+
+namespace SJZY.Track.Application.Services.ProvideServices;
+
+///
+/// 轨迹拉取服务
+///
+[ApiExplorerSettings(GroupName = "提供接口")]
+[Route("/ProviderService")]
+public class TrackPullService : ApplicationService
+{
+ private readonly IOrderRepository _orderRepository;
+ private readonly IHttpClientProxy _httpClientProxy;
+
+ public TrackPullService(IOrderRepository orderRepository,
+ IHttpClientProxy httpClientProxy)
+ {
+ _orderRepository = orderRepository;
+ _httpClientProxy = httpClientProxy;
+ }
+
+ ///
+ /// 刷新轨迹
+ ///
+ ///
+ ///
+ [HttpPost("Track/Refresh")]
+ public async Task RefreshTrackAsync(RefreshTrackInput input)
+ {
+ if (input.OrderNos.Count == 0)
+ {
+ throw new BusinessException(message: "订单号数组不能为空");
+ }
+
+ input.OrderNos = input.OrderNos.Distinct().ToList();
+
+ var orderTemplates = await _orderRepository.GetOrderTemplatesAsync(input.OrderNos);
+
+ foreach (var group in orderTemplates.GroupBy(x => x.ServiceProviderId))
+ {
+ var data = group.Select(x => new OrderNoInfo
+ {
+ OrderType = x.OrderType,
+ OrderNo = x.OrderNo
+ }).ToList();
+
+ await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
+ "A012", "yicang", 42, data, GlobalConst.InterfaceRelayTrackRefreshSubscribe
+ , group.Key.ToString());
+ }
+
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackPushService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackPushService.cs
new file mode 100644
index 00000000..f2b5320f
--- /dev/null
+++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackPushService.cs
@@ -0,0 +1,11 @@
+namespace SJZY.Track.Application.Services.ProvideServices;
+
+///
+/// 轨迹推送服务
+///
+[ApiExplorerSettings(GroupName = "提供接口")]
+[Route("/ProviderService")]
+public class TrackPushService: ApplicationService
+{
+
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs
new file mode 100644
index 00000000..241d9030
--- /dev/null
+++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs
@@ -0,0 +1,108 @@
+using SJZY.Track.Application.Contract.Dtos.ProvideServices;
+using SJZY.Track.Domain.Aggregates.OrderAggregate;
+using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
+using SJZY.Track.Domain.Queries;
+
+namespace SJZY.Track.Application.Services.ProvideServices;
+
+///
+/// 轨迹查询服务
+///
+[ApiExplorerSettings(GroupName = "提供接口")]
+[Route("/ProviderService")]
+public class TrackQueryService : ApplicationService
+{
+ private readonly ITrackDetailsRepository _trackDetailsRepository;
+ private readonly IOrderRepository _orderRepository;
+ private readonly IProvideQueries _provideQueries;
+
+ public TrackQueryService(ITrackDetailsRepository trackDetailsRepository,
+ IOrderRepository orderRepository,
+ IProvideQueries provideQueries)
+ {
+ _trackDetailsRepository = trackDetailsRepository;
+ _orderRepository = orderRepository;
+ _provideQueries = provideQueries;
+ }
+
+ ///
+ /// 根据订单号获取轨迹
+ ///
+ ///
+ ///
+ ///
+ [HttpPost("Track/Query")]
+ public async Task> QueryAsync(GetTrackInput input)
+ {
+ if (input.OrderNos.Count > 500)
+ {
+ throw new BusinessException(message: "最多只能查询500单");
+ }
+
+ var res = new List();
+ input.OrderNos = input.OrderNos.Where(x => !x.IsNullOrWhiteSpace()).Distinct().ToList(); // 单号去重、去空
+ var details = await _trackDetailsRepository.GetListAsync(input.OrderType, input.OrderNos);
+
+ foreach (var group in details.GroupBy(x => x.OrderId))
+ {
+ var item = new GetTrackOutput();
+ var trackDetails = group.ToList();
+ item.OrderNo = trackDetails.First().OrderNo;
+
+ item.TrackDetails = trackDetails.Select(x => new TrackDetail
+ {
+ Code = x.TrackCode,
+ Status = x.TrackStatus,
+ Content = x.TrackContent,
+ Location = x.TrackPlace,
+ Time = x.TrackTime.AddHours(input.TimeZone ?? 8 - x.TrackTimeZone),
+ TimeZone = input.TimeZone ?? 8
+ }).ToList();
+
+ res.Add(item);
+ }
+
+ await TrackDetailSort(res, input);
+
+ return res;
+ }
+
+ private async Task TrackDetailSort(List list, GetTrackInput input)
+ {
+ switch (input.SortMethod)
+ {
+ case SortMethod.ByTrackTime:
+ // tips:quick-sort 直接修改原list
+ list.ForEach(item => item.TrackDetails.Sort((a, b) => a.Time.CompareTo(b.Time)));
+ break;
+ case SortMethod.ByTrackTimeDesc:
+ list.ForEach(item => item.TrackDetails.Sort((a, b) => b.Time.CompareTo(a.Time)));
+ break;
+ case SortMethod.ByTemplate:
+ var orderTemplates = await _provideQueries
+ .GetOrderTemplateLinksAsync(input.OrderType, input.OrderNos);
+ var distinctTemplateIds = orderTemplates.Select(x => x.TemplateId).Distinct().ToList();
+ var templateContent = await _provideQueries.GetOrderedTrackCodesAsync(distinctTemplateIds);
+ list.ForEach(item =>
+ {
+ var codes = new List();
+ // 多模板拼接显示
+ foreach (var orderTemplate in orderTemplates.Where(x => x.OrderNo == item.OrderNo))
+ {
+ codes.AddRange(templateContent
+ .Where(t => t.TemplateId == orderTemplate.TemplateId) // 按模板
+ .Where(t => t.IsExternal) // 过滤不对外的
+ .Select(t => t.Code));
+ }
+
+ item.TrackDetails = item.TrackDetails
+ .Where(x => codes.Contains(x.Code)) // 剔除不在模板内容中的元素
+ .OrderBy(x => codes.IndexOf(x.Code)) // 按照在模板内容的位置排序
+ .ToList();
+ });
+ break;
+ default:
+ throw new ArgumentOutOfRangeException(nameof(input.SortMethod), input.SortMethod, "不支持的排序方式");
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs
new file mode 100644
index 00000000..18adf7fa
--- /dev/null
+++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs
@@ -0,0 +1,93 @@
+using DotNetCore.CAP;
+using SJZY.Track.Application.Contract.Dtos.ProvideServices;
+using SJZY.Track.Application.Contract.Events;
+using SJZY.Track.Domain.Aggregates.OrderAggregate;
+using SJZY.Track.Domain.Queries;
+
+namespace SJZY.Track.Application.Services.ProvideServices;
+
+///
+/// 轨迹服务
+///
+[ApiExplorerSettings(GroupName = "提供接口")]
+[Route("/ProviderService")]
+public class TrackService : ApplicationService
+{
+ private readonly IOrderRepository _orderRepository;
+ private readonly IProvideQueries _provideQueries;
+ private readonly ICapPublisher _capPublisher;
+
+ public TrackService(IOrderRepository orderRepository, IProvideQueries provideQueries, ICapPublisher capPublisher)
+ {
+ _orderRepository = orderRepository;
+ _provideQueries = provideQueries;
+ _capPublisher = capPublisher;
+ }
+
+ ///
+ /// 新增/更新订单轨迹接口
+ ///
+ ///
+ ///
+ ///
+ [HttpPost("Track/Upsert")]
+ public async Task UpsertTrackAsync(UpsertTrackInput input)
+ {
+ var order = await _orderRepository.GetFirstAsync(x =>
+ x.OrderType == input.OrderType && x.OrderNo == input.OrderNo, x => new
+ {
+ x.Id, x.SubSystemId, x.IsPushCompleted, x.CustomId
+ });
+ if (order == default)
+ {
+ throw new BusinessException(message: $"订单:{input.OrderNo}不存在");
+ }
+
+ // 新增/更新轨迹
+ var @event = ObjectMapper.Map(input);
+ @event.OrderId = order.Id;
+ @event.SubSystemId = order.SubSystemId;
+ @event.IsPushCompleted = order.IsPushCompleted;
+ @event.CustomId = order.CustomId;
+ await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, @event);
+ return true;
+ }
+
+ ///
+ /// 删除轨迹
+ ///
+ ///
+ ///
+ ///
+ [HttpPost("Track/Delete")]
+ public async Task DeleteTrackAsync(DeleteTrackInput input)
+ {
+ var order = await _orderRepository.GetFirstAsync(x =>
+ x.OrderType == input.OrderType && x.OrderNo == input.OrderNo, x => new
+ {
+ x.Id, x.SubSystemId, x.IsPushCompleted, x.CustomId
+ });
+ if (order == default)
+ {
+ throw new BusinessException(message: $"订单:{input.OrderNo}不存在");
+ }
+
+ var codes = await _provideQueries.GetCanDeleteTrackCodesAsync(order.Id, input.TrackCodes);
+
+ if (codes.Count == 0)
+ {
+ throw new BusinessException(message: "没有一个轨迹代码是可删的");
+ }
+
+ // 删除轨迹
+ var @event = new TrackDeleteEvent
+ {
+ OrderId = order.Id,
+ TrackCodes = codes,
+ SubSystemId = order.SubSystemId,
+ };
+ await _capPublisher.PublishAsync(GlobalConst.TrackDeleteSubscribe, @event);
+
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs
new file mode 100644
index 00000000..f4946435
--- /dev/null
+++ b/src/SJZY.Track.Application/Services/TrackContents/TrackContentService.cs
@@ -0,0 +1,297 @@
+using Microsoft.Extensions.Localization;
+using SJZY.Expand.ABP.Core.Localization;
+using SJZY.Expand.ABP.Core.PublicMethords;
+using SJZY.Track.Application.Contract.Dtos.TrackContents;
+using SJZY.Track.Application.Localization;
+using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
+using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
+using SJZY.Track.Domain.Dtos.TrackContents;
+using SJZY.Track.Domain.Queries;
+using System.Linq.Expressions;
+using Volo.Abp.DependencyInjection;
+
+namespace SJZY.Track.Application.Services.TrackContents
+{
+ ///
+ /// 轨迹内容服务
+ ///
+ [ApiExplorerSettings(GroupName = "轨迹内容")]
+ [Route("/Track/Content")]
+ public class TrackContentService : ApplicationService, ITransientDependency
+ {
+ private readonly IStringLocalizer _stringLocalizer;
+ private readonly ITrackContentRepository _trackContentRepository;
+ private readonly IBasicQuery _trackContentMapBasicQuery;
+ private readonly IBasicQuery _trackTemplateContentBasicQuery;
+
+ public TrackContentService(
+ IStringLocalizer stringLocalizer,
+ ITrackContentRepository trackContentRepository,
+ IBasicQuery trackContentMapBasicQuery,
+ IBasicQuery trackTemplateContentBasicQuery
+ )
+ {
+ this._stringLocalizer = stringLocalizer;
+ this._trackContentRepository = trackContentRepository;
+ this._trackContentMapBasicQuery = trackContentMapBasicQuery;
+ this._trackTemplateContentBasicQuery = trackTemplateContentBasicQuery;
+ }
+
+ ///
+ /// 轨迹内容编辑
+ ///
+ ///
+ [HttpPost("Edit")]
+ public async Task EditAsync(EditTrackContentInput input)
+ {
+ return input.Options switch
+ {
+ OptionType.新增 => await AddAsync(input),
+ OptionType.修改 => await UpdateAsync(input),
+ OptionType.删除 => await DeleteAsync(input),
+ _ => throw new BusinessException(message: "当前操作动作不合法")
+ };
+ }
+
+ ///
+ /// 根据内容id获取轨迹内容
+ ///
+ ///
+ ///
+ [HttpGet("GetDetail")]
+ public async Task> GetDetailAsync(int id)
+ {
+ var detailInfo = await _trackContentRepository.GetDetailAsync(id);
+ if (detailInfo == null)
+ {
+ return new UnifyResultDto(false, null, "未查询到轨迹状态");
+ }
+
+ var dto = ObjectMapper.Map(detailInfo);
+ return new UnifyResultDto("200", "", dto);
+ }
+
+ ///
+ /// 获取分页轨迹内容
+ ///
+ ///
+ ///
+ [HttpPost("GetList")]
+ public async Task> GetPageTrackContent(
+ GetPageTrackContentInput input)
+ {
+ var vo = ObjectMapper.Map(input);
+ var resultDto = await _trackContentRepository.GetPageTrackContent(vo);
+ var pageResultDto =
+ ObjectMapper.Map, UnifyPageResultDto>(
+ resultDto);
+
+ return pageResultDto;
+ }
+
+ #region 私有方法
+
+ private async Task AddAsync(EditTrackContentInput input)
+ {
+ #region 业务逻辑校验
+
+ var trackContentEntitys = await _trackContentRepository.GetListAsync(a =>
+ a.SubSystemId == input.SubSystemId && (a.Code == input.Code ||
+ a.Content == input.Content || a.EnContent == input.EnContent));
+ if (trackContentEntitys.Any())
+ {
+ //throw new BusinessException(message: _stringLocalizer["TrackContentExist"]);
+ var codes = trackContentEntitys.FirstOrDefault(a => a.Code==input.Code);
+ if (codes!=null)
+ {
+ throw new BusinessException(message: "该子系统下轨迹代码已存在");
+ }
+ var contents = trackContentEntitys.FirstOrDefault(a => a.Content==input.Content);
+ if (contents!=null)
+ {
+ throw new BusinessException(message: "该子系统下轨迹内容已存在");
+ }
+ var contentEns = trackContentEntitys.FirstOrDefault(a => a.EnContent==input.EnContent);
+ if (contentEns!=null)
+ {
+ throw new BusinessException(message: "该子系统下轨迹内容英文已存在");
+ }
+ //throw new BusinessException(message: "当前子系统下,轨迹代码或轨迹内容或轨迹内容英文存在");
+ }
+
+ #endregion 业务逻辑校验
+
+ var entity = ObjectMapper.Map(input);
+ var isTrue = await _trackContentRepository.InsertAsync(entity);
+
+ return new UnifyResultDto("200", "新增成功", isTrue);
+ }
+
+ private async Task UpdateAsync(EditTrackContentInput input)
+ {
+ #region 业务逻辑校验
+
+ var trackContentEntitys = await _trackContentRepository.GetListAsync(a => a.Id != input.Id &&
+ a.SubSystemId == input.SubSystemId && (a.Code == input.Code ||
+ a.Content == input.Content || a.EnContent == input.EnContent));
+ if (trackContentEntitys.Any())
+ {
+ //throw new BusinessException(message: _stringLocalizer["TrackContentExist"]);
+ //throw new BusinessException(message: "当前子系统下,轨迹代码或轨迹内容或轨迹内容英文存在");
+ var codes = trackContentEntitys.FirstOrDefault(a => a.Code==input.Code);
+ if (codes!=null)
+ {
+ throw new BusinessException(message: "该子系统下轨迹代码已存在");
+ }
+ var contents = trackContentEntitys.FirstOrDefault(a => a.Content==input.Content);
+ if (contents!=null)
+ {
+ throw new BusinessException(message: "该子系统下轨迹内容已存在");
+ }
+ var contentEns = trackContentEntitys.FirstOrDefault(a => a.EnContent==input.EnContent);
+ if (contentEns!=null)
+ {
+ throw new BusinessException(message: "该子系统下轨迹内容英文已存在");
+ }
+ }
+
+ #endregion 业务逻辑校验
+
+ //更新的时候需要覆盖内容映射轨迹代码
+ var templateEntity = await _trackContentRepository.GetFirstAsync(a => a.Id == input.Id);
+
+ bool isTrue = false;
+
+ using (var ts = TransactionScopeHelper.Create())
+ {
+ // 如果轨迹内容的子系统和code发生变化,同步到轨迹映射表
+ if (templateEntity.SubSystemId != input.SubSystemId || templateEntity.Code != input.Code)
+ {
+ await _trackContentRepository.UpdateMapAsync(x => new TrackContentMapEntity
+ {
+ SubSystemId = input.SubSystemId,
+ TrackContentCode = input.Code
+ }, x => x.TrackContentId == input.Id);
+
+ await _trackContentRepository.UpdateMapAsync(x => new TrackContentMapEntity
+ {
+ MapSubSystemId = input.SubSystemId,
+ MapTrackContentCode = input.Code
+ }, x => x.MapTrackContentId == input.Id);
+ }
+
+ ObjectMapper.Map(input, templateEntity);
+
+ isTrue = await _trackContentRepository.UpdateAsync(templateEntity);
+
+ ts.Complete();
+ }
+
+ return new UnifyResultDto("200", "修改成功", isTrue);
+ }
+
+ private async Task DeleteAsync(EditTrackContentInput input)
+ {
+ #region 业务校验
+ //查询是否关联了轨迹模版内容
+ var isExistTemplate = await _trackContentRepository.GetTemplateIsExist(input.Id);
+ if (isExistTemplate)
+ {
+ throw new BusinessException(message: "该轨迹内容关联轨迹模板,禁止删除");
+ }
+ //var trackTemplateContents = await _trackTemplateContentBasicQuery.GetListAsync(a => a.TrackContentId == input.Id);
+ //if (trackTemplateContents.Any())
+ //{
+ // throw new BusinessException(message: "该轨迹内容关联轨迹模板,禁止删除");
+ //}
+
+ //需要加个判断,存在内容映射,则出提示
+ //var trackContentMapEntities = await _trackContentMapBasicQuery.GetListAsync(a => a.TrackContentId == input.Id || a.MapTrackContentId == input.Id);
+ //if (trackContentMapEntities.Any())
+ //{
+ // throw new BusinessException(message: "无法删除该内容,该轨迹内容已在轨迹内容映射中使用了,请检查");
+ //}
+ #endregion 业务校验
+
+ var isTrue = await _trackContentRepository.SoftDeleteAsync(x => x.Id == input.Id);
+
+ return new UnifyResultDto("200", "删除成功", isTrue);
+ }
+
+ #endregion 私有方法
+
+ ///
+ /// 轨迹内容映射列表
+ ///
+ ///
+ ///
+ [HttpPost("GetMapPage")]
+ public async Task> GetMapPageAsync([FromBody] GetTrackContentMapPageInputVO input)
+ {
+ return await _trackContentRepository.GetMapPageAsync(input);
+ }
+
+ ///
+ /// 轨迹内容映射详情
+ ///
+ ///
+ ///
+ [HttpGet("GetMapDetail")]
+ public async Task GetMapDetailAsync(int id)
+ {
+ return await _trackContentRepository.GetMapDetailAsync(id);
+ }
+
+ ///
+ /// 轨迹内容映射编辑
+ ///
+ ///
+ ///
+ [HttpPost("EditMap")]
+ public async Task EditMapAsync([FromBody] EditTrackContentMapInput input)
+ {
+ if (input.Options != OptionTypeNoNull.删除)
+ {
+ if (input.SubSystemId == input.MapSubSystemId) throw new BusinessException(message: _stringLocalizer["NotAllowedToMapSubSystem"]);
+
+ Expression> isMapAnyExp = x =>
+ x.TrackContentId == input.TrackContentId && x.MapTrackContentId == input.MapTrackContentId;
+ if (input.Options == OptionTypeNoNull.修改) isMapAnyExp.And(x => x.Id != input.Id);
+
+ if (await _trackContentRepository.IsMapAnyAsync(isMapAnyExp))
+ throw new BusinessException(message: _stringLocalizer["IsTrackContentMapAny"]);
+ }
+
+ switch (input.Options)
+ {
+ case OptionTypeNoNull.新增:
+ {
+ var trackContentMapEntity = ObjectMapper.Map(input);
+
+ await _trackContentRepository.InsertMapAsync(trackContentMapEntity);
+ }
+ break;
+
+ case OptionTypeNoNull.修改:
+ {
+ var oldTrackContentMapEntity = await _trackContentRepository.GetMapByIdAsync(input.Id!.Value) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]);
+
+ ObjectMapper.Map(input, oldTrackContentMapEntity);
+
+ await _trackContentRepository.UpdateMapAsync(oldTrackContentMapEntity);
+ }
+ break;
+
+ case OptionTypeNoNull.删除:
+ await _trackContentRepository.SoftDeleteMapAsync(x => x.Id == input.Id);
+ break;
+
+ default:
+ throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum,
+ nameof(EditTrackContentMapInput.Options)]);
+ }
+
+ return true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs b/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs
new file mode 100644
index 00000000..9e7d4056
--- /dev/null
+++ b/src/SJZY.Track.Application/Services/TrackFlags/TrackFlagService.cs
@@ -0,0 +1,163 @@
+using Microsoft.Extensions.Localization;
+using SJZY.Track.Application.Contract.Dtos.TrackFlags;
+using SJZY.Track.Application.Localization;
+using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
+using SJZY.Track.Domain.Aggregates.TrackFlagAggregate;
+using SJZY.Track.Domain.Dtos.TrackFlags;
+using Volo.Abp.DependencyInjection;
+
+namespace SJZY.Track.Application.Services.TrackFlags
+{
+ ///
+ /// 轨迹标记服务
+ ///
+ [ApiExplorerSettings(GroupName = "轨迹标记")]
+ [Route("/Track/Flag")]
+ public class TrackFlagService : ApplicationService, ITransientDependency
+ {
+ private readonly IStringLocalizer _stringLocalizer;
+ private readonly ITrackFlagRepository _trackFlagRepository;
+ private readonly ITrackContentRepository _trackContentRepository;
+
+ public TrackFlagService(
+ IStringLocalizer stringLocalizer,
+ ITrackFlagRepository trackFlagRepository,
+ ITrackContentRepository trackContentRepository
+ )
+ {
+ this._stringLocalizer = stringLocalizer;
+ this._trackFlagRepository = trackFlagRepository;
+ this._trackContentRepository=trackContentRepository;
+ }
+
+ ///
+ /// 轨迹标记编辑
+ ///
+ ///
+ [HttpPost("Edit")]
+ public async Task EditAsync(EditTrackFlagInput input)
+ {
+ return input.Options switch
+ {
+ OptionType.新增 => await AddAsync(input),
+ OptionType.修改 => await UpdateAsync(input),
+ OptionType.删除 => await DeleteAsync(input),
+ _ => throw new BusinessException(message: "当前操作动作不合法")
+ };
+ }
+
+ ///
+ /// 根据标记id获取轨迹标记
+ ///
+ ///
+ ///
+ [HttpGet("GetDetail")]
+ public async Task> GetDetailAsync(int id)
+ {
+ var detailInfo = await _trackFlagRepository.GetDetailAsync(id);
+ if (detailInfo == null)
+ {
+ return new UnifyResultDto(false, null, "未查询到轨迹状态");
+ }
+
+ var dto = ObjectMapper.Map(detailInfo);
+ return new UnifyResultDto("200", "", dto);
+ }
+
+ ///
+ /// 获取分页轨迹标记
+ ///
+ ///
+ ///
+ [HttpPost("GetList")]
+ public async Task> GetPageTrackFlag(GetPageTrackFlagInput input)
+ {
+ var vo = ObjectMapper.Map(input);
+ var resultDto = await _trackFlagRepository.GetPageTrackFlag(vo);
+ var pageResultDto =
+ ObjectMapper.Map, UnifyPageResultDto>(
+ resultDto);
+
+ return pageResultDto;
+ }
+
+ #region 私有方法
+
+ private async Task AddAsync(EditTrackFlagInput input)
+ {
+ #region 业务校验
+ var trackFlagsEntitys = await _trackFlagRepository.GetListAsync(a =>
+ a.SubSystemId == input.SubSystemId && (a.Code == input.Code || a.Name == input.Flag));
+ if (trackFlagsEntitys.Any())
+ {
+ //throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]);
+ //throw new BusinessException(message: "当前子系统下已存在轨迹标记代码");
+ var trackFlagCode = trackFlagsEntitys.FirstOrDefault(a => a.Code==input.Code);
+ if (trackFlagCode!=null)
+ {
+ throw new BusinessException(message: "该子系统下代码已存在");
+ }
+ var trackFlagName = trackFlagsEntitys.FirstOrDefault(a => a.Name==input.Flag);
+ if (trackFlagName!=null)
+ {
+ throw new BusinessException(message: "该子系统下标记已存在");
+ }
+ }
+ #endregion
+
+ var entity = ObjectMapper.Map(input);
+ var isTrue = await _trackFlagRepository.InsertAsync(entity);
+
+ return new UnifyResultDto("200", "新增成功", isTrue);
+ }
+
+ private async Task UpdateAsync(EditTrackFlagInput input)
+ {
+ #region 业务校验
+
+ var trackFlagsEntitys = await _trackFlagRepository.GetListAsync(a => a.Id != input.Id &&
+ a.SubSystemId == input.SubSystemId && (a.Code == input.Code ||
+ a.Name == input.Flag));
+ if (trackFlagsEntitys.Any())
+ {
+ //throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]);
+ //throw new BusinessException(message: "当前子系统下已存在轨迹标记代码");
+ var trackFlagCode = trackFlagsEntitys.FirstOrDefault(a => a.Code==input.Code);
+ if (trackFlagCode!=null)
+ {
+ throw new BusinessException(message: "该子系统下代码已存在");
+ }
+ var trackFlagName = trackFlagsEntitys.FirstOrDefault(a => a.Name==input.Flag);
+ if (trackFlagName!=null)
+ {
+ throw new BusinessException(message: "该子系统下标记已存在");
+ }
+ }
+
+ #endregion
+
+ var templateEntity = await _trackFlagRepository.GetFirstAsync(a => a.Id == input.Id);
+ ObjectMapper.Map(input, templateEntity);
+ var isTrue = await _trackFlagRepository.UpdateAsync(templateEntity);
+
+ return new UnifyResultDto("200", "修改成功", isTrue);
+ }
+
+ private async Task DeleteAsync(EditTrackFlagInput input)
+ {
+ #region 业务校验
+ var isExistContent = await _trackContentRepository.GetFirstAsync(a => a.TrackFlagId==input.Id);
+ if (isExistContent!=null)
+ {
+ //throw new BusinessException(message: _stringLocalizer["IsExistTrackFlag"]);
+ throw new BusinessException(message: "该标记关联轨迹内容,禁止删除");
+ }
+ #endregion
+ var isTrue = await _trackFlagRepository.SoftDeleteAsync(x => x.Id == input.Id);
+
+ return new UnifyResultDto("200", "删除成功", isTrue);
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs b/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs
new file mode 100644
index 00000000..908d7227
--- /dev/null
+++ b/src/SJZY.Track.Application/Services/TrackOrders/TrackOrderService.cs
@@ -0,0 +1,115 @@
+using SJZY.Track.Application.Contract.Dtos.ProvideServices;
+using SJZY.Track.Domain.Aggregates.OrderAggregate;
+using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
+using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
+using SJZY.Track.Domain.Dtos.Order;
+using SJZY.Track.Domain.Dtos.TrackTemplate;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.DependencyInjection;
+
+namespace SJZY.Track.Application.Services.TrackOrders
+{
+ [ApiExplorerSettings(GroupName = "轨迹订单")]
+ [Route("/Track/Order")]
+ public class TrackOrderService : ApplicationService, ITransientDependency
+ {
+ private readonly IOrderRepository _orderRepository;
+ private readonly ITrackDetailsRepository _trackDetailsRepository;
+ private readonly ITrackContentRepository _trackContentRepository;
+
+ public TrackOrderService(
+ IOrderRepository orderRepository,
+ ITrackDetailsRepository trackDetailsRepository,
+ ITrackContentRepository trackContentRepository
+ )
+ {
+ this._orderRepository=orderRepository;
+ this._trackDetailsRepository=trackDetailsRepository;
+ this._trackContentRepository=trackContentRepository;
+ }
+
+ #region 轨迹订单明细
+ ///
+ /// 根据轨迹订单id获取轨迹订单明细列表
+ ///
+ ///
+ ///
+ [HttpPost("GetDetails")]
+ public async Task> GetOrderDetails(GetOrderDetailsInput input)
+ {
+ var trackDetails = await _trackDetailsRepository.GetListAsync(input.OrderId);
+ if (!trackDetails.IsNullOrEmpty())
+ {
+ var list = ObjectMapper.Map, List>(trackDetails);
+ var trackCodes = list.Where(a => !a.Code.IsNullOrWhiteSpace()).Select(a => a.Code).Distinct().ToList();
+
+ var trackContents = await _trackContentRepository.GetTrackContentAttributeValue(new GetTemplateContentAttributeValueInputVO
+ {
+ SubSystemId =input.SubSystemId,
+ TrackTemplateIds = input.TrackTemplateIds,
+ TrackCodes=trackCodes
+ });
+ input.TrackTemplateIds =input.TrackTemplateIds.Where(a => a>0).ToList();
+ int id = 1;
+ list.ForEach(a =>
+ {
+ a.Id = id++;
+
+ var trackContentsOfTemplates = trackContents.Where(b => b.SubSystemId==input.SubSystemId && b.TrackCode==a.Code
+ && input.TrackTemplateIds.Contains(b.TrackTemplateId));
+ GetTemplateContentAttributeValueVO trackContent = null;
+ var insertData = input.TrackTemplateIds.Intersect(trackContentsOfTemplates.Select(aa => aa.TrackTemplateId)).ToList();
+ if (!insertData.IsNullOrEmpty())
+ {
+ trackContent =trackContentsOfTemplates.FirstOrDefault(a => a.TrackTemplateId==insertData.FirstOrDefault());
+ }
+
+ if (trackContent!=null)
+ {
+ a.IsCanDelete=trackContent.IsCanDelete;
+ a.IsExternal = trackContent.IsExternal;
+ }
+ if (a.TrackTimeZoneValue==0f)
+ {
+ a.TrackTimeZone=$"GTM{" "}+00:00";
+ }
+ else
+ {
+ // 将小数形式的小时转换为时区偏移量
+ int hours = (int)a.TrackTimeZoneValue; // 提取整数部分作为小时
+ int minutes = (int)((a.TrackTimeZoneValue - hours) * 60); // 将小数部分乘以 60 转换为分钟
+ TimeSpan offset = new TimeSpan(hours, minutes, 0);
+ string timeZoneStr = offset.ToString();
+ string flag = a.TrackTimeZoneValue>0f ? "+" : "";
+ a.TrackTimeZone = $"GTM{" "}{flag}{timeZoneStr.RemovePostFix(":00")}";
+ }
+ });
+ return list;
+ }
+
+ return new List();
+ }
+ #endregion
+
+ #region 轨迹订单列表
+ ///
+ /// 获取分页的轨迹订单
+ ///
+ ///
+ ///
+ [HttpPost("GetTrackOrderList")]
+ public async Task> GetPageTrackOrder(GetPageTrackOrderInput input)
+ {
+ var vo = ObjectMapper.Map(input);
+ var pageList = await _orderRepository.GetPageTrackOrder(vo);
+ var pageResultDto =
+ ObjectMapper.Map, UnifyPageResultDto>(pageList);
+ return pageResultDto;
+ }
+ #endregion
+ }
+}
diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs
new file mode 100644
index 00000000..34998b29
--- /dev/null
+++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs
@@ -0,0 +1,241 @@
+using System;
+using System.Linq.Expressions;
+using Microsoft.Extensions.Localization;
+using SJZY.Expand.ABP.Core.Localization;
+using SJZY.Expand.ABP.Core.PublicMethords;
+using SJZY.Track.Application.Contract.Dtos.TrackPull;
+using SJZY.Track.Application.Localization;
+using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
+using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
+using SJZY.Track.Domain.Dtos.Common;
+using SJZY.Track.Domain.Dtos.TrackPull;
+using SqlSugar;
+using Volo.Abp.DependencyInjection;
+
+namespace SJZY.Track.Application.Services.TrackPull;
+
+///
+/// 轨迹拉取
+///
+[ApiExplorerSettings(GroupName = "轨迹拉取")]
+[Route("/Track/PullConfig")]
+public class TrackPullService : ApplicationService, ITransientDependency
+{
+ private readonly IStringLocalizer _stringLocalizer;
+ private readonly ITrackPullConfigRepository _trackPullConfigRepository;
+ private readonly ITrackTemplateRepository _trackTemplateRepository;
+
+ public TrackPullService(
+ IStringLocalizer stringLocalizer,
+ ITrackPullConfigRepository trackPullConfigRepository,
+ ITrackTemplateRepository trackTemplateRepository)
+ {
+ _stringLocalizer = stringLocalizer;
+ _trackPullConfigRepository = trackPullConfigRepository;
+ _trackTemplateRepository = trackTemplateRepository;
+ }
+
+ ///
+ /// 轨迹拉取配置列表
+ ///
+ ///
+ ///
+ [HttpPost("GetPage")]
+ public async Task> GetPageAsync([FromBody] KeywordsInputVO input)
+ {
+ return await _trackPullConfigRepository.GetPageAsync(input);
+ }
+
+ ///
+ /// 轨迹拉取配置内容列表
+ ///
+ ///
+ ///
+ [HttpPost("GetContentPage")]
+ public async Task> GetContentPageAsync(
+ [FromBody] GetTrackPullContentPageInputVO input)
+ {
+ return await _trackPullConfigRepository.GetContentPageAsync(input);
+ }
+
+ ///
+ /// 轨迹拉取配置详情
+ ///
+ ///
+ ///
+ [HttpGet("GetDetail")]
+ public async Task GetDetailAsync(int id)
+ {
+ return await _trackPullConfigRepository.GetDetailAsync(id);
+ }
+
+ ///
+ /// 轨迹拉取配置内容详情
+ ///
+ ///
+ ///
+ [HttpGet("GetContentDetail")]
+ public async Task GetContentDetailAsync(int id)
+ {
+ return await _trackPullConfigRepository.GetContentDetailAsync(id);
+ }
+
+ ///
+ /// 轨迹拉取配置编辑
+ ///
+ ///
+ ///
+ [HttpPost("Edit")]
+ public async Task EditAsync([FromBody] EditTrackPullConfigInput input)
+ {
+ if (input.Options != OptionTypeNoNull.删除)
+ {
+ Expression> isAnyExp = x =>
+ x.SubSystemId == input.SubSystemId && x.TrackTemplateId == input.TrackTemplateId &&
+ x.ServiceProviderId == input.ServiceProviderId;
+ if (input.Options == OptionTypeNoNull.修改) isAnyExp = isAnyExp.And(x => x.Id != input.Id);
+
+ if (await _trackPullConfigRepository.IsAnyAsync(isAnyExp))
+ throw new BusinessException(message: _stringLocalizer["IsTrackPullConfigAny"]);
+ }
+
+ switch (input.Options)
+ {
+ case OptionTypeNoNull.新增:
+ {
+ var trackPullEntity = ObjectMapper.Map(input);
+ var trackPullParamsEntity =
+ ObjectMapper.Map(input);
+
+ var trackTemplateContentEntities =
+ await _trackTemplateRepository.GetContentListAsync(x => x.TrackTemplateId == input.TrackTemplateId);
+
+ var trackPullContentEntities = new List();
+
+ using (var ts = TransactionScopeHelper.Create())
+ {
+ int id = await _trackPullConfigRepository.InsertReturnIdentityAsync(trackPullEntity);
+
+ trackPullParamsEntity.PullOrPushConfigId = id;
+ await _trackPullConfigRepository.InsertParamsAsync(trackPullParamsEntity);
+
+ foreach (var item in trackTemplateContentEntities)
+ {
+ trackPullContentEntities.Add(new()
+ {
+ TrackPullConfigId = id,
+ TrackContentId = item.TrackContentId
+ });
+ }
+
+ await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities);
+
+ ts.Complete();
+ }
+ }
+ break;
+
+ case OptionTypeNoNull.修改:
+ {
+ var oldTrackPullEntity = await _trackPullConfigRepository.GetFirstAsync(x => x.Id == input.Id) ??
+ throw new BusinessException(message: _stringLocalizer["NotFindData"]);
+
+ var oldTrackPullParamsEntity =
+ await _trackPullConfigRepository.GetParamsSingleAsync(x =>
+ x.PullOrPushConfigId == input.Id && !x.IsPush);
+
+ var trackPullContentEntities = new List();
+
+ if (oldTrackPullEntity.TrackTemplateId != input.TrackTemplateId)
+ {
+ var trackTemplateContentEntities =
+ await _trackTemplateRepository.GetContentListAsync(x =>
+ x.TrackTemplateId == input.TrackTemplateId);
+
+ foreach (var item in trackTemplateContentEntities)
+ {
+ trackPullContentEntities.Add(new()
+ {
+ TrackPullConfigId = oldTrackPullEntity.Id,
+ TrackContentId = item.TrackContentId
+ });
+ }
+ }
+
+ ObjectMapper.Map(input, oldTrackPullEntity);
+ ObjectMapper.Map(input, oldTrackPullParamsEntity);
+
+ using (var ts = TransactionScopeHelper.Create())
+ {
+ await _trackPullConfigRepository.UpdateAsync(oldTrackPullEntity);
+ await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPullParamsEntity);
+
+ if (trackPullContentEntities.Count > 0)
+ {
+ await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id);
+ await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities);
+ }
+
+ ts.Complete();
+ }
+ }
+ break;
+
+ case OptionTypeNoNull.删除:
+ using (var ts = TransactionScopeHelper.Create())
+ {
+ await _trackPullConfigRepository.SoftDeleteAsync(x => x.Id == input.Id);
+ await _trackPullConfigRepository.SoftDeleteParamsAsync(x =>
+ x.PullOrPushConfigId == input.Id && !x.IsPush);
+ await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id);
+
+ ts.Complete();
+ }
+
+ break;
+
+ default:
+ throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum,
+ nameof(EditTrackPullConfigInput.Options)]);
+ }
+
+ return true;
+ }
+
+ ///
+ /// 轨迹拉取配置内容修改
+ ///
+ ///
+ ///
+ [HttpPost("UpdateContent")]
+ public async Task UpdateContentAsync([FromBody] UpdateTrackPullContentInput input)
+ {
+ Expression> isContentAnyExp = x => x.Id != input.Id && x.TrackPullConfigId == input.TrackPullConfigId;
+
+ if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentId == input.TrackContentId)))
+ throw new BusinessException(message: _stringLocalizer["IsTrackPullContentAny"]);
+ else if (!input.TrackContentCodeValue.IsNullOrWhiteSpace() && await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentCodeValue == input.TrackContentCodeValue)))
+ throw new BusinessException(message: _stringLocalizer["IsTrackPullContentCodeValueAny"]);
+ else if (!input.TrackStatusValue.IsNullOrWhiteSpace() && await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackStatusValue == input.TrackStatusValue)))
+ throw new BusinessException(message: _stringLocalizer["IsTrackPullContentStatusValueAny"]);
+ else if (!input.TrackContentValue.IsNullOrWhiteSpace() && await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentValue == input.TrackContentValue)))
+ throw new BusinessException(message: _stringLocalizer["IsTrackPullContentValueAny"]);
+ else if (!input.TrackKeywords.IsNullOrEmpty())
+ {
+ Expression> trackKeywordExp = _ => false;
+ input.TrackKeywords!.ForEach(item => { trackKeywordExp = trackKeywordExp.Or(x => SqlFunc.SplitIn(x.TrackKeyword, item)); });
+
+ if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(trackKeywordExp)))
+ throw new BusinessException(message: _stringLocalizer["IsTrackPullContentKeywordsAny"]);
+ }
+
+ var oldTrackPullContentEntity = await _trackPullConfigRepository.GetContentByIdAsync(input.Id) ??
+ throw new BusinessException(message: _stringLocalizer["NotFindData"]);
+
+ ObjectMapper.Map(input, oldTrackPullContentEntity);
+
+ await _trackPullConfigRepository.UpdateContentAsync(oldTrackPullContentEntity);
+
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs
new file mode 100644
index 00000000..62df4046
--- /dev/null
+++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs
@@ -0,0 +1,39 @@
+using SJZY.Expand.ABP.Core;
+using SJZY.Track.Application.Contract.Services;
+using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
+using SJZY.Track.Domain.Queries;
+using Volo.Abp.DependencyInjection;
+
+namespace SJZY.Track.Application.Services.TrackPush;
+
+public class TrackPushCacheService : ITrackPushCacheService, ITransientDependency
+{
+ private readonly IBasicQuery _trackPushConfigQuery;
+
+ private string RedisKey(int customId) => GlobalConst.TrackPushKeyPrefix + customId;
+
+ public TrackPushCacheService(IBasicQuery trackPushConfigQuery)
+ {
+ _trackPushConfigQuery = trackPushConfigQuery;
+ }
+
+ public async Task IsPushAsync(int customId)
+ {
+ var isPush =
+ await RedisHelper.Client.GetAsync(RedisKey(customId));
+
+ if (isPush == null)
+ {
+ isPush = await _trackPushConfigQuery.GetFirstAsync(x => x.CustomId == customId,
+ x => x.IsAutoPush);
+ await RedisHelper.Client.SetAsync(RedisKey(customId), isPush);
+ }
+
+ return (bool)isPush;
+ }
+
+ public async Task UpdateAsync(int customId, bool isPush)
+ {
+ await RedisHelper.Client.SetAsync(RedisKey(customId), isPush);
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs
new file mode 100644
index 00000000..1b009a95
--- /dev/null
+++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs
@@ -0,0 +1,290 @@
+using Microsoft.Extensions.Localization;
+using SJZY.Expand.ABP.Core;
+using SJZY.Expand.ABP.Core.Localization;
+using SJZY.Expand.ABP.Core.PublicMethords;
+using SJZY.Track.Application.Contract.Dtos.TrackPush;
+using SJZY.Track.Application.Contract.Services;
+using SJZY.Track.Application.Localization;
+using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
+using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
+using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
+using SJZY.Track.Domain.Dtos.Common;
+using SJZY.Track.Domain.Dtos.TrackPush;
+using SqlSugar;
+using System.Linq.Expressions;
+using Volo.Abp.DependencyInjection;
+
+namespace SJZY.Track.Application.Services.TrackPush;
+
+///
+/// 轨迹推送
+///
+[ApiExplorerSettings(GroupName = "轨迹推送")]
+[Route("/Track/PushConfig")]
+public class TrackPushService : ApplicationService, ITransientDependency
+{
+ private readonly IStringLocalizer _stringLocalizer;
+ private readonly ITrackPushConfigRepository _trackPushConfigRepository;
+ private readonly ITrackTemplateRepository _trackTemplateRepository;
+ private readonly ITrackPullConfigRepository _trackPullConfigRepository;
+ private readonly ITrackPushCacheService _trackPushCacheService;
+
+ public TrackPushService(
+ IStringLocalizer stringLocalizer,
+ ITrackPushConfigRepository trackPushConfigRepository,
+ ITrackTemplateRepository trackTemplateRepository,
+ ITrackPullConfigRepository trackPullConfigRepository,
+ ITrackPushCacheService trackPushCacheService)
+ {
+ _stringLocalizer = stringLocalizer;
+ _trackPushConfigRepository = trackPushConfigRepository;
+ _trackTemplateRepository = trackTemplateRepository;
+ _trackPullConfigRepository = trackPullConfigRepository;
+ _trackPushCacheService = trackPushCacheService;
+ }
+
+ ///
+ /// 轨迹推送配置列表
+ ///
+ ///
+ ///
+ [HttpPost("GetPage")]
+ public async Task> GetPageAsync([FromBody] KeywordsInputVO input)
+ {
+ return await _trackPushConfigRepository.GetPageAsync(input);
+ }
+
+ ///
+ /// 轨迹推送配置内容列表
+ ///
+ ///
+ ///
+ [HttpPost("GetContentPage")]
+ public async Task> GetContentPageAsync([FromBody] GetTrackPushContentPageInputVO input)
+ {
+ return await _trackPushConfigRepository.GetContentPageAsync(input);
+ }
+
+ ///
+ /// 轨迹推送配置详情
+ ///
+ ///
+ ///
+ [HttpGet("GetDetail")]
+ public async Task GetDetailAsync(int id)
+ {
+ var res = await _trackPushConfigRepository.GetDetailAsync(id);
+ if (res is null) return null;
+
+ List trackTemplateIds = res.TrackTemplateId.Split(',').Select(int.Parse).ToList();
+
+ var trackTemplateEntities = await _trackTemplateRepository.GetListAsync(x => trackTemplateIds.Contains(x.Id));
+
+ trackTemplateEntities.ForEach(item => { (res.TrackTemplate ??= new()).Add(new() { Value = item.Id, Key = item.Name }); });
+
+ return res;
+ }
+
+ ///
+ /// 轨迹推送配置内容详情
+ ///
+ ///
+ ///
+ [HttpGet("GetContentDetail")]
+ public async Task GetContentDetailAsync(int id)
+ {
+ return await _trackPushConfigRepository.GetContentDetailAsync(id);
+ }
+
+ ///
+ /// 轨迹推送配置编辑
+ ///
+ ///
+ ///
+ [HttpPost("Edit")]
+ public async Task EditAsync([FromBody] EditTrackPushConfigInput input)
+ {
+ if (input.Options != OptionTypeNoNull.删除)
+ {
+ Expression> isAnyExp = x =>
+ x.SubSystemId == input.SubSystemId && x.CustomId == input.CustomId && x.ServiceProviderId == input.ServiceProviderId;
+ if (input.Options == OptionTypeNoNull.修改) isAnyExp = isAnyExp.And(x => x.Id != input.Id);
+
+ var trackTemplateIdExp = Expressionable.Create();
+ input.TrackTemplateIds?.ForEach(item => { trackTemplateIdExp.Or(x => SqlFunc.SplitIn(x.TrackTemplateId, item.ToString())); });
+
+ isAnyExp = isAnyExp.And(trackTemplateIdExp.ToExpression());
+
+ if (await _trackPushConfigRepository.IsAnyAsync(isAnyExp))
+ throw new BusinessException(message: _stringLocalizer["IsTrackPushConfigAny"]);
+ }
+
+ switch (input.Options)
+ {
+ case OptionTypeNoNull.新增:
+ {
+ var trackPushEntity = ObjectMapper.Map(input);
+ var trackPushParamsEntity = ObjectMapper.Map(input);
+
+ using (var ts = TransactionScopeHelper.Create())
+ {
+ int id = await _trackPushConfigRepository.InsertReturnIdentityAsync(trackPushEntity);
+
+ trackPushParamsEntity.PullOrPushConfigId = id;
+ await _trackPullConfigRepository.InsertParamsAsync(trackPushParamsEntity);
+
+ if (input.IsAutoPush) await _trackPushCacheService.IsPushAsync(input.CustomId);
+
+ ts.Complete();
+ }
+ }
+ break;
+
+ case OptionTypeNoNull.修改:
+ {
+ var oldTrackPushEntity = await _trackPushConfigRepository.GetFirstAsync(x => x.Id == input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]);
+
+ int oldCustomId = oldTrackPushEntity.CustomId;
+
+ var oldTrackPushParamsEntity =
+ await _trackPullConfigRepository.GetParamsSingleAsync(x =>
+ x.PullOrPushConfigId == input.Id && x.IsPush);
+
+ ObjectMapper.Map(input, oldTrackPushEntity);
+ ObjectMapper.Map(input, oldTrackPushParamsEntity);
+
+ using (var ts = TransactionScopeHelper.Create())
+ {
+ await _trackPushConfigRepository.UpdateAsync(oldTrackPushEntity);
+ await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPushParamsEntity);
+
+ await _trackPushCacheService.UpdateAsync(oldCustomId, false);
+ if (input.IsAutoPush) await _trackPushCacheService.IsPushAsync(input.CustomId);
+
+ ts.Complete();
+ }
+ }
+ break;
+
+ case OptionTypeNoNull.删除:
+ {
+ var oldTrackPushEntity = await _trackPushConfigRepository.GetFirstAsync(x => x.Id == input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]);
+
+ using (var ts = TransactionScopeHelper.Create())
+ {
+ await _trackPushConfigRepository.SoftDeleteAsync(x => x.Id == input.Id);
+ await _trackPullConfigRepository.SoftDeleteParamsAsync(x =>
+ x.PullOrPushConfigId == input.Id && x.IsPush);
+ await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.TrackPushConfigId == input.Id);
+
+ await _trackPushCacheService.UpdateAsync(oldTrackPushEntity.CustomId, false);
+
+ ts.Complete();
+ }
+ }
+ break;
+
+ default:
+ throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum,
+ nameof(EditTrackPushConfigInput.Options)]);
+ }
+
+ return true;
+ }
+
+ ///
+ /// 轨迹推送配置内容编辑
+ ///
+ ///
+ ///
+ [HttpPost("EditContent")]
+ public async Task EditContentAsync([FromBody] EditTrackPushContentInput input)
+ {
+ if (input.Options != OptionTypeNoNull.删除)
+ {
+ Expression> isContentAnyExp = x => x.TrackPushConfigId == input.TrackPushConfigId;
+ if (input.Options == OptionTypeNoNull.修改) isContentAnyExp = isContentAnyExp.And(x => x.Id != input.Id);
+
+ if (await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentId == input.TrackContentId)))
+ throw new BusinessException(message: _stringLocalizer["IsTrackPushContentAny"]);
+ else if (!input.TrackContentCodeValue.IsNullOrWhiteSpace() && await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentCodeValue == input.TrackContentCodeValue)))
+ throw new BusinessException(message: _stringLocalizer["IsTrackPushContentCodeValueAny"]);
+ else if (!input.TrackStatusValue.IsNullOrWhiteSpace() && await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackStatusValue == input.TrackStatusValue)))
+ throw new BusinessException(message: _stringLocalizer["IsTrackPushContentStatusValueAny"]);
+ else if (!input.TrackContentValue.IsNullOrWhiteSpace() && await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentValue == input.TrackContentValue)))
+ throw new BusinessException(message: _stringLocalizer["IsTrackPushContentValueAny"]);
+ else if (!input.TrackEnContentValue.IsNullOrWhiteSpace() && await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackEnContentValue == input.TrackEnContentValue)))
+ throw new BusinessException(message: _stringLocalizer["IsTrackPushEnContentValueAny"]);
+ }
+
+ switch (input.Options)
+ {
+ case OptionTypeNoNull.新增:
+ {
+ int maxSort = await _trackPushConfigRepository.ContentMaxAsync(x => x.Sort, x => x.TrackPushConfigId == input.TrackPushConfigId);
+
+ var entity = ObjectMapper.Map(input);
+ entity.Sort = maxSort + 1;
+
+ await _trackPushConfigRepository.InsertContentAsync(entity);
+
+ break;
+ }
+
+ case OptionTypeNoNull.修改:
+ {
+ var entity = await _trackPushConfigRepository.GetContentByIdAsync(input.Id!.Value) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]);
+
+ ObjectMapper.Map(input, entity);
+
+ await _trackPushConfigRepository.UpdateContentAsync(entity);
+
+ break;
+ }
+
+ case OptionTypeNoNull.删除:
+ {
+ var entity = await _trackPushConfigRepository.GetContentByIdAsync(input.Id!.Value) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]);
+
+ using (var ts = TransactionScopeHelper.Create())
+ {
+ await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.Id == input.Id);
+
+ await _trackPushConfigRepository.UpdateContentAsync(x => x.Sort == x.Sort - 1, x => x.TrackPushConfigId == entity.TrackPushConfigId && x.Sort > entity.Sort);
+
+ ts.Complete();
+ }
+
+ break;
+ }
+
+ default:
+ throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum,
+ nameof(EditTrackPushContentInput.Options)]);
+ }
+
+ return true;
+ }
+
+ ///
+ /// 轨迹推送配置内容排序
+ ///
+ ///
+ ///
+ [HttpPost("SortContent")]
+ public async Task SortContentAsync([FromBody] SortTrackPushContentInput input)
+ {
+ List ids = input.SortInfo.Select(x => int.Parse(x.Key)).ToList();
+
+ var trackPushContentEntities = await _trackPushConfigRepository.GetContentListAsync(x => ids.Contains(x.Id));
+
+ trackPushContentEntities.ForEach(item =>
+ {
+ item.Sort = input.SortInfo.Single(x => x.Key == item.Id.ToString()).Value;
+ });
+
+ await _trackPushConfigRepository.UpdateContentRangeAsync(trackPushContentEntities);
+
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs
new file mode 100644
index 00000000..979d412d
--- /dev/null
+++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs
@@ -0,0 +1,175 @@
+using Microsoft.Extensions.Localization;
+using SJZY.Track.Application.Contract.Dtos.TrackStatus;
+using SJZY.Track.Application.Localization;
+using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
+using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
+using SJZY.Track.Domain.Dtos.TrackStatus;
+using Volo.Abp.DependencyInjection;
+
+namespace SJZY.Track.Application.Services.TrackStatus;
+
+///
+/// 轨迹状态
+///
+[ApiExplorerSettings(GroupName = "轨迹状态")]
+[Route("/Track/Status")]
+public class TrackStatusService : ApplicationService, ITransientDependency
+{
+ private readonly IStringLocalizer _stringLocalizer;
+ private readonly ITrackStatusRepository _trackStatusRepository;
+ private readonly ITrackContentRepository _trackContentRepository;
+
+ public TrackStatusService(
+ IStringLocalizer stringLocalizer,
+ ITrackStatusRepository trackStatusRepository,
+ ITrackContentRepository trackContentRepository
+ )
+ {
+ this._stringLocalizer = stringLocalizer;
+ this._trackStatusRepository = trackStatusRepository;
+ this._trackContentRepository=trackContentRepository;
+ }
+
+ ///
+ /// 轨迹状态编辑
+ ///
+ ///
+ [HttpPost("Edit")]
+ public async Task EditAsync(EditTrackStatusInput input)
+ {
+ return input.Options switch
+ {
+ OptionType.新增 => await AddAsync(input),
+ OptionType.修改 => await UpdateAsync(input),
+ OptionType.删除 => await DeleteAsync(input),
+ _ => throw new BusinessException(message: "当前操作动作不合法")
+ };
+ }
+
+ ///
+ /// 根据状态id获取轨迹状态
+ ///
+ ///
+ ///
+ [HttpGet("GetDetail")]
+ public async Task> GetDetailAsync(int id)
+ {
+ var detailInfo = await _trackStatusRepository.GetDetailAsync(id);
+ if (detailInfo == null)
+ {
+ return new UnifyResultDto(false, null, "未查询到轨迹状态");
+ }
+
+ var dto = ObjectMapper.Map(detailInfo);
+ return new UnifyResultDto("200", "", dto);
+ }
+
+ ///
+ /// 获取分页轨迹状态
+ ///
+ ///
+ ///
+ [HttpPost("GetList")]
+ public async Task> GetPageTrackStatus(GetPageTrackStatusInput input)
+ {
+ var vo = ObjectMapper.Map(input);
+ var resultDto = await _trackStatusRepository.GetPageTrackStatus(vo);
+ var pageResultDto =
+ ObjectMapper.Map, UnifyPageResultDto>(
+ resultDto);
+
+ return pageResultDto;
+ }
+
+ #region 私有方法
+
+ private async Task AddAsync(EditTrackStatusInput input)
+ {
+ #region 业务校验
+
+ var trackStatusEntitys = await _trackStatusRepository.GetListAsync(a => a.SubSystemId == input.SubSystemId &&
+ (a.Code == input.Code ||
+ a.Status == input.TrackStatus || a.EnStatus == input.EntrackStatus));
+ if (trackStatusEntitys.Any())
+ {
+ //throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]);
+ //throw new BusinessException(message: "当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在");
+ var trackStatusCode = trackStatusEntitys.FirstOrDefault(t => t.Code==input.Code);
+ if (trackStatusCode!=null)
+ {
+ throw new BusinessException(message: "该子系统下轨迹状态代码已存在");
+ }
+ var trackStatusName = trackStatusEntitys.FirstOrDefault(t => t.Status==input.TrackStatus);
+ if (trackStatusName!=null)
+ {
+ throw new BusinessException(message: "该子系统下轨迹状态已存在");
+ }
+ var trackStatusEnName = trackStatusEntitys.FirstOrDefault(t => t.EnStatus==input.EntrackStatus);
+ if (trackStatusEnName!=null)
+ {
+ throw new BusinessException(message: "该子系统下轨迹状态英文已存在");
+ }
+ }
+
+ #endregion
+
+ var entity = ObjectMapper.Map(input);
+ var isTrue = await _trackStatusRepository.InsertAsync(entity);
+
+ return new UnifyResultDto("200", "新增成功", isTrue);
+ }
+
+ private async Task UpdateAsync(EditTrackStatusInput input)
+ {
+ #region 业务校验
+
+ var trackStatusEntitys = await _trackStatusRepository.GetListAsync(a => a.Id != input.Id &&
+ a.SubSystemId == input.SubSystemId && (a.Code == input.Code ||
+ a.Status == input.TrackStatus || a.EnStatus == input.EntrackStatus));
+ if (trackStatusEntitys.Any())
+ {
+ //throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]);
+ //throw new BusinessException(message: "当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在");
+ var trackStatusCode = trackStatusEntitys.FirstOrDefault(t => t.Code==input.Code);
+ if (trackStatusCode!=null)
+ {
+ throw new BusinessException(message: "该子系统下轨迹状态代码已存在");
+ }
+ var trackStatusName = trackStatusEntitys.FirstOrDefault(t => t.Status==input.TrackStatus);
+ if (trackStatusName!=null)
+ {
+ throw new BusinessException(message: "该子系统下轨迹状态已存在");
+ }
+ var trackStatusEnName = trackStatusEntitys.FirstOrDefault(t => t.EnStatus==input.EntrackStatus);
+ if (trackStatusEnName!=null)
+ {
+ throw new BusinessException(message: "该子系统下轨迹状态英文已存在");
+ }
+ }
+
+ #endregion
+
+ var templateEntity = await _trackStatusRepository.GetFirstAsync(a => a.Id == input.Id);
+ ObjectMapper.Map(input, templateEntity);
+ var isTrue = await _trackStatusRepository.UpdateAsync(templateEntity);
+
+ return new UnifyResultDto("200", "修改成功", isTrue);
+ }
+
+ private async Task DeleteAsync(EditTrackStatusInput input)
+ {
+ #region 业务校验
+ var isExistStatus = await _trackContentRepository.GetFirstAsync(a => a.TrackStatusId==input.Id);
+ if (isExistStatus!=null)
+ {
+ //throw new BusinessException(message: _stringLocalizer["IsExistTrackStatus"]);
+ throw new BusinessException(message: "该状态关联轨迹内容,禁止删除");
+ }
+ #endregion
+ var isTrue = await _trackStatusRepository.SoftDeleteAsync(x => x.Id == input.Id);
+
+ return new UnifyResultDto("200", "删除成功", isTrue);
+ }
+
+ #endregion
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/ITrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/ITrackTemplateService.cs
new file mode 100644
index 00000000..f6e29107
--- /dev/null
+++ b/src/SJZY.Track.Application/Services/TrackTemplates/ITrackTemplateService.cs
@@ -0,0 +1,7 @@
+namespace SJZY.Track.Application.Services.TrackTemplates
+{
+ public interface ITrackTemplateService
+ {
+
+ }
+}
diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs
new file mode 100644
index 00000000..525add23
--- /dev/null
+++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs
@@ -0,0 +1,308 @@
+using System.Linq.Expressions;
+using Microsoft.Extensions.Localization;
+using SJZY.Expand.ABP.Core.Localization;
+using SJZY.Expand.ABP.Core.PublicMethords;
+using SJZY.Track.Application.Contract.Dtos.TrackTemplates;
+using SJZY.Track.Application.Localization;
+using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
+using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
+using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
+using SJZY.Track.Domain.Dtos.TrackTemplate;
+using Volo.Abp.DependencyInjection;
+
+namespace SJZY.Track.Application.Services.TrackTemplates;
+
+///
+/// 轨迹模版
+///
+[ApiExplorerSettings(GroupName = "轨迹模版")]
+[Route("/Track/Template")]
+public class TrackTemplateService : ApplicationService, ITransientDependency
+{
+ private readonly IStringLocalizer _stringLocalizer;
+ private readonly ITrackTemplateRepository _trackTemplateRepository;
+ private readonly ITrackPullConfigRepository _trackPullConfigRepository;
+ private readonly ITrackPushConfigRepository _trackPushConfigRepository;
+
+ ///
+ public TrackTemplateService(
+ IStringLocalizer stringLocalizer,
+ ITrackTemplateRepository trackTemplateRepository,
+ ITrackPullConfigRepository trackPullConfigRepository,
+ ITrackPushConfigRepository trackPushConfigRepository
+ )
+ {
+ _stringLocalizer = stringLocalizer;
+ _trackTemplateRepository = trackTemplateRepository;
+ _trackPullConfigRepository = trackPullConfigRepository;
+ _trackPushConfigRepository = trackPushConfigRepository;
+ }
+
+ ///
+ /// 轨迹模版编辑
+ ///
+ ///
+ [HttpPost("Edit")]
+ public async Task EditAsync(EditTrackTemplateInput input)
+ {
+ return input.Options switch
+ {
+ OptionType.新增 => await AddAsync(input),
+ OptionType.修改 => await UpdateAsync(input),
+ OptionType.删除 => await DeleteAsync(input),
+ _ => throw new BusinessException(message: "当前操作动作不合法")
+ };
+ }
+
+ ///
+ /// 根据模版id获取轨迹模版
+ ///
+ ///
+ ///
+ [HttpGet("GetDetail")]
+ public async Task> GetDetailAsync(int id)
+ {
+ var detailInfo = await _trackTemplateRepository.GetDetailAsync(id);
+ if (detailInfo == null)
+ {
+ return new UnifyResultDto(false, null, "未查询到轨迹模版");
+ }
+
+ var dto = ObjectMapper.Map(detailInfo);
+ return new UnifyResultDto("200", "", dto);
+ }
+
+ ///
+ /// 获取分页轨迹模版
+ ///
+ ///
+ ///
+ [HttpPost("GetList")]
+ public async Task> GetPageTrackTemplate(GetPageTrackTemplateInput input)
+ {
+ var vo = ObjectMapper.Map(input);
+ var resultDto = await _trackTemplateRepository.GetPageTrackTemplate(vo);
+ var pageResultDto =
+ ObjectMapper.Map, UnifyPageResultDto>(
+ resultDto);
+
+ return pageResultDto;
+ }
+
+ #region 私有方法
+
+ private async Task AddAsync(EditTrackTemplateInput input)
+ {
+ #region 业务校验
+
+ //校验模版代码唯一性
+ //var templateEntity =
+ // await _trackTemplateRepository.GetFirstAsync(
+ // a => a.SubSystemId == input.SubSystemId && a.Code == input.Code);
+ var templateEntitys = await _trackTemplateRepository.GetListAsync(a => a.SubSystemId == input.SubSystemId && (a.Code == input.Code|| a.Name==input.Name));
+ if (templateEntitys.Any())
+ {
+ //throw new BusinessException(message: _stringLocalizer["TemplateExist"]);
+ //throw new BusinessException(message: "模板代码已存在于当前选择的子系统下");
+ var trackTemplateCode = templateEntitys.FirstOrDefault(t => t.Code==input.Code);
+ if (trackTemplateCode!=null)
+ {
+ throw new BusinessException(message: "该子系统下模板代码已存在");
+ }
+ var trackTemplateName = templateEntitys.FirstOrDefault(t => t.Name==input.Name);
+ if (trackTemplateName!=null)
+ {
+ throw new BusinessException(message: "该子系统下模板名称已存在");
+ }
+ }
+
+ #endregion 业务校验
+
+ var entity = ObjectMapper.Map(input);
+ var isTrue = await _trackTemplateRepository.InsertAsync(entity);
+
+ return new UnifyResultDto("200", "新增成功", isTrue);
+ }
+
+ private async Task UpdateAsync(EditTrackTemplateInput input)
+ {
+ #region 业务校验
+
+ var templateEntitys = await _trackTemplateRepository.GetListAsync(a =>
+ a.Id != input.Id && a.SubSystemId == input.SubSystemId && (a.Code == input.Code || a.Name==input.Name));
+ if (templateEntitys.Any())
+ {
+ //throw new BusinessException(message: "模板代码已存在于当前选择的子系统下");
+ var trackTemplateCode = templateEntitys.FirstOrDefault(t => t.Code==input.Code);
+ if (trackTemplateCode!=null)
+ {
+ throw new BusinessException(message: "该子系统下模板代码已存在");
+ }
+ var trackTemplateName = templateEntitys.FirstOrDefault(t => t.Name==input.Name);
+ if (trackTemplateName!=null)
+ {
+ throw new BusinessException(message: "该子系统下模板名称已存在");
+ }
+ }
+
+ #endregion 业务校验
+
+ var templateEntity = await _trackTemplateRepository.GetFirstAsync(a => a.Id == input.Id);
+ ObjectMapper.Map(input, templateEntity);
+ var isTrue = await _trackTemplateRepository.UpdateAsync(templateEntity);
+
+ return new UnifyResultDto("200", "修改成功", isTrue);
+ }
+
+ private async Task DeleteAsync(EditTrackTemplateInput input)
+ {
+ #region 业务校验
+
+ //查询看看在轨迹拉取里面有没有被占用
+ var isExisistTrackPullConfigs = await _trackPullConfigRepository.GetListAsync(a => a.TrackTemplateId == input.Id);
+ if (isExisistTrackPullConfigs.Any())
+ {
+ //throw new BusinessException(message: _stringLocalizer["IsExistTrackPullConfig"]);
+ throw new BusinessException(message: "该模板存在映射,禁止删除");
+ }
+ //轨迹推送里看看是否被占用
+ var isExisistTrackPushConfigs = await _trackPushConfigRepository.GetListAsync(a => a.TrackTemplateId.Contains(input.Id.ToString()));
+ if (isExisistTrackPushConfigs.Any())
+ {
+ throw new BusinessException(message: "该模板存在映射,禁止删除");
+ }
+
+ #endregion 业务校验
+
+ var isTrue = await _trackTemplateRepository.SoftDeleteAsync(x => x.Id == input.Id);
+
+ return new UnifyResultDto("200", "删除成功", isTrue);
+ }
+
+ #endregion 私有方法
+
+ ///
+ /// 轨迹模板内容列表
+ ///
+ ///
+ ///
+ [HttpPost("GetContentPage")]
+ public async Task> GetContentPageAsync(
+ [FromBody] GetTrackTemplateContentPageInputVO input)
+ {
+ return await _trackTemplateRepository.GetContentPageAsync(input);
+ }
+
+ ///