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

This commit is contained in:
柳文翔 2024-03-01 11:50:43 +08:00
commit 21f2c215d7
94 changed files with 489 additions and 1515 deletions

View File

@ -12,7 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0E2537C3-6
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.Infrastructure", "src\SJZY.Track.Infrastructure\SJZY.Track.Infrastructure.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

@ -10,10 +10,10 @@ try
.AddConfigurationContainer() .AddConfigurationContainer()
.AddOptionsFromConfiguration() .AddOptionsFromConfiguration()
.UseSerilogDefault() .UseSerilogDefault()
.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,34 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <Import Project="../../common.props"/>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup>
<ItemGroup> <PropertyGroup>
<Compile Remove="logs\**" /> <TargetFramework>net7.0</TargetFramework>
<Content Remove="logs\**" /> <GenerateDocumentationFile>True</GenerateDocumentationFile>
<EmbeddedResource Remove="logs\**" /> <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<None Remove="logs\**" /> <DockerfileContext>..\..</DockerfileContext>
</ItemGroup> </PropertyGroup>
<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"/>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.17.0" /> <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.17.0"/>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0"/>
<PackageReference Include="Volo.Abp.Autofac" Version="7.0.2" /> <PackageReference Include="Volo.Abp.Autofac" Version="7.0.2"/>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SJZY.Track.Application\SJZY.Track.Application.csproj"/>
<ProjectReference Include="..\SJZY.Track.Infrastructure\SJZY.Track.Infrastructure.csproj"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SJZY.Track.Application\SJZY.Track.Application.csproj" />
<ProjectReference Include="..\SJZY.Track.Infrastructure\SJZY.Track.Infrastructure.csproj"/>
</ItemGroup>
</Project> </Project>

View File

@ -27,10 +27,10 @@ namespace SJZY.Track.Api
typeof(SjzyAbpCodeModule), typeof(SjzyAbpCodeModule),
typeof(AbpAspNetCoreMvcModule), typeof(AbpAspNetCoreMvcModule),
typeof(AbpAspNetCoreSerilogModule), typeof(AbpAspNetCoreSerilogModule),
typeof(ApplicationModule), typeof(SjzyTrackApplicationModule),
typeof(SJZYTrackInfrastructureModule) typeof(SjzyTrackInfrastructureModule)
)] )]
public class SJZYTrackApiModule : AbpModule public class SjzyTrackApiModule : AbpModule
{ {
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)
{ {

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
{ {
@ -30,7 +24,7 @@ namespace SJZY.Track.Application.Dtos.ProvideServices
/// 轨迹内容 /// 轨迹内容
/// </summary> /// </summary>
public string Content { get; set; } public string Content { get; set; }
/// <summary> /// <summary>
/// 轨迹内容英文 /// 轨迹内容英文
/// </summary> /// </summary>
@ -51,4 +45,4 @@ namespace SJZY.Track.Application.Dtos.ProvideServices
/// </summary> /// </summary>
public string TrackTimeZone { get; set; } public string TrackTimeZone { get; set; }
} }
} }

View File

@ -0,0 +1,95 @@
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? 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,4 +1,4 @@
namespace SJZY.Track.Application.Dtos.ProvideServices; namespace SJZY.Track.Application.Contract.Dtos.ProvideServices;
public class UpsertTrackInput : OrderNoInfo public class UpsertTrackInput : OrderNoInfo
{ {

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
{ {
@ -79,12 +73,12 @@ namespace SJZY.Track.Application.Dtos.TrackContents
/// <summary> /// <summary>
/// 轨迹内容代码 /// 轨迹内容代码
/// </summary> /// </summary>
public string Code { get; set; } public string Code { get; set; }
/// <summary> /// <summary>
/// 轨迹内容 /// 轨迹内容
/// </summary> /// </summary>
public string Content { get; set; } public string Content { get; set; }
/// <summary> /// <summary>
/// 轨迹内容英文 /// 轨迹内容英文
@ -94,12 +88,11 @@ namespace SJZY.Track.Application.Dtos.TrackContents
/// <summary> /// <summary>
/// 轨迹标记id /// 轨迹标记id
/// </summary> /// </summary>
public int TrackFlagId { get; set; } public int TrackFlagId { get; set; }
/// <summary> /// <summary>
/// 轨迹标记 /// 轨迹标记
/// </summary> /// </summary>
public string TrackFlag { get; set; } public string TrackFlag { 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
{ {
@ -81,4 +75,4 @@ namespace SJZY.Track.Application.Dtos.TrackContents
/// </summary> /// </summary>
public string UpdateUser { get; set; } public string UpdateUser { get; set; }
} }
} }

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
{ {
@ -54,7 +48,7 @@ namespace SJZY.Track.Application.Dtos.TrackFlags
/// <summary> /// <summary>
/// 子系统 /// 子系统
/// </summary> /// </summary>
public string SubSystem { get; set; } public string SubSystem { get; set; }
/// <summary> /// <summary>
/// 代码 /// 代码
@ -71,4 +65,4 @@ namespace SJZY.Track.Application.Dtos.TrackFlags
/// </summary> /// </summary>
public bool IsFinish { get; set; } public bool IsFinish { get; set; }
} }
} }

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
{ {
@ -66,4 +60,4 @@ namespace SJZY.Track.Application.Dtos.TrackFlags
///// </summary> ///// </summary>
//public string Keywords { get; set; } //public string Keywords { get; set; }
} }
} }

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
{ {

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
{ {

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
{ {
@ -43,4 +37,4 @@ namespace SJZY.Track.Application.Dtos.TrackStatus
/// </summary> /// </summary>
public string? EntrackStatus { get; set; } public string? EntrackStatus { get; set; }
} }
} }

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
{ {
@ -21,26 +15,26 @@ namespace SJZY.Track.Application.Dtos.TrackStatus
/// <summary> /// <summary>
/// 子系统 /// 子系统
/// </summary> /// </summary>
public string SubSystem { get; set; } public string SubSystem { get; set; }
/// <summary> /// <summary>
/// 节点id /// 节点id
/// </summary> /// </summary>
public int NodeId { get; set; } public int NodeId { get; set; }
/// <summary> /// <summary>
/// 所属轨迹状态 /// 所属轨迹状态
/// </summary> /// </summary>
public string TrackStatus { get; set; } public string TrackStatus { get; set; }
/// <summary> /// <summary>
/// 轨迹状态代码 /// 轨迹状态代码
/// </summary> /// </summary>
public string Code { get; set; } public string Code { get; set; }
/// <summary> /// <summary>
/// 轨迹内容英文 /// 轨迹内容英文
/// </summary> /// </summary>
public string EntrackStatus { get; set; } public string EntrackStatus { get; set; }
} }
} }

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
{ {
@ -72,4 +66,4 @@ namespace SJZY.Track.Application.Dtos.TrackStatus
/// </summary> /// </summary>
public string Keywords { get; set; } = ""; public string Keywords { 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>
/// 获取轨迹模版分页输入 /// 获取轨迹模版分页输入
@ -20,4 +20,4 @@
/// </summary> /// </summary>
public int TrackTemplateId { get; set; } public int TrackTemplateId { get; set; }
} }
} }

