修改问题和提示语
This commit is contained in:
parent
e7b80fb1fd
commit
9d8cdadc9c
@ -209,20 +209,25 @@ 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)
|
||||||
{
|
{
|
||||||
Expression<Func<TrackPullContentConfigEntity, bool>> isContentAnyExp = x => x.Id != input.Id && x.TrackPullConfigId == input.TrackPullConfigId;
|
var isContentAnyExp = Expressionable.Create<TrackPullContentConfigEntity>()
|
||||||
|
.And(x => x.Id != input.Id && x.TrackPullConfigId == input.TrackPullConfigId);
|
||||||
|
|
||||||
var trackKeywordExp = Expressionable.Create<TrackPullContentConfigEntity>()
|
if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentId == input.TrackContentId).ToExpression()))
|
||||||
.And(x => x.TrackContentId == input.TrackContentId
|
|
||||||
|| (input.TrackContentCodeValue != null && x.TrackContentCodeValue == input.TrackContentCodeValue)
|
|
||||||
|| (input.TrackStatusValue != null && x.TrackStatusValue == input.TrackStatusValue)
|
|
||||||
|| (input.TrackContentValue != null && x.TrackContentValue == input.TrackContentValue));
|
|
||||||
|
|
||||||
input.TrackKeywords?.ForEach(item => { trackKeywordExp.Or(x => SqlFunc.SplitIn(x.TrackKeyword, item)); });
|
|
||||||
|
|
||||||
isContentAnyExp = isContentAnyExp.And(trackKeywordExp.ToExpression());
|
|
||||||
|
|
||||||
if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp))
|
|
||||||
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentAny"]);
|
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentAny"]);
|
||||||
|
else if (!input.TrackContentCodeValue.IsNullOrWhiteSpace() && await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentCodeValue == input.TrackContentCodeValue).ToExpression()))
|
||||||
|
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentCodeValueAny"]);
|
||||||
|
else if (!input.TrackStatusValue.IsNullOrWhiteSpace() && await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackStatusValue == input.TrackStatusValue).ToExpression()))
|
||||||
|
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentStatusValueAny"]);
|
||||||
|
else if (!input.TrackContentValue.IsNullOrWhiteSpace() && await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentValue == input.TrackContentValue).ToExpression()))
|
||||||
|
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentValueAny"]);
|
||||||
|
else if (!input.TrackKeywords.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
var trackKeywordExp = Expressionable.Create<TrackPullContentConfigEntity>();
|
||||||
|
input.TrackKeywords!.ForEach(item => { trackKeywordExp.Or(x => SqlFunc.SplitIn(x.TrackKeyword, item)); });
|
||||||
|
|
||||||
|
if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(trackKeywordExp.ToExpression()).ToExpression()))
|
||||||
|
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentKeywordsAny"]);
|
||||||
|
}
|
||||||
|
|
||||||
var oldTrackPullContentEntity = await _trackPullConfigRepository.GetContentByIdAsync(input.Id) ??
|
var oldTrackPullContentEntity = await _trackPullConfigRepository.GetContentByIdAsync(input.Id) ??
|
||||||
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
||||||
|
|||||||
@ -111,7 +111,7 @@ public class TrackPushService : ApplicationService, ITransientDependency
|
|||||||
if (input.Options == OptionTypeNoNull.修改) isAnyExp = isAnyExp.And(x => x.Id != input.Id);
|
if (input.Options == OptionTypeNoNull.修改) isAnyExp = isAnyExp.And(x => x.Id != input.Id);
|
||||||
|
|
||||||
var trackTemplateIdExp = Expressionable.Create<TrackPushConfigEntity>();
|
var trackTemplateIdExp = Expressionable.Create<TrackPushConfigEntity>();
|
||||||
foreach (var trackTemplateId in input.TrackTemplateIds) { trackTemplateIdExp.Or(x => SqlFunc.SplitIn(x.TrackTemplateId, trackTemplateId.ToString())); }
|
input.TrackTemplateIds?.ForEach(item => { trackTemplateIdExp.Or(x => SqlFunc.SplitIn(x.TrackTemplateId, item.ToString())); });
|
||||||
|
|
||||||
isAnyExp = isAnyExp.And(trackTemplateIdExp.ToExpression());
|
isAnyExp = isAnyExp.And(trackTemplateIdExp.ToExpression());
|
||||||
|
|
||||||
@ -202,17 +202,20 @@ public class TrackPushService : ApplicationService, ITransientDependency
|
|||||||
{
|
{
|
||||||
if (input.Options != OptionTypeNoNull.删除)
|
if (input.Options != OptionTypeNoNull.删除)
|
||||||
{
|
{
|
||||||
Expression<Func<TrackPushContentConfigEntity, bool>> isContentAnyExp = x =>
|
var isContentAnyExp = Expressionable.Create<TrackPushContentConfigEntity>()
|
||||||
x.TrackPushConfigId == input.TrackPushConfigId
|
.And(x => x.TrackPushConfigId == input.TrackPushConfigId);
|
||||||
&& (x.TrackContentId == input.TrackContentId
|
if (input.Options == OptionTypeNoNull.修改) isContentAnyExp.And(x => x.Id != input.Id);
|
||||||
|| (input.TrackContentCodeValue != null && x.TrackContentCodeValue == input.TrackContentCodeValue)
|
|
||||||
|| (input.TrackStatusValue != null && x.TrackStatusValue == input.TrackStatusValue)
|
|
||||||
|| (input.TrackContentValue != null && x.TrackContentValue == input.TrackContentValue)
|
|
||||||
|| (input.TrackEnContentValue != null && x.TrackEnContentValue == input.TrackEnContentValue));
|
|
||||||
if (input.Options == OptionTypeNoNull.修改) isContentAnyExp = isContentAnyExp.And(x => x.Id != input.Id);
|
|
||||||
|
|
||||||
if (await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp))
|
if (await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentId == input.TrackContentId).ToExpression()))
|
||||||
throw new BusinessException(message: _stringLocalizer["IsTrackPushContentAny"]);
|
throw new BusinessException(message: _stringLocalizer["IsTrackPushContentAny"]);
|
||||||
|
else if (!input.TrackContentCodeValue.IsNullOrWhiteSpace() && await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentCodeValue == input.TrackContentCodeValue).ToExpression()))
|
||||||
|
throw new BusinessException(message: _stringLocalizer["IsTrackPushContentCodeValueAny"]);
|
||||||
|
else if (!input.TrackStatusValue.IsNullOrWhiteSpace() && await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackStatusValue == input.TrackStatusValue).ToExpression()))
|
||||||
|
throw new BusinessException(message: _stringLocalizer["IsTrackPushContentStatusValueAny"]);
|
||||||
|
else if (!input.TrackContentValue.IsNullOrWhiteSpace() && await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentValue == input.TrackContentValue).ToExpression()))
|
||||||
|
throw new BusinessException(message: _stringLocalizer["IsTrackPushContentValueAny"]);
|
||||||
|
else if (!input.TrackEnContentValue.IsNullOrWhiteSpace() && await _trackPushConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackEnContentValue == input.TrackEnContentValue).ToExpression()))
|
||||||
|
throw new BusinessException(message: _stringLocalizer["IsTrackPushEnContentValueAny"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (input.Options)
|
switch (input.Options)
|
||||||
|
|||||||
@ -47,7 +47,7 @@ public class GetTrackPushContentDetailOutputVO
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹推送配置id
|
/// 轨迹推送配置id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int TrackPullConfigId { get; set; }
|
public int TrackPushConfigId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 推送轨迹状态
|
/// 推送轨迹状态
|
||||||
|
|||||||
@ -11,4 +11,9 @@ public enum EnumPropertyEnums
|
|||||||
/// 节点
|
/// 节点
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Description("ServiceNode")] 节点,
|
[Description("ServiceNode")] 节点,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 单号类型
|
||||||
|
/// </summary>
|
||||||
|
[Description("TrackOrderType")] 单号类型
|
||||||
}
|
}
|
||||||
@ -1,9 +1,11 @@
|
|||||||
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
using SJZY.Expand.ABP.Core.PublicMethords;
|
||||||
|
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
||||||
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.TrackPush;
|
using SJZY.Track.Domain.Dtos.TrackPush;
|
||||||
|
using SJZY.Track.Domain.Enums;
|
||||||
using SJZY.Track.Domain.VEntities;
|
using SJZY.Track.Domain.VEntities;
|
||||||
using SJZY.Track.Repository.VData.Entitys;
|
using SJZY.Track.Repository.VData.Entitys;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
@ -44,12 +46,14 @@ public class TrackPushConfigRepository : BasicRepository<TrackPushConfigEntity>,
|
|||||||
{
|
{
|
||||||
return await Context.Queryable<TrackPushContentConfigEntity>()
|
return await Context.Queryable<TrackPushContentConfigEntity>()
|
||||||
.InnerJoin<TrackContentEntity>((pushContent, trackContent) => pushContent.TrackContentId == trackContent.Id)
|
.InnerJoin<TrackContentEntity>((pushContent, trackContent) => pushContent.TrackContentId == trackContent.Id)
|
||||||
|
.LeftJoin<VEnumValueInfoEntity>((pushContent, trackContent, enumValue) => enumValue.Property == EnumPropertyEnums.单号类型.GetDescription() && pushContent.OrderNoType == enumValue.Enumkey && !enumValue.IsDeleted)
|
||||||
.Where(pushContent => pushContent.TrackPushConfigId == input.TrackPushConfigId)
|
.Where(pushContent => pushContent.TrackPushConfigId == input.TrackPushConfigId)
|
||||||
.OrderBy((pushContent, trackContent) => pushContent.Sort)
|
.OrderBy(pushContent => pushContent.Sort)
|
||||||
.Select((pushContent, trackContent) => new GetTrackPushContentPageOutputVO
|
.Select((pushContent, trackContent, enumValue) => new GetTrackPushContentPageOutputVO
|
||||||
{
|
{
|
||||||
Id = pushContent.Id,
|
Id = pushContent.Id,
|
||||||
Sort = pushContent.Sort
|
Sort = pushContent.Sort,
|
||||||
|
OrderNoType = enumValue.Disp
|
||||||
}, true)
|
}, true)
|
||||||
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user