Merge branch 'S01-轨迹中台' of http://192.168.80.50:3000/Dotnet/SJZY.Track.Api into S01-轨迹中台

This commit is contained in:
dingenwen 2024-03-02 09:00:35 +08:00
commit 45ac0a3e53
157 changed files with 2088 additions and 1907 deletions

View File

@ -10,9 +10,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{DAC93270-5A2
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0E2537C3-6EF3-4085-9BD2-CF923E53F82A}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0E2537C3-6EF3-4085-9BD2-CF923E53F82A}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SJZY.Track.Infrastructure", "src\SJZY.Track.Infrastructure\SJZY.Track.Infrastructure.csproj", "{D9CF5706-1972-414F-821E-AA32C13B8570}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SJZY.Track.Repository", "src\SJZY.Track.Repository\SJZY.Track.Repository.csproj", "{D9CF5706-1972-414F-821E-AA32C13B8570}"
EndProject 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 EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SJZY.Track.Test", "test\SJZY.Track.Test\SJZY.Track.Test.csproj", "{3A53539C-4A85-4E5D-A071-7B4B193AB0E0}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SJZY.Track.Test", "test\SJZY.Track.Test\SJZY.Track.Test.csproj", "{3A53539C-4A85-4E5D-A071-7B4B193AB0E0}"
EndProject EndProject

View File

@ -13,7 +13,7 @@ try
.Host.AddAppSettingsSecretsJson() .Host.AddAppSettingsSecretsJson()
.UseAutofac(); .UseAutofac();
await builder.AddApplicationAsync<SJZYTrackApiModule>(); await builder.AddApplicationAsync<SjzyTrackApiModule>();
var app = builder.Build(); var app = builder.Build();
await app.InitializeApplicationAsync(); await app.InitializeApplicationAsync();

View File