View File

@ -1,4 +1,4 @@
namespace SJZY.Track.Application.Dtos.TrackTemplates namespace SJZY.Track.Application.Contract.Dtos.TrackTemplates
{ {
/// <summary> /// <summary>
/// 获取轨迹模版详情 /// 获取轨迹模版详情
@ -92,4 +92,4 @@
/// </summary> /// </summary>
public string? Code { set; get; } public string? Code { set; get; }
} }
} }

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,14 +1,14 @@
<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>
<PackageReference Include="SJZY.Expand.ABP.Common" Version="7.0.11" /> <PackageReference Include="SJZY.Expand.ABP.Common" Version="7.0.11"/>
<PackageReference Include="Volo.Abp.Core" Version="7.0.2" /> <PackageReference Include="Volo.Abp.Core" Version="7.0.2"/>
</ItemGroup> </ItemGroup>
</Project> </Project>

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,6 +1,5 @@
using AutoMapper; using AutoMapper;
using AutoMapper.Internal.Mappers; 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.Dtos.Order; using SJZY.Track.Domain.Dtos.Order;
using System.Diagnostics; using System.Diagnostics;
@ -21,6 +20,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);
} }
} }

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,8 @@ 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);
} }
} }
} }

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,10 +9,9 @@ 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));
CreateMap<GetTrackFlagDetailVO, GetTrackFlagDetailDto>(MemberList.None); CreateMap<GetTrackFlagDetailVO, GetTrackFlagDetailDto>(MemberList.None);
CreateMap<GetTrackFlagListVO, GetTrackFlagListDto>(MemberList.None); CreateMap<GetTrackFlagListVO, GetTrackFlagListDto>(MemberList.None);
CreateMap<UnifyPageResultDto<GetTrackFlagListVO>, UnifyPageResultDto<GetTrackFlagListDto>>(MemberList.None); CreateMap<UnifyPageResultDto<GetTrackFlagListVO>, UnifyPageResultDto<GetTrackFlagListDto>>(MemberList.None);
@ -32,4 +22,4 @@ namespace SJZY.Track.Application.AutoMapper
// resultDto); // resultDto);
} }
} }
} }

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,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
{ {
@ -18,14 +10,15 @@ namespace SJZY.Track.Application.AutoMapper
public TrackStatusAutoMapperProfile() public TrackStatusAutoMapperProfile()
{ {
CreateMap<EditTrackStatusInput, TrackStatusEntity>(MemberList.None) CreateMap<EditTrackStatusInput, TrackStatusEntity>(MemberList.None)
//层级不一致的场景 //层级不一致的场景
.ForMember(dest => dest.Status, opt => opt.MapFrom(source => source.TrackStatus)) .ForMember(dest => dest.Status, opt => opt.MapFrom(source => source.TrackStatus))
.ForMember(dest => dest.EnStatus, opt => opt.MapFrom(source => source.EntrackStatus)) .ForMember(dest => dest.EnStatus, opt => opt.MapFrom(source => source.EntrackStatus))
.ForMember(dest => dest.Node, opt => opt.MapFrom(source => source.NodeId)); .ForMember(dest => dest.Node, opt => opt.MapFrom(source => source.NodeId));
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

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

@ -1,32 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="../../common.props" /> <Import Project="../../common.props"/>
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup> <PropertyGroup>
<Compile Remove="Services\TrackMap\**" /> <TargetFramework>net7.0</TargetFramework>
<Compile Remove="Validations\Docuai\**" /> <GenerateDocumentationFile>True</GenerateDocumentationFile>
<EmbeddedResource Remove="Services\TrackMap\**" /> </PropertyGroup>
<EmbeddedResource Remove="Validations\Docuai\**" />
<None Remove="Services\TrackMap\**" />
<None Remove="Validations\Docuai\**" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="SJZY.Expand.AliyunOSS" Version="7.0.10"/> <PackageReference Include="Volo.Abp.Http.Client" Version="7.0.2"/>
<PackageReference Include="SJZY.Expand.Excel" Version="7.0.5"/> <PackageReference Include="Volo.Abp.FluentValidation" Version="7.0.2"/>
<PackageReference Include="Volo.Abp.Http.Client" Version="7.0.2"/> <PackageReference Include="SJZY.UserCenter.HttpApi" Version="3.0.3-alpha8"/>
<PackageReference Include="Volo.Abp.FluentValidation" Version="7.0.2"/> <PackageReference Include="SJZY.Expand.CAP" Version="7.8.0"/>
<PackageReference Include="SJZY.UserCenter.HttpApi" Version="3.0.3-alpha8"/> </ItemGroup>
<PackageReference Include="SJZY.Expand.CAP" Version="7.8.0"/>
</ItemGroup>
<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,5 +1,4 @@
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.Dtos.Order; using SJZY.Track.Domain.Dtos.Order;
@ -93,7 +92,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,9 @@
using DotNetCore.CAP;
using Volo.Abp.DependencyInjection;
namespace SJZY.Track.Application.Services.ProvideServices;
public class TrackCustomer : ITransientDependency, ICapSubscribe
{
public const string CapSubscribe = "SJZY.FMC.VoucherRedundantCalc";
}

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,5 +1,5 @@
using DotNetCore.CAP; using DotNetCore.CAP;
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.Aggregates.TrackDetailsAggregate;
using SJZY.Track.Domain.Queries; using SJZY.Track.Domain.Queries;

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,8 @@
using Microsoft.AspNetCore.Authorization; using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Localization; using SJZY.Track.Application.Contract.Dtos.TrackContents;
using SJZY.Track.Application.Dtos.TrackContents;
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.TrackContentAggregate;
using SJZY.Track.Domain.Dtos.TrackContents; using SJZY.Track.Domain.Dtos.TrackContents;
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.TrackContents namespace SJZY.Track.Application.Services.TrackContents
@ -28,10 +20,10 @@ 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;
this._trackContentRepository=trackContentRepository; this._trackContentRepository = trackContentRepository;
} }
/// <summary> /// <summary>
@ -74,7 +66,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,15 +79,19 @@ 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 ||
a.Content==input.Content || a.EnContent==input.EnContent)); var trackContentEntity = await _trackContentRepository.GetFirstAsync(a =>
a.SubSystemId == input.SubSystemId && (a.Code == input.Code ||
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);
@ -106,12 +103,15 @@ 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 ||
a.Content==input.Content || a.EnContent==input.EnContent)); 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));
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);
@ -127,6 +127,7 @@ namespace SJZY.Track.Application.Services.TrackContents
return new UnifyResultDto("200", "删除成功", isTrue); return new UnifyResultDto("200", "删除成功", isTrue);
} }
#endregion #endregion
} }
} }

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,8 @@
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.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
@ -28,10 +20,10 @@ namespace SJZY.Track.Application.Services.TrackFlags
public TrackFlagService( public TrackFlagService(
IStringLocalizer<TrackLocalizationResource> stringLocalizer, IStringLocalizer<TrackLocalizationResource> stringLocalizer,
ITrackFlagRepository trackFlagRepository ITrackFlagRepository trackFlagRepository
) )
{ {
this._stringLocalizer=stringLocalizer; this._stringLocalizer = stringLocalizer;
this._trackFlagRepository=trackFlagRepository; this._trackFlagRepository = trackFlagRepository;
} }
/// <summary> /// <summary>
@ -86,14 +78,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));
if (trackStatusEntity!=null) var trackStatusEntity = await _trackFlagRepository.GetFirstAsync(a =>
a.SubSystemId == input.SubSystemId && (a.Code == input.Code || a.Name == input.Flag));
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 +101,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 ||
a.Name ==input.Flag)); var trackStatusEntity = await _trackFlagRepository.GetFirstAsync(a => a.Id != input.Id &&
if (trackStatusEntity!=null) a.SubSystemId == input.SubSystemId && (a.Code == input.Code ||
a.Name == input.Flag));
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);
@ -126,6 +125,7 @@ namespace SJZY.Track.Application.Services.TrackFlags
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))
@ -98,86 +100,96 @@ public class TrackPullService : ApplicationService, ITransientDependency
switch (input.Options) switch (input.Options)
{ {
case OptionTypeNoNull.新增: case OptionTypeNoNull.新增:
{
var trackPullEntity = ObjectMapper.Map<EditTrackPullConfigInput, TrackPullConfigEntity>(input);
var trackPullParamsEntity =
ObjectMapper.Map<EditTrackPullConfigInput, TrackPushPullParamsConfigEntity>(input);
var trackTemplateContentEntities =
await _trackTemplateRepository.GetContentListAsync(x => x.TrackTemplateId == input.TrackTemplateId);
var trackPullContentEntities = new List<TrackPullContentConfigEntity>();
using (var ts = TransactionScopeHelper.Create())
{ {
var trackPullEntity = ObjectMapper.Map<EditTrackPullConfigInput, TrackPullConfigEntity>(input); int id = await _trackPullConfigRepository.InsertReturnIdentityAsync(trackPullEntity);
var trackPullParamsEntity = ObjectMapper.Map<EditTrackPullConfigInput, TrackPushPullParamsConfigEntity>(input);
var trackTemplateContentEntities = await _trackTemplateRepository.GetContentListAsync(x => x.TrackTemplateId == input.TrackTemplateId); trackPullParamsEntity.PullOrPushConfigId = id;
await _trackPullConfigRepository.InsertParamsAsync(trackPullParamsEntity);
var trackPullContentEntities = new List<TrackPullContentConfigEntity>(); foreach (var item in trackTemplateContentEntities)
using (var ts = TransactionScopeHelper.Create())
{ {
int id = await _trackPullConfigRepository.InsertReturnIdentityAsync(trackPullEntity); trackPullContentEntities.Add(new()
trackPullParamsEntity.PullOrPushConfigId = id;
await _trackPullConfigRepository.InsertParamsAsync(trackPullParamsEntity);
foreach (var item in trackTemplateContentEntities)
{ {
trackPullContentEntities.Add(new() TrackPullConfigId = id,
{ TrackContentId = item.TrackContentId
TrackPullConfigId = id, });
TrackContentId = item.TrackContentId
});
}
await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities);
ts.Complete();
} }
await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities);
ts.Complete();
} }
}
break; break;
case OptionTypeNoNull.修改: case OptionTypeNoNull.修改:
{
var oldTrackPullEntity = await _trackPullConfigRepository.GetFirstAsync(x => x.Id == input.Id) ??
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
var oldTrackPullParamsEntity =
await _trackPullConfigRepository.GetParamsSingleAsync(x =>
x.PullOrPushConfigId == input.Id && !x.IsPush);
var trackPullContentEntities = new List<TrackPullContentConfigEntity>();
if (oldTrackPullEntity.TrackTemplateId != input.TrackTemplateId)
{ {
var oldTrackPullEntity = await _trackPullConfigRepository.GetFirstAsync(x => x.Id == input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); var trackTemplateContentEntities =
await _trackTemplateRepository.GetContentListAsync(x =>
x.TrackTemplateId == input.TrackTemplateId);
var oldTrackPullParamsEntity = await _trackPullConfigRepository.GetParamsSingleAsync(x => x.PullOrPushConfigId == input.Id && !x.IsPush); foreach (var item in trackTemplateContentEntities)
{
trackPullContentEntities.Add(new()
{
TrackPullConfigId = oldTrackPullEntity.Id,
TrackContentId = item.TrackContentId
});
}
}
var trackPullContentEntities = new List<TrackPullContentConfigEntity>(); ObjectMapper.Map(input, oldTrackPullEntity);
ObjectMapper.Map(input, oldTrackPullParamsEntity);
using (var ts = TransactionScopeHelper.Create())
{
await _trackPullConfigRepository.UpdateAsync(oldTrackPullEntity);
await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPullParamsEntity);
if (oldTrackPullEntity.TrackTemplateId != input.TrackTemplateId) if (oldTrackPullEntity.TrackTemplateId != input.TrackTemplateId)
{ {
var trackTemplateContentEntities = await _trackTemplateRepository.GetContentListAsync(x => x.TrackTemplateId == input.TrackTemplateId); await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id);
await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities);
foreach (var item in trackTemplateContentEntities)
{
trackPullContentEntities.Add(new()
{
TrackPullConfigId = oldTrackPullEntity.Id,
TrackContentId = item.TrackContentId
});
}
} }
ObjectMapper.Map(input, oldTrackPullEntity); ts.Complete();
ObjectMapper.Map(input, oldTrackPullParamsEntity);
using (var ts = TransactionScopeHelper.Create())
{
await _trackPullConfigRepository.UpdateAsync(oldTrackPullEntity);
await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPullParamsEntity);
if (oldTrackPullEntity.TrackTemplateId != input.TrackTemplateId)
{
await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id);
await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities);
}
ts.Complete();
}
} }
}
break; break;
case OptionTypeNoNull.删除: case OptionTypeNoNull.删除:
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,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,6 +1,5 @@
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.TrackStatusAggregate; using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
using SJZY.Track.Domain.Dtos.TrackStatus; using SJZY.Track.Domain.Dtos.TrackStatus;
@ -23,7 +22,7 @@ public class TrackStatusService : ApplicationService, ITransientDependency
ITrackStatusRepository trackStatusRepository ITrackStatusRepository trackStatusRepository
) )
{ {
this._stringLocalizer=stringLocalizer; this._stringLocalizer = stringLocalizer;
this._trackStatusRepository = trackStatusRepository; this._trackStatusRepository = trackStatusRepository;
} }
@ -79,15 +78,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 ||
a.Status==input.TrackStatus || a.EnStatus==input.EntrackStatus)); var trackStatusEntity = await _trackStatusRepository.GetFirstAsync(a => a.SubSystemId == input.SubSystemId &&
if (trackStatusEntity!=null) (a.Code == input.Code ||
a.Status == input.TrackStatus || a.EnStatus == input.EntrackStatus));
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 +102,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 ||
a.Status==input.TrackStatus || a.EnStatus==input.EntrackStatus)); var trackStatusEntity = await _trackStatusRepository.GetFirstAsync(a => a.Id != input.Id &&
if (trackStatusEntity!=null) a.SubSystemId == input.SubSystemId && (a.Code == input.Code ||
a.Status == input.TrackStatus || a.EnStatus == input.EntrackStatus));
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);
@ -120,5 +126,6 @@ public class TrackStatusService : ApplicationService, ITransientDependency
return new UnifyResultDto("200", "删除成功", isTrue); return new UnifyResultDto("200", "删除成功", isTrue);
} }
#endregion #endregion
} }

