Merge remote-tracking branch 'origin/S01-轨迹中台' into S01-轨迹中台
This commit is contained in:
commit
b6e0abc03f
@ -101,7 +101,22 @@ namespace SJZY.Track.Application.Services.TrackContents
|
||||
if (trackContentEntitys.Any())
|
||||
{
|
||||
//throw new BusinessException(message: _stringLocalizer["TrackContentExist"]);
|
||||
throw new BusinessException(message: "当前子系统下,轨迹代码或轨迹内容或轨迹内容英文存在");
|
||||
var codes = trackContentEntitys.FirstOrDefault(a => a.Code==input.Code);
|
||||
if (codes!=null)
|
||||
{
|
||||
throw new BusinessException(message: "该子系统下轨迹代码已存在");
|
||||
}
|
||||
var contents = trackContentEntitys.FirstOrDefault(a => a.Content==input.Content);
|
||||
if (contents!=null)
|
||||
{
|
||||
throw new BusinessException(message: "该子系统下轨迹内容已存在");
|
||||
}
|
||||
var contentEns = trackContentEntitys.FirstOrDefault(a => a.EnContent==input.EnContent);
|
||||
if (contentEns!=null)
|
||||
{
|
||||
throw new BusinessException(message: "该子系统下轨迹内容英文已存在");
|
||||
}
|
||||
//throw new BusinessException(message: "当前子系统下,轨迹代码或轨迹内容或轨迹内容英文存在");
|
||||
}
|
||||
|
||||
#endregion 业务逻辑校验
|
||||
@ -122,7 +137,22 @@ namespace SJZY.Track.Application.Services.TrackContents
|
||||
if (trackContentEntitys.Any())
|
||||
{
|
||||
//throw new BusinessException(message: _stringLocalizer["TrackContentExist"]);
|
||||
throw new BusinessException(message: "当前子系统下,轨迹代码或轨迹内容或轨迹内容英文存在");
|
||||
//throw new BusinessException(message: "当前子系统下,轨迹代码或轨迹内容或轨迹内容英文存在");
|
||||
var codes = trackContentEntitys.FirstOrDefault(a => a.Code==input.Code);
|
||||
if (codes!=null)
|
||||
{
|
||||
throw new BusinessException(message: "该子系统下轨迹代码已存在");
|
||||
}
|
||||
var contents = trackContentEntitys.FirstOrDefault(a => a.Content==input.Content);
|
||||
if (contents!=null)
|
||||
{
|
||||
throw new BusinessException(message: "该子系统下轨迹内容已存在");
|
||||
}
|
||||
var contentEns = trackContentEntitys.FirstOrDefault(a => a.EnContent==input.EnContent);
|
||||
if (contentEns!=null)
|
||||
{
|
||||
throw new BusinessException(message: "该子系统下轨迹内容英文已存在");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion 业务逻辑校验
|
||||
|
||||
@ -86,12 +86,22 @@ namespace SJZY.Track.Application.Services.TrackFlags
|
||||
private async Task<UnifyResultDto> AddAsync(EditTrackFlagInput input)
|
||||
{
|
||||
#region 业务校验
|
||||
var trackStatusEntitys = await _trackFlagRepository.GetListAsync(a =>
|
||||
var trackFlagsEntitys = await _trackFlagRepository.GetListAsync(a =>
|
||||
a.SubSystemId == input.SubSystemId && (a.Code == input.Code || a.Name == input.Flag));
|
||||
if (trackStatusEntitys.Any())
|
||||
if (trackFlagsEntitys.Any())
|
||||
{
|
||||
//throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]);
|
||||
throw new BusinessException(message: "当前子系统下已存在轨迹标记代码");
|
||||
//throw new BusinessException(message: "当前子系统下已存在轨迹标记代码");
|
||||
var trackFlagCode = trackFlagsEntitys.FirstOrDefault(a => a.Code==input.Code);
|
||||
if (trackFlagCode!=null)
|
||||
{
|
||||
throw new BusinessException(message: "该子系统下代码已存在");
|
||||
}
|
||||
var trackFlagName = trackFlagsEntitys.FirstOrDefault(a => a.Name==input.Flag);
|
||||
if (trackFlagName!=null)
|
||||
{
|
||||
throw new BusinessException(message: "该子系统下标记已存在");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -105,13 +115,23 @@ namespace SJZY.Track.Application.Services.TrackFlags
|
||||
{
|
||||
#region 业务校验
|
||||
|
||||
var trackStatusEntitys = await _trackFlagRepository.GetListAsync(a => a.Id != input.Id &&
|
||||
var trackFlagsEntitys = await _trackFlagRepository.GetListAsync(a => a.Id != input.Id &&
|
||||
a.SubSystemId == input.SubSystemId && (a.Code == input.Code ||
|
||||
a.Name == input.Flag));
|
||||
if (trackStatusEntitys.Any())
|
||||
if (trackFlagsEntitys.Any())
|
||||
{
|
||||
//throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]);
|
||||
throw new BusinessException(message: "当前子系统下已存在轨迹标记代码");
|
||||
//throw new BusinessException(message: "当前子系统下已存在轨迹标记代码");
|
||||
var trackFlagCode = trackFlagsEntitys.FirstOrDefault(a => a.Code==input.Code);
|
||||
if (trackFlagCode!=null)
|
||||
{
|
||||
throw new BusinessException(message: "该子系统下代码已存在");
|
||||
}
|
||||
var trackFlagName = trackFlagsEntitys.FirstOrDefault(a => a.Name==input.Flag);
|
||||
if (trackFlagName!=null)
|
||||
{
|
||||
throw new BusinessException(message: "该子系统下标记已存在");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -169,7 +169,7 @@ public class TrackPullService : ApplicationService, ITransientDependency
|
||||
await _trackPullConfigRepository.UpdateAsync(oldTrackPullEntity);
|
||||
await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPullParamsEntity);
|
||||
|
||||
if (oldTrackPullEntity.TrackTemplateId != input.TrackTemplateId)
|
||||
if (trackPullContentEntities.Count > 0)
|
||||
{
|
||||
await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id);
|
||||
await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities);
|
||||
|
||||
@ -93,7 +93,22 @@ public class TrackStatusService : ApplicationService, ITransientDependency
|
||||
if (trackStatusEntitys.Any())
|
||||
{
|
||||
//throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]);
|
||||
throw new BusinessException(message: "当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在");
|
||||
//throw new BusinessException(message: "当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在");
|
||||
var trackStatusCode = trackStatusEntitys.FirstOrDefault(t => t.Code==input.Code);
|
||||
if (trackStatusCode!=null)
|
||||
{
|
||||
throw new BusinessException(message: "该子系统下轨迹状态代码已存在");
|
||||
}
|
||||
var trackStatusName = trackStatusEntitys.FirstOrDefault(t => t.Status==input.TrackStatus);
|
||||
if (trackStatusName!=null)
|
||||
{
|
||||
throw new BusinessException(message: "该子系统下轨迹状态已存在");
|
||||
}
|
||||
var trackStatusEnName = trackStatusEntitys.FirstOrDefault(t => t.EnStatus==input.EntrackStatus);
|
||||
if (trackStatusEnName!=null)
|
||||
{
|
||||
throw new BusinessException(message: "该子系统下轨迹状态英文已存在");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -114,7 +129,22 @@ public class TrackStatusService : ApplicationService, ITransientDependency
|
||||
if (trackStatusEntitys.Any())
|
||||
{
|
||||
//throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]);
|
||||
throw new BusinessException(message: "当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在");
|
||||
//throw new BusinessException(message: "当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在");
|
||||
var trackStatusCode = trackStatusEntitys.FirstOrDefault(t => t.Code==input.Code);
|
||||
if (trackStatusCode!=null)
|
||||
{
|
||||
throw new BusinessException(message: "该子系统下轨迹状态代码已存在");
|
||||
}
|
||||
var trackStatusName = trackStatusEntitys.FirstOrDefault(t => t.Status==input.TrackStatus);
|
||||
if (trackStatusName!=null)
|
||||
{
|
||||
throw new BusinessException(message: "该子系统下轨迹状态已存在");
|
||||
}
|
||||
var trackStatusEnName = trackStatusEntitys.FirstOrDefault(t => t.EnStatus==input.EntrackStatus);
|
||||
if (trackStatusEnName!=null)
|
||||
{
|
||||
throw new BusinessException(message: "该子系统下轨迹状态英文已存在");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -96,13 +96,24 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
|
||||
#region 业务校验
|
||||
|
||||
//校验模版代码唯一性
|
||||
var templateEntity =
|
||||
await _trackTemplateRepository.GetFirstAsync(
|
||||
a => a.SubSystemId == input.SubSystemId && a.Code == input.Code);
|
||||
if (templateEntity != null)
|
||||
//var templateEntity =
|
||||
// await _trackTemplateRepository.GetFirstAsync(
|
||||
// a => a.SubSystemId == input.SubSystemId && a.Code == input.Code);
|
||||
var templateEntitys = await _trackTemplateRepository.GetListAsync(a => a.SubSystemId == input.SubSystemId && (a.Code == input.Code|| a.Name==input.Name));
|
||||
if (templateEntitys.Any())
|
||||
{
|
||||
//throw new BusinessException(message: _stringLocalizer["TemplateExist"]);
|
||||
throw new BusinessException(message: "模板代码已存在于当前选择的子系统下");
|
||||
//throw new BusinessException(message: "模板代码已存在于当前选择的子系统下");
|
||||
var trackTemplateCode = templateEntitys.FirstOrDefault(t => t.Code==input.Code);
|
||||
if (trackTemplateCode!=null)
|
||||
{
|
||||
throw new BusinessException(message: "该子系统下模板代码已存在");
|
||||
}
|
||||
var trackTemplateName = templateEntitys.FirstOrDefault(t => t.Name==input.Name);
|
||||
if (trackTemplateName!=null)
|
||||
{
|
||||
throw new BusinessException(message: "该子系统下模板名称已存在");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion 业务校验
|
||||
@ -117,11 +128,21 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
|
||||
{
|
||||
#region 业务校验
|
||||
|
||||
var isExist = await _trackTemplateRepository.GetFirstAsync(a =>
|
||||
a.Id != input.Id && a.SubSystemId == input.SubSystemId && a.Code == input.Code);
|
||||
if (isExist != null)
|
||||
var templateEntitys = await _trackTemplateRepository.GetListAsync(a =>
|
||||
a.Id != input.Id && a.SubSystemId == input.SubSystemId && (a.Code == input.Code || a.Name==input.Name));
|
||||
if (templateEntitys.Any())
|
||||
{
|
||||
throw new BusinessException(message: "模板代码已存在于当前选择的子系统下");
|
||||
//throw new BusinessException(message: "模板代码已存在于当前选择的子系统下");
|
||||
var trackTemplateCode = templateEntitys.FirstOrDefault(t => t.Code==input.Code);
|
||||
if (trackTemplateCode!=null)
|
||||
{
|
||||
throw new BusinessException(message: "该子系统下模板代码已存在");
|
||||
}
|
||||
var trackTemplateName = templateEntitys.FirstOrDefault(t => t.Name==input.Name);
|
||||
if (trackTemplateName!=null)
|
||||
{
|
||||
throw new BusinessException(message: "该子系统下模板名称已存在");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion 业务校验
|
||||
|
||||
@ -12,7 +12,7 @@ public class EditTrackContentMapInputValidation : AbstractValidator<EditTrackCon
|
||||
{
|
||||
RuleFor(x => x.Options).IsInEnum().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum, nameof(EditTrackContentMapInput.Options)]);
|
||||
|
||||
//RuleFor(x => x.Id).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackContentMapInput.Id), 0]);
|
||||
RuleFor(x => x.Id).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackContentMapInput.Id), 0]);
|
||||
|
||||
RuleFor(x => x.MapSubSystemId).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackContentMapInput.MapSubSystemId), 0]);
|
||||
|
||||
@ -22,10 +22,10 @@ public class EditTrackContentMapInputValidation : AbstractValidator<EditTrackCon
|
||||
|
||||
RuleFor(x => x.TrackContentId).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackContentMapInput.TrackContentId), 0]);
|
||||
|
||||
//When(x => x.Options != OptionTypeNoNull.新增, () =>
|
||||
//{
|
||||
// RuleFor(x => x.Id).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackContentMapInput.Id)]);
|
||||
//});
|
||||
When(x => x.Options != OptionTypeNoNull.新增, () =>
|
||||
{
|
||||
RuleFor(x => x.Id).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackContentMapInput.Id)]);
|
||||
});
|
||||
|
||||
When(x => x.Options != OptionTypeNoNull.删除, () =>
|
||||
{
|
||||
|
||||
@ -16,7 +16,8 @@ public class EditTrackPullConfigInputValidation : AbstractValidator<EditTrackPul
|
||||
|
||||
RuleFor(x => x.ParseMethod).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackPullConfigInput.ParseMethod), 0]);
|
||||
|
||||
RuleFor(x => x.PullInterval).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackPullConfigInput.PullInterval), 0]);
|
||||
RuleFor(x => x.PullInterval)
|
||||
.GreaterThanOrEqualTo(30).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThanOrEqualTo, nameof(EditTrackPullConfigInput.PullInterval), 30]);
|
||||
|
||||
RuleFor(x => x.SubSystemId).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackPullConfigInput.SubSystemId), 0]);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user