@ -1,21 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="../../common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<GenerateDocumentationFile>True</GenerateDocumentationFile> <GenerateDocumentationFile>True</GenerateDocumentationFile>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext> <DockerfileContext>..\..</DockerfileContext>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<Compile Remove="logs\**" />
<Content Remove="logs\**" />
<EmbeddedResource Remove="logs\**" />
<None Remove="logs\**" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="FluentValidation.AspNetCore" Version="11.2.2" /> <PackageReference Include="FluentValidation.AspNetCore" Version="11.2.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.2" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.2" />
@ -26,9 +19,8 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\SJZY.Track.Application\SJZY.Track.Application.csproj" /> <ProjectReference Include="..\SJZY.Track.Application\SJZY.Track.Application.csproj" />
<ProjectReference Include="..\SJZY.Track.Infrastructure\SJZY.Track.Infrastructure.csproj"/> <ProjectReference Include="..\SJZY.Track.Repository\SJZY.Track.Repository.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -9,7 +9,7 @@ using SJZY.Expand.ABP.Core.Prometheus;
using SJZY.Expand.ABP.Core.Redis; using SJZY.Expand.ABP.Core.Redis;
using SJZY.Expand.ABP.Core.Swagger; using SJZY.Expand.ABP.Core.Swagger;
using SJZY.Track.Application; using SJZY.Track.Application;
using SJZY.Track.Infrastructure; using SJZY.Track.Repository;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Serilog; using Volo.Abp.AspNetCore.Serilog;
@ -27,16 +27,17 @@ namespace SJZY.Track.Api
typeof(SjzyAbpCodeModule), typeof(SjzyAbpCodeModule),
typeof(AbpAspNetCoreMvcModule), typeof(AbpAspNetCoreMvcModule),
typeof(AbpAspNetCoreSerilogModule), typeof(AbpAspNetCoreSerilogModule),
typeof(ApplicationModule), typeof(SjzyTrackApplicationModule),
typeof(SJZYTrackInfrastructureModule) typeof(SjzyTrackRepositoryModule)
)] )]
public class SJZYTrackApiModule : AbpModule public class SjzyTrackApiModule : AbpModule
{ {
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)
{ {
var environment = context.Services.GetHostingEnvironment(); var environment = context.Services.GetHostingEnvironment();
var configuration = context.Services.GetConfiguration(); var configuration = context.Services.GetConfiguration();
context.Services.AddSwagger(); context.Services.AddSwagger();
//过滤器相关配置 //过滤器相关配置
context.Services.AddMvc(options => context.Services.AddMvc(options =>
{ {
@ -60,7 +61,6 @@ namespace SJZY.Track.Api
Configure<AbpJsonOptions>(options => options.OutputDateTimeFormat = "yyyy-MM-dd HH:mm:ss"); Configure<AbpJsonOptions>(options => options.OutputDateTimeFormat = "yyyy-MM-dd HH:mm:ss");
Configure<AbpAuditingOptions>(options => { options.IsEnabled = false; }); Configure<AbpAuditingOptions>(options => { options.IsEnabled = false; });
context.Services.AddRedis(); context.Services.AddRedis();
} }

View File

@ -0,0 +1,5 @@
namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
public class DeleteOrderInput : OrderNoInfo
{
}

View File

@ -1,10 +1,4 @@
using System; namespace SJZY.Track.Application.Contract.Dtos.ProvideServices
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SJZY.Track.Application.Dtos.ProvideServices
{ {
public class GetOrderDetailsInput public class GetOrderDetailsInput
{ {

View File

@ -0,0 +1,100 @@
namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
public class GetPageTrackOrderInput : PageInfoInput
{
/// <summary>
/// 子系统id
/// </summary>
public int SubSystemId { get; set; }
/// <summary>
/// 单号
/// </summary>
public List<string>? OrderNos { get; set; }
/// <summary>
/// 创建时间开始
/// </summary>
public DateTime? CreateTimeStart { get; set; }
/// <summary>
/// 创建时间截止
/// </summary>
public DateTime? CreateTimeEnd { get; set; }
}
/// <summary>
/// 轨迹订单Dto
/// </summary>
public class TrackOrderDto
{
/// <summary>
/// 轨迹订单id
/// </summary>
public int Id { get; set; }
/// <summary>
/// 订单类型id
/// </summary>
public int OrderType { get; set; }
/// <summary>
/// 订单名称
/// </summary>
public string? OrderTypeName { get; set; }
/// <summary>
/// 订单号
/// </summary>
public string? OrderNumber { get; set; }
/// <summary>
/// 轨迹模版
/// </summary>
public string? TrackTemplateNames { get; set; }
/// <summary>
/// 客户简称
/// </summary>
public string? CustomerShortName { get; set; }
/// <summary>
/// 客户代码
/// </summary>
public string? CustomerCode { get; set; }
/// <summary>
/// 订单明细(json)
/// </summary>
public string? OrderDetails { get; set; }
/// <summary>
/// 最新轨迹内容
/// </summary>
public string? NewestTrackContent { get; set; }
/// <summary>
/// 最新轨迹内容英文
/// </summary>
public string? NewestTrackEnContent { get; set; }
/// <summary>
/// 最新轨迹发生地
/// </summary>
public string? NewestTrackPlace { get; set; }
/// <summary>
/// 是否完结
/// </summary>
public bool IsFinish { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreateTime { get; set; }
/// <summary>
/// 子系统
/// </summary>
public string SubSystem { get; set; }
}

View File

@ -1,4 +1,4 @@
namespace SJZY.Track.Application.Dtos.ProvideServices; namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
public class GetTrackInput public class GetTrackInput
{ {

View File

@ -1,4 +1,4 @@
namespace SJZY.Track.Application.Dtos.ProvideServices; namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
public class GetTrackOutput public class GetTrackOutput
{ {

View File

@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace SJZY.Track.Application.Dtos.ProvideServices; namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
public class LinkOrderInput public class LinkOrderInput
{ {

View File

@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace SJZY.Track.Application.Dtos.ProvideServices; namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
public class OrderNoInfo public class OrderNoInfo
{ {

View File

@ -1,4 +1,4 @@
namespace SJZY.Track.Application.Dtos.ProvideServices; namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
public class UpdateOrderInput : OrderNoInfo public class UpdateOrderInput : OrderNoInfo
{ {

View File

@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace SJZY.Track.Application.Dtos.ProvideServices; namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
public class UpsertOrderInput : UpdateOrderInput public class UpsertOrderInput : UpdateOrderInput
{ {

View File

@ -1,16 +1,16 @@
namespace SJZY.Track.Application.Dtos.ProvideServices; namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
public class UpsertTrackInput : OrderNoInfo public class UpsertTrackInput : OrderNoInfo
{ {
/// <summary> /// <summary>
/// 轨迹内容代码 /// 轨迹内容代码
/// </summary> /// </summary>
public string TrackCode { get; set; } public string TrackCode { get; set; } = null!;
/// <summary> /// <summary>
/// 轨迹发生地 /// 轨迹发生地
/// </summary> /// </summary>
public string TrackPlace { get; set; } public string TrackPlace { get; set; } = null!;
/// <summary> /// <summary>
/// 轨迹发生时间 /// 轨迹发生时间

View File

@ -1,10 +1,4 @@
using System; namespace SJZY.Track.Application.Contract.Dtos.TrackContents
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SJZY.Track.Application.Dtos.TrackContents
{ {
public class EditTrackContentInput public class EditTrackContentInput
{ {
@ -102,4 +96,3 @@ namespace SJZY.Track.Application.Dtos.TrackContents
public string TrackFlag { get; set; } public string TrackFlag { get; set; }
} }
} }

View File

@ -0,0 +1,41 @@
namespace SJZY.Track.Application.Contract.Dtos.TrackContents;
public class EditTrackContentMapInput
{
public int? Id { get; set; }
/// <summary>
/// 映射子系统id
/// </summary>
public int MapSubSystemId { get; set; }
/// <summary>
/// 映射轨迹内容代码
/// </summary>
public string MapTrackContentCode { get; set; }
/// <summary>
/// 映射轨迹内容id
/// </summary>
public int MapTrackContentId { get; set; }
/// <summary>
/// 操作类型
/// </summary>
public OptionTypeNoNull Options { get; set; }
/// <summary>
/// 源子系统id
/// </summary>
public int SubSystemId { get; set; }
/// <summary>
/// 源轨迹内容代码
/// </summary>
public string TrackContentCode { get; set; }
/// <summary>
/// 源轨迹内容id
/// </summary>
public int TrackContentId { get; set; }
}

View File

@ -1,10 +1,4 @@
using System; namespace SJZY.Track.Application.Contract.Dtos.TrackContents
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SJZY.Track.Application.Dtos.TrackContents
{ {
public class GetPageTrackContentInput : PageInfoInput public class GetPageTrackContentInput : PageInfoInput
{ {
@ -16,7 +10,12 @@ namespace SJZY.Track.Application.Dtos.TrackContents
/// <summary> /// <summary>
/// 关键字 /// 关键字
/// </summary> /// </summary>
public string Keywords { get; set; } = ""; public string? Keywords { get; set; }
/// <summary>
/// 选中的轨迹内容id
/// </summary>
public List<int>? SelectIds { get; set; }
} }
public class GetTrackContentListDto public class GetTrackContentListDto

View File

@ -1,10 +1,4 @@
using System; namespace SJZY.Track.Application.Contract.Dtos.TrackFlags
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SJZY.Track.Application.Dtos.TrackFlags
{ {
public class EditTrackFlagInput public class EditTrackFlagInput
{ {

View File

@ -1,10 +1,4 @@
using System; namespace SJZY.Track.Application.Contract.Dtos.TrackFlags
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SJZY.Track.Application.Dtos.TrackFlags
{ {
public class GetTrackFlagListDto public class GetTrackFlagListDto
{ {
@ -61,6 +55,11 @@ namespace SJZY.Track.Application.Dtos.TrackFlags
/// </summary> /// </summary>
public int SubSystemId { get; set; } public int SubSystemId { get; set; }
/// <summary>
/// 选中的轨迹标记id
/// </summary>
public List<int>? SelectIds { get; set; }
///// <summary> ///// <summary>
///// 关键字 ///// 关键字
///// </summary> ///// </summary>

View File

@ -1,4 +1,4 @@
namespace SJZY.Track.Application.Dtos.TrackPull; namespace SJZY.Track.Application.Contract.Dtos.TrackPull;
public class EditTrackPullConfigInput public class EditTrackPullConfigInput
{ {
@ -37,27 +37,27 @@ public class EditTrackPullConfigInput
/// <summary> /// <summary>
/// 拉取轨迹时区 /// 拉取轨迹时区
/// </summary> /// </summary>
public string TackTimeZoneName { get; set; } public string? TackTimeZoneName { get; set; }
/// <summary> /// <summary>
/// 拉取轨迹内容代码 /// 拉取轨迹内容代码
/// </summary> /// </summary>
public string TrackContentCodeName { get; set; } public string? TrackContentCodeName { get; set; }
/// <summary> /// <summary>
/// 拉取轨迹内容 /// 拉取轨迹内容
/// </summary> /// </summary>
public string TrackContentName { get; set; } public string? TrackContentName { get; set; }
/// <summary> /// <summary>
/// 拉取轨迹发生地 /// 拉取轨迹发生地
/// </summary> /// </summary>
public string TrackPlaceName { get; set; } public string? TrackPlaceName { get; set; }
/// <summary> /// <summary>
/// 拉取轨迹状态 /// 拉取轨迹状态
/// </summary> /// </summary>
public string TrackStatusName { get; set; } public string? TrackStatusName { get; set; }
/// <summary> /// <summary>
/// 轨迹模板id /// 轨迹模板id
@ -67,5 +67,5 @@ public class EditTrackPullConfigInput
/// <summary> /// <summary>
/// 拉取轨迹发生时间 /// 拉取轨迹发生时间
/// </summary> /// </summary>
public string TrackTimeName { get; set; } public string? TrackTimeName { get; set; }
} }

View File

@ -1,4 +1,4 @@
namespace SJZY.Track.Application.Dtos.TrackPull; namespace SJZY.Track.Application.Contract.Dtos.TrackPull;
public class UpdateTrackPullContentInput public class UpdateTrackPullContentInput
{ {
@ -47,5 +47,5 @@ public class UpdateTrackPullContentInput
/// <summary> /// <summary>
/// 轨迹时区GMT /// 轨迹时区GMT
/// </summary> /// </summary>
public string TrackTimeZone { get; set; } public double? TrackTimeZone { get; set; }
} }

View File

@ -0,0 +1,81 @@
namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
public class EditTrackPushConfigInput
{
/// <summary>
/// 客户id
/// </summary>
public int CustomId { get; set; }
/// <summary>
/// 推送扩展字段
/// </summary>
public string ExpandFieldsName { get; set; }
public int? Id { get; set; }
/// <summary>
/// 是否自动推送
/// </summary>
public bool IsAutoPush { get; set; }
/// <summary>
/// 操作类型
/// </summary>
public OptionTypeNoNull Options { get; set; }
/// <summary>
/// 推送轨迹订单号
/// </summary>
public string OrderNoName { get; set; }
/// <summary>
/// 服务商id
/// </summary>
public int ServiceProviderId { get; set; }
/// <summary>
/// 子系统id
/// </summary>
public int SubSystemId { get; set; }
/// <summary>
/// 推送轨迹时区
/// </summary>
public string TackTimeZoneName { get; set; }
/// <summary>
/// 推送轨迹内容代码
/// </summary>
public string TrackContentCodeName { get; set; }
/// <summary>
/// 推送轨迹内容
/// </summary>
public string TrackContentName { get; set; }
/// <summary>
/// 推送轨迹内容英文
/// </summary>
public string TrackEnContentName { get; set; }
/// <summary>
/// 推送轨迹发生地
/// </summary>
public string TrackPlaceName { get; set; }
/// <summary>
/// 推送轨迹状态
/// </summary>
public string TrackStatusName { get; set; }
/// <summary>
/// 轨迹模板id
/// </summary>
public List<int> TrackTemplateIds { get; set; }
/// <summary>
/// 推送轨迹发生时间
/// </summary>
public string TrackTimeName { get; set; }
}

View File

@ -0,0 +1,61 @@
namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
public class EditTrackPushContentInput
{
/// <summary>
/// 扩展字段参数值
/// </summary>
public string ExpandFieldsValue { get; set; }
public int? Id { get; set; }
/// <summary>
/// 操作类型
/// </summary>
public OptionTypeNoNull Options { get; set; }
/// <summary>
/// 推送单号类型
/// </summary>
public int OrderNoType { get; set; }
/// <summary>
/// 推送轨迹排序
/// </summary>
public int Sort { get; set; }
/// <summary>
/// 轨迹代码参数值
/// </summary>
public string TrackContentCodeValue { get; set; }
/// <summary>
/// 轨迹内容id
/// </summary>
public int TrackContentId { get; set; }
/// <summary>
/// 轨迹内容参数值
/// </summary>
public string TrackContentValue { get; set; }
/// <summary>
/// 轨迹内容英文参数值
/// </summary>
public string TrackEnContentValue { get; set; }
/// <summary>
/// 轨迹推送配置id
/// </summary>
public int TrackPushConfigId { get; set; }
/// <summary>
/// 轨迹状态参数值
/// </summary>
public string TrackStatusValue { get; set; }
/// <summary>
/// 轨迹时区GMT
/// </summary>
public double? TrackTimeZone { get; set; }
}

View File

@ -0,0 +1,5 @@
namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
public class SortTrackPushContentInput
{
}

View File

@ -1,10 +1,4 @@
using System; namespace SJZY.Track.Application.Contract.Dtos.TrackStatus
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SJZY.Track.Application.Dtos.TrackStatus
{ {
public class EditTrackStatusInput public class EditTrackStatusInput
{ {

View File

@ -1,10 +1,4 @@
using System; namespace SJZY.Track.Application.Contract.Dtos.TrackStatus
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SJZY.Track.Application.Dtos.TrackStatus
{ {
public class GetTrackStatusDetailDto public class GetTrackStatusDetailDto
{ {

View File

@ -1,10 +1,4 @@
using System; namespace SJZY.Track.Application.Contract.Dtos.TrackStatus
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SJZY.Track.Application.Dtos.TrackStatus
{ {
public class GetTrackStatusListDto public class GetTrackStatusListDto
{ {
@ -70,6 +64,11 @@ namespace SJZY.Track.Application.Dtos.TrackStatus
/// <summary> /// <summary>
/// 关键字 /// 关键字
/// </summary> /// </summary>
public string Keywords { get; set; } = ""; public string? Keywords { get; set; }
/// <summary>
/// 选中的轨迹状态id
/// </summary>
public List<int>? SelectIds { get; set;}
} }
} }

View File

@ -1,4 +1,4 @@
namespace SJZY.Track.Application.Dtos.TrackTemplates; namespace SJZY.Track.Application.Contract.Dtos.TrackTemplates;
/// <inheritdoc/> /// <inheritdoc/>
public class EditTrackTemplateContentInput public class EditTrackTemplateContentInput

View File

@ -1,4 +1,4 @@
namespace SJZY.Track.Application.Dtos.TrackTemplates namespace SJZY.Track.Application.Contract.Dtos.TrackTemplates
{ {
/// <summary> /// <summary>
/// 获取轨迹模版分页输入 /// 获取轨迹模版分页输入
@ -13,11 +13,16 @@
/// <summary> /// <summary>
/// 关键字 /// 关键字
/// </summary> /// </summary>
public string Keywords { get; set; } = ""; public string? Keywords { get; set; }
///// <summary>
///// 轨迹模版id,轨迹映射的查询使用
///// </summary>
//public int TrackTemplateId { get; set; }
/// <summary> /// <summary>
/// 轨迹模版id,轨迹映射的查询使用 /// 选中的轨迹模版id
/// </summary> /// </summary>
public int TrackTemplateId { get; set; } public List<int>? SelectIds { get; set; }
} }
} }

View File

@ -1,4 +1,4 @@
namespace SJZY.Track.Application.Dtos.TrackTemplates namespace SJZY.Track.Application.Contract.Dtos.TrackTemplates
{ {
/// <summary> /// <summary>
/// 获取轨迹模版详情 /// 获取轨迹模版详情

View File

@ -0,0 +1,21 @@
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
namespace SJZY.Track.Application.Contract.Events;
public class TrackUpsertEvent : UpsertTrackInput
{
/// <summary>
/// 订单id
/// </summary>
public int OrderId { get; set; }
/// <summary>
/// 子系统id
/// </summary>
public int SubSystemId { get; set; }
/// <summary>
/// 上游子系统id
/// </summary>
public int UpSubSystemId { get; set; }
}

View File

@ -0,0 +1,4 @@
// Global using directives
global using SJZY.Expand.ABP.Common.Enums;
global using SJZY.Expand.ABP.Core.Common.Dto;

View File

@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="../../common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.0.2</Version> <Version>0.0.2</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -0,0 +1,5 @@
namespace SJZY.Track.Application.Contract.Services;
public interface ITrackContentService
{
}

View File

@ -0,0 +1,5 @@
namespace SJZY.Track.Application.Contract.Services;
public interface ITrackFlagService
{
}

View File

@ -0,0 +1,5 @@
namespace SJZY.Track.Application.Contract.Services;
public interface ITrackStatusService
{
}

View File

@ -0,0 +1,10 @@
using Volo.Abp.Modularity;
namespace SJZY.Track.Application.Contract;
public class SjzyTrackApplicationContractModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
}
}

View File

@ -1,33 +0,0 @@
using AutoMapper;
using SJZY.Track.Application.Dtos.Demo;
using SJZY.Track.Domain.Aggregates.DemoAggregate;
using SJZY.Track.Domain.Dtos.Demo;
namespace SJZY.Track.Application.AutoMapper;
internal class AutoMapperProfile : Profile
{
public AutoMapperProfile()
{
CreateMap<UnifyPageResultDto<DemoEntity>, UnifyPageResultDto<GetDemoListByPageOutput>>(MemberList.None);
CreateMap<GetDemoListByPageInput, DemoValueObject>(MemberList.None).ReverseMap();
CreateMap<UnifyPageResultDto<GetDemoListByPageInput>, UnifyPageResultDto<DemoValueObject>>(MemberList.None)
.ReverseMap();
/*
代码说明:
MemberList.None的意思是,忽略源对象和目标对象的属性匹配检查,其他可选值:MemberList.Source(检查是否映射了所有源成员)、MemberList.Destination(检查是否映射了所有目标成员)
.ReverseMap()的意思是配置双向调用关系,既一行代码既支持从 GetDemoListByPageInput -> DemoValueObject 的映射,同时也支持从 DemoValueObject -> GetDemoListByPageInput 的映射
如果对一对模型多次配置规则,会以最后一次为准,配置了这样规则后,最终执行结果是 Name + 444
CreateMap<DemoInput, DemoEntity>().ForMember(dest => dest.Description, opt => opt.MapFrom(m => m.Name + "22"));
CreateMap<DemoInput, DemoEntity>().ForMember(dest => dest.Description, opt => opt.MapFrom(m => m.Name + "444"));
*/
CreateMap<DemoEntity, DemoInput>(MemberList.None).ReverseMap();
CreateMap<DemoEntity, GetDemoListByPageOutput>(MemberList.None);
CreateMap<DemoEntity, DemoDetailSaveInput>(MemberList.None).ReverseMap();
}
}

View File

@ -1,43 +0,0 @@
using AutoMapper;
using SJZY.Expand.ABP.Core.PublicMethords;
using SJZY.Track.Application.Dtos.Demo;
namespace SJZY.Track.Application.AutoMapper
{
/// <summary>
/// 稍复杂的配置类
/// </summary>
internal class DemoAutoMapperProfile : Profile
{
public DemoAutoMapperProfile()
{
CreateMap<ComplexAutomapperDemoInput, ComplexAutomapperDemoOutput>(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;
}
}
}

View File

@ -1,7 +1,8 @@
using AutoMapper; using AutoMapper;
using AutoMapper.Internal.Mappers; using AutoMapper.Internal.Mappers;
using SJZY.Track.Application.Dtos.ProvideServices; using SJZY.Track.Application.Contract.Dtos.ProvideServices;
using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Aggregates.OrderAggregate;
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
using SJZY.Track.Domain.Dtos.Order; using SJZY.Track.Domain.Dtos.Order;
using System.Diagnostics; using System.Diagnostics;
@ -22,5 +23,6 @@ public class OrderAutoMapperProfile : Profile
CreateMap<GetPageTrackOrderInput, GetPageTrackOrderInputVO>(MemberList.None); CreateMap<GetPageTrackOrderInput, GetPageTrackOrderInputVO>(MemberList.None);
CreateMap<TrackOrderVO, TrackOrderDto>(MemberList.None); CreateMap<TrackOrderVO, TrackOrderDto>(MemberList.None);
CreateMap<UnifyPageResultDto<TrackOrderVO>, UnifyPageResultDto<TrackOrderDto>>(MemberList.None); CreateMap<UnifyPageResultDto<TrackOrderVO>, UnifyPageResultDto<TrackOrderDto>>(MemberList.None);
CreateMap<TrackDetailsIndex, TrackOrderDetailDto>(MemberList.None);
} }
} }

View File

@ -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<UpsertTrackInput, TrackUpsertEvent>(MemberList.None);
}
}

View File

@ -1,16 +1,7 @@
using AutoMapper; using AutoMapper;
using AutoMapper.Internal.Mappers; using SJZY.Track.Application.Contract.Dtos.TrackContents;
using SJZY.Track.Application.Dtos.TrackContents;
using SJZY.Track.Application.Dtos.TrackTemplates;
using SJZY.Track.Domain.Aggregates.TrackContentAggregate; using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
using SJZY.Track.Domain.Dtos.TrackContents; using SJZY.Track.Domain.Dtos.TrackContents;
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.ObjectMapping;
namespace SJZY.Track.Application.AutoMapper namespace SJZY.Track.Application.AutoMapper
{ {
@ -22,7 +13,9 @@ namespace SJZY.Track.Application.AutoMapper
CreateMap<GetTrackContentDetailVO, GetTrackContentDetailDto>(MemberList.None); CreateMap<GetTrackContentDetailVO, GetTrackContentDetailDto>(MemberList.None);
CreateMap<GetPageTrackContentInput, GetPageTrackContentVO>(MemberList.None); CreateMap<GetPageTrackContentInput, GetPageTrackContentVO>(MemberList.None);
CreateMap<GetTrackContentListVO, GetTrackContentListDto>(MemberList.None); CreateMap<GetTrackContentListVO, GetTrackContentListDto>(MemberList.None);
CreateMap<UnifyPageResultDto<GetTrackContentListVO>, UnifyPageResultDto<GetTrackContentListDto>>(MemberList.None); CreateMap<UnifyPageResultDto<GetTrackContentListVO>, UnifyPageResultDto<GetTrackContentListDto>>(
MemberList.None);
CreateMap<EditTrackContentMapInput, TrackContentMapEntity>(MemberList.None);
} }
} }
} }

View File

@ -1,16 +1,7 @@
using AutoMapper; using AutoMapper;
using AutoMapper.Internal.Mappers; using SJZY.Track.Application.Contract.Dtos.TrackFlags;
using SJZY.Track.Application.Dtos.TrackFlags;
using SJZY.Track.Application.Dtos.TrackStatus;
using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; using SJZY.Track.Domain.Aggregates.TrackFlagAggregate;
using SJZY.Track.Domain.Dtos.TrackFlags; using SJZY.Track.Domain.Dtos.TrackFlags;
using SJZY.Track.Domain.Dtos.TrackStatus;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.ObjectMapping;
namespace SJZY.Track.Application.AutoMapper namespace SJZY.Track.Application.AutoMapper
{ {
@ -18,7 +9,6 @@ namespace SJZY.Track.Application.AutoMapper
{ {
public TrackFlagAutoMapperProfile() public TrackFlagAutoMapperProfile()
{ {
CreateMap<EditTrackFlagInput, TrackFlagEntity>(MemberList.None) CreateMap<EditTrackFlagInput, TrackFlagEntity>(MemberList.None)
.ForMember(dest => dest.Name, opt => opt.MapFrom(source => source.Flag)) .ForMember(dest => dest.Name, opt => opt.MapFrom(source => source.Flag))
.ForMember(dest => dest.IsCompleted, opt => opt.MapFrom(source => source.IsFinish)); .ForMember(dest => dest.IsCompleted, opt => opt.MapFrom(source => source.IsFinish));

View File

@ -1,5 +1,5 @@
using AutoMapper; using AutoMapper;
using SJZY.Track.Application.Dtos.TrackPull; using SJZY.Track.Application.Contract.Dtos.TrackPull;
using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
using Volo.Abp.AutoMapper; using Volo.Abp.AutoMapper;

View File

@ -1,4 +1,8 @@
using AutoMapper; 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; namespace SJZY.Track.Application.AutoMapper;
@ -6,5 +10,10 @@ public class TrackPushAutoMapperProfile : Profile
{ {
public TrackPushAutoMapperProfile() public TrackPushAutoMapperProfile()
{ {
CreateMap<EditTrackPushConfigInput, TrackPushConfigEntity>(MemberList.None)
.ForMember(dest => dest.TrackTemplateId, opt => opt.MapFrom(source => string.Join(',', source.TrackTemplateIds)));
CreateMap<EditTrackPushConfigInput, TrackPushPullParamsConfigEntity>(MemberList.None).Ignore(dest => dest.Id)
.ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => true));
CreateMap<EditTrackPushContentInput, TrackPushContentConfigEntity>(MemberList.None);
} }
} }

View File

@ -1,15 +1,7 @@
using AutoMapper; using AutoMapper;
using AutoMapper.Internal.Mappers; using SJZY.Track.Application.Contract.Dtos.TrackStatus;
using SJZY.Track.Application.Dtos.Demo;
using SJZY.Track.Application.Dtos.TrackStatus;
using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
using SJZY.Track.Domain.Dtos.TrackStatus; using SJZY.Track.Domain.Dtos.TrackStatus;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.ObjectMapping;
namespace SJZY.Track.Application.AutoMapper namespace SJZY.Track.Application.AutoMapper
{ {
@ -25,7 +17,8 @@ namespace SJZY.Track.Application.AutoMapper
CreateMap<GetTrackStatusDetailVO, GetTrackStatusDetailDto>(MemberList.None); CreateMap<GetTrackStatusDetailVO, GetTrackStatusDetailDto>(MemberList.None);
CreateMap<GetPageTrackStatusInput, GetPageTrackStatusVO>(MemberList.None); CreateMap<GetPageTrackStatusInput, GetPageTrackStatusVO>(MemberList.None);
CreateMap<GetTrackStatusListVO, GetTrackStatusListDto>(MemberList.None); CreateMap<GetTrackStatusListVO, GetTrackStatusListDto>(MemberList.None);
CreateMap<UnifyPageResultDto<GetTrackStatusListVO>, UnifyPageResultDto<GetTrackStatusListDto>>(MemberList.None); CreateMap<UnifyPageResultDto<GetTrackStatusListVO>, UnifyPageResultDto<GetTrackStatusListDto>>(MemberList
.None);
} }
} }
} }

View File

@ -1,9 +1,7 @@
using AutoMapper; using AutoMapper;
using AutoMapper.Internal.Mappers; using SJZY.Track.Application.Contract.Dtos.TrackTemplates;
using SJZY.Track.Application.Dtos.TrackTemplates;
using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
using SJZY.Track.Domain.Dtos.TrackTemplate; using SJZY.Track.Domain.Dtos.TrackTemplate;
using Volo.Abp.ObjectMapping;
namespace SJZY.Track.Application.AutoMapper; namespace SJZY.Track.Application.AutoMapper;
@ -19,6 +17,7 @@ public class TrackTemplateAutoMapperProfile : Profile
CreateMap<EditTrackTemplateInput, TrackTemplateEntity>(MemberList.None); CreateMap<EditTrackTemplateInput, TrackTemplateEntity>(MemberList.None);
CreateMap<GetPageTrackTemplateInput, GetPageTrackTemplateVO>(MemberList.None); CreateMap<GetPageTrackTemplateInput, GetPageTrackTemplateVO>(MemberList.None);
CreateMap<GetTrackTemplateListVO, GetTrackTemplateListDto>(MemberList.None); CreateMap<GetTrackTemplateListVO, GetTrackTemplateListDto>(MemberList.None);
CreateMap<UnifyPageResultDto<GetTrackTemplateListVO>, UnifyPageResultDto<GetTrackTemplateListDto>>(MemberList.None); CreateMap<UnifyPageResultDto<GetTrackTemplateListVO>, UnifyPageResultDto<GetTrackTemplateListDto>>(MemberList
.None);
} }
} }

View File

@ -1,89 +0,0 @@
namespace SJZY.Track.Application.Dtos.Demo
{
/// <summary>
/// automapper 复杂转换样例
/// </summary>
public class ComplexAutomapperDemoInput
{
/// <summary>
/// 编号
/// </summary>
public int Id { get; set; }
/// <summary>
/// 操作类型
/// </summary>
public OptionType OptionType { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; }
/// <summary>
/// 性别
/// </summary>
public Gender Gender { get; set; }
/// <summary>
/// 用户信息
/// </summary>
public UserInfoInput UserInfo { get; set; }
/// <summary>
/// 用户角色
/// </summary>
public List<UserRoleInput> UserRoleInputList { get; set; }
/// <summary>
/// 拓展演示,目前大家共同约定,暂时不使用充血模型
/// </summary>
/// <returns></returns>
public string GetAddress()
{
return "辽宁省沈阳市...";
}
}
public class ComplexAutomapperDemoOutput
{
/// <summary>
/// 编号
/// </summary>
public int Id { get; set; }
/// <summary>
/// 性别
/// </summary>
public string Gender { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; }
/// <summary>
/// 年龄
/// </summary>
public int Age { get; set; }
/// <summary>
/// qq号码
/// </summary>
public string QQ { get; set; }
/// <summary>
/// 地址
/// </summary>
public string Address { get; set; }
/// <summary>
/// 角色编号
/// </summary>
public int[] RoleIds { get; set; }
}
}

View File

@ -1,48 +0,0 @@
namespace SJZY.Track.Application.Dtos.Demo
{
public class DemoDetailSaveInput
{
/// <summary>
///
/// </summary>
public int Id { get; set; }
/// <summary>
/// 姓名
/// </summary>
public string Name { get; set; }
/// <summary>
/// 年龄
/// </summary>
public int Age { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; }
/// <summary>
/// 详情合集
/// </summary>
public List<DemoDetailInput> DemoDetailList { get; set; }
}
public class DemoDetailInput
{
/// <summary>
/// Id
/// </summary>
public int Id { get; set; }
/// <summary>
/// t_demo.id
/// </summary>
public int DemoId { get; set; }
/// <summary>
/// 一些说明..
/// </summary>
public string OtherInfo { get; set; }
}
}

View File

@ -1,42 +0,0 @@
namespace SJZY.Track.Application.Dtos.Demo
{
public class DemoInput
{
/// <summary>
/// 操作类型
/// </summary>
public OptionType Option { get; set; }
/// <summary>
///
/// </summary>
public int Id { get; set; }
/// <summary>
/// 姓名
/// </summary>
public string Name { get; set; }
/// <summary>
/// 年龄
/// </summary>
public int Age { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; }
//以下两个属性用来说明类型转换
/// <summary>
/// 创建人id
/// </summary>
public string CreateUserId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public string CreateTime { get; set; }
}
}

View File

@ -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; }
}
}

View File

@ -1,10 +0,0 @@
namespace SJZY.Track.Application.Dtos.Demo
{
public class GetDemoListByPageInput : PageInfoInput
{
/// <summary>
/// 姓名
/// </summary>
public string Name { get; set; }
}
}

View File

@ -1,27 +0,0 @@
namespace SJZY.Track.Application.Dtos.Demo
{
public class GetDemoListByPageOutput
{
/// <summary>
///
/// </summary>
public int Id { get; set; }
/// <summary>
/// 姓名
/// </summary>
public string Name { get; set; }
/// <summary>
/// 年龄
/// </summary>
public int Age { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; }
public DateTime CreateTime { get; set; }
}
}

View File

@ -1,9 +0,0 @@
namespace SJZY.Track.Application.Dtos.Demo
{
public class MyCustomerResultOutput
{
public string Code { get; set; }
public string Message { get; set; }
}
}

View File

@ -1,15 +0,0 @@
namespace SJZY.Track.Application.Dtos.Demo
{
public class OssUploadOutput
{
/// <summary>
/// 文件key
/// </summary>
public string Key { get; set; }
/// <summary>
/// 文件路径
/// </summary>
public string Url { get; set; }
}
}

View File

@ -1,42 +0,0 @@
using System.ComponentModel;
using System.Text.Json.Serialization;
namespace SJZY.Track.Application.Dtos.Demo
{
public class SwaggerDemoInput
{
/// <summary>
/// 年龄
/// </summary>
/// <example>18</example> 这里可以写一些初始值
public int Age { get; set; }
/// <summary>
/// 姓名
/// </summary>
public string Name { get; set; }
/// <summary>
/// 性别(枚举的展示样例)
/// </summary>
public Gender Gender { get; set; }
/// <summary>
/// 隐藏属性
/// </summary>
[JsonIgnore]
public int MyProperty { get; set; }
}
public enum Gender
{
[Description("纯爷们")]
男 = 2,
[Description("大姑娘")]
女 = 5,
[Description("你憋问")]
未知 = 8
}
}

View File

@ -1,98 +0,0 @@
namespace SJZY.Track.Application.Dtos.Demo
{
public class ValidateExecuteInput
{
/// <summary>
/// 操作类型
/// </summary>
public OptionType Option { get; set; }
/// <summary>
/// 主键编号
/// </summary>
public int Id { get; set; }
/// <summary>
/// 雪花ID
/// </summary>
public long SnowId { get; set; }
/// <summary>
/// 登录账号
/// </summary>
public string LoginName { get; set; }
/// <summary>
/// 登录密码
/// </summary>
public string? PassWord { get; set; }
/// <summary>
/// 登录密码确认
/// </summary>
public string PassWordAgain { get; set; }
/// <summary>
/// 最大金额额度
/// </summary>
public decimal TotalQuota { get; set; }
/// <summary>
/// 最大数量
/// </summary>
public int MaxCount { get; set; }
/// <summary>
/// 最小数量
/// </summary>
public int MiniCount { get; set; }
/// <summary>
/// 用户信息
/// </summary>
public UserInfoInput UserInfoInput { get; set; }
/// <summary>
/// 用户角色
/// </summary>
public List<UserRoleInput> UserRoleInputList { get; set; }
}
public class UserInfoInput
{
/// <summary>
/// 生日
/// </summary>
public DateTime BirthDay { get; set; }
/// <summary>
/// qq号码
/// </summary>
public string QQ { get; set; }
/// <summary>
/// 电子邮箱
/// </summary>
public string Email { get; set; }
/// <summary>
/// 用户姓名
/// </summary>
public string UserName { get; set; }
}
public class UserRoleInput
{
/// <summary>
/// 角色编号
/// </summary>
public int Id { get; set; }
/// <summary>
/// 角色名称
/// </summary>
public string Name { get; set; }
}
}

View File

@ -1,6 +0,0 @@
namespace SJZY.Track.Application.Dtos.Demo
{
public class ValidateExecuteOutput
{
}
}

View File

@ -1,5 +0,0 @@
namespace SJZY.Track.Application.Dtos.ProvideServices;
public class DeleteOrderInput : OrderNoInfo
{
}

View File

@ -1,102 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SJZY.Track.Application.Dtos.ProvideServices
{
public class GetPageTrackOrderInput : PageInfoInput
{
/// <summary>
/// 子系统id
/// </summary>
public int SubSystemId { get; set; }
/// <summary>
/// 单号
/// </summary>
public List<string>? OrderNos { get; set; }
/// <summary>
/// 创建时间开始
/// </summary>
public DateTime? CreateTimeStart { get; set; }
/// <summary>
/// 创建时间截止
/// </summary>
public DateTime? CreateTimeEnd { get; set; }
}
/// <summary>
/// 轨迹订单Dto
/// </summary>
public class TrackOrderDto
{
/// <summary>
/// 轨迹订单id
/// </summary>
public int Id { get; set; }
/// <summary>
/// 订单类型id
/// </summary>
public int OrderType { get; set; }
/// <summary>
/// 订单号
/// </summary>
public string? OrderNumber { get; set; }
/// <summary>
/// 轨迹模版
/// </summary>
public string? TrackTemplateNames { get; set; }
/// <summary>
/// 客户简称
/// </summary>
public string? CustomerShortName { get; set; }
/// <summary>
/// 客户代码
/// </summary>
public string? CustomerCode { get; set; }
/// <summary>
/// 订单明细(json)
/// </summary>
public string? OrderDetails { get; set; }
/// <summary>
/// 最新轨迹内容
/// </summary>
public string? NewestTrackContent { get; set; }
/// <summary>
/// 最新轨迹内容英文
/// </summary>
public string? NewestTrackEnContent { get; set; }
/// <summary>
/// 最新轨迹发生地
/// </summary>
public string? NewestTrackPlace { get; set; }
/// <summary>
/// 是否完结
/// </summary>
public bool IsFinish { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreateTime { get; set; }
/// <summary>
/// 子系统
/// </summary>
public string SubSystem { get; set; }
}
}

View File

@ -0,0 +1,108 @@
using DotNetCore.CAP;
using SJZY.Expand.ABP.Core.PublicMethords;
using SJZY.Track.Application.Contract.Events;
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 ITrackQueries _trackQueries;
private readonly ITrackDetailsRepository _trackDetailsRepository;
private readonly ICapPublisher _capPublisher;
public TrackUpsertEventHandler(IOrderRepository orderRepository, ICapPublisher capPublisher,
ITrackQueries trackQueries, ITrackDetailsRepository trackDetailsRepository)
{
_orderRepository = orderRepository;
_capPublisher = capPublisher;
_trackQueries = trackQueries;
_trackDetailsRepository = trackDetailsRepository;
}
[NonAction]
[CapSubscribe(GlobalConst.TrackUpsertSubscribe)]
public async Task ConsumerAsync(TrackUpsertEvent @event)
{
// 不同子系统需要做内容映射
if (@event.UpSubSystemId != @event.SubSystemId)
{
var mapCode = await _trackQueries.MapTrackContentCodeAsync(@event.UpSubSystemId, @event.SubSystemId, @event.TrackCode);
if (mapCode == default)
{
throw new BusinessException(message: "订单跨子系统,未配置内容映射,请联系管理员");
}
@event.TrackCode = mapCode;
}
await UpsertTrackAsync(@event);
}
internal async Task UpsertTrackAsync(TrackUpsertEvent @event)
{
// 不存在则新增轨迹,存在则更新
var track = await _trackDetailsRepository.GetFirstOrDefaultAsync(@event.OrderId, @event.TrackCode);
var isPush = false; // 推送只做新增的,更新和删除的不做先
if (track == default)
{
// 根据轨迹code在订单模板内容中寻找匹配的
var trackContent = await _trackQueries.MatchTrackContentAsync(@event.OrderId, @event.TrackCode);
if (trackContent == default)
{
throw new BusinessException(message: $"订单:{@event.OrderNo} 所绑定的模板,没有一条内容可以匹配轨迹代码:{@event.TrackCode}");
}
track = new TrackDetailsIndex
{
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,
TraceTimeZone = @event.TraceTimeZone,
CreateUserId = CurrentUserRequest.CurrentUser.UserId,
CreateTime = DateTime.Now
};
isPush = true;
}
else
{
track.TrackPlace = @event.TrackPlace;
track.TrackTime = @event.TrackTime;
track.TraceTimeZone = @event.TraceTimeZone;
track.UpdateUserId = CurrentUserRequest.CurrentUser.UserId;
track.UpdateTime = DateTime.Now;
}
await _trackDetailsRepository.UpsertAsync(track);
// 根据订单关联关系异步向下刷
var linkedOrders = await _orderRepository.GetLinkedOrdersAsync(@event.OrderId);
foreach (var linkedOrder in linkedOrders)
{
var nextEvent = @event.DeepCopy();
nextEvent.OrderId = linkedOrder.OrderId;
nextEvent.SubSystemId = linkedOrder.SubSystemId;
nextEvent.UpSubSystemId = @event.SubSystemId;
await _capPublisher.PublishAsync(GlobalConst.TrackUpsertSubscribe, nextEvent);
}
if (isPush)
{
//await PushTrack();
}
}
}

View File

@ -5,3 +5,4 @@ global using SJZY.Expand.ABP.Core.Common.Dto;
global using Volo.Abp; global using Volo.Abp;
global using Volo.Abp.Application.Services; global using Volo.Abp.Application.Services;
global using Volo.Abp.Validation; global using Volo.Abp.Validation;
global using SJZY.Track.Domain;

View File

@ -1,3 +0,0 @@
// Global using directives
global using SJZY.Track.Domain;

View File

@ -7,6 +7,9 @@
"TemplateExist": "The template code already exists under the currently selected subsystem", "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", "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", "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" "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"
} }
} }

View File

@ -7,6 +7,9 @@
"TemplateExist": "模板代码已存在于当前选择的子系统下", "TemplateExist": "模板代码已存在于当前选择的子系统下",
"TrackContentExist": "当前子系统下轨迹代码或轨迹内容或轨迹内容英文重复", "TrackContentExist": "当前子系统下轨迹代码或轨迹内容或轨迹内容英文重复",
"TrackStatusExist": "当前子系统下轨迹状态代码或轨迹状态或轨迹状态英文重复", "TrackStatusExist": "当前子系统下轨迹状态代码或轨迹状态或轨迹状态英文重复",
"TrackFlagExist": "当前子系统下代码或标记重复" "TrackFlagExist": "当前子系统下代码或标记重复",
"IsExistTrackPullConfig": "轨迹拉取已绑定了该模版,请先删除轨迹拉取再删除该模版",
"IsExistTrackStatus": "轨迹内容已经绑定了该轨迹状态,请先删除轨迹内容后再删除该轨迹状态",
"IsExistTrackFlag": "轨迹内容已经绑定了该轨迹标记,请先删除轨迹内容后再删除该轨迹标记"
} }
} }

View File

@ -8,17 +8,6 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Remove="Services\TrackMap\**" />
<Compile Remove="Validations\Docuai\**" />
<EmbeddedResource Remove="Services\TrackMap\**" />
<EmbeddedResource Remove="Validations\Docuai\**" />
<None Remove="Services\TrackMap\**" />
<None Remove="Validations\Docuai\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="SJZY.Expand.AliyunOSS" Version="7.0.10"/>
<PackageReference Include="SJZY.Expand.Excel" Version="7.0.5"/>
<PackageReference Include="Volo.Abp.Http.Client" Version="7.0.2" /> <PackageReference Include="Volo.Abp.Http.Client" Version="7.0.2" />
<PackageReference Include="Volo.Abp.FluentValidation" Version="7.0.2" /> <PackageReference Include="Volo.Abp.FluentValidation" Version="7.0.2" />
<PackageReference Include="SJZY.UserCenter.HttpApi" Version="3.0.3-alpha8" /> <PackageReference Include="SJZY.UserCenter.HttpApi" Version="3.0.3-alpha8" />
@ -27,6 +16,6 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\SJZY.Track.Domain\SJZY.Track.Domain.csproj" /> <ProjectReference Include="..\SJZY.Track.Domain\SJZY.Track.Domain.csproj" />
<ProjectReference Include="..\SJZY.Track.HttpApi\SJZY.Track.HttpApi.csproj" /> <ProjectReference Include="..\SJZY.Track.Application.Contract\SJZY.Track.Application.Contract.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,251 +0,0 @@
using SJZY.Expand.ABP.Core.Common;
using SJZY.Track.Application.Dtos.Demo;
using SJZY.Track.Domain.Aggregates.DemoAggregate;
using SJZY.Track.Domain.Dtos.Demo;
namespace SJZY.Track.Application.Services.Demo;
/// <summary>
/// 接口请求完整样例
/// </summary>
[ApiExplorerSettings(GroupName = "Demo")]
public class InterFaceDemoService : ApplicationService
{
#region 构造函数
private readonly IDemoRepository _demoRepository;
public InterFaceDemoService(IDemoRepository demoRepository)
{
_demoRepository = demoRepository;
}
#endregion
#region 增删改
/// <summary>
/// 增删改
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("InterFace/Edit")]
public async Task<LongIdBaseDto> Edit(DemoInput input)
{
var res = new LongIdBaseDto();
if (input.Option == OptionType.新增)
{
var entity = ObjectMapper.Map<DemoInput, DemoEntity>(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 局部更新最佳实践
/// <summary>
/// 局部更新最佳实践
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="BusinessException"></exception>
[HttpPost("InterFace/UpdatePartColumns")]
public async Task<IdBaseDto> 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 分页查询接口
/// <summary>
/// 分页查询
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("InterFace/GetListByPage")]
public async Task<UnifyPageResultDto<GetDemoListByPageOutput>> GetListByPage(GetDemoListByPageInput input)
{
//分页时返回值统一用 PageResultDto<> 类型
var list = await _demoRepository.GetListByPage(input.PageSize, input.PageIndex, input.Name);
var res = ObjectMapper.Map<UnifyPageResultDto<DemoEntity>, UnifyPageResultDto<GetDemoListByPageOutput>>(list);
return res;
}
#endregion
#region 入参转换
/// <summary>
/// 入参转换
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("InterFace/InputToValueObject")]
public async Task<List<GetDemoListByPageOutput>> InputToValueObject(GetDemoListByPageInput input)
{
var obj = ObjectMapper.Map<GetDemoListByPageInput, DemoValueObject>(input);
var list = await _demoRepository.InputToValueObject(obj);
var res = ObjectMapper.Map<List<DemoEntity>, List<GetDemoListByPageOutput>>(list);
return res;
}
#endregion
#region 原生sql
/// <summary>
/// 原生sql
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
[HttpPost("InterFace/OriginalSql")]
public async Task<UnifyPageResultDto<DemoValueObject>> OriginalSql(DemoValueObject obj)
{
var list = await _demoRepository.OriginalSql(obj);
return list;
}
#endregion
#region 自定义返回结果格式
/// <summary>
/// 自定义返回结果格式
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("Demo/CustomerResult")]
[CustomerResult]
public async Task<MyCustomerResultOutput> GetListAsync()
{
/*
说明:
理论上我们有全公司级别的返回值约定,不管是前端调后端,还是后端微服务间的调用,都应完全遵循该规范。
但不排除有些特殊情况下,必须要返回自定义格式的场景。
*/
var res = new MyCustomerResultOutput();
res.Code = "200";
res.Message = "这是一个自定义返回结果";
return res;
}
#endregion
#region 约定类型下返回null
/// <summary>
/// 约定类型下返回null
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("Demo/ReturnNull")]
public async Task<MyCustomerResultOutput> ReturnNull()
{
MyCustomerResultOutput res = null;
return res;
}
#endregion
#region
/// <summary>
/// 没有返回值
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("Demo/WithoutReturnObject")]
public async Task<UnifyResultDto> WithoutReturnObject()
{
return null;
}
#endregion
#region 主从关系实体存储
/// <summary>
/// 主从关系实体存储
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
[HttpPost("InterFace/EntityRelationSave")]
public async Task<UnifyResultDto> EntityRelationSave(DemoDetailSaveInput input)
{
var obj = ObjectMapper.Map<DemoDetailSaveInput, DemoEntity>(input);
var res = await _demoRepository.EntityRelationSave(obj);
return new UnifyResultDto(res);
}
#endregion
#region 数据缓存
/// <summary>
/// 数据缓存
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("InterFace/GetDataCache")]
public async Task<DemoEntity> GetDataCache(IdBaseDto input)
{
var res = await _demoRepository.GetDataCache(input.Id);
return res;
}
#endregion
//[HttpPost("InterFace/AAAA")]
//public async Task<UnifyResultDto> AAAA()
//{
// var result = await _httpClientProxy.Service.GetSystemTokenAsync("Track");
// return result;
//}
}

View File

@ -1,4 +1,4 @@
using SJZY.Track.Application.Dtos.ProvideServices; using SJZY.Track.Application.Contract.Dtos.ProvideServices;
using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Aggregates.OrderAggregate;
using SJZY.Track.Domain.Queries; using SJZY.Track.Domain.Queries;

View File

@ -1,7 +1,8 @@
using SJZY.Expand.ABP.Core.Common.Dto; using SJZY.Track.Application.Contract.Dtos.ProvideServices;
using SJZY.Track.Application.Dtos.ProvideServices;
using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Aggregates.OrderAggregate;
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
using SJZY.Track.Domain.Dtos.Order; using SJZY.Track.Domain.Dtos.Order;
using Volo.Abp.ObjectMapping;
namespace SJZY.Track.Application.Services.ProvideServices; namespace SJZY.Track.Application.Services.ProvideServices;
@ -12,10 +13,14 @@ namespace SJZY.Track.Application.Services.ProvideServices;
public class OrderService : ApplicationService public class OrderService : ApplicationService
{ {
private readonly IOrderRepository _orderRepository; private readonly IOrderRepository _orderRepository;
private readonly ITrackDetailsRepository _trackDetailsRepository;
public OrderService(IOrderRepository orderRepository) public OrderService(IOrderRepository orderRepository,
ITrackDetailsRepository trackDetailsRepository
)
{ {
_orderRepository = orderRepository; _orderRepository = orderRepository;
this._trackDetailsRepository=trackDetailsRepository;
} }
/// <summary> /// <summary>
@ -76,7 +81,14 @@ public class OrderService : ApplicationService
[HttpPost("/Order/GetDetails")] [HttpPost("/Order/GetDetails")]
public async Task<List<TrackOrderDetailDto>> GetOrderDetails(GetOrderDetailsInput input) public async Task<List<TrackOrderDetailDto>> GetOrderDetails(GetOrderDetailsInput input)
{ {
return null; var trackDetails = await _trackDetailsRepository.GetListAsync(input.OrderId);
if (!trackDetails.IsNullOrEmpty())
{
var list = ObjectMapper.Map<List<TrackDetailsIndex>, List<TrackOrderDetailDto>>(trackDetails);
return list;
}
return new List<TrackOrderDetailDto>();
} }
#endregion #endregion
@ -93,7 +105,8 @@ public class OrderService : ApplicationService
{ {
var vo = ObjectMapper.Map<GetPageTrackOrderInput, GetPageTrackOrderInputVO>(input); var vo = ObjectMapper.Map<GetPageTrackOrderInput, GetPageTrackOrderInputVO>(input);
var pageList = await _orderRepository.GetPageTrackOrder(vo); var pageList = await _orderRepository.GetPageTrackOrder(vo);
var pageResultDto = ObjectMapper.Map<UnifyPageResultDto<TrackOrderVO>, UnifyPageResultDto<TrackOrderDto>>(pageList); var pageResultDto =
ObjectMapper.Map<UnifyPageResultDto<TrackOrderVO>, UnifyPageResultDto<TrackOrderDto>>(pageList);
return pageResultDto; return pageResultDto;
} }

View File

@ -0,0 +1,10 @@
namespace SJZY.Track.Application.Services.ProvideServices;
/// <summary>
/// 轨迹推送服务
/// </summary>
[ApiExplorerSettings(GroupName = "提供接口")]
public class TrackPushService: ApplicationService
{
}

View File

@ -1,4 +1,4 @@
using SJZY.Track.Application.Dtos.ProvideServices; using SJZY.Track.Application.Contract.Dtos.ProvideServices;
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
using SJZY.Track.Domain.Queries; using SJZY.Track.Domain.Queries;

View File

@ -1,9 +1,7 @@
using DotNetCore.CAP; using SJZY.Track.Application.Contract.Dtos.ProvideServices;
using SJZY.Track.Application.Dtos.ProvideServices; using SJZY.Track.Application.Contract.Events;
using SJZY.Track.Application.EventHandlers;
using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Aggregates.OrderAggregate;
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
using SJZY.Track.Domain.Queries;
using SJZY.UserCenter.HttpApi.Services;
namespace SJZY.Track.Application.Services.ProvideServices; namespace SJZY.Track.Application.Services.ProvideServices;
@ -14,17 +12,12 @@ namespace SJZY.Track.Application.Services.ProvideServices;
public class TrackService : ApplicationService public class TrackService : ApplicationService
{ {
private readonly IOrderRepository _orderRepository; private readonly IOrderRepository _orderRepository;
private readonly ITrackDetailsRepository _trackDetailsRepository; private readonly TrackUpsertEventHandler _trackUpsertEventHandler;
private readonly ITrackQueries _trackQueries;
private readonly ICapPublisher _capPublisher;
public TrackService(ITrackQueries trackQueries, IOrderRepository orderRepository, public TrackService(IOrderRepository orderRepository, TrackUpsertEventHandler trackUpsertEventHandler)
ITrackDetailsRepository trackDetailsRepository, ICapPublisher capPublisher)
{ {
_trackQueries = trackQueries;
_orderRepository = orderRepository; _orderRepository = orderRepository;
_trackDetailsRepository = trackDetailsRepository; _trackUpsertEventHandler = trackUpsertEventHandler;
_capPublisher = capPublisher;
} }
/// <summary> /// <summary>
@ -36,53 +29,21 @@ public class TrackService : ApplicationService
[HttpPost("Track/Upsert")] [HttpPost("Track/Upsert")]
public async Task<bool> UpsertTrackAsync(UpsertTrackInput input) public async Task<bool> UpsertTrackAsync(UpsertTrackInput input)
{ {
var orderId = await _orderRepository.GetFirstAsync(x => var order = await _orderRepository.GetFirstAsync(x =>
x.OrderType == input.OrderType && x.OrderNo == input.OrderNo, x => x.Id); x.OrderType == input.OrderType && x.OrderNo == input.OrderNo, x => new
if (orderId == default) {
x.Id, x.SubSystemId, x.IsPushCompleted
});
if (order == default)
{ {
throw new BusinessException(message: $"订单:{input.OrderNo}不存在"); throw new BusinessException(message: $"订单:{input.OrderNo}不存在");
} }
// 不存在则新增轨迹,存在则更新 // 新增/更新轨迹
var track = await _trackDetailsRepository.GetFirstOrDefaultAsync(orderId, input.TrackCode); var @event = ObjectMapper.Map<UpsertTrackInput, TrackUpsertEvent>(input);
if (track == default) @event.OrderId = order.Id;
{ @event.SubSystemId = order.SubSystemId;
var trackContent = await _trackQueries.MatchTrackContentAsync(orderId, input.TrackCode); await _trackUpsertEventHandler.UpsertTrackAsync(@event);
if (trackContent == default)
{
throw new BusinessException(message: $"订单:{input.OrderNo} 所绑定的模板,没有一条内容可以匹配轨迹代码:{input.TrackCode}");
}
track = new TrackDetailsIndex
{
OrderId = orderId,
OrderNo = input.OrderNo,
OrderType = input.OrderType,
TrackStatus = trackContent.Status,
TrackCode = input.TrackCode,
TrackContent = trackContent.Content,
TrackEnContent = trackContent.EnContent,
TrackPlace = input.TrackPlace,
TrackTime = input.TrackTime,
TraceTimeZone = input.TraceTimeZone,
CreateUserId = CurrentUserRequest.CurrentUser.UserId,
CreateTime = DateTime.Now
};
await _trackDetailsRepository.CreateAsync(track);
}
else
{
track.UpdateUserId = CurrentUserRequest.CurrentUser.UserId;
track.UpdateTime = DateTime.Now;
track.TrackPlace = input.TrackPlace;
track.TrackTime = input.TrackTime;
track.TraceTimeZone = input.TraceTimeZone;
await _trackDetailsRepository.UpdateAsync(track);
}
// 根据订单关联关系向下刷,不同子系统还需要做内容映射
// 推送
return true; return true;
} }
} }

View File

@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SJZY.Track.Application.Services.TrackContents
{
public interface ITrackContentService
{
}
}

View File

@ -1,16 +1,14 @@
using Microsoft.AspNetCore.Authorization; using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Localization; using SJZY.Expand.ABP.Core.Common.Dto;
using SJZY.Track.Application.Dtos.TrackContents; using SJZY.Expand.ABP.Core.Localization;
using SJZY.Track.Application.Dtos.TrackStatus; using SJZY.Expand.ABP.Core.PublicMethords;
using SJZY.Track.Application.Contract.Dtos.TrackContents;
using SJZY.Track.Application.Contract.Dtos.TrackPull;
using SJZY.Track.Application.Localization; using SJZY.Track.Application.Localization;
using SJZY.Track.Domain.Aggregates.TrackContentAggregate; using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
using SJZY.Track.Domain.Dtos.TrackContents; using SJZY.Track.Domain.Dtos.TrackContents;
using SJZY.Track.Domain.Dtos.TrackStatus; using System.Linq.Expressions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
namespace SJZY.Track.Application.Services.TrackContents namespace SJZY.Track.Application.Services.TrackContents
@ -28,6 +26,7 @@ namespace SJZY.Track.Application.Services.TrackContents
public TrackContentService( public TrackContentService(
IStringLocalizer<TrackLocalizationResource> stringLocalizer, IStringLocalizer<TrackLocalizationResource> stringLocalizer,
ITrackContentRepository trackContentRepository ITrackContentRepository trackContentRepository
) )
{ {
this._stringLocalizer = stringLocalizer; this._stringLocalizer = stringLocalizer;
@ -74,7 +73,8 @@ namespace SJZY.Track.Application.Services.TrackContents
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("GetList")] [HttpPost("GetList")]
public async Task<UnifyPageResultDto<GetTrackContentListDto>> GetPageTrackContent(GetPageTrackContentInput input) public async Task<UnifyPageResultDto<GetTrackContentListDto>> GetPageTrackContent(
GetPageTrackContentInput input)
{ {
var vo = ObjectMapper.Map<GetPageTrackContentInput, GetPageTrackContentVO>(input); var vo = ObjectMapper.Map<GetPageTrackContentInput, GetPageTrackContentVO>(input);
var resultDto = await _trackContentRepository.GetPageTrackContent(vo); var resultDto = await _trackContentRepository.GetPageTrackContent(vo);
@ -86,16 +86,20 @@ namespace SJZY.Track.Application.Services.TrackContents
} }
#region 私有方法 #region 私有方法
private async Task<UnifyResultDto> AddAsync(EditTrackContentInput input) private async Task<UnifyResultDto> AddAsync(EditTrackContentInput input)
{ {
#region 业务逻辑校验 #region 业务逻辑校验
var trackContentEntity = await _trackContentRepository.GetFirstAsync(a => a.SubSystemId==input.SubSystemId&&(a.Code==input.Code ||
var trackContentEntity = await _trackContentRepository.GetFirstAsync(a =>
a.SubSystemId == input.SubSystemId && (a.Code == input.Code ||
a.Content == input.Content || a.EnContent == input.EnContent)); a.Content == input.Content || a.EnContent == input.EnContent));
if (trackContentEntity != null) if (trackContentEntity != null)
{ {
throw new BusinessException(message: _stringLocalizer["TrackContentExist"]); throw new BusinessException(message: _stringLocalizer["TrackContentExist"]);
} }
#endregion
#endregion 业务逻辑校验
var entity = ObjectMapper.Map<EditTrackContentInput, TrackContentEntity>(input); var entity = ObjectMapper.Map<EditTrackContentInput, TrackContentEntity>(input);
var isTrue = await _trackContentRepository.InsertAsync(entity); var isTrue = await _trackContentRepository.InsertAsync(entity);
@ -106,27 +110,135 @@ namespace SJZY.Track.Application.Services.TrackContents
private async Task<UnifyResultDto> UpdateAsync(EditTrackContentInput input) private async Task<UnifyResultDto> UpdateAsync(EditTrackContentInput input)
{ {
#region 业务逻辑校验 #region 业务逻辑校验
var trackContentEntity = await _trackContentRepository.GetFirstAsync(a => a.Id!=input.Id && a.SubSystemId==input.SubSystemId && (a.Code==input.Code ||
var trackContentEntity = await _trackContentRepository.GetFirstAsync(a => a.Id != input.Id &&
a.SubSystemId == input.SubSystemId && (a.Code == input.Code ||
a.Content == input.Content || a.EnContent == input.EnContent)); a.Content == input.Content || a.EnContent == input.EnContent));
if (trackContentEntity != null) if (trackContentEntity != null)
{ {
throw new BusinessException(message: _stringLocalizer["TrackContentExist"]); throw new BusinessException(message: _stringLocalizer["TrackContentExist"]);
} }
#endregion
#endregion 业务逻辑校验
//更新的时候需要覆盖内容映射轨迹代码
var templateEntity = await _trackContentRepository.GetFirstAsync(a => a.Id == input.Id); 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); ObjectMapper.Map(input, templateEntity);
var isTrue = await _trackContentRepository.UpdateAsync(templateEntity);
isTrue = await _trackContentRepository.UpdateAsync(templateEntity);
ts.Complete();
}
return new UnifyResultDto("200", "修改成功", isTrue); return new UnifyResultDto("200", "修改成功", isTrue);
} }
private async Task<UnifyResultDto> DeleteAsync(EditTrackContentInput input) private async Task<UnifyResultDto> DeleteAsync(EditTrackContentInput input)
{ {
#region 业务校验
//需要加个判断,存在内容映射,则出提示
#endregion 业务校验
var isTrue = await _trackContentRepository.SoftDeleteAsync(x => x.Id == input.Id); var isTrue = await _trackContentRepository.SoftDeleteAsync(x => x.Id == input.Id);
return new UnifyResultDto("200", "删除成功", isTrue); return new UnifyResultDto("200", "删除成功", isTrue);
} }
#endregion
#endregion 私有方法
/// <summary>
/// 轨迹内容映射列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("GetMapPage")]
public async Task<UnifyPageResultDto<GetTrackContentMapPageOutputVO>> GetMapPageAsync([FromBody] GetTrackContentMapPageInputVO input)
{
return await _trackContentRepository.GetMapPageAsync(input);
}
/// <summary>
/// 轨迹内容映射详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet("GetMapDetail")]
public async Task<GetTrackContentMapDetailOutputVO> GetMapDetailAsync(int id)
{
return await _trackContentRepository.GetMapDetailAsync(id);
}
/// <summary>
/// 轨迹内容映射编辑
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("EditMap")]
public async Task<bool> EditMapAsync([FromBody] EditTrackContentMapInput input)
{
if (input.Options != OptionTypeNoNull.删除)
{
Expression<Func<TrackContentMapEntity, bool>> 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<EditTrackContentMapInput, TrackContentMapEntity>(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;
}
} }
} }

View File

@ -1,12 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SJZY.Track.Application.Services.TrackFlags
{
public interface ITrackFlagService
{
}
}

View File

@ -1,16 +1,9 @@
using Microsoft.Extensions.Localization; using Microsoft.Extensions.Localization;
using SJZY.Track.Application.Dtos.TrackFlags; using SJZY.Track.Application.Contract.Dtos.TrackFlags;
using SJZY.Track.Application.Dtos.TrackStatus;
using SJZY.Track.Application.Localization; using SJZY.Track.Application.Localization;
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; using SJZY.Track.Domain.Aggregates.TrackFlagAggregate;
using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
using SJZY.Track.Domain.Dtos.TrackFlags; using SJZY.Track.Domain.Dtos.TrackFlags;
using SJZY.Track.Domain.Dtos.TrackStatus;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
namespace SJZY.Track.Application.Services.TrackFlags namespace SJZY.Track.Application.Services.TrackFlags
@ -24,14 +17,17 @@ namespace SJZY.Track.Application.Services.TrackFlags
{ {
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer; private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
private readonly ITrackFlagRepository _trackFlagRepository; private readonly ITrackFlagRepository _trackFlagRepository;
private readonly ITrackContentRepository _trackContentRepository;
public TrackFlagService( public TrackFlagService(
IStringLocalizer<TrackLocalizationResource> stringLocalizer, IStringLocalizer<TrackLocalizationResource> stringLocalizer,
ITrackFlagRepository trackFlagRepository ITrackFlagRepository trackFlagRepository,
ITrackContentRepository trackContentRepository
) )
{ {
this._stringLocalizer = stringLocalizer; this._stringLocalizer = stringLocalizer;
this._trackFlagRepository = trackFlagRepository; this._trackFlagRepository = trackFlagRepository;
this._trackContentRepository=trackContentRepository;
} }
/// <summary> /// <summary>
@ -86,14 +82,18 @@ namespace SJZY.Track.Application.Services.TrackFlags
} }
#region 私有方法 #region 私有方法
private async Task<UnifyResultDto> AddAsync(EditTrackFlagInput input) private async Task<UnifyResultDto> AddAsync(EditTrackFlagInput input)
{ {
#region 业务校验 #region 业务校验
var trackStatusEntity = await _trackFlagRepository.GetFirstAsync(a => a.SubSystemId==input.SubSystemId&& (a.Code==input.Code || a.Name==input.Flag));
var trackStatusEntity = await _trackFlagRepository.GetFirstAsync(a =>
a.SubSystemId == input.SubSystemId && (a.Code == input.Code || a.Name == input.Flag));
if (trackStatusEntity != null) if (trackStatusEntity != null)
{ {
throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]); throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]);
} }
#endregion #endregion
var entity = ObjectMapper.Map<EditTrackFlagInput, TrackFlagEntity>(input); var entity = ObjectMapper.Map<EditTrackFlagInput, TrackFlagEntity>(input);
@ -105,12 +105,15 @@ namespace SJZY.Track.Application.Services.TrackFlags
private async Task<UnifyResultDto> UpdateAsync(EditTrackFlagInput input) private async Task<UnifyResultDto> UpdateAsync(EditTrackFlagInput input)
{ {
#region 业务校验 #region 业务校验
var trackStatusEntity = await _trackFlagRepository.GetFirstAsync(a => a.Id !=input.Id && a.SubSystemId==input.SubSystemId&& (a.Code==input.Code ||
var trackStatusEntity = await _trackFlagRepository.GetFirstAsync(a => a.Id != input.Id &&
a.SubSystemId == input.SubSystemId && (a.Code == input.Code ||
a.Name == input.Flag)); a.Name == input.Flag));
if (trackStatusEntity != null) if (trackStatusEntity != null)
{ {
throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]); throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]);
} }
#endregion #endregion
var templateEntity = await _trackFlagRepository.GetFirstAsync(a => a.Id == input.Id); var templateEntity = await _trackFlagRepository.GetFirstAsync(a => a.Id == input.Id);
@ -122,10 +125,18 @@ namespace SJZY.Track.Application.Services.TrackFlags
private async Task<UnifyResultDto> DeleteAsync(EditTrackFlagInput input) private async Task<UnifyResultDto> DeleteAsync(EditTrackFlagInput input)
{ {
#region 业务校验
var isExistContent = await _trackContentRepository.GetFirstAsync(a => a.TrackFlagId==input.Id);
if (isExistContent!=null)
{
throw new BusinessException(message: _stringLocalizer["IsExistTrackFlag"]);
}
#endregion
var isTrue = await _trackFlagRepository.SoftDeleteAsync(x => x.Id == input.Id); var isTrue = await _trackFlagRepository.SoftDeleteAsync(x => x.Id == input.Id);
return new UnifyResultDto("200", "删除成功", isTrue); return new UnifyResultDto("200", "删除成功", isTrue);
} }
#endregion #endregion
} }
} }

View File

@ -1,13 +1,13 @@
using Microsoft.Extensions.Localization; using System.Linq.Expressions;
using Microsoft.Extensions.Localization;
using SJZY.Expand.ABP.Core.Localization; using SJZY.Expand.ABP.Core.Localization;
using SJZY.Expand.ABP.Core.PublicMethords; using SJZY.Expand.ABP.Core.PublicMethords;
using SJZY.Track.Application.Dtos.TrackPull; using SJZY.Track.Application.Contract.Dtos.TrackPull;
using SJZY.Track.Application.Localization; using SJZY.Track.Application.Localization;
using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
using SJZY.Track.Domain.Dtos.Common; using SJZY.Track.Domain.Dtos.Common;
using SJZY.Track.Domain.Dtos.TrackPull; using SJZY.Track.Domain.Dtos.TrackPull;
using System.Linq.Expressions;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
namespace SJZY.Track.Application.Services.TrackPull; namespace SJZY.Track.Application.Services.TrackPull;
@ -50,7 +50,8 @@ public class TrackPullService : ApplicationService, ITransientDependency
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("GetContentPage")] [HttpPost("GetContentPage")]
public async Task<UnifyPageResultDto<GetTrackPullContentPageOutputVO>> GetContentPageAsync([FromBody] GetTrackPullContentPageInputVO input) public async Task<UnifyPageResultDto<GetTrackPullContentPageOutputVO>> GetContentPageAsync(
[FromBody] GetTrackPullContentPageInputVO input)
{ {
return await _trackPullConfigRepository.GetContentPageAsync(input); return await _trackPullConfigRepository.GetContentPageAsync(input);
} }
@ -88,7 +89,8 @@ public class TrackPullService : ApplicationService, ITransientDependency
if (input.Options != OptionTypeNoNull.删除) if (input.Options != OptionTypeNoNull.删除)
{ {
Expression<Func<TrackPullConfigEntity, bool>> isAnyExp = x => Expression<Func<TrackPullConfigEntity, bool>> isAnyExp = x =>
x.SubSystemId == input.SubSystemId && x.TrackTemplateId == input.TrackTemplateId && x.ServiceProviderId == input.ServiceProviderId; x.SubSystemId == input.SubSystemId && x.TrackTemplateId == input.TrackTemplateId &&
x.ServiceProviderId == input.ServiceProviderId;
if (input.Options == OptionTypeNoNull.修改) isAnyExp.And(x => x.Id != input.Id); if (input.Options == OptionTypeNoNull.修改) isAnyExp.And(x => x.Id != input.Id);
if (await _trackPullConfigRepository.IsAnyAsync(isAnyExp)) if (await _trackPullConfigRepository.IsAnyAsync(isAnyExp))
@ -100,9 +102,11 @@ public class TrackPullService : ApplicationService, ITransientDependency
case OptionTypeNoNull.新增: case OptionTypeNoNull.新增:
{ {
var trackPullEntity = ObjectMapper.Map<EditTrackPullConfigInput, TrackPullConfigEntity>(input); var trackPullEntity = ObjectMapper.Map<EditTrackPullConfigInput, TrackPullConfigEntity>(input);
var trackPullParamsEntity = ObjectMapper.Map<EditTrackPullConfigInput, TrackPushPullParamsConfigEntity>(input); var trackPullParamsEntity =
ObjectMapper.Map<EditTrackPullConfigInput, TrackPushPullParamsConfigEntity>(input);
var trackTemplateContentEntities = await _trackTemplateRepository.GetContentListAsync(x => x.TrackTemplateId == input.TrackTemplateId); var trackTemplateContentEntities =
await _trackTemplateRepository.GetContentListAsync(x => x.TrackTemplateId == input.TrackTemplateId);
var trackPullContentEntities = new List<TrackPullContentConfigEntity>(); var trackPullContentEntities = new List<TrackPullContentConfigEntity>();
@ -121,6 +125,7 @@ public class TrackPullService : ApplicationService, ITransientDependency
TrackContentId = item.TrackContentId TrackContentId = item.TrackContentId
}); });
} }
await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities); await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities);
ts.Complete(); ts.Complete();
@ -130,15 +135,20 @@ public class TrackPullService : ApplicationService, ITransientDependency
case OptionTypeNoNull.修改: case OptionTypeNoNull.修改:
{ {
var oldTrackPullEntity = await _trackPullConfigRepository.GetFirstAsync(x => x.Id == input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); 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 oldTrackPullParamsEntity =
await _trackPullConfigRepository.GetParamsSingleAsync(x =>
x.PullOrPushConfigId == input.Id && !x.IsPush);
var trackPullContentEntities = new List<TrackPullContentConfigEntity>(); var trackPullContentEntities = new List<TrackPullContentConfigEntity>();
if (oldTrackPullEntity.TrackTemplateId != input.TrackTemplateId) if (oldTrackPullEntity.TrackTemplateId != input.TrackTemplateId)
{ {
var trackTemplateContentEntities = await _trackTemplateRepository.GetContentListAsync(x => x.TrackTemplateId == input.TrackTemplateId); var trackTemplateContentEntities =
await _trackTemplateRepository.GetContentListAsync(x =>
x.TrackTemplateId == input.TrackTemplateId);
foreach (var item in trackTemplateContentEntities) foreach (var item in trackTemplateContentEntities)
{ {
@ -173,11 +183,13 @@ public class TrackPullService : ApplicationService, ITransientDependency
using (var ts = TransactionScopeHelper.Create()) using (var ts = TransactionScopeHelper.Create())
{ {
await _trackPullConfigRepository.SoftDeleteAsync(x => x.Id == input.Id); await _trackPullConfigRepository.SoftDeleteAsync(x => x.Id == input.Id);
await _trackPullConfigRepository.SoftDeleteParamsAsync(x => x.PullOrPushConfigId == input.Id && !x.IsPush); await _trackPullConfigRepository.SoftDeleteParamsAsync(x =>
x.PullOrPushConfigId == input.Id && !x.IsPush);
await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id); await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id);
ts.Complete(); ts.Complete();
} }
break; break;
default: default:
@ -196,7 +208,8 @@ public class TrackPullService : ApplicationService, ITransientDependency
[HttpPost("UpdateContent")] [HttpPost("UpdateContent")]
public async Task<bool> UpdateContentAsync([FromBody] UpdateTrackPullContentInput input) public async Task<bool> UpdateContentAsync([FromBody] UpdateTrackPullContentInput input)
{ {
var oldTrackPullContentEntity = await _trackPullConfigRepository.GetContentByIdAsync(input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); var oldTrackPullContentEntity = await _trackPullConfigRepository.GetContentByIdAsync(input.Id) ??
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
ObjectMapper.Map(input, oldTrackPullContentEntity); ObjectMapper.Map(input, oldTrackPullContentEntity);

View File

@ -1,8 +1,17 @@
using Microsoft.Extensions.Localization; 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.Localization; using SJZY.Track.Application.Localization;
using SJZY.Track.Domain.Aggregates.DemoAggregate;
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
using SJZY.Track.Domain.Aggregates.TrackPushAggregate; using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
using SJZY.Track.Domain.Dtos.Common; using SJZY.Track.Domain.Dtos.Common;
using SJZY.Track.Domain.Dtos.TrackPush; using SJZY.Track.Domain.Dtos.TrackPush;
using SqlSugar;
using System.Linq.Expressions;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
namespace SJZY.Track.Application.Services.TrackPush; namespace SJZY.Track.Application.Services.TrackPush;
@ -16,13 +25,19 @@ public class TrackPushService : ApplicationService, ITransientDependency
{ {
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer; private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
private readonly ITrackPushConfigRepository _trackPushConfigRepository; private readonly ITrackPushConfigRepository _trackPushConfigRepository;
private readonly ITrackTemplateRepository _trackTemplateRepository;
private readonly ITrackPullConfigRepository _trackPullConfigRepository;
public TrackPushService( public TrackPushService(
IStringLocalizer<TrackLocalizationResource> stringLocalizer, IStringLocalizer<TrackLocalizationResource> stringLocalizer,
ITrackPushConfigRepository trackPushConfigRepository) ITrackPushConfigRepository trackPushConfigRepository,
ITrackTemplateRepository trackTemplateRepository,
ITrackPullConfigRepository trackPullConfigRepository)
{ {
_stringLocalizer = stringLocalizer; _stringLocalizer = stringLocalizer;
_trackPushConfigRepository = trackPushConfigRepository; _trackPushConfigRepository = trackPushConfigRepository;
_trackTemplateRepository = trackTemplateRepository;
_trackPullConfigRepository = trackPullConfigRepository;
} }
/// <summary> /// <summary>
@ -55,6 +70,182 @@ public class TrackPushService : ApplicationService, ITransientDependency
[HttpGet("GetDetail")] [HttpGet("GetDetail")]
public async Task<GetTrackPushConfigDetailOutputVO> GetDetailAsync(int id) public async Task<GetTrackPushConfigDetailOutputVO> GetDetailAsync(int id)
{ {
return await _trackPushConfigRepository.GetDetailAsync(id); var res = await _trackPushConfigRepository.GetDetailAsync(id);
if (res is null) return null;
List<int> 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;
}
/// <summary>
/// 轨迹推送配置内容详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet("GetContentDetail")]
public async Task<GetTrackPushContentDetailOutputVO> GetContentDetailAsync(int id)
{
return await _trackPushConfigRepository.GetContentDetailAsync(id);
}
/// <summary>
/// 轨迹推送配置编辑
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("Edit")]
public async Task<bool> EditAsync([FromBody] EditTrackPushConfigInput input)
{
if (input.Options != OptionTypeNoNull.删除)
{
Expression<Func<TrackPushConfigEntity, bool>> isAnyExp = x =>
x.SubSystemId == input.SubSystemId && x.CustomId == input.CustomId && x.ServiceProviderId == input.ServiceProviderId;
if (input.Options == OptionTypeNoNull.修改) isAnyExp.And(x => x.Id != input.Id);
var trackTemplateIdExp = Expressionable.Create<TrackPushConfigEntity>();
foreach (var trackTemplateId in input.TrackTemplateIds) { trackTemplateIdExp.Or(x => SqlFunc.SplitIn(x.TrackTemplateId, trackTemplateId.ToString())); }
if (await _trackPushConfigRepository.IsAnyAsync(isAnyExp.And(trackTemplateIdExp.ToExpression())))
throw new BusinessException(message: _stringLocalizer["IsTrackPushConfigAny"]);
}
switch (input.Options)
{
case OptionTypeNoNull.新增:
{
var trackPushEntity = ObjectMapper.Map<EditTrackPushConfigInput, TrackPushConfigEntity>(input);
var trackPushParamsEntity = ObjectMapper.Map<EditTrackPushConfigInput, TrackPushPullParamsConfigEntity>(input);
using (var ts = TransactionScopeHelper.Create())
{
int id = await _trackPushConfigRepository.InsertReturnIdentityAsync(trackPushEntity);
trackPushParamsEntity.PullOrPushConfigId = id;
await _trackPullConfigRepository.InsertParamsAsync(trackPushParamsEntity);
if (input.IsAutoPush) await RedisHelper.Client.SAddAsync(GlobalConst.AutoPushRosterRedisKey, 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 RedisHelper.Client.SRemAsync(GlobalConst.AutoPushRosterRedisKey, oldCustomId);
if (input.IsAutoPush) await RedisHelper.Client.SAddAsync(GlobalConst.AutoPushRosterRedisKey, 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 RedisHelper.Client.SRemAsync(GlobalConst.AutoPushRosterRedisKey, oldTrackPushEntity.CustomId);
ts.Complete();
}
}
break;
default:
throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum,
nameof(EditTrackPushConfigInput.Options)]);
}
return true;
}
/// <summary>
/// 轨迹推送配置内容编辑
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("EditContent")]
public async Task<bool> EditContentAsync([FromBody] EditTrackPushContentInput input)
{
if (input.Options != OptionTypeNoNull.删除)
{
Expression<Func<TrackPushContentConfigEntity, bool>> isContentAnyExp = x =>
x.TrackPushConfigId == input.TrackPushConfigId && x.TrackContentId == input.TrackContentId;
if (input.Options == OptionTypeNoNull.修改) isContentAnyExp.And(x => x.Id != input.Id);
if (await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp))
throw new BusinessException(message: _stringLocalizer["IsTrackPushContentAny"]);
}
switch (input.Options)
{
case OptionTypeNoNull.新增:
{
var trackPushContentEntity = ObjectMapper.Map<EditTrackPushContentInput, TrackPushContentConfigEntity>(input);
await _trackPushConfigRepository.InsertContentAsync(trackPushContentEntity);
}
break;
case OptionTypeNoNull.修改:
{
var oldTrackPushContentEntity = await _trackPushConfigRepository.GetContentByIdAsync(input.Id!.Value) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]);
ObjectMapper.Map(input, oldTrackPushContentEntity);
await _trackPushConfigRepository.UpdateContentAsync(oldTrackPushContentEntity);
}
break;
case OptionTypeNoNull.删除:
await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.Id == input.Id);
break;
default:
throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum,
nameof(EditTrackPushContentInput.Options)]);
}
return true;
}
/// <summary>
/// 轨迹推送配置内容排序
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("SortContent")]
public async Task<bool> SortContentAsync([FromBody] SortTrackPushContentInput input)
{
return true;
} }
} }