View File

@ -1,8 +1,7 @@
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.TrackTemplateAggregate; using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
using SJZY.Track.Domain.Dtos.TrackTemplate; using SJZY.Track.Domain.Dtos.TrackTemplate;
@ -85,12 +84,16 @@ 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);
@ -102,11 +105,14 @@ 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);
@ -119,8 +125,11 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
private async Task<UnifyResultDto> DeleteAsync(EditTrackTemplateInput input) private async Task<UnifyResultDto> DeleteAsync(EditTrackTemplateInput input)
{ {
#region 业务校验 #region 业务校验
//到时候,得判断这个模版有没有在轨迹映射里面被使用过,如果被使用就抛出提示 //到时候,得判断这个模版有没有在轨迹映射里面被使用过,如果被使用就抛出提示
#endregion #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.新增, () =>
{ {
@ -32,4 +21,4 @@ namespace SJZY.Track.Application.Validations.TrackFlags
}); });
} }
} }
} }

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.新增, () =>
{ {
@ -34,4 +23,4 @@ namespace SJZY.Track.Application.Validations.TrackStatus
}); });
} }
} }
} }

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.新增, () =>
{ {
@ -30,4 +24,4 @@ namespace SJZY.Track.Application.Validations.TrackTemplates
}); });
} }
} }
} }

