Merge branch 'S02-轨迹中台' into test

This commit is contained in:
dingenwen 2024-03-12 14:43:06 +08:00
commit e332ae31d9
9 changed files with 51 additions and 2 deletions

View File

@ -5,6 +5,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<Version>1.0.0</Version> <Version>1.0.0</Version>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="SJZY.Expand.ABP.Common" Version="7.0.11" /> <PackageReference Include="SJZY.Expand.ABP.Common" Version="7.0.11" />

View File

@ -34,7 +34,9 @@ public class TrackPullCacheService : ApplicationService, ITrackPullCacheService,
{ {
var data = new TrackPullConfigDto(); var data = new TrackPullConfigDto();
Expression<Func<TrackPullConfigEntity, bool>> exp = x => id.HasValue ? x.Id == id : x.SubSystemId == subSystemId && x.ServiceProviderId == serviceProviderId; Expression<Func<TrackPullConfigEntity, bool>> exp = x =>
(!id.HasValue || x.Id == id) && (id.HasValue || (x.SubSystemId == subSystemId && x.ServiceProviderId == serviceProviderId));
var trackPullConfigEntity = await _trackPullConfigRepository.GetFirstAsync(exp); var trackPullConfigEntity = await _trackPullConfigRepository.GetFirstAsync(exp);
if (trackPullConfigEntity == null) return data; if (trackPullConfigEntity == null) return data;

View File

@ -167,7 +167,7 @@ public class TrackPullService : ApplicationService, ITransientDependency
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("EditContent")] [HttpPost("EditContent")]
public async Task<bool> UpdateContentAsync([FromBody] EditTrackPullContentInput input) public async Task<bool> EditContentAsync([FromBody] EditTrackPullContentInput input)
{ {
if (input.Options != OptionTypeNoNull.删除) if (input.Options != OptionTypeNoNull.删除)
{ {

View File

@ -0,0 +1,33 @@
using FluentValidation;
using Microsoft.Extensions.Localization;
using SJZY.Expand.ABP.Core.Localization;
using SJZY.Track.Application.Contract.Dtos.TrackPull;
using SJZY.Track.Application.Localization;
namespace SJZY.Track.Application.Validations.TrackPull;
public class EditTrackPullContentInputValidation : AbstractValidator<EditTrackPullContentInput>, IValidationEnabled
{
public EditTrackPullContentInputValidation(IStringLocalizer<TrackLocalizationResource> stringLocalizer)
{
RuleFor(x => x.Options).IsInEnum().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum, nameof(EditTrackPullContentInput.Options)]);
RuleFor(x => x.Id).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackPullContentInput.Id), 0]);
RuleFor(x => x.TrackContentId).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackPullContentInput.TrackContentId), 0]);
RuleFor(x => x.TrackPullConfigId).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackPullContentInput.TrackPullConfigId), 0]);
When(x => x.Options != OptionTypeNoNull.新增, () =>
{
RuleFor(x => x.Id).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackPullContentInput.Id)]);
});
When(x => x.Options != OptionTypeNoNull.删除, () =>
{
RuleFor(x => x.TrackContentId).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackPullContentInput.TrackContentId)]);
RuleFor(x => x.TrackPullConfigId).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackPullContentInput.TrackPullConfigId)]);
});
}
}

View File

@ -18,4 +18,9 @@ public class GetTrackPullConfigPageOutputVO
/// 子系统名称 /// 子系统名称
/// </summary> /// </summary>
public string SubSystem { get; set; } public string SubSystem { get; set; }
/// <summary>
/// 子系统id
/// </summary>
public int SubSystemId { get; set; }
} }

View File

@ -18,4 +18,9 @@ public class GetTrackPushConfigPageOutputVO
/// 子系统名称 /// 子系统名称
/// </summary> /// </summary>
public string SubSystem { get; set; } public string SubSystem { get; set; }
/// <summary>
/// 子系统id
/// </summary>
public int SubSystemId { get; set; }
} }

View File

@ -4,6 +4,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -25,6 +25,7 @@ public class TrackPullConfigRepository : BasicRepository<TrackPullConfigEntity>,
.Select((trackPull, system, service) => new GetTrackPullConfigPageOutputVO .Select((trackPull, system, service) => new GetTrackPullConfigPageOutputVO
{ {
Id = trackPull.Id, Id = trackPull.Id,
SubSystemId = system.Id,
SubSystem = system.CnName, SubSystem = system.CnName,
ServiceProvider = service.Name, ServiceProvider = service.Name,
CreateTime = trackPull.CreateTime CreateTime = trackPull.CreateTime

View File

@ -28,6 +28,7 @@ public class TrackPushConfigRepository : BasicRepository<TrackPushConfigEntity>,
.Select((trackPush, system, externalSubject) => new GetTrackPushConfigPageOutputVO .Select((trackPush, system, externalSubject) => new GetTrackPushConfigPageOutputVO
{ {
Id = trackPush.Id, Id = trackPush.Id,
SubSystemId = system.Id,
SubSystem = system.CnName, SubSystem = system.CnName,
CustomName = externalSubject.Abbreviation, CustomName = externalSubject.Abbreviation,
CreateTime = trackPush.CreateTime CreateTime = trackPush.CreateTime