View File

@ -1,12 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SJZY.Track.Application.Services.TrackStatus
{
public interface ITrackStatusService
{
}
}

View File

@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Authorization; using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Localization; using SJZY.Track.Application.Contract.Dtos.TrackStatus;
using SJZY.Track.Application.Dtos.TrackStatus;
using SJZY.Track.Application.Localization; using SJZY.Track.Application.Localization;
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
using SJZY.Track.Domain.Dtos.TrackStatus; using SJZY.Track.Domain.Dtos.TrackStatus;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
@ -17,14 +17,17 @@ public class TrackStatusService : ApplicationService, ITransientDependency
{ {
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer; private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
private readonly ITrackStatusRepository _trackStatusRepository; private readonly ITrackStatusRepository _trackStatusRepository;
private readonly ITrackContentRepository _trackContentRepository;
public TrackStatusService( public TrackStatusService(
IStringLocalizer<TrackLocalizationResource> stringLocalizer, IStringLocalizer<TrackLocalizationResource> stringLocalizer,
ITrackStatusRepository trackStatusRepository ITrackStatusRepository trackStatusRepository,
ITrackContentRepository trackContentRepository
) )
{ {
this._stringLocalizer = stringLocalizer; this._stringLocalizer = stringLocalizer;
this._trackStatusRepository = trackStatusRepository; this._trackStatusRepository = trackStatusRepository;
this._trackContentRepository=trackContentRepository;
} }
/// <summary> /// <summary>
@ -79,15 +82,19 @@ public class TrackStatusService : ApplicationService, ITransientDependency
} }
#region 私有方法 #region 私有方法
private async Task<UnifyResultDto> AddAsync(EditTrackStatusInput input) private async Task<UnifyResultDto> AddAsync(EditTrackStatusInput input)
{ {
#region 业务校验 #region 业务校验
var trackStatusEntity = await _trackStatusRepository.GetFirstAsync(a => a.SubSystemId==input.SubSystemId&& (a.Code==input.Code ||
var trackStatusEntity = await _trackStatusRepository.GetFirstAsync(a => a.SubSystemId == input.SubSystemId &&
(a.Code == input.Code ||
a.Status == input.TrackStatus || a.EnStatus == input.EntrackStatus)); a.Status == input.TrackStatus || a.EnStatus == input.EntrackStatus));
if (trackStatusEntity != null) if (trackStatusEntity != null)
{ {
throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]);
} }
#endregion #endregion
var entity = ObjectMapper.Map<EditTrackStatusInput, TrackStatusEntity>(input); var entity = ObjectMapper.Map<EditTrackStatusInput, TrackStatusEntity>(input);
@ -99,12 +106,15 @@ public class TrackStatusService : ApplicationService, ITransientDependency
private async Task<UnifyResultDto> UpdateAsync(EditTrackStatusInput input) private async Task<UnifyResultDto> UpdateAsync(EditTrackStatusInput input)
{ {
#region 业务校验 #region 业务校验
var trackStatusEntity = await _trackStatusRepository.GetFirstAsync(a => a.Id !=input.Id && a.SubSystemId==input.SubSystemId&& (a.Code==input.Code ||
var trackStatusEntity = await _trackStatusRepository.GetFirstAsync(a => a.Id != input.Id &&
a.SubSystemId == input.SubSystemId && (a.Code == input.Code ||
a.Status == input.TrackStatus || a.EnStatus == input.EntrackStatus)); a.Status == input.TrackStatus || a.EnStatus == input.EntrackStatus));
if (trackStatusEntity != null) if (trackStatusEntity != null)
{ {
throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]); throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]);
} }
#endregion #endregion
var templateEntity = await _trackStatusRepository.GetFirstAsync(a => a.Id == input.Id); var templateEntity = await _trackStatusRepository.GetFirstAsync(a => a.Id == input.Id);
@ -116,9 +126,17 @@ public class TrackStatusService : ApplicationService, ITransientDependency
private async Task<UnifyResultDto> DeleteAsync(EditTrackStatusInput input) private async Task<UnifyResultDto> DeleteAsync(EditTrackStatusInput input)
{ {
#region 业务校验
var isExistStatus = await _trackContentRepository.GetFirstAsync(a => a.TrackStatusId==input.Id);
if (isExistStatus!=null)
{
throw new BusinessException(message: _stringLocalizer["IsExistTrackStatus"]);
}
#endregion
var isTrue = await _trackStatusRepository.SoftDeleteAsync(x => x.Id == input.Id); var isTrue = await _trackStatusRepository.SoftDeleteAsync(x => x.Id == input.Id);
return new UnifyResultDto("200", "删除成功", isTrue); return new UnifyResultDto("200", "删除成功", isTrue);
} }
#endregion #endregion
} }