View File

@ -16,7 +16,7 @@ namespace SJZY.Track.Domain.Dtos.Order
/// <summary> /// <summary>
/// 单号 /// 单号
/// </summary> /// </summary>
public List<string> OrderNos { get; set; } public List<string>? OrderNos { get; set; }
/// <summary> /// <summary>
/// 创建时间开始 /// 创建时间开始
@ -26,7 +26,7 @@ namespace SJZY.Track.Domain.Dtos.Order
/// <summary> /// <summary>
/// 创建时间截止 /// 创建时间截止
/// </summary> /// </summary>
public DateTime? createTimeEnd { get; set; } public DateTime? CreateTimeEnd { get; set; }
} }
/// <summary> /// <summary>
@ -64,10 +64,10 @@ namespace SJZY.Track.Domain.Dtos.Order
/// </summary> /// </summary>
public string? CustomerCode { get; set; } public string? CustomerCode { get; set; }
/// <summary> ///// <summary>
/// 订单明细(json) ///// 订单明细(json)
/// </summary> ///// </summary>
public string? OrderDetails { get; set; } //public string? OrderDetails { get; set; }
/// <summary> /// <summary>
/// 最新轨迹内容 /// 最新轨迹内容

View File

@ -10,7 +10,7 @@ public interface IBasicRepository<T> : IBasicQuery<T> where T : IAggregateRoot
/// <param name="entity"></param> /// <param name="entity"></param>
/// <param name="ignoreColumns">要忽略更新的列</param> /// <param name="ignoreColumns">要忽略更新的列</param>
/// <returns></returns> /// <returns></returns>
Task<bool> UpdateAsync(T entity, Expression<Func<T, object>> ignoreColumns); Task<bool> UpdateAsync(T entity, Expression<Func<T, object>>? ignoreColumns);
/// <summary> /// <summary>
/// update /// update
@ -18,7 +18,7 @@ public interface IBasicRepository<T> : IBasicQuery<T> where T : IAggregateRoot
/// <param name="entity"></param> /// <param name="entity"></param>
/// <param name="updateColumns">要更新的列</param> /// <param name="updateColumns">要更新的列</param>
/// <returns></returns> /// <returns></returns>
Task<bool> UpdateColumnAsync(T entity, Expression<Func<T, object>> updateColumns); Task<bool> UpdateColumnAsync(T entity, Expression<Func<T, object>>? updateColumns);
/// <summary> /// <summary>
/// update /// update

