Merge remote-tracking branch 'origin/S01-轨迹中台' into S01-轨迹中台
This commit is contained in:
commit
594411bfc3
@ -0,0 +1,28 @@
|
||||
using AutoMapper;
|
||||
using AutoMapper.Internal.Mappers;
|
||||
using SJZY.Track.Application.Dtos.TrackContents;
|
||||
using SJZY.Track.Application.Dtos.TrackTemplates;
|
||||
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
||||
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
|
||||
{
|
||||
public class TrackContentAutoMapperProfile : Profile
|
||||
{
|
||||
public TrackContentAutoMapperProfile()
|
||||
{
|
||||
CreateMap<EditTrackContentInput, TrackContentEntity>(MemberList.None);
|
||||
CreateMap<GetTrackContentDetailVO, GetTrackContentDetailDto>(MemberList.None);
|
||||
CreateMap<GetPageTrackContentInput, GetPageTrackContentVO>(MemberList.None);
|
||||
CreateMap<GetTrackContentListVO, GetTrackContentListDto>(MemberList.None);
|
||||
CreateMap<UnifyPageResultDto<GetTrackContentListVO>, UnifyPageResultDto<GetTrackContentListDto>>(MemberList.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
using AutoMapper;
|
||||
using AutoMapper.Internal.Mappers;
|
||||
using SJZY.Track.Application.Dtos.Demo;
|
||||
using SJZY.Track.Application.Dtos.TrackStatus;
|
||||
using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
|
||||
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
|
||||
{
|
||||
public class TrackStatusAutoMapperProfile : Profile
|
||||
{
|
||||
public TrackStatusAutoMapperProfile()
|
||||
{
|
||||
CreateMap<EditTrackStatusInput, TrackStatusEntity>(MemberList.None)
|
||||
//层级不一致的场景
|
||||
.ForMember(dest => dest.Status, opt => opt.MapFrom(source => source.TrackStatus))
|
||||
.ForMember(dest => dest.EnStatus, opt => opt.MapFrom(source => source.EntrackStatus))
|
||||
.ForMember(dest => dest.Node, opt => opt.MapFrom(source => source.NodeId));
|
||||
CreateMap<GetTrackStatusDetailVO, GetTrackStatusDetailDto>(MemberList.None);
|
||||
CreateMap<GetPageTrackStatusInput, GetPageTrackStatusVO>(MemberList.None);
|
||||
CreateMap<GetTrackStatusListVO, GetTrackStatusListDto>(MemberList.None);
|
||||
CreateMap<UnifyPageResultDto<GetTrackStatusListVO>, UnifyPageResultDto<GetTrackStatusListDto>>(MemberList.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3,6 +3,7 @@ using AutoMapper.Internal.Mappers;
|
||||
using SJZY.Track.Application.Dtos.TrackTemplates;
|
||||
using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
|
||||
using SJZY.Track.Domain.Dtos.TrackTemplate;
|
||||
using Volo.Abp.ObjectMapping;
|
||||
|
||||
namespace SJZY.Track.Application.AutoMapper;
|
||||
|
||||
@ -14,11 +15,10 @@ public class TrackTemplateAutoMapperProfile : Profile
|
||||
public TrackTemplateAutoMapperProfile()
|
||||
{
|
||||
CreateMap<GetTrackTemplateDetailVO, GetTrackTemplateDetailDto>(MemberList.None);
|
||||
|
||||
//CreateMap<UnifyResultDto<GetTrackTemplateDetailVO>, UnifyResultDto<GetTrackTemplateDetailDto>>(MemberList.None);
|
||||
|
||||
CreateMap<EditTrackTemplateContentInput, TrackTemplateContentEntity>(MemberList.None);
|
||||
|
||||
CreateMap<EditTrackTemplateInput, TrackTemplateEntity>(MemberList.None);
|
||||
CreateMap<GetPageTrackTemplateInput, GetPageTrackTemplateVO>(MemberList.None);
|
||||
CreateMap<GetTrackTemplateListVO, GetTrackTemplateListDto>(MemberList.None);
|
||||
CreateMap<UnifyPageResultDto<GetTrackTemplateListVO>, UnifyPageResultDto<GetTrackTemplateListDto>>(MemberList.None);
|
||||
}
|
||||
}
|
||||
@ -4,7 +4,8 @@
|
||||
"NotNull1": "{0} is not null",
|
||||
"NotFindData": "No data found under the specified number",
|
||||
"ParameterDemo1": "{0} in {1} to do {2}",
|
||||
"TemplateExist": "The template code already exists under the currently selected subsystem"
|
||||
|
||||
"TemplateExist": "The template code already exists under the currently selected subsystem",
|
||||
"TrackContentExist": "The trace code or trace content or trace content in the current subsystem is repeated in English",
|
||||
"TrackStatusExist": "The trajectory status code or trajectory status or trajectory status in English is repeated under the current subsystem"
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,8 @@
|
||||
"NotFindData": "未找到指定编号下的任何数据!",
|
||||
"ParameterDemo": "{0}在{1}地方做了{2}动作",
|
||||
"ParameterDemo1": "{0}在{1}地方做了{2}动作",
|
||||
"TemplateExist": "模板代码已存在于当前选择的子系统下"
|
||||
"TemplateExist": "模板代码已存在于当前选择的子系统下",
|
||||
"TrackContentExist": "当前子系统下轨迹代码或轨迹内容或轨迹内容英文重复",
|
||||
"TrackStatusExist": "当前子系统下轨迹状态代码或轨迹状态或轨迹状态英文重复"
|
||||
}
|
||||
}
|
||||
@ -8,8 +8,11 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Services\TrackMap\**" />
|
||||
<Compile Remove="Validations\Docuai\**" />
|
||||
<EmbeddedResource Remove="Services\TrackMap\**" />
|
||||
<EmbeddedResource Remove="Validations\Docuai\**" />
|
||||
<None Remove="Services\TrackMap\**" />
|
||||
<None Remove="Validations\Docuai\**" />
|
||||
</ItemGroup>
|
||||
|
||||
@ -26,8 +29,4 @@
|
||||
<ProjectReference Include="..\SJZY.Track.Domain\SJZY.Track.Domain.csproj" />
|
||||
<ProjectReference Include="..\SJZY.Track.HttpApi\SJZY.Track.HttpApi.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Services\TrackMap\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using SJZY.Track.Application.Dtos.TrackContents;
|
||||
using SJZY.Track.Application.Dtos.TrackStatus;
|
||||
using SJZY.Track.Application.Localization;
|
||||
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
||||
using SJZY.Track.Domain.Dtos.TrackContents;
|
||||
using SJZY.Track.Domain.Dtos.TrackStatus;
|
||||
@ -20,12 +22,15 @@ namespace SJZY.Track.Application.Services.TrackContents
|
||||
[Route("/Track/Content")]
|
||||
public class TrackContentService : ApplicationService, ITransientDependency
|
||||
{
|
||||
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
|
||||
private readonly ITrackContentRepository _trackContentRepository;
|
||||
|
||||
public TrackContentService(
|
||||
IStringLocalizer<TrackLocalizationResource> stringLocalizer,
|
||||
ITrackContentRepository trackContentRepository
|
||||
)
|
||||
{
|
||||
this._stringLocalizer=stringLocalizer;
|
||||
this._trackContentRepository=trackContentRepository;
|
||||
}
|
||||
|
||||
@ -34,7 +39,6 @@ namespace SJZY.Track.Application.Services.TrackContents
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost("Edit")]
|
||||
[AllowAnonymous]
|
||||
public async Task<UnifyResultDto> EditAsync(EditTrackContentInput input)
|
||||
{
|
||||
return input.Options switch
|
||||
@ -84,6 +88,15 @@ namespace SJZY.Track.Application.Services.TrackContents
|
||||
#region 私有方法
|
||||
private async Task<UnifyResultDto> AddAsync(EditTrackContentInput input)
|
||||
{
|
||||
#region 业务逻辑校验
|
||||
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)
|
||||
{
|
||||
throw new BusinessException(message: _stringLocalizer["TrackContentExist"]);
|
||||
}
|
||||
#endregion
|
||||
|
||||
var entity = ObjectMapper.Map<EditTrackContentInput, TrackContentEntity>(input);
|
||||
var isTrue = await _trackContentRepository.InsertAsync(entity);
|
||||
|
||||
@ -92,6 +105,15 @@ namespace SJZY.Track.Application.Services.TrackContents
|
||||
|
||||
private async Task<UnifyResultDto> UpdateAsync(EditTrackContentInput input)
|
||||
{
|
||||
#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));
|
||||
if (trackContentEntity != null)
|
||||
{
|
||||
throw new BusinessException(message: _stringLocalizer["TrackContentExist"]);
|
||||
}
|
||||
#endregion
|
||||
|
||||
var templateEntity = await _trackContentRepository.GetFirstAsync(a => a.Id == input.Id);
|
||||
ObjectMapper.Map(input, templateEntity);
|
||||
var isTrue = await _trackContentRepository.UpdateAsync(templateEntity);
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
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
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
using SJZY.Track.Application.Dtos.TrackStatus;
|
||||
using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
|
||||
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;
|
||||
|
||||
namespace SJZY.Track.Application.Services.TrackFlags
|
||||
{
|
||||
/// <summary>
|
||||
/// 轨迹标记服务
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "轨迹标记")]
|
||||
[Route("/Track/Flag")]
|
||||
public class TrackFlagService : ApplicationService, ITransientDependency
|
||||
{
|
||||
public TrackFlagService()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
using Microsoft.Extensions.Localization;
|
||||
using SJZY.Track.Application.Localization;
|
||||
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
|
||||
using SJZY.Track.Domain.Dtos.Common;
|
||||
using SJZY.Track.Domain.Dtos.TrackPull;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
|
||||
namespace SJZY.Track.Application.Services.TrackPull;
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹拉取
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "轨迹拉取")]
|
||||
[Route("/Track/PullConfig")]
|
||||
public class TrackPullService : ApplicationService, ITransientDependency
|
||||
{
|
||||
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
|
||||
private readonly ITrackPullConfigRepository _trackPullConfigRepository;
|
||||
|
||||
public TrackPullService(
|
||||
IStringLocalizer<TrackLocalizationResource> stringLocalizer,
|
||||
ITrackPullConfigRepository trackPullConfigRepository)
|
||||
{
|
||||
_stringLocalizer = stringLocalizer;
|
||||
_trackPullConfigRepository = trackPullConfigRepository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹拉取配置列表
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("GetPage")]
|
||||
public async Task<UnifyPageResultDto<GetTrackPullConfigPageOutputVO>> GetPageAsync([FromBody] KeywordsInputVO input)
|
||||
{
|
||||
return await _trackPullConfigRepository.GetPageAsync(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹拉取配置内容列表
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("GetContentPage")]
|
||||
public async Task<UnifyPageResultDto<GetTrackPullContentPageOutputVO>> GetContentPageAsync([FromBody] GetTrackPullContentPageInputVO input)
|
||||
{
|
||||
return await _trackPullConfigRepository.GetContentPageAsync(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹拉取配置详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("GetDetail")]
|
||||
public async Task<GetTrackPullConfigDetailOutputVO> GetDetailAsync(int id)
|
||||
{
|
||||
return await _trackPullConfigRepository.GetDetailAsync(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹拉取配置内容详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("GetContentDetail")]
|
||||
public async Task<GetTrackPullContentDetailOutputVO> GetContentDetailAsync(int id)
|
||||
{
|
||||
return await _trackPullConfigRepository.GetContentDetailAsync(id);
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,6 @@
|
||||
using SJZY.Track.Application.Dtos.TrackStatus;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using SJZY.Track.Application.Dtos.TrackStatus;
|
||||
using SJZY.Track.Application.Localization;
|
||||
using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
|
||||
using SJZY.Track.Domain.Dtos.TrackStatus;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
@ -12,12 +14,15 @@ namespace SJZY.Track.Application.Services.TrackStatus;
|
||||
[Route("/Track/Status")]
|
||||
public class TrackStatusService : ApplicationService, ITransientDependency
|
||||
{
|
||||
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
|
||||
private readonly ITrackStatusRepository _trackStatusRepository;
|
||||
|
||||
public TrackStatusService(
|
||||
IStringLocalizer<TrackLocalizationResource> stringLocalizer,
|
||||
ITrackStatusRepository trackStatusRepository
|
||||
)
|
||||
{
|
||||
this._stringLocalizer=stringLocalizer;
|
||||
this._trackStatusRepository = trackStatusRepository;
|
||||
}
|
||||
|
||||
@ -73,9 +78,17 @@ public class TrackStatusService : ApplicationService, ITransientDependency
|
||||
}
|
||||
|
||||
#region 私有方法
|
||||
|
||||
private async Task<UnifyResultDto> AddAsync(EditTrackStatusInput input)
|
||||
{
|
||||
#region 业务校验
|
||||
var trackStatusEntity = await _trackStatusRepository.GetFirstAsync(a => 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"]);
|
||||
}
|
||||
#endregion
|
||||
|
||||
var entity = ObjectMapper.Map<EditTrackStatusInput, TrackStatusEntity>(input);
|
||||
var isTrue = await _trackStatusRepository.InsertAsync(entity);
|
||||
|
||||
@ -84,6 +97,15 @@ public class TrackStatusService : ApplicationService, ITransientDependency
|
||||
|
||||
private async Task<UnifyResultDto> UpdateAsync(EditTrackStatusInput input)
|
||||
{
|
||||
#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));
|
||||
if (trackStatusEntity!=null)
|
||||
{
|
||||
throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]);
|
||||
}
|
||||
#endregion
|
||||
|
||||
var templateEntity = await _trackStatusRepository.GetFirstAsync(a => a.Id == input.Id);
|
||||
ObjectMapper.Map(input, templateEntity);
|
||||
var isTrue = await _trackStatusRepository.UpdateAsync(templateEntity);
|
||||
@ -97,6 +119,5 @@ public class TrackStatusService : ApplicationService, ITransientDependency
|
||||
|
||||
return new UnifyResultDto("200", "删除成功", isTrue);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@ -164,7 +164,7 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
|
||||
x.TrackTemplateId == input.TrackTemplateId && x.TrackContentId == input.TrackContentId;
|
||||
if (input.Options == OptionTypeNoNull.修改) isAnyExp.And(x => x.Id != input.Id);
|
||||
|
||||
if (await _trackTemplateRepository.IsAnyAsync(isAnyExp))
|
||||
if (await _trackTemplateRepository.IsContentAnyAsync(isAnyExp))
|
||||
throw new BusinessException(message: _stringLocalizer["IsTrackTemplateContentAny"]);
|
||||
}
|
||||
|
||||
@ -174,18 +174,18 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
|
||||
|
||||
var entity = ObjectMapper.Map<EditTrackTemplateContentInput, TrackTemplateContentEntity>(input);
|
||||
|
||||
await _trackTemplateRepository.InsertAsync(entity);
|
||||
await _trackTemplateRepository.InsertContentAsync(entity);
|
||||
|
||||
break;
|
||||
|
||||
case OptionTypeNoNull.修改:
|
||||
|
||||
var oldEntity = await _trackTemplateRepository.GetByIdAsync(input.Id!.Value) ??
|
||||
var oldEntity = await _trackTemplateRepository.GetContentByIdAsync(input.Id!.Value) ??
|
||||
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
||||
|
||||
ObjectMapper.Map(input, oldEntity);
|
||||
|
||||
await _trackTemplateRepository.UpdateAsync(oldEntity);
|
||||
await _trackTemplateRepository.UpdateContentAsync(oldEntity);
|
||||
|
||||
break;
|
||||
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
using FluentValidation;
|
||||
using SJZY.Track.Application.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
|
||||
{
|
||||
public class EditTrackContentInputValidation : AbstractValidator<EditTrackContentInput>, IValidationEnabled
|
||||
{
|
||||
public EditTrackContentInputValidation()
|
||||
{
|
||||
//条件分支
|
||||
When(x => x.Options == OptionType.修改 || x.Options == OptionType.删除, () =>
|
||||
{
|
||||
RuleFor(x => x.Id).GreaterThan(0).WithMessage("修改或删除时Id必须大于0!");
|
||||
});
|
||||
|
||||
When(x => x.Options == OptionType.新增, () =>
|
||||
{
|
||||
RuleFor(x => x.Id).Equal(0).WithMessage("新增时Id必须等于0!");
|
||||
});
|
||||
|
||||
When(x => x.Options == OptionType.修改 || x.Options == OptionType.新增, () =>
|
||||
{
|
||||
RuleFor(x => x.SubSystemId).GreaterThan(0).WithMessage("子系统的id必须大于0!");
|
||||
RuleFor(x => x.TrackStatusId).GreaterThan(0).WithMessage("所属状态的id必须大于0!");
|
||||
RuleFor(x => x.Code).NotNull().WithMessage("轨迹内容代码必填!").NotEmpty().WithMessage("轨迹内容代码不能为空!");
|
||||
RuleFor(x => x.Content).NotNull().WithMessage("轨迹内容必填!").NotEmpty().WithMessage("轨迹内容不能为空!");
|
||||
RuleFor(x => x.EnContent).NotNull().WithMessage("轨迹内容英文必填!").NotEmpty().WithMessage("轨迹内容英文不能为空!");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
using FluentValidation;
|
||||
using SJZY.Track.Application.Dtos.TrackContents;
|
||||
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
|
||||
{
|
||||
public class EditTrackStatusInputValidation : AbstractValidator<EditTrackStatusInput>, IValidationEnabled
|
||||
{
|
||||
public EditTrackStatusInputValidation()
|
||||
{
|
||||
//条件分支
|
||||
When(x => x.Options == OptionType.修改 || x.Options == OptionType.删除, () =>
|
||||
{
|
||||
RuleFor(x => x.Id).GreaterThan(0).WithMessage("修改或删除时Id必须大于0!");
|
||||
});
|
||||
|
||||
When(x => x.Options == OptionType.新增, () =>
|
||||
{
|
||||
RuleFor(x => x.Id).Equal(0).WithMessage("新增时Id必须等于0!");
|
||||
});
|
||||
|
||||
When(x => x.Options == OptionType.修改 || x.Options == OptionType.新增, () =>
|
||||
{
|
||||
RuleFor(x => x.SubSystemId).GreaterThan(0).WithMessage("子系统的id必须大于0!");
|
||||
RuleFor(x => x.NodeId).GreaterThan(0).WithMessage("所属节点的id必须大于0!");
|
||||
RuleFor(x => x.Code).NotNull().WithMessage("轨迹状态代码必填!").NotEmpty().WithMessage("轨迹状态代码不能为空!");
|
||||
RuleFor(x => x.TrackStatus).NotNull().WithMessage("轨迹状态必填!").NotEmpty().WithMessage("轨迹状态不能为空!");
|
||||
RuleFor(x => x.EntrackStatus).NotNull().WithMessage("轨迹状态英文必填!").NotEmpty().WithMessage("轨迹状态英文不能为空!");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,35 @@
|
||||
namespace SJZY.Track.Domain.Aggregates.TrackPullAggregate;
|
||||
using SJZY.Track.Domain.Dtos.Common;
|
||||
using SJZY.Track.Domain.Dtos.TrackPull;
|
||||
|
||||
namespace SJZY.Track.Domain.Aggregates.TrackPullAggregate;
|
||||
|
||||
public interface ITrackPullConfigRepository : IBasicRepository<TrackPullConfigEntity>
|
||||
{
|
||||
/// <summary>
|
||||
/// 轨迹拉取配置列表
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
Task<UnifyPageResultDto<GetTrackPullConfigPageOutputVO>> GetPageAsync(KeywordsInputVO input);
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹拉取配置内容列表
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
Task<UnifyPageResultDto<GetTrackPullContentPageOutputVO>> GetContentPageAsync(GetTrackPullContentPageInputVO input);
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹拉取配置详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<GetTrackPullConfigDetailOutputVO> GetDetailAsync(int id);
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹拉取配置内容详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<GetTrackPullContentDetailOutputVO> GetContentDetailAsync(int id);
|
||||
}
|
||||
@ -25,13 +25,13 @@ public interface ITrackTemplateRepository : IBasicRepository<TrackTemplateEntity
|
||||
/// <returns></returns>
|
||||
Task<GetTrackTemplateContentDetailOutputVO> GetContentDetailAsync(int id);
|
||||
|
||||
Task<bool> IsAnyAsync(Expression<Func<TrackTemplateContentEntity, bool>> whereExpression);
|
||||
Task<bool> IsContentAnyAsync(Expression<Func<TrackTemplateContentEntity, bool>> whereExpression);
|
||||
|
||||
Task<bool> InsertAsync(TrackTemplateContentEntity insertObj);
|
||||
Task<bool> InsertContentAsync(TrackTemplateContentEntity insertObj);
|
||||
|
||||
Task<TrackTemplateContentEntity> GetByIdAsync(int id);
|
||||
Task<TrackTemplateContentEntity> GetContentByIdAsync(int id);
|
||||
|
||||
Task<bool> UpdateAsync(TrackTemplateContentEntity updateObj);
|
||||
Task<bool> UpdateContentAsync(TrackTemplateContentEntity updateObj);
|
||||
|
||||
Task<bool> SoftDeleteContentAsync(int id);
|
||||
}
|
||||
19
src/SJZY.Track.Domain/Dtos/Common/KeywordsInputVO.cs
Normal file
19
src/SJZY.Track.Domain/Dtos/Common/KeywordsInputVO.cs
Normal file
@ -0,0 +1,19 @@
|
||||
namespace SJZY.Track.Domain.Dtos.Common;
|
||||
|
||||
public class KeywordsInputVO : PageInfoInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 子系统id
|
||||
/// </summary>
|
||||
public int? SubSystemId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关键字
|
||||
/// </summary>
|
||||
public string Keywords { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 选中项
|
||||
/// </summary>
|
||||
public int? SelectedId { get; set; }
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
namespace SJZY.Track.Domain.Dtos.TrackPull;
|
||||
|
||||
public class GetTrackPullConfigDetailOutputVO
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹订单号
|
||||
/// </summary>
|
||||
public string OrderNoName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 返参解析对象
|
||||
/// </summary>
|
||||
public int ParseMethod { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 定时任务(分钟)
|
||||
/// </summary>
|
||||
public int PullInterval { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务商
|
||||
/// </summary>
|
||||
public string ServiceProvider { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务商id
|
||||
/// </summary>
|
||||
public int ServiceProviderId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子系统
|
||||
/// </summary>
|
||||
public string SubSystem { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子系统id
|
||||
/// </summary>
|
||||
public int SubSystemId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹时区
|
||||
/// </summary>
|
||||
public string TackTimeZoneName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹内容代码
|
||||
/// </summary>
|
||||
public string TrackContentCodeName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹内容
|
||||
/// </summary>
|
||||
public string TrackContentName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹发生地
|
||||
/// </summary>
|
||||
public string TrackPlaceName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹状态
|
||||
/// </summary>
|
||||
public string TrackStatusName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹模板
|
||||
/// </summary>
|
||||
public string TrackTemplate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹模板id
|
||||
/// </summary>
|
||||
public int TrackTemplateId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹发生时间
|
||||
/// </summary>
|
||||
public string TrackTimeName { get; set; }
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
namespace SJZY.Track.Domain.Dtos.TrackPull;
|
||||
|
||||
public class GetTrackPullConfigPageOutputVO
|
||||
{
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? CreateTime { get; set; }
|
||||
|
||||
public int? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务商名称
|
||||
/// </summary>
|
||||
public string ServiceProvider { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子系统名称
|
||||
/// </summary>
|
||||
public string SubSystem { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 模板名称
|
||||
/// </summary>
|
||||
public string TrackTemplate { get; set; }
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
namespace SJZY.Track.Domain.Dtos.TrackPull;
|
||||
|
||||
public class GetTrackPullContentDetailOutputVO
|
||||
{
|
||||
/// <summary>
|
||||
/// 轨迹内容代码
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹内容代码
|
||||
/// </summary>
|
||||
public string TrackContentCodeValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹内容id
|
||||
/// </summary>
|
||||
public int TrackContentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹内容
|
||||
/// </summary>
|
||||
public string TrackContentValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹关键字(正向)
|
||||
/// </summary>
|
||||
public string TrackKeyword { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹关键字(反向)
|
||||
/// </summary>
|
||||
public string TrackKeywordReverse { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹发生地
|
||||
/// </summary>
|
||||
public int TrackPlaceValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹拉取配置id
|
||||
/// </summary>
|
||||
public int TrackPullConfigId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹状态
|
||||
/// </summary>
|
||||
public string TrackStatusValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹时区
|
||||
/// </summary>
|
||||
public string TrackTimeZone { get; set; }
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
namespace SJZY.Track.Domain.Dtos.TrackPull;
|
||||
|
||||
public class GetTrackPullContentPageInputVO : PageInfoInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 轨迹拉取配置id
|
||||
/// </summary>
|
||||
public int TrackPullConfigId { get; set; }
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
namespace SJZY.Track.Domain.Dtos.TrackPull;
|
||||
|
||||
public class GetTrackPullContentPageOutputVO
|
||||
{
|
||||
/// <summary>
|
||||
/// 轨迹内容代码
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹内容
|
||||
/// </summary>
|
||||
public string Content { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹内容英文
|
||||
/// </summary>
|
||||
public string EnContent { get; set; }
|
||||
|
||||
public int? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹内容代码
|
||||
/// </summary>
|
||||
public string TrackContentCodeValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹内容
|
||||
/// </summary>
|
||||
public bool? TrackContentValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹关键字(正向)
|
||||
/// </summary>
|
||||
public string TrackKeyword { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹关键字(正向)
|
||||
/// </summary>
|
||||
public List<string> TrackKeywords { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹关键字(反向)
|
||||
/// </summary>
|
||||
public string TrackKeywordReverse { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹关键字(反向)
|
||||
/// </summary>
|
||||
public List<string> TrackKeywordsReverse { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹发生地
|
||||
/// </summary>
|
||||
public string TrackPlaceValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拉取轨迹状态
|
||||
/// </summary>
|
||||
public string TrackStatusValue { get; set; }
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="../../common.props" />
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
||||
using SJZY.Track.Domain.Aggregates.TrackFlagAggregate;
|
||||
using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
|
||||
using SJZY.Track.Domain.Dtos.TrackContents;
|
||||
using SJZY.Track.Domain.Dtos.TrackStatus;
|
||||
@ -22,20 +23,22 @@ public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrac
|
||||
public async Task<GetTrackContentDetailVO?> GetDetailAsync(int id)
|
||||
{
|
||||
var detail = await Context.Queryable<TrackContentEntity>()
|
||||
.LeftJoin<VSystemEntity>((a, b) => a.SubSystemId == b.Id)
|
||||
.Where((a, b) => a.Id == id)
|
||||
.Select((a, b) => new GetTrackContentDetailVO
|
||||
.LeftJoin<TrackStatusEntity>((a, b) => a.TrackStatusId==b.Id)
|
||||
.LeftJoin<TrackFlagEntity>((a, b, c) => a.TrackFlagId==c.Id)
|
||||
.LeftJoin<VSystemEntity>((a, b, c, d) => a.SubSystemId == b.Id)
|
||||
.Where((a, b, c, d) => a.Id == id)
|
||||
.Select((a, b, c, d) => new GetTrackContentDetailVO
|
||||
{
|
||||
Id = a.Id,
|
||||
SubSystemId = a.SubSystemId,
|
||||
SubSystem = b.CnName,
|
||||
SubSystem = d.CnName,
|
||||
TrackStatusId=a.TrackStatusId,
|
||||
TrackStatus= "",
|
||||
TrackStatus= b.Status,
|
||||
Code = a.Code,
|
||||
Content = a.Content,
|
||||
EnContent = a.EnContent,
|
||||
TrackFlagId=a.TrackFlagId,
|
||||
TrackFlag=""
|
||||
TrackFlag=c.Name
|
||||
})
|
||||
.FirstAsync();
|
||||
return detail;
|
||||
@ -50,28 +53,32 @@ public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrac
|
||||
{
|
||||
UnifyPageResultDto<GetTrackContentListVO> pagedList = new UnifyPageResultDto<GetTrackContentListVO>();
|
||||
pagedList = await Context.Queryable<TrackContentEntity>()
|
||||
.LeftJoin<VSystemEntity>((a, b) => a.SubSystemId == b.Id)
|
||||
.LeftJoin<VUserEntity>((a, b, c) => a.CreateUserId == c.Id)
|
||||
.LeftJoin<VUserEntity>((a, b, c, d) => a.UpdateUserId == d.Id)
|
||||
.WhereIF(input.SubSystemId > 0, (a, b, c, d) => a.SubSystemId == input.SubSystemId)
|
||||
.LeftJoin<TrackStatusEntity>((a, b) => a.TrackStatusId==b.Id)
|
||||
.LeftJoin<TrackFlagEntity>((a, b, c) => a.TrackFlagId==c.Id)
|
||||
.LeftJoin<VSystemEntity>((a, b, c, d) => a.SubSystemId == d.Id)
|
||||
.LeftJoin<VUserEntity>((a, b, c, d, e) => a.CreateUserId == e.Id)
|
||||
.LeftJoin<VUserEntity>((a, b, c, d, e, f) => a.UpdateUserId == f.Id)
|
||||
.WhereIF(input.SubSystemId > 0, (a, b, c, d, e, f) => a.SubSystemId == input.SubSystemId)
|
||||
.WhereIF(!input.Keywords.IsNullOrWhiteSpace(),
|
||||
(a, b, c, d) => a.Code.Contains(input.Keywords)
|
||||
(a, b, c, d, e, f) => a.Code.Contains(input.Keywords) || a.Content.Contains(input.Keywords)
|
||||
|| a.EnContent.Contains(input.Keywords)
|
||||
)
|
||||
.Select((a, b, c, d) => new GetTrackContentListVO
|
||||
.Select((a, b, c, d, e, f) => new GetTrackContentListVO
|
||||
{
|
||||
Id = a.Id,
|
||||
SubSystem = b.CnName,
|
||||
SubSystem = d.CnName,
|
||||
Code = a.Code,
|
||||
Content = a.Content,
|
||||
EnContent = a.EnContent,
|
||||
TrackStatus= "",
|
||||
Node = "",
|
||||
TrackFlag= "",
|
||||
TrackStatus= b.Status,
|
||||
Node = SqlFunc.IF(b.Node == 1).Return("揽收").ElseIF(b.Node == 2).Return("干线").ElseIF(b.Node == 3).Return("清关")
|
||||
.ElseIF(b.Node == 4).Return("中转").ElseIF(b.Node == 5).Return("派送")
|
||||
.End(""),
|
||||
TrackFlag= c.Name,
|
||||
CreateTime = a.CreateTime,
|
||||
CreateUser = c.Name,
|
||||
CreateUser = e.Name,
|
||||
UpdateTime = a.UpdateTime,
|
||||
UpdateUser = d.Name,
|
||||
|
||||
UpdateUser = f.Name
|
||||
})
|
||||
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||
|
||||
|
||||
@ -1,8 +1,86 @@
|
||||
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
|
||||
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
||||
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
|
||||
using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
|
||||
using SJZY.Track.Domain.Dtos.Common;
|
||||
using SJZY.Track.Domain.Dtos.TrackPull;
|
||||
using SJZY.Track.Domain.VEntities;
|
||||
|
||||
namespace SJZY.Track.Repository;
|
||||
|
||||
public class TrackPullConfigRepository : BasicRepository<TrackPullConfigEntity>, ITrackPullConfigRepository,
|
||||
IScopedDependency
|
||||
{
|
||||
public async Task<UnifyPageResultDto<GetTrackPullConfigPageOutputVO>> GetPageAsync(KeywordsInputVO input)
|
||||
{
|
||||
return await AsQueryable()
|
||||
.LeftJoin<VSystemEntity>((trackPull, system) => trackPull.SubSystemId == system.Id && !system.IsDeleted)
|
||||
.LeftJoin<VServiceProviderEntity>((trackPull, system, service) => trackPull.ServiceProviderId == service.Id && !service.IsDeleted)
|
||||
.LeftJoin<TrackTemplateEntity>((trackPull, system, service, template) => trackPull.TrackTemplateId == template.Id && !template.IsDeleted)
|
||||
.Filter(null, true)
|
||||
.Where(trackPull => !trackPull.IsDeleted)
|
||||
.WhereIF(input.SubSystemId.HasValue, trackPull => trackPull.SubSystemId == input.SubSystemId)
|
||||
.WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (trackPull, system, service, template) => service.Name.Contains(input.Keywords) || template.Name.Contains(input.Keywords))
|
||||
.OrderByDescending(trackPull => trackPull.CreateTime)
|
||||
.Select((trackPull, system, service, template) => new GetTrackPullConfigPageOutputVO
|
||||
{
|
||||
Id = trackPull.Id,
|
||||
SubSystem = system.CnName,
|
||||
ServiceProvider = service.Name,
|
||||
TrackTemplate = template.Name,
|
||||
CreateTime = trackPull.CreateTime
|
||||
})
|
||||
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||
}
|
||||
|
||||
public async Task<UnifyPageResultDto<GetTrackPullContentPageOutputVO>> GetContentPageAsync(GetTrackPullContentPageInputVO input)
|
||||
{
|
||||
return await Context.Queryable<TrackPullContentConfigEntity>()
|
||||
.InnerJoin<TrackContentEntity>((pullContent, trackContent) => pullContent.TrackContentId == trackContent.Id)
|
||||
.InnerJoin<TrackPullConfigEntity>((pullContent, trackContent, trackPull) => pullContent.TrackPullConfigId == trackPull.Id)
|
||||
.InnerJoin<TrackTemplateContentEntity>((pullContent, trackContent, trackPull, templateContent) => trackPull.TrackTemplateId == templateContent.TrackTemplateId && pullContent.TrackContentId == templateContent.TrackContentId)
|
||||
.Where(pullContent => pullContent.TrackPullConfigId == input.TrackPullConfigId)
|
||||
.OrderBy((pullContent, trackContent, trackPull, templateContent) => templateContent.Sort)
|
||||
.Select((pullContent, trackContent, trackPull, templateContent) => new GetTrackPullContentPageOutputVO
|
||||
{
|
||||
Id = pullContent.Id
|
||||
}, true)
|
||||
.Mapper(x =>
|
||||
{
|
||||
x.TrackKeywords = [.. x.TrackKeyword.Split(',')];
|
||||
x.TrackKeywordsReverse = [.. x.TrackKeywordReverse.Split(',')];
|
||||
})
|
||||
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||
}
|
||||
|
||||
public async Task<GetTrackPullConfigDetailOutputVO> GetDetailAsync(int id)
|
||||
{
|
||||
return await AsQueryable()
|
||||
.LeftJoin<VSystemEntity>((trackPull, system) => trackPull.SubSystemId == system.Id && !system.IsDeleted)
|
||||
.LeftJoin<VServiceProviderEntity>((trackPull, system, service) => trackPull.ServiceProviderId == service.Id && !service.IsDeleted)
|
||||
.LeftJoin<TrackTemplateEntity>((trackPull, system, service, template) => trackPull.TrackTemplateId == template.Id && !template.IsDeleted)
|
||||
.InnerJoin<TrackPushPullParamsConfigEntity>((trackPull, system, service, template, paramsConfig) => trackPull.Id == paramsConfig.PullOrPushConfigId && !paramsConfig.IsPush && !paramsConfig.IsDeleted)
|
||||
.Filter(null, true)
|
||||
.Where(trackPull => trackPull.Id == id && !trackPull.IsDeleted)
|
||||
.Select((trackPull, system, service, template, paramsConfig) => new GetTrackPullConfigDetailOutputVO
|
||||
{
|
||||
Id = trackPull.Id,
|
||||
SubSystem = system.CnName,
|
||||
ServiceProvider = service.Name,
|
||||
TrackTemplate = template.Name
|
||||
}, true)
|
||||
.SingleAsync();
|
||||
}
|
||||
|
||||
public async Task<GetTrackPullContentDetailOutputVO> GetContentDetailAsync(int id)
|
||||
{
|
||||
return await Context.Queryable<TrackPullContentConfigEntity>()
|
||||
.InnerJoin<TrackContentEntity>((pullContent, trackContent) => pullContent.TrackContentId == trackContent.Id)
|
||||
.Where(pullContent => pullContent.Id == id)
|
||||
.Select((pullContent, trackContent) => new GetTrackPullContentDetailOutputVO
|
||||
{
|
||||
Id = pullContent.Id,
|
||||
Code = trackContent.Code + "-" + trackContent.Content,
|
||||
}, true)
|
||||
.SingleAsync();
|
||||
}
|
||||
}
|
||||
@ -11,7 +11,7 @@ public class TrackStatusRepository : BasicRepository<TrackStatusEntity>, ITrackS
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取轨迹模版明细
|
||||
/// 获取轨迹状态明细
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
@ -56,7 +56,10 @@ public class TrackStatusRepository : BasicRepository<TrackStatusEntity>, ITrackS
|
||||
Code = a.Code,
|
||||
EntrackStatus = a.EnStatus,
|
||||
TrackStatus = a.Status,
|
||||
Node = "",
|
||||
NodeId = a.Node,
|
||||
Node = SqlFunc.IF(a.Node == 1).Return("揽收").ElseIF(a.Node == 2).Return("干线").ElseIF(a.Node == 3).Return("清关")
|
||||
.ElseIF(a.Node == 4).Return("中转").ElseIF(a.Node == 5).Return("派送")
|
||||
.End(""),
|
||||
CreateTime = a.CreateTime,
|
||||
CreateUser = c.Name,
|
||||
UpdateTime = a.UpdateTime,
|
||||
|
||||
@ -64,6 +64,7 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
|
||||
.WhereIF(input.SubSystemId > 0, (a, b) => a.SubSystemId == input.SubSystemId)
|
||||
.WhereIF(!input.Keywords.IsNullOrWhiteSpace(),
|
||||
(a, b) => a.Name.Contains(input.Keywords) || a.Code.Contains(input.Keywords))
|
||||
.OrderByIF(input.TrackTemplateId > 0, (a, b) => SqlFunc.IIF(a.Id == input.TrackTemplateId, SqlFunc.DateAdd(SqlFunc.GetDate(), 1), a.CreateTime), OrderByType.Desc)
|
||||
.Select((a, b) => new GetTrackTemplateListVO
|
||||
{
|
||||
Id = a.Id,
|
||||
@ -73,41 +74,6 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
|
||||
SubSystem = b.CnName
|
||||
})
|
||||
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||
//如果轨迹模版id传值了,就置顶在第一条
|
||||
if (input.TrackTemplateId > 0 && (!pagedList.List.IsNullOrEmpty()))
|
||||
{
|
||||
if (input.PageIndex == 1)
|
||||
{
|
||||
bool existCurrent = pagedList.List.Any(x => x.Id == input.TrackTemplateId);
|
||||
if (existCurrent)
|
||||
{
|
||||
var item = pagedList.List.FirstOrDefault(x => x.Id == input.TrackTemplateId);
|
||||
pagedList.List.Remove(item);
|
||||
pagedList.List.Insert(0, item);
|
||||
}
|
||||
else
|
||||
{
|
||||
var item = await Context.Queryable<TrackTemplateEntity>()
|
||||
.LeftJoin<VSystemEntity>((a, b) => a.SubSystemId == b.Id)
|
||||
.Where((a, b) => a.Id == input.TrackTemplateId)
|
||||
.Select((a, b) => new GetTrackTemplateListVO
|
||||
{
|
||||
Id = a.Id,
|
||||
Code = a.Code,
|
||||
CreateTime = a.CreateTime,
|
||||
Name = a.Name,
|
||||
SubSystem = b.CnName
|
||||
})
|
||||
.FirstAsync();
|
||||
if (item != null)
|
||||
{
|
||||
var removeItem = pagedList.List.LastOrDefault();
|
||||
pagedList.List.Remove(removeItem);
|
||||
pagedList.List.Insert(0, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pagedList;
|
||||
}
|
||||
@ -134,6 +100,7 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
|
||||
.Filter(null, true)
|
||||
.Where(templateContent =>
|
||||
templateContent.TrackTemplateId == input.TrackTemplateId && !templateContent.IsDeleted)
|
||||
.OrderByDescending(templateContent => templateContent.CreateTime)
|
||||
.Select((templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) =>
|
||||
new GetTrackTemplateContentPageOutputVO
|
||||
{
|
||||
@ -169,25 +136,25 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<bool> IsAnyAsync(Expression<Func<TrackTemplateContentEntity, bool>> whereExpression)
|
||||
public async Task<bool> IsContentAnyAsync(Expression<Func<TrackTemplateContentEntity, bool>> whereExpression)
|
||||
{
|
||||
return await Context.Queryable<TrackTemplateContentEntity>().Where(whereExpression).AnyAsync();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<bool> InsertAsync(TrackTemplateContentEntity insertObj)
|
||||
public async Task<bool> InsertContentAsync(TrackTemplateContentEntity insertObj)
|
||||
{
|
||||
return await Context.Insertable(insertObj).ExecuteCommandAsync() > 0;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<TrackTemplateContentEntity> GetByIdAsync(int id)
|
||||
public async Task<TrackTemplateContentEntity> GetContentByIdAsync(int id)
|
||||
{
|
||||
return await Context.Queryable<TrackTemplateContentEntity>().InSingleAsync(id);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<bool> UpdateAsync(TrackTemplateContentEntity updateObj)
|
||||
public async Task<bool> UpdateContentAsync(TrackTemplateContentEntity updateObj)
|
||||
{
|
||||
return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user