Merge branch 'S01-轨迹中台' into dev
This commit is contained in:
commit
92ee6be804
@ -8,6 +8,7 @@ using SJZY.Track.Application.Localization;
|
|||||||
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
|
||||||
using SJZY.Track.Domain.Dtos.TrackContents;
|
using SJZY.Track.Domain.Dtos.TrackContents;
|
||||||
|
using SJZY.Track.Domain.Queries;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using Volo.Abp.DependencyInjection;
|
using Volo.Abp.DependencyInjection;
|
||||||
|
|
||||||
@ -22,15 +23,17 @@ namespace SJZY.Track.Application.Services.TrackContents
|
|||||||
{
|
{
|
||||||
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
|
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
|
||||||
private readonly ITrackContentRepository _trackContentRepository;
|
private readonly ITrackContentRepository _trackContentRepository;
|
||||||
|
private readonly IBasicQuery<TrackContentMapEntity> _trackContentMapBasicQuery;
|
||||||
|
|
||||||
public TrackContentService(
|
public TrackContentService(
|
||||||
IStringLocalizer<TrackLocalizationResource> stringLocalizer,
|
IStringLocalizer<TrackLocalizationResource> stringLocalizer,
|
||||||
ITrackContentRepository trackContentRepository
|
ITrackContentRepository trackContentRepository,
|
||||||
|
IBasicQuery<TrackContentMapEntity> trackContentMapBasicQuery
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this._stringLocalizer = stringLocalizer;
|
this._stringLocalizer = stringLocalizer;
|
||||||
this._trackContentRepository = trackContentRepository;
|
this._trackContentRepository = trackContentRepository;
|
||||||
|
this._trackContentMapBasicQuery=trackContentMapBasicQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -99,7 +102,6 @@ namespace SJZY.Track.Application.Services.TrackContents
|
|||||||
//throw new BusinessException(message: _stringLocalizer["TrackContentExist"]);
|
//throw new BusinessException(message: _stringLocalizer["TrackContentExist"]);
|
||||||
throw new BusinessException(message: "当前子系统下,轨迹代码或轨迹内容或轨迹内容英文存在");
|
throw new BusinessException(message: "当前子系统下,轨迹代码或轨迹内容或轨迹内容英文存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion 业务逻辑校验
|
#endregion 业务逻辑校验
|
||||||
|
|
||||||
var entity = ObjectMapper.Map<EditTrackContentInput, TrackContentEntity>(input);
|
var entity = ObjectMapper.Map<EditTrackContentInput, TrackContentEntity>(input);
|
||||||
@ -111,7 +113,6 @@ namespace SJZY.Track.Application.Services.TrackContents
|
|||||||
private async Task<UnifyResultDto> UpdateAsync(EditTrackContentInput input)
|
private async Task<UnifyResultDto> UpdateAsync(EditTrackContentInput input)
|
||||||
{
|
{
|
||||||
#region 业务逻辑校验
|
#region 业务逻辑校验
|
||||||
|
|
||||||
var trackContentEntitys = await _trackContentRepository.GetListAsync(a => a.Id != input.Id &&
|
var trackContentEntitys = await _trackContentRepository.GetListAsync(a => a.Id != input.Id &&
|
||||||
a.SubSystemId == input.SubSystemId && (a.Code == input.Code ||
|
a.SubSystemId == input.SubSystemId && (a.Code == input.Code ||
|
||||||
a.Content == input.Content || a.EnContent == input.EnContent));
|
a.Content == input.Content || a.EnContent == input.EnContent));
|
||||||
@ -161,7 +162,11 @@ namespace SJZY.Track.Application.Services.TrackContents
|
|||||||
#region 业务校验
|
#region 业务校验
|
||||||
|
|
||||||
//需要加个判断,存在内容映射,则出提示
|
//需要加个判断,存在内容映射,则出提示
|
||||||
|
var trackContentMapEntities = await _trackContentMapBasicQuery.GetListAsync(a => a.TrackContentId==input.Id|| a.MapTrackContentId==input.Id);
|
||||||
|
if (trackContentMapEntities.Any())
|
||||||
|
{
|
||||||
|
throw new BusinessException(message: "无法删除该内容,该轨迹内容已在轨迹内容映射中使用了,请检查");
|
||||||
|
}
|
||||||
#endregion 业务校验
|
#endregion 业务校验
|
||||||
|
|
||||||
var isTrue = await _trackContentRepository.SoftDeleteAsync(x => x.Id == input.Id);
|
var isTrue = await _trackContentRepository.SoftDeleteAsync(x => x.Id == input.Id);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user