View File

@ -10,9 +10,5 @@
<PackageReference Include="SJZY.Expand.ABP.Core" Version="7.7.1" /> <PackageReference Include="SJZY.Expand.ABP.Core" Version="7.7.1" />
<PackageReference Include="SJZY.Expand.ElasticSearch" Version="7.0.17" /> <PackageReference Include="SJZY.Expand.ElasticSearch" Version="7.0.17" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Aggregates\" />
</ItemGroup>
</Project> </Project>

View File

@ -2,6 +2,6 @@
namespace SJZY.Track.Domain; namespace SJZY.Track.Domain;
public class SJZYTrackDomainModule : AbpModule public class SjzyTrackDomainModule : AbpModule
{ {
} }

View File

@ -1,10 +0,0 @@
namespace SJZY.Track.HttpApi.Dtos
{
public class RemoteDemoInput
{
/// <summary>
/// 当前时间
/// </summary>
public DateTime CurrentTime { get; set; }
}
}

View File

@ -1,7 +0,0 @@
namespace SJZY.Track.HttpApi.Dtos
{
public class RemoteDemoOutput
{
public string Context { get; set; }
}
}

View File

@ -1,15 +0,0 @@
using SJZY.Expand.ABP.Core.Common.Dto;
using SJZY.Track.HttpApi.Dtos;
using Volo.Abp;
using Volo.Abp.DependencyInjection;
namespace SJZY.Track.HttpApi.Services
{
/// <summary>
/// 客户端连接测试接口
/// </summary>
public interface IRemoteDemoService : IRemoteService, IScopedDependency
{
Task<UnifyResultDto<RemoteDemoOutput>> ConnectionTest(RemoteDemoInput input);
}
}

View File

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

View File