View File

@ -1,9 +1,9 @@
using System.Linq.Expressions; using System.Linq.Expressions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Localization; using Microsoft.Extensions.Localization;
using SJZY.Expand.ABP.Core.Localization; using SJZY.Expand.ABP.Core.Localization;
using SJZY.Track.Application.Dtos.TrackTemplates; using SJZY.Track.Application.Contract.Dtos.TrackTemplates;
using SJZY.Track.Application.Localization; using SJZY.Track.Application.Localization;
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
using SJZY.Track.Domain.Dtos.TrackTemplate; using SJZY.Track.Domain.Dtos.TrackTemplate;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
@ -19,14 +19,18 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
{ {
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer; private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
private readonly ITrackTemplateRepository _trackTemplateRepository; private readonly ITrackTemplateRepository _trackTemplateRepository;
private readonly ITrackPullConfigRepository _trackPullConfigRepository;
/// <inheritdoc/> /// <inheritdoc/>
public TrackTemplateService( public TrackTemplateService(
IStringLocalizer<TrackLocalizationResource> stringLocalizer, IStringLocalizer<TrackLocalizationResource> stringLocalizer,
ITrackTemplateRepository trackTemplateRepository) ITrackTemplateRepository trackTemplateRepository,
ITrackPullConfigRepository trackPullConfigRepository
)
{ {
_stringLocalizer = stringLocalizer; _stringLocalizer = stringLocalizer;
_trackTemplateRepository = trackTemplateRepository; _trackTemplateRepository = trackTemplateRepository;
_trackPullConfigRepository = trackPullConfigRepository;
} }
/// <summary> /// <summary>
@ -85,13 +89,17 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
private async Task<UnifyResultDto> AddAsync(EditTrackTemplateInput input) private async Task<UnifyResultDto> AddAsync(EditTrackTemplateInput input)
{ {
#region 业务校验 #region 业务校验
//校验模版代码唯一性 //校验模版代码唯一性
var templateEntity = await _trackTemplateRepository.GetFirstAsync(a => a.SubSystemId == input.SubSystemId &&a.Code==input.Code); var templateEntity =
await _trackTemplateRepository.GetFirstAsync(
a => a.SubSystemId == input.SubSystemId && a.Code == input.Code);
if (templateEntity != null) if (templateEntity != null)
{ {
throw new BusinessException(message: _stringLocalizer["TemplateExist"]); throw new BusinessException(message: _stringLocalizer["TemplateExist"]);
} }
#endregion
#endregion 业务校验
var entity = ObjectMapper.Map<EditTrackTemplateInput, TrackTemplateEntity>(input); var entity = ObjectMapper.Map<EditTrackTemplateInput, TrackTemplateEntity>(input);
var isTrue = await _trackTemplateRepository.InsertAsync(entity); var isTrue = await _trackTemplateRepository.InsertAsync(entity);
@ -102,12 +110,15 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
private async Task<UnifyResultDto> UpdateAsync(EditTrackTemplateInput input) private async Task<UnifyResultDto> UpdateAsync(EditTrackTemplateInput input)
{ {
#region 业务校验 #region 业务校验
var isExist = await _trackTemplateRepository.GetFirstAsync(a => a.Id!=input.Id && a.SubSystemId == input.SubSystemId &&a.Code==input.Code);
var isExist = await _trackTemplateRepository.GetFirstAsync(a =>
a.Id != input.Id && a.SubSystemId == input.SubSystemId && a.Code == input.Code);
if (isExist != null) if (isExist != null)
{ {
throw new BusinessException(message: _stringLocalizer["TemplateExist"]); throw new BusinessException(message: _stringLocalizer["TemplateExist"]);
} }
#endregion
#endregion 业务校验
var templateEntity = await _trackTemplateRepository.GetFirstAsync(a => a.Id == input.Id); var templateEntity = await _trackTemplateRepository.GetFirstAsync(a => a.Id == input.Id);
ObjectMapper.Map(input, templateEntity); ObjectMapper.Map(input, templateEntity);
@ -119,8 +130,16 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
private async Task<UnifyResultDto> DeleteAsync(EditTrackTemplateInput input) private async Task<UnifyResultDto> DeleteAsync(EditTrackTemplateInput input)
{ {
#region 业务校验 #region 业务校验
//到时候,得判断这个模版有没有在轨迹映射里面被使用过,如果被使用就抛出提示
#endregion //查询看看在轨迹拉取里面有没有被占用
var isExisistTrackPullConfig = await _trackPullConfigRepository.GetFirstAsync(a => a.TrackTemplateId == input.Id);
if (isExisistTrackPullConfig != null)
{
throw new BusinessException(message: _stringLocalizer["IsExistTrackPullConfig"]);
}
#endregion 业务校验
var isTrue = await _trackTemplateRepository.SoftDeleteAsync(x => x.Id == input.Id); var isTrue = await _trackTemplateRepository.SoftDeleteAsync(x => x.Id == input.Id);
return new UnifyResultDto("200", "删除成功", isTrue); return new UnifyResultDto("200", "删除成功", isTrue);

View File

@ -1,4 +1,5 @@
using SJZY.Expand.ABP.Core.Localization; using SJZY.Expand.ABP.Core.Localization;
using SJZY.Track.Application.Contract;
using SJZY.Track.Application.Localization; using SJZY.Track.Application.Localization;
using SJZY.UserCenter.Contracts; using SJZY.UserCenter.Contracts;
using SJZY.UserCenter.SharedModel; using SJZY.UserCenter.SharedModel;
@ -19,25 +20,26 @@ namespace SJZY.Track.Application
typeof(AbpLocalizationModule), typeof(AbpLocalizationModule),
typeof(AbpVirtualFileSystemModule), typeof(AbpVirtualFileSystemModule),
typeof(AbpHttpClientModule), typeof(AbpHttpClientModule),
typeof(SJZYTrackDomainModule), typeof(SjzyUserCenterHttpApiModule),
typeof(SjzyUserCenterHttpApiModule) typeof(SjzyTrackDomainModule),
typeof(SjzyTrackApplicationContractModule)
)] )]
public class ApplicationModule : AbpModule public class SjzyTrackApplicationModule : AbpModule
{ {
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)
{ {
var configuration = context.Services.GetConfiguration(); var configuration = context.Services.GetConfiguration();
Configure<AbpAutoMapperOptions>(options => { options.AddMaps<ApplicationModule>(true); }); Configure<AbpAutoMapperOptions>(options => { options.AddMaps<SjzyTrackApplicationModule>(true); });
Configure<AbpAspNetCoreMvcOptions>(options => Configure<AbpAspNetCoreMvcOptions>(options =>
{ {
options.ConventionalControllers.Create(typeof(ApplicationModule).Assembly); //创建动态api options.ConventionalControllers.Create(typeof(SjzyTrackApplicationModule).Assembly); //创建动态api
}); });
//添加虚拟文件系统 //添加虚拟文件系统
Configure<AbpVirtualFileSystemOptions>(options => Configure<AbpVirtualFileSystemOptions>(options =>
{ {
options.FileSets.AddEmbedded<ApplicationModule>("SJZY.Track.Application"); options.FileSets.AddEmbedded<SjzyTrackApplicationModule>("SJZY.Track.Application");
}); });
//添加多语言 //添加多语言

View File

@ -1,68 +0,0 @@
using FluentValidation;
using SJZY.Track.Application.Dtos.Demo;
namespace SJZY.Track.Application.Validations.Demo
{
public class SimpleValidateInputValidation : AbstractValidator<ValidateExecuteInput>, IValidationEnabled
{
public SimpleValidateInputValidation()
{
/*
非空校验
NotNull 和 NotEmpty 的区别?
NotNull:请求中没找到指定参数
NotEmpty:请求中没找到指定参数 或 参数值为初始值(0/"")
关于字符串的最佳实践:
参数定义成可空字符串 string?,校验规则只用isempty
*/
RuleFor(x => x.PassWord).NotNull().WithMessage("操作密码为必填参数!").NotEmpty().WithMessage("操作密码不能为空!");
//雪花id
RuleFor(x => x.SnowId).NotNull().WithMessage("雪花ID为必填参数!").NotEmpty().WithMessage("雪花ID不能为空!");
//枚举校验
RuleFor(x => x.Option).IsInEnum().WithMessage("操作类型不在可选范围!");
//字符串长度校验,长度不分中文、字符、数值
RuleFor(x => x.LoginName).Length(6, 10).WithMessage("登录账号必须在6-10位之间!");
RuleFor(x => x.LoginName).MaximumLength(10).WithMessage("登录账号不能超过10个字符!");
RuleFor(x => x.LoginName).MinimumLength(6).WithMessage("登录账号不能小于6个字符!");
//正则表达式
RuleFor(x => x.PassWord).Matches("^(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[!@#$\\%\\^\\&\\*\\(\\)])[0-9a-zA-Z!@#$\\%\\^\\&\\*\\(\\)]{6,10}")
.WithMessage("密码必须同时包含数字、英文字母、特殊字符,且长度必须在6-10位之间");
//自定义校验规则,注意这里的校验仅限于模型参数级的校验,更复杂的业务校验应在业务层完成
RuleFor(x => x.PassWordAgain).Must((data, context) =>
{
return data.PassWord == data.PassWordAgain;
}).WithMessage("两次输入密码不一致!");
//数字类型校验
RuleFor(x => x.MiniCount).LessThan(100).WithMessage("最小数量必须小于100");
RuleFor(x => x.MiniCount).LessThanOrEqualTo(100).WithMessage("最小数量必须小于或等于100");
RuleFor(x => x.MaxCount).GreaterThan(100).WithMessage("最大数量必须大于100");
RuleFor(x => x.MaxCount).GreaterThanOrEqualTo(100).WithMessage("最大数量必须大于或等于100");
//小数类型校验,10.56
RuleFor(x => x.TotalQuota).ScalePrecision(2, 4, true).WithMessage("最大额度金额【整数位+小数位】不能超过4位,且小数位不能超过2位");
//条件分支
When(x => x.Option == OptionType.修改 || x.Option == OptionType.删除, () =>
{
RuleFor(x => x.Id).NotNull().WithMessage("修改或删除时Id为必填参数!").GreaterThan(0).WithMessage("修改或删除时Id必须大于0!");
});
//单个实体校验
RuleFor(x => x.UserInfoInput).NotNull().WithMessage("用户信息为必填参数!").SetValidator(new UserInfoInputValidation());
//集合校验
RuleForEach(x => x.UserRoleInputList).SetValidator(new UserRoleInputValidation());
}
}
}

View File

@ -1,15 +0,0 @@
using FluentValidation;
using SJZY.Track.Application.Dtos.Demo;
namespace SJZY.Track.Application.Validations.Demo
{
public class UserInfoInputValidation : AbstractValidator<UserInfoInput>, IValidationEnabled
{
public UserInfoInputValidation()
{
RuleFor(x => x.QQ).NotNull().WithMessage("QQ号码不能为空");
}
}
}

View File

@ -1,13 +0,0 @@
using FluentValidation;
using SJZY.Track.Application.Dtos.Demo;
namespace SJZY.Track.Application.Validations.Demo
{
public class UserRoleInputValidation : AbstractValidator<UserRoleInput>, IValidationEnabled
{
public UserRoleInputValidation()
{
RuleFor(m => m.Id).GreaterThan(0).WithMessage("角色ID必须大于0!");
}
}
}

View File

@ -1,11 +1,5 @@
using FluentValidation; using FluentValidation;
using SJZY.Track.Application.Dtos.TrackContents; using SJZY.Track.Application.Contract.Dtos.TrackContents;
using SJZY.Track.Application.Dtos.TrackTemplates;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SJZY.Track.Application.Validations.TrackContents namespace SJZY.Track.Application.Validations.TrackContents
{ {
@ -14,15 +8,10 @@ namespace SJZY.Track.Application.Validations.TrackContents
public EditTrackContentInputValidation() public EditTrackContentInputValidation()
{ {
//条件分支 //条件分支
When(x => x.Options == OptionType.修改 || x.Options == OptionType.删除, () => When(x => x.Options == OptionType.修改 || x.Options == OptionType.删除,
{ () => { RuleFor(x => x.Id).GreaterThan(0).WithMessage("修改或删除时Id必须大于0!"); });
RuleFor(x => x.Id).GreaterThan(0).WithMessage("修改或删除时Id必须大于0!");
});
When(x => x.Options == OptionType.新增, () => When(x => x.Options == OptionType.新增, () => { RuleFor(x => x.Id).Equal(0).WithMessage("新增时Id必须等于0!"); });
{
RuleFor(x => x.Id).Equal(0).WithMessage("新增时Id必须等于0!");
});
When(x => x.Options == OptionType.修改 || x.Options == OptionType.新增, () => When(x => x.Options == OptionType.修改 || x.Options == OptionType.新增, () =>
{ {
@ -33,6 +22,5 @@ namespace SJZY.Track.Application.Validations.TrackContents
RuleFor(x => x.EnContent).NotNull().WithMessage("轨迹内容英文必填!").NotEmpty().WithMessage("轨迹内容英文不能为空!"); RuleFor(x => x.EnContent).NotNull().WithMessage("轨迹内容英文必填!").NotEmpty().WithMessage("轨迹内容英文不能为空!");
}); });
} }
} }
} }

View File

@ -1,11 +1,5 @@
using FluentValidation; using FluentValidation;
using SJZY.Track.Application.Dtos.TrackFlags; using SJZY.Track.Application.Contract.Dtos.TrackFlags;
using SJZY.Track.Application.Dtos.TrackStatus;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SJZY.Track.Application.Validations.TrackFlags namespace SJZY.Track.Application.Validations.TrackFlags
{ {
@ -14,15 +8,10 @@ namespace SJZY.Track.Application.Validations.TrackFlags
public EditTrackFlagInputValidation() public EditTrackFlagInputValidation()
{ {
//条件分支 //条件分支
When(x => x.Options == OptionType.修改 || x.Options == OptionType.删除, () => When(x => x.Options == OptionType.修改 || x.Options == OptionType.删除,
{ () => { RuleFor(x => x.Id).GreaterThan(0).WithMessage("修改或删除时Id必须大于0!"); });
RuleFor(x => x.Id).GreaterThan(0).WithMessage("修改或删除时Id必须大于0!");
});
When(x => x.Options == OptionType.新增, () => When(x => x.Options == OptionType.新增, () => { RuleFor(x => x.Id).Equal(0).WithMessage("新增时Id必须等于0!"); });
{
RuleFor(x => x.Id).Equal(0).WithMessage("新增时Id必须等于0!");
});
When(x => x.Options == OptionType.修改 || x.Options == OptionType.新增, () => When(x => x.Options == OptionType.修改 || x.Options == OptionType.新增, () =>
{ {

View File

@ -1,11 +1,5 @@
using FluentValidation; using FluentValidation;
using SJZY.Track.Application.Dtos.TrackContents; using SJZY.Track.Application.Contract.Dtos.TrackStatus;
using SJZY.Track.Application.Dtos.TrackStatus;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SJZY.Track.Application.Validations.TrackStatus namespace SJZY.Track.Application.Validations.TrackStatus
{ {
@ -14,15 +8,10 @@ namespace SJZY.Track.Application.Validations.TrackStatus
public EditTrackStatusInputValidation() public EditTrackStatusInputValidation()
{ {
//条件分支 //条件分支
When(x => x.Options == OptionType.修改 || x.Options == OptionType.删除, () => When(x => x.Options == OptionType.修改 || x.Options == OptionType.删除,
{ () => { RuleFor(x => x.Id).GreaterThan(0).WithMessage("修改或删除时Id必须大于0!"); });
RuleFor(x => x.Id).GreaterThan(0).WithMessage("修改或删除时Id必须大于0!");
});
When(x => x.Options == OptionType.新增, () => When(x => x.Options == OptionType.新增, () => { RuleFor(x => x.Id).Equal(0).WithMessage("新增时Id必须等于0!"); });
{
RuleFor(x => x.Id).Equal(0).WithMessage("新增时Id必须等于0!");
});
When(x => x.Options == OptionType.修改 || x.Options == OptionType.新增, () => When(x => x.Options == OptionType.修改 || x.Options == OptionType.新增, () =>
{ {

View File

@ -1,5 +1,5 @@
using FluentValidation; using FluentValidation;
using SJZY.Track.Application.Dtos.TrackTemplates; using SJZY.Track.Application.Contract.Dtos.TrackTemplates;
namespace SJZY.Track.Application.Validations.TrackTemplates namespace SJZY.Track.Application.Validations.TrackTemplates
{ {
@ -11,16 +11,10 @@ namespace SJZY.Track.Application.Validations.TrackTemplates
public EditTrackTemplateInputValidation() public EditTrackTemplateInputValidation()
{ {
//条件分支 //条件分支
When(x => x.Options == OptionType.修改 || x.Options == OptionType.删除, () => When(x => x.Options == OptionType.修改 || x.Options == OptionType.删除,
{ () => { RuleFor(x => x.Id).GreaterThan(0).WithMessage("修改或删除时Id必须大于0!"); });
RuleFor(x => x.Id).GreaterThan(0).WithMessage("修改或删除时Id必须大于0!");
});
When(x => x.Options == OptionType.新增, () => When(x => x.Options == OptionType.新增, () => { RuleFor(x => x.Id).Equal(0).WithMessage("新增时Id必须等于0!"); });
{
RuleFor(x => x.Id).Equal(0).WithMessage("新增时Id必须等于0!");
});
When(x => x.Options == OptionType.修改 || x.Options == OptionType.新增, () => When(x => x.Options == OptionType.修改 || x.Options == OptionType.新增, () =>
{ {

View File

@ -11,7 +11,7 @@ public interface IOrderRepository : IBasicRepository<OrderEntity>
/// <returns></returns> /// <returns></returns>
Task<bool> CreateOrderAsync(OrderEntity order); Task<bool> CreateOrderAsync(OrderEntity order);
Task<List<TrackOrderDetailVO>> GetOrderDetails(GetOrderDetailsInputVO input); //Task<List<TrackOrderDetailVO>> GetOrderDetails(GetOrderDetailsInputVO input);
/// <summary> /// <summary>
/// 获取分页的轨迹订单 /// 获取分页的轨迹订单
@ -20,6 +20,30 @@ public interface IOrderRepository : IBasicRepository<OrderEntity>
/// <returns></returns> /// <returns></returns>
Task<UnifyPageResultDto<TrackOrderVO>> GetPageTrackOrder(GetPageTrackOrderInputVO input); Task<UnifyPageResultDto<TrackOrderVO>> GetPageTrackOrder(GetPageTrackOrderInputVO input);
/// <summary>
/// 更新订单
/// </summary>
/// <param name="order"></param>
/// <returns></returns>
Task UpdateOrderAsync(OrderEntity order);
/// <summary>
/// 删除订单
/// </summary>
/// <param name="orderId"></param>
/// <returns></returns>
Task DeleteOrderAsync(int orderId);
#region 订单关联
/// <summary>
/// 根据订单id,获取关联的订单集合
/// </summary>
/// <param name="orderId"></param>
/// <returns></returns>
Task<List<LinkedOrderVO>> GetLinkedOrdersAsync(int orderId);
/// <summary> /// <summary>
/// 关联订单 /// 关联订单
/// </summary> /// </summary>
@ -34,17 +58,5 @@ public interface IOrderRepository : IBasicRepository<OrderEntity>
/// <returns></returns> /// <returns></returns>
Task UnLinkByIdsAsync(List<int> linkIds); Task UnLinkByIdsAsync(List<int> linkIds);
/// <summary> #endregion
/// 更新订单
/// </summary>
/// <param name="order"></param>
/// <returns></returns>
Task UpdateOrderAsync(OrderEntity order);
/// <summary>
/// 删除订单
/// </summary>
/// <param name="orderId"></param>
/// <returns></returns>
Task DeleteOrderAsync(int orderId);
} }

View File

@ -42,6 +42,12 @@ public class OrderEntity : IFullAuditedBasicEntitys, IAggregateRoot
[SugarColumn(ColumnName = "IsCompleted")] [SugarColumn(ColumnName = "IsCompleted")]
public bool IsCompleted { get; set; } public bool IsCompleted { get; set; }
/// <summary>
/// 订单是否推送完成(异步维护)
/// </summary>
[SugarColumn(ColumnName = "IsPushCompleted")]
public bool IsPushCompleted { get; set; }
/// <summary> /// <summary>
/// 最新轨迹内容(异步维护) /// 最新轨迹内容(异步维护)
/// </summary> /// </summary>

View File

@ -12,6 +12,18 @@ public class OrderLinkEntity : ICreateBaicEntity, ISoftDeleteBasicEntity, IEntit
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)] [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)]
public int Id { get; set; } public int Id { get; set; }
/// <summary>
/// 订单id
/// </summary>
[SugarColumn(ColumnName = "OrderId")]
public int OrderId { get; set; }
/// <summary>
/// 关联的订单id
/// </summary>
[SugarColumn(ColumnName = "LinkOrderId")]
public int LinkOrderId { get; set; }
/// <summary> /// <summary>
/// 订单类型 /// 订单类型
/// </summary> /// </summary>
@ -24,6 +36,7 @@ public class OrderLinkEntity : ICreateBaicEntity, ISoftDeleteBasicEntity, IEntit
[SugarColumn(ColumnName = "OrderNo")] [SugarColumn(ColumnName = "OrderNo")]
public string OrderNo { get; set; } = null!; public string OrderNo { get; set; } = null!;
/// <summary> /// <summary>
/// 关联的订单类型 /// 关联的订单类型
/// </summary> /// </summary>

View File

@ -1,10 +1,26 @@
using SJZY.Track.Domain.Dtos.TrackContents; using SJZY.Track.Domain.Dtos.TrackContents;
using SJZY.Track.Domain.Dtos.TrackStatus;
namespace SJZY.Track.Domain.Aggregates.TrackContentAggregate; namespace SJZY.Track.Domain.Aggregates.TrackContentAggregate;
public interface ITrackContentRepository : IBasicRepository<TrackContentEntity> public interface ITrackContentRepository : IBasicRepository<TrackContentEntity>
{ {
Task<GetTrackContentDetailVO?> GetDetailAsync(int id); Task<GetTrackContentDetailVO?> GetDetailAsync(int id);
Task<UnifyPageResultDto<GetTrackContentListVO>> GetPageTrackContent(GetPageTrackContentVO input); Task<UnifyPageResultDto<GetTrackContentListVO>> GetPageTrackContent(GetPageTrackContentVO input);
Task<UnifyPageResultDto<GetTrackContentMapPageOutputVO>> GetMapPageAsync(GetTrackContentMapPageInputVO input);
Task<GetTrackContentMapDetailOutputVO> GetMapDetailAsync(int id);
Task<bool> IsMapAnyAsync(Expression<Func<TrackContentMapEntity, bool>> whereExpression);
Task<bool> InsertMapAsync(TrackContentMapEntity insertObj);
Task<TrackContentMapEntity> GetMapByIdAsync(int id);
Task<bool> UpdateMapAsync(TrackContentMapEntity updateObj);
Task<bool> SoftDeleteMapAsync(Expression<Func<TrackContentMapEntity, bool>> whereExpression);
Task<bool> UpdateMapAsync(Expression<Func<TrackContentMapEntity, TrackContentMapEntity>> columns, Expression<Func<TrackContentMapEntity, bool>> whereExpression);
} }

View File

@ -13,14 +13,38 @@ public class TrackContentMapEntity : IFullAuditedBasicEntitys, IEntity
public int Id { get; set; } public int Id { get; set; }
/// <summary> /// <summary>
/// 映射轨迹内容id /// 源子系统id
/// </summary> /// </summary>
[SugarColumn(ColumnName = "MapTrackContentId")] [SugarColumn(ColumnName = "SubSystemId")]
public int MapTrackContentId { get; set; } public int SubSystemId { get; set; }
/// <summary> /// <summary>
/// 源轨迹内容id /// 源轨迹内容id
/// </summary> /// </summary>
[SugarColumn(ColumnName = "TrackContentId")] [SugarColumn(ColumnName = "TrackContentId")]
public int TrackContentId { get; set; } public int TrackContentId { get; set; }
/// <summary>
/// 源轨迹内容code
/// </summary>
[SugarColumn(ColumnName = "TrackContentCode")]
public string TrackContentCode { get; set; } = null!;
/// <summary>
/// 映射子系统id
/// </summary>
[SugarColumn(ColumnName = "MapSubSystemId")]
public int MapSubSystemId { get; set; }
/// <summary>
/// 映射轨迹内容id
/// </summary>
[SugarColumn(ColumnName = "MapTrackContentId")]
public int MapTrackContentId { get; set; }
/// <summary>
/// 映射轨迹内容code
/// </summary>
[SugarColumn(ColumnName = "MapTrackContentCode")]
public string MapTrackContentCode { get; set; } = null!;
} }

View File

@ -6,11 +6,10 @@ public interface ITrackDetailsRepository
{ {
Task<TrackDetailsIndex?> GetFirstOrDefaultAsync(int orderId, string inputTrackCode); Task<TrackDetailsIndex?> GetFirstOrDefaultAsync(int orderId, string inputTrackCode);
Task UpdateAsync(TrackDetailsIndex index); Task UpsertAsync(TrackDetailsIndex index);
Task CreateAsync(TrackDetailsIndex index);
Task<List<TrackDetailsIndex>> GetListAsync(int orderType, List<string> orderNos); Task<List<TrackDetailsIndex>> GetListAsync(int orderType, List<string> orderNos);
Task<(List<TrackDetailsIndex> list, long total)> GetListAsync(TrackDetailsQueryInput input); Task<(List<TrackDetailsIndex> list, long total)> GetListAsync(TrackDetailsQueryInput input);
Task<List<TrackDetailsIndex>> GetListAsync(int orderId);
} }

View File

@ -3,11 +3,9 @@ using SJZY.Expand.ElasticSearch;
namespace SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; namespace SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
[ElasticsearchType(RelationName = IndexName)] [ElasticsearchType(RelationName = GlobalConst.TrackIndex)]
public class TrackDetailsIndex : IdBaseIndex public class TrackDetailsIndex : IdBaseIndex
{ {
public const string IndexName = "sjzy_track_details";
/// <summary> /// <summary>
/// 订单Id /// 订单Id
/// </summary> /// </summary>
@ -16,7 +14,7 @@ public class TrackDetailsIndex : IdBaseIndex
/// <summary> /// <summary>
/// 订单号 /// 订单号
/// </summary> /// </summary>
public string OrderNo { get; set; } public string OrderNo { get; set; } = null!;
/// <summary> /// <summary>
/// 订单类型(主数据枚举TrackOrderType) /// 订单类型(主数据枚举TrackOrderType)
@ -26,42 +24,42 @@ public class TrackDetailsIndex : IdBaseIndex
/// <summary> /// <summary>
/// 轨迹状态 /// 轨迹状态
/// </summary> /// </summary>
public string TrackStatus { get; set; } public string TrackStatus { get; set; } = null!;
/// <summary> /// <summary>
/// 原轨迹状态 /// 原轨迹状态
/// </summary> /// </summary>
public string OriginTrackStatus { get; set; } public string? OriginTrackStatus { get; set; }
/// <summary> /// <summary>
/// 轨迹内容代码 /// 轨迹内容代码
/// </summary> /// </summary>
public string TrackCode { get; set; } public string TrackCode { get; set; } = null!;
/// <summary> /// <summary>
/// 轨迹内容 /// 轨迹内容
/// </summary> /// </summary>
public string TrackContent { get; set; } public string TrackContent { get; set; } = null!;
/// <summary> /// <summary>
/// 原轨迹内容 /// 原轨迹内容
/// </summary> /// </summary>
public string OriginTrackContent { get; set; } public string? OriginTrackContent { get; set; }
/// <summary> /// <summary>
/// 原轨迹报文 /// 原轨迹报文
/// </summary> /// </summary>
public string OriginTrackData { get; set; } public string? OriginTrackData { get; set; }
/// <summary> /// <summary>
/// 轨迹内容英文 /// 轨迹内容英文
/// </summary> /// </summary>
public string TrackEnContent { get; set; } public string TrackEnContent { get; set; } = null!;
/// <summary> /// <summary>
/// 轨迹发生地 /// 轨迹发生地
/// </summary> /// </summary>
public string TrackPlace { get; set; } public string? TrackPlace { get; set; }
/// <summary> /// <summary>
/// 轨迹发生时间 /// 轨迹发生时间

View File

@ -64,5 +64,5 @@ public class TrackPullContentConfigEntity : IFullAuditedBasicEntitys, IEntity
/// 轨迹时区GMT /// 轨迹时区GMT
/// </summary> /// </summary>
[SugarColumn(ColumnName = "TrackTimeZone")] [SugarColumn(ColumnName = "TrackTimeZone")]
public string TrackTimeZone { get; set; } public double? TrackTimeZone { get; set; }
} }

View File

@ -10,4 +10,16 @@ public interface ITrackPushConfigRepository : IBasicRepository<TrackPushConfigEn
Task<UnifyPageResultDto<GetTrackPushContentPageOutputVO>> GetContentPageAsync(GetTrackPushContentPageInputVO input); Task<UnifyPageResultDto<GetTrackPushContentPageOutputVO>> GetContentPageAsync(GetTrackPushContentPageInputVO input);
Task<GetTrackPushConfigDetailOutputVO> GetDetailAsync(int id); Task<GetTrackPushConfigDetailOutputVO> GetDetailAsync(int id);
Task<GetTrackPushContentDetailOutputVO> GetContentDetailAsync(int id);
Task<bool> SoftDeleteContentAsync(Expression<Func<TrackPushContentConfigEntity, bool>> whereExpression);
Task<bool> IsContentAnyAsync(Expression<Func<TrackPushContentConfigEntity, bool>> whereExpression);
Task<bool> InsertContentAsync(TrackPushContentConfigEntity insertObj);
Task<TrackPushContentConfigEntity> GetContentByIdAsync(int id);
Task<bool> UpdateContentAsync(TrackPushContentConfigEntity updateObj);
} }

View File

@ -70,5 +70,5 @@ public class TrackPushContentConfigEntity : IFullAuditedBasicEntitys, IEntity
/// 轨迹时区GMT /// 轨迹时区GMT
/// </summary> /// </summary>
[SugarColumn(ColumnName = "TrackTimeZone")] [SugarColumn(ColumnName = "TrackTimeZone")]
public string TrackTimeZone { get; set; } public double? TrackTimeZone { get; set; }
} }

View File

@ -10,10 +10,10 @@ public class KeywordsInputVO : PageInfoInput
/// <summary> /// <summary>
/// 关键字 /// 关键字
/// </summary> /// </summary>
public string Keywords { get; set; } public string? Keywords { get; set; }
/// <summary> /// <summary>
/// 选中项 /// 选中项
/// </summary> /// </summary>
public int? SelectedId { get; set; } public List<int>? SelectedId { get; set; }
} }

Some files were not shown because too many files have changed in this diff Show More