@ -12,14 +12,14 @@ namespace SJZY.Track.Infrastructure.Repositories;
/// <typeparam name="T"></typeparam> /// <typeparam name="T"></typeparam>
public class BasicRepository<T> : BasicQuery<T>, IBasicRepository<T> where T : class, IAggregateRoot, new() public class BasicRepository<T> : BasicQuery<T>, IBasicRepository<T> where T : class, IAggregateRoot, new()
{ {
public async Task<bool> UpdateAsync(T entity, Expression<Func<T, object>> ignoreColumns) public async Task<bool> UpdateAsync(T entity, Expression<Func<T, object>>? ignoreColumns)
{ {
return await Context.Updateable(entity) return await Context.Updateable(entity)
.IgnoreColumnsIF(ignoreColumns != null, ignoreColumns) .IgnoreColumnsIF(ignoreColumns != null, ignoreColumns)
.ExecuteCommandHasChangeAsync(); .ExecuteCommandHasChangeAsync();
} }
public async Task<bool> UpdateColumnAsync(T entity, Expression<Func<T, object>> updateColumns) public async Task<bool> UpdateColumnAsync(T entity, Expression<Func<T, object>>? updateColumns)
{ {
return await Context.Updateable(entity) return await Context.Updateable(entity)
.UpdateColumnsIF(updateColumns != null, updateColumns) .UpdateColumnsIF(updateColumns != null, updateColumns)
@ -40,15 +40,13 @@ public class BasicRepository<T> : BasicQuery<T>, IBasicRepository<T> where T : c
.ExecuteCommandHasChangeAsync(); .ExecuteCommandHasChangeAsync();
} }
// tips: required where
public async Task<bool> SoftDeleteAsync(Expression<Func<T, bool>> where) public async Task<bool> SoftDeleteAsync(Expression<Func<T, bool>> where)
{ {
if (!typeof(T).IsAssignableTo<ISoftDeleteBasicEntity>()) if (!typeof(T).IsAssignableTo<ISoftDeleteBasicEntity>())
throw new BusinessException( throw new BusinessException(
message: $"实体没有实现{nameof(ISoftDeleteBasicEntity)}不能调用{nameof(SoftDeleteAsync)}"); message: $"实体没有实现{nameof(ISoftDeleteBasicEntity)}不能调用{nameof(SoftDeleteAsync)}");
// tips: required where
if (where == default) return false;
return await Context.Updateable<T>() return await Context.Updateable<T>()
.Where(where) .Where(where)
.SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), 1) .SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), 1)

View File

@ -88,6 +88,11 @@ public class OrderRepository : BasicRepository<OrderEntity>, IOrderRepository, I
var pageList = await Context.Queryable<OrderEntity>() var pageList = await Context.Queryable<OrderEntity>()
.LeftJoin<VExternalSubjectEntity>((a, b) => a.CustomId==b.Id) .LeftJoin<VExternalSubjectEntity>((a, b) => a.CustomId==b.Id)
.LeftJoin<VSystemEntity>((a, b, c) => a.SubSystemId==c.Id) .LeftJoin<VSystemEntity>((a, b, c) => a.SubSystemId==c.Id)
.WhereIF(input.SubSystemId > 0, (a, b, c) => a.SubSystemId == input.SubSystemId)
.WhereIF(!input.OrderNos.IsNullOrEmpty(), (a, b, c) => input.OrderNos.Contains(a.OrderNo))
.WhereIF(input.CreateTimeStart.HasValue&& input.CreateTimeEnd.HasValue, (a, b, c) => a.CreateTime>= input.CreateTimeStart && a.CreateTime<= input.CreateTimeEnd)
.WhereIF(input.CreateTimeStart.HasValue&& (!input.CreateTimeEnd.HasValue), (a, b, c) => a.CreateTime>= input.CreateTimeStart)
.WhereIF((!input.CreateTimeStart.HasValue)&& input.CreateTimeEnd.HasValue, (a, b, c) => a.CreateTime<= input.CreateTimeEnd)
.Select((a, b, c) => new TrackOrderVO .Select((a, b, c) => new TrackOrderVO
{ {
Id = a.Id, Id = a.Id,
@ -95,8 +100,8 @@ public class OrderRepository : BasicRepository<OrderEntity>, IOrderRepository, I
OrderType = a.OrderType, OrderType = a.OrderType,
CustomerShortName= b.Abbreviation, CustomerShortName= b.Abbreviation,
CustomerCode= b.Code, CustomerCode= b.Code,
TrackTemplateNames = "", TrackTemplateNames = SqlFunc.Subqueryable<OrderTemplateEntity>().LeftJoin<TrackTemplateEntity>((aa, bb) => aa.TrackTemplateId==bb.Id)
OrderDetails="", .Where((aa, bb) => a.Id==aa.OrderId).SelectStringJoin((aa, bb) => bb.Name, ","),
NewestTrackContent= a.LatestTrackContent, NewestTrackContent= a.LatestTrackContent,
NewestTrackEnContent= a.LatestTrackEnContent, NewestTrackEnContent= a.LatestTrackEnContent,
NewestTrackPlace= a.LatestTrackPlace, NewestTrackPlace= a.LatestTrackPlace,
@ -105,26 +110,26 @@ public class OrderRepository : BasicRepository<OrderEntity>, IOrderRepository, I
SubSystem= c.CnName SubSystem= c.CnName
}) })
.ToPagedListAsync(input.PageIndex, input.PageSize); .ToPagedListAsync(input.PageIndex, input.PageSize);
#region 暂时注释
if (pageList.List.Any()) //if (pageList.List.Any())
{ //{
var orderIds = pageList.List.Select(a => a.Id); // var orderIds = pageList.List.Select(a => a.Id);
//查询轨迹模版 // //查询轨迹模版
var trackTemplateList = await Context.Queryable<OrderTemplateEntity>() // var trackTemplateList = await Context.Queryable<OrderTemplateEntity>()
.LeftJoin<TrackTemplateEntity>((a, b) => a.TrackTemplateId==b.Id) // .LeftJoin<TrackTemplateEntity>((a, b) => a.TrackTemplateId==b.Id)
.Where((a, b) => orderIds.Contains(a.OrderId)) // .Where((a, b) => orderIds.Contains(a.OrderId))
.Select((a, b) => new { OrderId = a.OrderId, Name = b.Name }) // .Select((a, b) => new { OrderId = a.OrderId, Name = b.Name })
.ToListAsync(); // .ToListAsync();
pageList.List.ForEach(a =>
{
var templateListOfOrderId = trackTemplateList.Where(b => b.OrderId== a.Id);
a.TrackTemplateNames = templateListOfOrderId.Select(c => c.Name).JoinAsString(",");
});
}
// pageList.List.ForEach(a =>
// {
// var templateListOfOrderId = trackTemplateList.Where(b => b.OrderId== a.Id);
// a.TrackTemplateNames = templateListOfOrderId.Select(c => c.Name).JoinAsString(",");
// });
//}
#endregion
return pageList; return pageList;
} }

View File

@ -6,10 +6,6 @@ namespace SJZY.Track.Infrastructure.Repositories;
public class TrackStatusRepository : BasicRepository<TrackStatusEntity>, ITrackStatusRepository, IScopedDependency public class TrackStatusRepository : BasicRepository<TrackStatusEntity>, ITrackStatusRepository, IScopedDependency
{ {
public TrackStatusRepository()
{
}
/// <summary> /// <summary>
/// 获取轨迹状态明细 /// 获取轨迹状态明细
/// </summary> /// </summary>
@ -35,14 +31,13 @@ public class TrackStatusRepository : BasicRepository<TrackStatusEntity>, ITrackS
} }
/// <summary> /// <summary>
/// 分页获取轨迹模版 /// 分页获取轨迹状态
/// </summary> /// </summary>
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
public async Task<UnifyPageResultDto<GetTrackStatusListVO>> GetPageTrackStatus(GetPageTrackStatusVO input) public async Task<UnifyPageResultDto<GetTrackStatusListVO>> GetPageTrackStatus(GetPageTrackStatusVO input)
{ {
UnifyPageResultDto<GetTrackStatusListVO> pagedList = new UnifyPageResultDto<GetTrackStatusListVO>(); UnifyPageResultDto<GetTrackStatusListVO> pagedList = await Context.Queryable<TrackStatusEntity>()
pagedList = await Context.Queryable<TrackStatusEntity>()
.LeftJoin<VSystemEntity>((a, b) => a.SubSystemId == b.Id) .LeftJoin<VSystemEntity>((a, b) => a.SubSystemId == b.Id)
.LeftJoin<VUserEntity>((a, b, c) => a.CreateUserId == c.Id) .LeftJoin<VUserEntity>((a, b, c) => a.CreateUserId == c.Id)
.LeftJoin<VUserEntity>((a, b, c, d) => a.UpdateUserId == d.Id) .LeftJoin<VUserEntity>((a, b, c, d) => a.UpdateUserId == d.Id)
@ -57,9 +52,10 @@ public class TrackStatusRepository : BasicRepository<TrackStatusEntity>, ITrackS
EntrackStatus = a.EnStatus, EntrackStatus = a.EnStatus,
TrackStatus = a.Status, TrackStatus = a.Status,
NodeId = a.Node, NodeId = a.Node,
Node = SqlFunc.IF(a.Node == 1).Return("揽收").ElseIF(a.Node == 2).Return("干线").ElseIF(a.Node == 3).Return("清关") Node = SqlFunc.IF(a.Node == 1).Return("揽收").ElseIF(a.Node == 2).Return("干线").ElseIF(a.Node == 3)
.ElseIF(a.Node == 4).Return("中转").ElseIF(a.Node == 5).Return("派送") .Return("清关")
.End(""), .ElseIF(a.Node == 4).Return("中转").ElseIF(a.Node == 5).Return("派送")
.End(""),
CreateTime = a.CreateTime, CreateTime = a.CreateTime,
CreateUser = c.Name, CreateUser = c.Name,
UpdateTime = a.UpdateTime, UpdateTime = a.UpdateTime,

View File

@ -1,37 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="../../common.props" /> <Import Project="../../common.props"/>
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<GenerateDocumentationFile>True</GenerateDocumentationFile> <GenerateDocumentationFile>True</GenerateDocumentationFile>
<LangVersion>preview</LangVersion> <LangVersion>preview</LangVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Remove="DataCenter\**" /> <PackageReference Include="SJZY.LoggerCenter.HttpApi" Version="7.0.5"/>
<EmbeddedResource Remove="DataCenter\**" /> <PackageReference Include="Volo.Abp.Autofac" Version="7.0.2"/>
<None Remove="DataCenter\**" /> <PackageReference Include="SJZY.UserCenter.HttpApi" Version="3.0.3-alpha8"/>
<Compile Remove="TrackTemplate\ValueObjects\**" /> <PackageReference Include="SJZY.Expand.CAP" Version="7.8.0"/>
<EmbeddedResource Remove="TrackTemplate\ValueObjects\**" /> </ItemGroup>
<None Remove="TrackTemplate\ValueObjects\**" />
</ItemGroup>
<ItemGroup>
<ItemGroup> <ProjectReference Include="..\SJZY.Track.Domain\SJZY.Track.Domain.csproj"/>
<PackageReference Include="SJZY.LoggerCenter.HttpApi" Version="7.0.5"/> </ItemGroup>
<PackageReference Include="Volo.Abp.Autofac" Version="7.0.2"/>
<PackageReference Include="SJZY.UserCenter.HttpApi" Version="3.0.3-alpha8"/>
<PackageReference Include="SJZY.Expand.CAP" Version="7.8.0"/>
</ItemGroup>
<ItemGroup>
<Folder Include="TrackPushRecordDetails\ValueObjects\" />
<Folder Include="TrackPushRecord\ValueObjects\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SJZY.Track.Domain\SJZY.Track.Domain.csproj" />
</ItemGroup>
</Project> </Project>

View File

@ -15,8 +15,8 @@ namespace SJZY.Track.Infrastructure;
/// 仓储模块 /// 仓储模块
/// </summary> /// </summary>
[DependsOn(typeof(AbpAutofacModule))] [DependsOn(typeof(AbpAutofacModule))]
[DependsOn(typeof(SJZYTrackDomainModule))] [DependsOn(typeof(SjzyTrackDomainModule))]
public class SJZYTrackInfrastructureModule : AbpModule public class SjzyTrackInfrastructureModule : AbpModule
{ {
public override void PreConfigureServices(ServiceConfigurationContext context) public override void PreConfigureServices(ServiceConfigurationContext context)
{ {
@ -28,7 +28,7 @@ public class SJZYTrackInfrastructureModule : AbpModule
{ {
new() new()
{ {
ConnectionString = configuration["ConnectionStrings:DefaultConnection"], ConnectionString = configuration["ConnectionStrings:DefaultConnection"]!,
DbType = DbType.MySql, DbType = DbType.MySql,
IsAutoCloseConnection = true, IsAutoCloseConnection = true,
ConfigId = "default", OpenSqlLog = true ConfigId = "default", OpenSqlLog = true
@ -39,10 +39,10 @@ public class SJZYTrackInfrastructureModule : AbpModule
context.Services.AddElasticSearch(options => context.Services.AddElasticSearch(options =>
{ {
options.NodeUrls = configuration.GetSection("ElasticSearch:NodeUrls").Get<List<string>>(); options.NodeUrls = configuration.GetSection("ElasticSearch:NodeUrls").Get<List<string>>()!;
options.LoginName = configuration["ElasticSearch:LoginName"]; options.LoginName = configuration["ElasticSearch:LoginName"]!;
options.Password = configuration["ElasticSearch:Password"]; options.Password = configuration["ElasticSearch:Password"]!;
options.Base64PassPassword = configuration["ElasticSearch:Base64PassPassword"]; options.Base64PassPassword = configuration["ElasticSearch:Base64PassPassword"]!;
}); });
} }

View File

@ -36,13 +36,13 @@ namespace SJZY.Track.Infrastructure.TrackPushRecord.Entitys
/// 推送内容 /// 推送内容
/// </summary> /// </summary>
[SugarColumn(ColumnName = "PushContent")] [SugarColumn(ColumnName = "PushContent")]
public string PushContent { get; set; } public string PushContent { get; set; } = null!;
/// <summary> /// <summary>
/// 接口通请求id /// 接口通请求id
/// </summary> /// </summary>
[SugarColumn(ColumnName = "RequestId")] [SugarColumn(ColumnName = "RequestId")]
public string RequestId { get; set; } public string RequestId { get; set; } = null!;
/// <summary> /// <summary>
/// 服务商id /// 服务商id
@ -54,6 +54,6 @@ namespace SJZY.Track.Infrastructure.TrackPushRecord.Entitys
/// 推送轨迹总数 /// 推送轨迹总数
/// </summary> /// </summary>
[SugarColumn(ColumnName = "TrackTotal")] [SugarColumn(ColumnName = "TrackTotal")]
public string TrackTotal { get; set; } public int TrackTotal { get; set; }
} }
} }

View File

@ -1,28 +0,0 @@

using SJZY.Track.Application.Dtos.Demo;
using SJZY.Track.Application.Services.Demo;
namespace SJZY.OpenApi.Test.Demo
{
public class DemoTest : TestModuleTestBase
{
#region 构造函数
private InterFaceDemoService _interFaceDemoService;
public DemoTest()
{
_interFaceDemoService = GetRequiredService<InterFaceDemoService>();
}
#endregion
[Fact]
public async Task Test()
{
var data = new DemoInput();
var res = await _interFaceDemoService.Edit(data);
Assert.NotNull(res);
}
}
}

View File

@ -13,22 +13,21 @@ using Volo.Abp.Modularity;
using Volo.Abp.Threading; using Volo.Abp.Threading;
[assembly: HostingStartup(typeof(SJZY.Expand.ABP.Core.HostingStartup))] [assembly: HostingStartup(typeof(SJZY.Expand.ABP.Core.HostingStartup))]
namespace SJZY.Track.Test; namespace SJZY.Track.Test;
[DependsOn( [DependsOn(
typeof(AbpAspNetCoreTestBaseModule), typeof(AbpAspNetCoreTestBaseModule),
typeof(AbpAutofacModule), typeof(AbpAutofacModule),
typeof(AbpAuthorizationModule), typeof(AbpAuthorizationModule),
typeof(SJZYTrackInfrastructureModule), typeof(SjzyTrackInfrastructureModule),
typeof(ApplicationModule), typeof(SjzyTrackApplicationModule),
typeof(SJZYTrackApiModule), typeof(SjzyTrackApiModule),
typeof(AbpHttpClientModule) //添加abp的http代理模块 typeof(AbpHttpClientModule) //添加abp的http代理模块
)] )]
[assembly: HostingStartup(typeof(Expand.ABP.Core.HostingStartup))] [assembly: HostingStartup(typeof(Expand.ABP.Core.HostingStartup))]
public class TestModule : AbpModule public class TestModule : AbpModule
{ {
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)
{ {
context.Services.AddAlwaysAllowAuthorization(); context.Services.AddAlwaysAllowAuthorization();