Merge pull request 'S02-轨迹中台' (#56) from S02-轨迹中台 into dev
Reviewed-on: http://192.168.80.50:3000/Dotnet/SJZY.Track.Api/pulls/56
This commit is contained in:
commit
1c720a8ead
@ -59,11 +59,6 @@ public class EditTrackPullConfigInput
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string? TrackStatusName { get; set; }
|
public string? TrackStatusName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 轨迹模板id
|
|
||||||
/// </summary>
|
|
||||||
public int? TrackTemplateId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 拉取轨迹发生时间
|
/// 拉取轨迹发生时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -1,8 +1,13 @@
|
|||||||
namespace SJZY.Track.Application.Contract.Dtos.TrackPull;
|
namespace SJZY.Track.Application.Contract.Dtos.TrackPull;
|
||||||
|
|
||||||
public class UpdateTrackPullContentInput
|
public class EditTrackPullContentInput
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
/// <summary>
|
||||||
|
/// 操作类型
|
||||||
|
/// </summary>
|
||||||
|
public OptionTypeNoNull Options { get; set; }
|
||||||
|
|
||||||
|
public int? Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 服务商轨迹代码参数值
|
/// 服务商轨迹代码参数值
|
||||||
@ -12,7 +17,7 @@ public class UpdateTrackPullContentInput
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹内容id
|
/// 轨迹内容id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int TrackContentId { get; set; }
|
public int? TrackContentId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 服务商轨迹内容参数值
|
/// 服务商轨迹内容参数值
|
||||||
@ -37,7 +42,7 @@ public class UpdateTrackPullContentInput
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹拉取配置id
|
/// 轨迹拉取配置id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int TrackPullConfigId { get; set; }
|
public int? TrackPullConfigId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 服务商轨迹状态参数值
|
/// 服务商轨迹状态参数值
|
||||||
@ -5,7 +5,7 @@ public class EditTrackPushConfigInput
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 客户id
|
/// 客户id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int CustomId { get; set; }
|
public int? CustomId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 推送扩展字段
|
/// 推送扩展字段
|
||||||
@ -17,7 +17,7 @@ public class EditTrackPushConfigInput
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否自动推送
|
/// 是否自动推送
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsAutoPush { get; set; }
|
public bool? IsAutoPush { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 操作类型
|
/// 操作类型
|
||||||
@ -32,12 +32,12 @@ public class EditTrackPushConfigInput
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 服务商id
|
/// 服务商id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int ServiceProviderId { get; set; }
|
public int? ServiceProviderId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 子系统id
|
/// 子系统id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int SubSystemId { get; set; }
|
public int? SubSystemId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 推送轨迹时区
|
/// 推送轨迹时区
|
||||||
@ -69,13 +69,18 @@ public class EditTrackPushConfigInput
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string? TrackStatusName { get; set; }
|
public string? TrackStatusName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 轨迹模板id
|
|
||||||
/// </summary>
|
|
||||||
public List<int>? TrackTemplateIds { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 推送轨迹发生时间
|
/// 推送轨迹发生时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? TrackTimeName { get; set; }
|
public string? TrackTimeName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否支持更新
|
||||||
|
/// </summary>
|
||||||
|
public bool? IsCanUpdate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否支持删除
|
||||||
|
/// </summary>
|
||||||
|
public bool? IsCanDelete { get; set; }
|
||||||
}
|
}
|
||||||
@ -12,7 +12,7 @@ public class TrackPullAutoMapperProfile : Profile
|
|||||||
CreateMap<EditTrackPullConfigInput, TrackPullConfigEntity>(MemberList.None);
|
CreateMap<EditTrackPullConfigInput, TrackPullConfigEntity>(MemberList.None);
|
||||||
CreateMap<EditTrackPullConfigInput, TrackPushPullParamsConfigEntity>(MemberList.None).Ignore(dest => dest.Id)
|
CreateMap<EditTrackPullConfigInput, TrackPushPullParamsConfigEntity>(MemberList.None).Ignore(dest => dest.Id)
|
||||||
.ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => false));
|
.ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => false));
|
||||||
CreateMap<UpdateTrackPullContentInput, TrackPullContentConfigEntity>(MemberList.None)
|
CreateMap<EditTrackPullContentInput, TrackPullContentConfigEntity>(MemberList.None)
|
||||||
.ForMember(dest => dest.TrackKeyword, opt => opt.MapFrom(src => string.Join(',', src.TrackKeywords)))
|
.ForMember(dest => dest.TrackKeyword, opt => opt.MapFrom(src => string.Join(',', src.TrackKeywords)))
|
||||||
.ForMember(dest => dest.TrackKeywordReverse, opt => opt.MapFrom(src => string.Join(',', src.TrackKeywordReverses)));
|
.ForMember(dest => dest.TrackKeywordReverse, opt => opt.MapFrom(src => string.Join(',', src.TrackKeywordReverses)));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,8 +10,7 @@ public class TrackPushAutoMapperProfile : Profile
|
|||||||
{
|
{
|
||||||
public TrackPushAutoMapperProfile()
|
public TrackPushAutoMapperProfile()
|
||||||
{
|
{
|
||||||
CreateMap<EditTrackPushConfigInput, TrackPushConfigEntity>(MemberList.None)
|
CreateMap<EditTrackPushConfigInput, TrackPushConfigEntity>(MemberList.None);
|
||||||
.ForMember(dest => dest.TrackTemplateId, opt => opt.MapFrom(source => string.Join(',', source.TrackTemplateIds)));
|
|
||||||
CreateMap<EditTrackPushConfigInput, TrackPushPullParamsConfigEntity>(MemberList.None).Ignore(dest => dest.Id)
|
CreateMap<EditTrackPushConfigInput, TrackPushPullParamsConfigEntity>(MemberList.None).Ignore(dest => dest.Id)
|
||||||
.ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => true));
|
.ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => true));
|
||||||
CreateMap<EditTrackPushContentInput, TrackPushContentConfigEntity>(MemberList.None);
|
CreateMap<EditTrackPushContentInput, TrackPushContentConfigEntity>(MemberList.None);
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System.Linq.Expressions;
|
||||||
using System.Linq.Expressions;
|
|
||||||
using Microsoft.Extensions.Localization;
|
using Microsoft.Extensions.Localization;
|
||||||
using SJZY.Expand.ABP.Core.Localization;
|
using SJZY.Expand.ABP.Core.Localization;
|
||||||
using SJZY.Expand.ABP.Core.PublicMethords;
|
using SJZY.Expand.ABP.Core.PublicMethords;
|
||||||
@ -91,8 +90,7 @@ public class TrackPullService : ApplicationService, ITransientDependency
|
|||||||
if (input.Options != OptionTypeNoNull.删除)
|
if (input.Options != OptionTypeNoNull.删除)
|
||||||
{
|
{
|
||||||
Expression<Func<TrackPullConfigEntity, bool>> isAnyExp = x =>
|
Expression<Func<TrackPullConfigEntity, bool>> isAnyExp = x =>
|
||||||
x.SubSystemId == input.SubSystemId && x.TrackTemplateId == input.TrackTemplateId &&
|
x.SubSystemId == input.SubSystemId && x.ServiceProviderId == input.ServiceProviderId;
|
||||||
x.ServiceProviderId == input.ServiceProviderId;
|
|
||||||
if (input.Options == OptionTypeNoNull.修改) isAnyExp = isAnyExp.And(x => x.Id != input.Id);
|
if (input.Options == OptionTypeNoNull.修改) isAnyExp = isAnyExp.And(x => x.Id != input.Id);
|
||||||
|
|
||||||
if (await _trackPullConfigRepository.IsAnyAsync(isAnyExp))
|
if (await _trackPullConfigRepository.IsAnyAsync(isAnyExp))
|
||||||
@ -104,13 +102,7 @@ public class TrackPullService : ApplicationService, ITransientDependency
|
|||||||
case OptionTypeNoNull.新增:
|
case OptionTypeNoNull.新增:
|
||||||
{
|
{
|
||||||
var trackPullEntity = ObjectMapper.Map<EditTrackPullConfigInput, TrackPullConfigEntity>(input);
|
var trackPullEntity = ObjectMapper.Map<EditTrackPullConfigInput, TrackPullConfigEntity>(input);
|
||||||
var trackPullParamsEntity =
|
var trackPullParamsEntity = ObjectMapper.Map<EditTrackPullConfigInput, TrackPushPullParamsConfigEntity>(input);
|
||||||
ObjectMapper.Map<EditTrackPullConfigInput, TrackPushPullParamsConfigEntity>(input);
|
|
||||||
|
|
||||||
var trackTemplateContentEntities =
|
|
||||||
await _trackTemplateRepository.GetContentListAsync(x => x.TrackTemplateId == input.TrackTemplateId);
|
|
||||||
|
|
||||||
var trackPullContentEntities = new List<TrackPullContentConfigEntity>();
|
|
||||||
|
|
||||||
using (var ts = TransactionScopeHelper.Create())
|
using (var ts = TransactionScopeHelper.Create())
|
||||||
{
|
{
|
||||||
@ -119,17 +111,6 @@ public class TrackPullService : ApplicationService, ITransientDependency
|
|||||||
trackPullParamsEntity.PullOrPushConfigId = id;
|
trackPullParamsEntity.PullOrPushConfigId = id;
|
||||||
await _trackPullConfigRepository.InsertParamsAsync(trackPullParamsEntity);
|
await _trackPullConfigRepository.InsertParamsAsync(trackPullParamsEntity);
|
||||||
|
|
||||||
foreach (var item in trackTemplateContentEntities)
|
|
||||||
{
|
|
||||||
trackPullContentEntities.Add(new()
|
|
||||||
{
|
|
||||||
TrackPullConfigId = id,
|
|
||||||
TrackContentId = item.TrackContentId
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities);
|
|
||||||
|
|
||||||
ts.Complete();
|
ts.Complete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -137,30 +118,9 @@ public class TrackPullService : ApplicationService, ITransientDependency
|
|||||||
|
|
||||||
case OptionTypeNoNull.修改:
|
case OptionTypeNoNull.修改:
|
||||||
{
|
{
|
||||||
var oldTrackPullEntity = await _trackPullConfigRepository.GetFirstAsync(x => x.Id == input.Id) ??
|
var oldTrackPullEntity = await _trackPullConfigRepository.GetFirstAsync(x => x.Id == input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
||||||
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
|
||||||
|
|
||||||
var oldTrackPullParamsEntity =
|
var oldTrackPullParamsEntity = await _trackPullConfigRepository.GetParamsSingleAsync(x => x.PullOrPushConfigId == input.Id && !x.IsPush);
|
||||||
await _trackPullConfigRepository.GetParamsSingleAsync(x =>
|
|
||||||
x.PullOrPushConfigId == input.Id && !x.IsPush);
|
|
||||||
|
|
||||||
var trackPullContentEntities = new List<TrackPullContentConfigEntity>();
|
|
||||||
|
|
||||||
if (oldTrackPullEntity.TrackTemplateId != input.TrackTemplateId)
|
|
||||||
{
|
|
||||||
var trackTemplateContentEntities =
|
|
||||||
await _trackTemplateRepository.GetContentListAsync(x =>
|
|
||||||
x.TrackTemplateId == input.TrackTemplateId);
|
|
||||||
|
|
||||||
foreach (var item in trackTemplateContentEntities)
|
|
||||||
{
|
|
||||||
trackPullContentEntities.Add(new()
|
|
||||||
{
|
|
||||||
TrackPullConfigId = oldTrackPullEntity.Id,
|
|
||||||
TrackContentId = item.TrackContentId
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ObjectMapper.Map(input, oldTrackPullEntity);
|
ObjectMapper.Map(input, oldTrackPullEntity);
|
||||||
ObjectMapper.Map(input, oldTrackPullParamsEntity);
|
ObjectMapper.Map(input, oldTrackPullParamsEntity);
|
||||||
@ -170,12 +130,6 @@ public class TrackPullService : ApplicationService, ITransientDependency
|
|||||||
await _trackPullConfigRepository.UpdateAsync(oldTrackPullEntity);
|
await _trackPullConfigRepository.UpdateAsync(oldTrackPullEntity);
|
||||||
await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPullParamsEntity);
|
await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPullParamsEntity);
|
||||||
|
|
||||||
if (trackPullContentEntities.Count > 0)
|
|
||||||
{
|
|
||||||
await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id);
|
|
||||||
await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities);
|
|
||||||
}
|
|
||||||
|
|
||||||
ts.Complete();
|
ts.Complete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -185,8 +139,7 @@ public class TrackPullService : ApplicationService, ITransientDependency
|
|||||||
using (var ts = TransactionScopeHelper.Create())
|
using (var ts = TransactionScopeHelper.Create())
|
||||||
{
|
{
|
||||||
await _trackPullConfigRepository.SoftDeleteAsync(x => x.Id == input.Id);
|
await _trackPullConfigRepository.SoftDeleteAsync(x => x.Id == input.Id);
|
||||||
await _trackPullConfigRepository.SoftDeleteParamsAsync(x =>
|
await _trackPullConfigRepository.SoftDeleteParamsAsync(x => x.PullOrPushConfigId == input.Id && !x.IsPush);
|
||||||
x.PullOrPushConfigId == input.Id && !x.IsPush);
|
|
||||||
await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id);
|
await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id);
|
||||||
|
|
||||||
ts.Complete();
|
ts.Complete();
|
||||||
@ -207,34 +160,65 @@ public class TrackPullService : ApplicationService, ITransientDependency
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("UpdateContent")]
|
[HttpPost("EditContent")]
|
||||||
public async Task<bool> UpdateContentAsync([FromBody] UpdateTrackPullContentInput input)
|
public async Task<bool> UpdateContentAsync([FromBody] EditTrackPullContentInput input)
|
||||||
{
|
{
|
||||||
Expression<Func<TrackPullContentConfigEntity, bool>> isContentAnyExp = x => x.Id != input.Id && x.TrackPullConfigId == input.TrackPullConfigId;
|
if (input.Options != OptionTypeNoNull.删除)
|
||||||
|
|
||||||
if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentId == input.TrackContentId)))
|
|
||||||
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentAny"]);
|
|
||||||
else if (!input.TrackContentCodeValue.IsNullOrWhiteSpace() && await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentCodeValue == input.TrackContentCodeValue)))
|
|
||||||
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentCodeValueAny"]);
|
|
||||||
else if (!input.TrackStatusValue.IsNullOrWhiteSpace() && await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackStatusValue == input.TrackStatusValue)))
|
|
||||||
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentStatusValueAny"]);
|
|
||||||
else if (!input.TrackContentValue.IsNullOrWhiteSpace() && await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentValue == input.TrackContentValue)))
|
|
||||||
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentValueAny"]);
|
|
||||||
else if (!input.TrackKeywords.IsNullOrEmpty())
|
|
||||||
{
|
{
|
||||||
Expression<Func<TrackPullContentConfigEntity, bool>> trackKeywordExp = _ => false;
|
Expression<Func<TrackPullContentConfigEntity, bool>> isContentAnyExp = x => x.TrackPullConfigId == input.TrackPullConfigId;
|
||||||
input.TrackKeywords!.ForEach(item => { trackKeywordExp = trackKeywordExp.Or(x => SqlFunc.SplitIn(x.TrackKeyword, item)); });
|
if (input.Options == OptionTypeNoNull.修改) isContentAnyExp = isContentAnyExp.And(x => x.Id != input.Id);
|
||||||
|
|
||||||
if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(trackKeywordExp)))
|
if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentId == input.TrackContentId)))
|
||||||
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentKeywordsAny"]);
|
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentAny"]);
|
||||||
|
else if (!input.TrackContentCodeValue.IsNullOrWhiteSpace() && await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentCodeValue == input.TrackContentCodeValue)))
|
||||||
|
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentCodeValueAny"]);
|
||||||
|
else if (!input.TrackStatusValue.IsNullOrWhiteSpace() && await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackStatusValue == input.TrackStatusValue)))
|
||||||
|
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentStatusValueAny"]);
|
||||||
|
else if (!input.TrackContentValue.IsNullOrWhiteSpace() && await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => x.TrackContentValue == input.TrackContentValue)))
|
||||||
|
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentValueAny"]);
|
||||||
|
else if (!input.TrackKeywords.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
Expression<Func<TrackPullContentConfigEntity, bool>> trackKeywordExp = _ => false;
|
||||||
|
input.TrackKeywords!.ForEach(item => { trackKeywordExp = trackKeywordExp.Or(x => SqlFunc.SplitIn(x.TrackKeyword, item)); });
|
||||||
|
|
||||||
|
if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(trackKeywordExp)))
|
||||||
|
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentKeywordsAny"]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var oldTrackPullContentEntity = await _trackPullConfigRepository.GetContentByIdAsync(input.Id) ??
|
switch (input.Options)
|
||||||
|
{
|
||||||
|
case OptionTypeNoNull.新增:
|
||||||
|
{
|
||||||
|
var entity = ObjectMapper.Map<EditTrackPullContentInput, TrackPullContentConfigEntity>(input);
|
||||||
|
|
||||||
|
await _trackPullConfigRepository.InsertContentAsync(entity);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case OptionTypeNoNull.修改:
|
||||||
|
{
|
||||||
|
var oldTrackPullContentEntity = await _trackPullConfigRepository.GetContentByIdAsync(input.Id!.Value) ??
|
||||||
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
||||||
|
|
||||||
ObjectMapper.Map(input, oldTrackPullContentEntity);
|
ObjectMapper.Map(input, oldTrackPullContentEntity);
|
||||||
|
|
||||||
await _trackPullConfigRepository.UpdateContentAsync(oldTrackPullContentEntity);
|
await _trackPullConfigRepository.UpdateContentAsync(oldTrackPullContentEntity);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case OptionTypeNoNull.删除:
|
||||||
|
|
||||||
|
await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.Id == input.Id);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum,
|
||||||
|
nameof(EditTrackPullContentInput.Options)]);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
using Microsoft.Extensions.Localization;
|
using Microsoft.Extensions.Localization;
|
||||||
using SJZY.Expand.ABP.Core;
|
|
||||||
using SJZY.Expand.ABP.Core.Localization;
|
using SJZY.Expand.ABP.Core.Localization;
|
||||||
using SJZY.Expand.ABP.Core.PublicMethords;
|
using SJZY.Expand.ABP.Core.PublicMethords;
|
||||||
using SJZY.Track.Application.Contract.Dtos.TrackPush;
|
using SJZY.Track.Application.Contract.Dtos.TrackPush;
|
||||||
@ -73,16 +72,7 @@ public class TrackPushService : ApplicationService, ITransientDependency
|
|||||||
[HttpGet("GetDetail")]
|
[HttpGet("GetDetail")]
|
||||||
public async Task<GetTrackPushConfigDetailOutputVO> GetDetailAsync(int id)
|
public async Task<GetTrackPushConfigDetailOutputVO> GetDetailAsync(int id)
|
||||||
{
|
{
|
||||||
var res = await _trackPushConfigRepository.GetDetailAsync(id);
|
return await _trackPushConfigRepository.GetDetailAsync(id);
|
||||||
if (res is null) return null;
|
|
||||||
|
|
||||||
List<int> trackTemplateIds = res.TrackTemplateId.Split(',').Select(int.Parse).ToList();
|
|
||||||
|
|
||||||
var trackTemplateEntities = await _trackTemplateRepository.GetListAsync(x => trackTemplateIds.Contains(x.Id));
|
|
||||||
|
|
||||||
trackTemplateEntities.ForEach(item => { (res.TrackTemplate ??= new()).Add(new() { Value = item.Id, Key = item.Name }); });
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -110,13 +100,7 @@ public class TrackPushService : ApplicationService, ITransientDependency
|
|||||||
x.SubSystemId == input.SubSystemId && x.CustomId == input.CustomId && x.ServiceProviderId == input.ServiceProviderId;
|
x.SubSystemId == input.SubSystemId && x.CustomId == input.CustomId && x.ServiceProviderId == input.ServiceProviderId;
|
||||||
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>();
|
if (await _trackPushConfigRepository.IsAnyAsync(isAnyExp)) throw new BusinessException(message: _stringLocalizer["IsTrackPushConfigAny"]);
|
||||||
input.TrackTemplateIds?.ForEach(item => { trackTemplateIdExp.Or(x => SqlFunc.SplitIn(x.TrackTemplateId, item.ToString())); });
|
|
||||||
|
|
||||||
isAnyExp = isAnyExp.And(trackTemplateIdExp.ToExpression());
|
|
||||||
|
|
||||||
if (await _trackPushConfigRepository.IsAnyAsync(isAnyExp))
|
|
||||||
throw new BusinessException(message: _stringLocalizer["IsTrackPushConfigAny"]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (input.Options)
|
switch (input.Options)
|
||||||
@ -133,7 +117,7 @@ public class TrackPushService : ApplicationService, ITransientDependency
|
|||||||
trackPushParamsEntity.PullOrPushConfigId = id;
|
trackPushParamsEntity.PullOrPushConfigId = id;
|
||||||
await _trackPullConfigRepository.InsertParamsAsync(trackPushParamsEntity);
|
await _trackPullConfigRepository.InsertParamsAsync(trackPushParamsEntity);
|
||||||
|
|
||||||
if (input.IsAutoPush) await _trackPushCacheService.IsPushAsync(input.CustomId);
|
if (input.IsAutoPush!.Value) await _trackPushCacheService.IsPushAsync(input.CustomId!.Value);
|
||||||
|
|
||||||
ts.Complete();
|
ts.Complete();
|
||||||
}
|
}
|
||||||
@ -146,9 +130,7 @@ public class TrackPushService : ApplicationService, ITransientDependency
|
|||||||
|
|
||||||
int oldCustomId = oldTrackPushEntity.CustomId;
|
int oldCustomId = oldTrackPushEntity.CustomId;
|
||||||
|
|
||||||
var oldTrackPushParamsEntity =
|
var oldTrackPushParamsEntity = await _trackPullConfigRepository.GetParamsSingleAsync(x => x.PullOrPushConfigId == input.Id && x.IsPush);
|
||||||
await _trackPullConfigRepository.GetParamsSingleAsync(x =>
|
|
||||||
x.PullOrPushConfigId == input.Id && x.IsPush);
|
|
||||||
|
|
||||||
ObjectMapper.Map(input, oldTrackPushEntity);
|
ObjectMapper.Map(input, oldTrackPushEntity);
|
||||||
ObjectMapper.Map(input, oldTrackPushParamsEntity);
|
ObjectMapper.Map(input, oldTrackPushParamsEntity);
|
||||||
@ -159,7 +141,7 @@ public class TrackPushService : ApplicationService, ITransientDependency
|
|||||||
await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPushParamsEntity);
|
await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPushParamsEntity);
|
||||||
|
|
||||||
await _trackPushCacheService.UpdateAsync(oldCustomId, false);
|
await _trackPushCacheService.UpdateAsync(oldCustomId, false);
|
||||||
if (input.IsAutoPush) await _trackPushCacheService.IsPushAsync(input.CustomId);
|
if (input.IsAutoPush!.Value) await _trackPushCacheService.IsPushAsync(input.CustomId!.Value);
|
||||||
|
|
||||||
ts.Complete();
|
ts.Complete();
|
||||||
}
|
}
|
||||||
@ -173,10 +155,8 @@ public class TrackPushService : ApplicationService, ITransientDependency
|
|||||||
using (var ts = TransactionScopeHelper.Create())
|
using (var ts = TransactionScopeHelper.Create())
|
||||||
{
|
{
|
||||||
await _trackPushConfigRepository.SoftDeleteAsync(x => x.Id == input.Id);
|
await _trackPushConfigRepository.SoftDeleteAsync(x => x.Id == input.Id);
|
||||||
await _trackPullConfigRepository.SoftDeleteParamsAsync(x =>
|
await _trackPullConfigRepository.SoftDeleteParamsAsync(x => x.PullOrPushConfigId == input.Id && x.IsPush);
|
||||||
x.PullOrPushConfigId == input.Id && x.IsPush);
|
|
||||||
await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.TrackPushConfigId == input.Id);
|
await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.TrackPushConfigId == input.Id);
|
||||||
|
|
||||||
await _trackPushCacheService.UpdateAsync(oldTrackPushEntity.CustomId, false);
|
await _trackPushCacheService.UpdateAsync(oldTrackPushEntity.CustomId, false);
|
||||||
|
|
||||||
ts.Complete();
|
ts.Complete();
|
||||||
|
|||||||
@ -21,21 +21,15 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
|
|||||||
{
|
{
|
||||||
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
|
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
|
||||||
private readonly ITrackTemplateRepository _trackTemplateRepository;
|
private readonly ITrackTemplateRepository _trackTemplateRepository;
|
||||||
private readonly ITrackPullConfigRepository _trackPullConfigRepository;
|
|
||||||
private readonly ITrackPushConfigRepository _trackPushConfigRepository;
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public TrackTemplateService(
|
public TrackTemplateService(
|
||||||
IStringLocalizer<TrackLocalizationResource> stringLocalizer,
|
IStringLocalizer<TrackLocalizationResource> stringLocalizer,
|
||||||
ITrackTemplateRepository trackTemplateRepository,
|
ITrackTemplateRepository trackTemplateRepository
|
||||||
ITrackPullConfigRepository trackPullConfigRepository,
|
|
||||||
ITrackPushConfigRepository trackPushConfigRepository
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
_stringLocalizer = stringLocalizer;
|
_stringLocalizer = stringLocalizer;
|
||||||
_trackTemplateRepository = trackTemplateRepository;
|
_trackTemplateRepository = trackTemplateRepository;
|
||||||
_trackPullConfigRepository = trackPullConfigRepository;
|
|
||||||
_trackPushConfigRepository = trackPushConfigRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -99,18 +93,18 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
|
|||||||
//var templateEntity =
|
//var templateEntity =
|
||||||
// await _trackTemplateRepository.GetFirstAsync(
|
// await _trackTemplateRepository.GetFirstAsync(
|
||||||
// a => a.SubSystemId == input.SubSystemId && a.Code == input.Code);
|
// 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));
|
var templateEntitys = await _trackTemplateRepository.GetListAsync(a => a.SubSystemId == input.SubSystemId && (a.Code == input.Code || a.Name == input.Name));
|
||||||
if (templateEntitys.Any())
|
if (templateEntitys.Any())
|
||||||
{
|
{
|
||||||
//throw new BusinessException(message: _stringLocalizer["TemplateExist"]);
|
//throw new BusinessException(message: _stringLocalizer["TemplateExist"]);
|
||||||
//throw new BusinessException(message: "模板代码已存在于当前选择的子系统下");
|
//throw new BusinessException(message: "模板代码已存在于当前选择的子系统下");
|
||||||
var trackTemplateCode = templateEntitys.FirstOrDefault(t => t.Code==input.Code);
|
var trackTemplateCode = templateEntitys.FirstOrDefault(t => t.Code == input.Code);
|
||||||
if (trackTemplateCode!=null)
|
if (trackTemplateCode != null)
|
||||||
{
|
{
|
||||||
throw new BusinessException(message: "该子系统下模板代码已存在");
|
throw new BusinessException(message: "该子系统下模板代码已存在");
|
||||||
}
|
}
|
||||||
var trackTemplateName = templateEntitys.FirstOrDefault(t => t.Name==input.Name);
|
var trackTemplateName = templateEntitys.FirstOrDefault(t => t.Name == input.Name);
|
||||||
if (trackTemplateName!=null)
|
if (trackTemplateName != null)
|
||||||
{
|
{
|
||||||
throw new BusinessException(message: "该子系统下模板名称已存在");
|
throw new BusinessException(message: "该子系统下模板名称已存在");
|
||||||
}
|
}
|
||||||
@ -129,17 +123,17 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
|
|||||||
#region 业务校验
|
#region 业务校验
|
||||||
|
|
||||||
var templateEntitys = await _trackTemplateRepository.GetListAsync(a =>
|
var templateEntitys = await _trackTemplateRepository.GetListAsync(a =>
|
||||||
a.Id != input.Id && a.SubSystemId == input.SubSystemId && (a.Code == input.Code || a.Name==input.Name));
|
a.Id != input.Id && a.SubSystemId == input.SubSystemId && (a.Code == input.Code || a.Name == input.Name));
|
||||||
if (templateEntitys.Any())
|
if (templateEntitys.Any())
|
||||||
{
|
{
|
||||||
//throw new BusinessException(message: "模板代码已存在于当前选择的子系统下");
|
//throw new BusinessException(message: "模板代码已存在于当前选择的子系统下");
|
||||||
var trackTemplateCode = templateEntitys.FirstOrDefault(t => t.Code==input.Code);
|
var trackTemplateCode = templateEntitys.FirstOrDefault(t => t.Code == input.Code);
|
||||||
if (trackTemplateCode!=null)
|
if (trackTemplateCode != null)
|
||||||
{
|
{
|
||||||
throw new BusinessException(message: "该子系统下模板代码已存在");
|
throw new BusinessException(message: "该子系统下模板代码已存在");
|
||||||
}
|
}
|
||||||
var trackTemplateName = templateEntitys.FirstOrDefault(t => t.Name==input.Name);
|
var trackTemplateName = templateEntitys.FirstOrDefault(t => t.Name == input.Name);
|
||||||
if (trackTemplateName!=null)
|
if (trackTemplateName != null)
|
||||||
{
|
{
|
||||||
throw new BusinessException(message: "该子系统下模板名称已存在");
|
throw new BusinessException(message: "该子系统下模板名称已存在");
|
||||||
}
|
}
|
||||||
@ -156,24 +150,6 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
|
|||||||
|
|
||||||
private async Task<UnifyResultDto> DeleteAsync(EditTrackTemplateInput input)
|
private async Task<UnifyResultDto> DeleteAsync(EditTrackTemplateInput input)
|
||||||
{
|
{
|
||||||
#region 业务校验
|
|
||||||
|
|
||||||
//查询看看在轨迹拉取里面有没有被占用
|
|
||||||
var isExisistTrackPullConfigs = await _trackPullConfigRepository.GetListAsync(a => a.TrackTemplateId == input.Id);
|
|
||||||
if (isExisistTrackPullConfigs.Any())
|
|
||||||
{
|
|
||||||
//throw new BusinessException(message: _stringLocalizer["IsExistTrackPullConfig"]);
|
|
||||||
throw new BusinessException(message: "该模板存在映射,禁止删除");
|
|
||||||
}
|
|
||||||
//轨迹推送里看看是否被占用
|
|
||||||
var isExisistTrackPushConfigs = await _trackPushConfigRepository.GetListAsync(a => a.TrackTemplateId.Contains(input.Id.ToString()));
|
|
||||||
if (isExisistTrackPushConfigs.Any())
|
|
||||||
{
|
|
||||||
throw new BusinessException(message: "该模板存在映射,禁止删除");
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion 业务校验
|
|
||||||
|
|
||||||
var isTrue = await _trackTemplateRepository.SoftDeleteAsync(x => x.Id == input.Id);
|
var isTrue = await _trackTemplateRepository.SoftDeleteAsync(x => x.Id == input.Id);
|
||||||
|
|
||||||
return new UnifyResultDto("200", "删除成功", isTrue);
|
return new UnifyResultDto("200", "删除成功", isTrue);
|
||||||
@ -204,17 +180,6 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
|
|||||||
return await _trackTemplateRepository.GetContentDetailAsync(id);
|
return await _trackTemplateRepository.GetContentDetailAsync(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 轨迹模板内容下拉框
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost("GetContentDropDownList")]
|
|
||||||
public async Task<UnifyPageResultDto<DropdownListDataDto>> GetContentDropDownListAsync([FromBody] GetTrackTemplateContentDropDownListVO input)
|
|
||||||
{
|
|
||||||
return await _trackTemplateRepository.GetContentDropDownListAsync(input);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹模板内容编辑
|
/// 轨迹模板内容编辑
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -25,8 +25,6 @@ public class EditTrackPullConfigInputValidation : AbstractValidator<EditTrackPul
|
|||||||
|
|
||||||
RuleFor(x => x.SubSystemId).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackPullConfigInput.SubSystemId), 0]);
|
RuleFor(x => x.SubSystemId).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackPullConfigInput.SubSystemId), 0]);
|
||||||
|
|
||||||
RuleFor(x => x.TrackTemplateId).GreaterThan(0).WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_GreaterThan, nameof(EditTrackPullConfigInput.TrackTemplateId), 0]);
|
|
||||||
|
|
||||||
When(x => x.Options != OptionTypeNoNull.新增, () =>
|
When(x => x.Options != OptionTypeNoNull.新增, () =>
|
||||||
{
|
{
|
||||||
RuleFor(x => x.Id).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackPullConfigInput.Id)]);
|
RuleFor(x => x.Id).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackPullConfigInput.Id)]);
|
||||||
@ -38,8 +36,6 @@ public class EditTrackPullConfigInputValidation : AbstractValidator<EditTrackPul
|
|||||||
|
|
||||||
RuleFor(x => x.ServiceProviderId).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackPullConfigInput.ServiceProviderId)]);
|
RuleFor(x => x.ServiceProviderId).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackPullConfigInput.ServiceProviderId)]);
|
||||||
|
|
||||||
RuleFor(x => x.TrackTemplateId).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackPullConfigInput.TrackTemplateId)]);
|
|
||||||
|
|
||||||
RuleFor(x => x.PullInterval).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackPullConfigInput.PullInterval)]);
|
RuleFor(x => x.PullInterval).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackPullConfigInput.PullInterval)]);
|
||||||
|
|
||||||
RuleFor(x => x.ParseMethod).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackPullConfigInput.ParseMethod)]);
|
RuleFor(x => x.ParseMethod).NotNull().WithMessage(stringLocalizer[SjzyBasicLocalization.Validation_NotNull, nameof(EditTrackPullConfigInput.ParseMethod)]);
|
||||||
|
|||||||
@ -35,7 +35,7 @@ public interface ITrackPullConfigRepository : IBasicRepository<TrackPullConfigEn
|
|||||||
|
|
||||||
Task<bool> InsertParamsAsync(TrackPushPullParamsConfigEntity insertObj);
|
Task<bool> InsertParamsAsync(TrackPushPullParamsConfigEntity insertObj);
|
||||||
|
|
||||||
Task<bool> InsertContentRangeAsync(List<TrackPullContentConfigEntity> insertObjs);
|
Task<bool> InsertContentAsync(TrackPullContentConfigEntity insertObj);
|
||||||
|
|
||||||
Task<TrackPushPullParamsConfigEntity> GetParamsSingleAsync(Expression<Func<TrackPushPullParamsConfigEntity, bool>> whereExpression);
|
Task<TrackPushPullParamsConfigEntity> GetParamsSingleAsync(Expression<Func<TrackPushPullParamsConfigEntity, bool>> whereExpression);
|
||||||
|
|
||||||
|
|||||||
@ -35,10 +35,4 @@ public class TrackPullConfigEntity : IFullAuditedBasicEntitys, IAggregateRoot
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnName = "SubSystemId")]
|
[SugarColumn(ColumnName = "SubSystemId")]
|
||||||
public int SubSystemId { get; set; }
|
public int SubSystemId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 模板id
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnName = "TrackTemplateId")]
|
|
||||||
public int TrackTemplateId { get; set; }
|
|
||||||
}
|
}
|
||||||
@ -37,8 +37,14 @@ public class TrackPushConfigEntity : IFullAuditedBasicEntitys, IAggregateRoot
|
|||||||
public int SubSystemId { get; set; }
|
public int SubSystemId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 模板id(多个之间英文逗号分隔)
|
/// 是否支持更新
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnName = "TrackTemplateId")]
|
[SugarColumn(ColumnName = "IsCanUpdate")]
|
||||||
public string TrackTemplateId { get; set; }
|
public bool IsCanUpdate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否支持删除
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "IsCanDelete")]
|
||||||
|
public bool IsCanDelete { get; set; }
|
||||||
}
|
}
|
||||||
@ -39,8 +39,6 @@ public interface ITrackTemplateRepository : IBasicRepository<TrackTemplateEntity
|
|||||||
|
|
||||||
Task<bool> UpdateContentRangeAsync(List<TrackTemplateContentEntity> updateObjs);
|
Task<bool> UpdateContentRangeAsync(List<TrackTemplateContentEntity> updateObjs);
|
||||||
|
|
||||||
Task<UnifyPageResultDto<DropdownListDataDto>> GetContentDropDownListAsync(GetTrackTemplateContentDropDownListVO input);
|
|
||||||
|
|
||||||
Task<T> ContentMaxAsync<T>(Expression<Func<TrackTemplateContentEntity, T>> columns, Expression<Func<TrackTemplateContentEntity, bool>> whereExpression);
|
Task<T> ContentMaxAsync<T>(Expression<Func<TrackTemplateContentEntity, T>> columns, Expression<Func<TrackTemplateContentEntity, bool>> whereExpression);
|
||||||
|
|
||||||
Task<bool> UpdateContentAsync(Expression<Func<TrackTemplateContentEntity, bool>> columns, Expression<Func<TrackTemplateContentEntity, bool>> whereExpression);
|
Task<bool> UpdateContentAsync(Expression<Func<TrackTemplateContentEntity, bool>> columns, Expression<Func<TrackTemplateContentEntity, bool>> whereExpression);
|
||||||
|
|||||||
@ -64,16 +64,6 @@ public class GetTrackPullConfigDetailOutputVO
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string TrackStatusName { get; set; }
|
public string TrackStatusName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 轨迹模板
|
|
||||||
/// </summary>
|
|
||||||
public string TrackTemplate { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 轨迹模板id
|
|
||||||
/// </summary>
|
|
||||||
public int TrackTemplateId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 拉取轨迹发生时间
|
/// 拉取轨迹发生时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -18,9 +18,4 @@ public class GetTrackPullConfigPageOutputVO
|
|||||||
/// 子系统名称
|
/// 子系统名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SubSystem { get; set; }
|
public string SubSystem { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 模板名称
|
|
||||||
/// </summary>
|
|
||||||
public string TrackTemplate { get; set; }
|
|
||||||
}
|
}
|
||||||
@ -81,23 +81,18 @@ public class GetTrackPushConfigDetailOutputVO
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string TrackStatusName { get; set; }
|
public string TrackStatusName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 轨迹模板
|
|
||||||
/// </summary>
|
|
||||||
public List<DropdownListDataDto> TrackTemplate { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 轨迹模板id
|
|
||||||
/// </summary>
|
|
||||||
public string TrackTemplateId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 轨迹模板ids
|
|
||||||
/// </summary>
|
|
||||||
public List<int> TrackTemplateIds { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 推送轨迹发生时间
|
/// 推送轨迹发生时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TrackTimeName { get; set; }
|
public string TrackTimeName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否支持更新
|
||||||
|
/// </summary>
|
||||||
|
public bool IsCanUpdate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否支持删除
|
||||||
|
/// </summary>
|
||||||
|
public bool IsCanDelete { get; set; }
|
||||||
}
|
}
|
||||||
@ -18,19 +18,4 @@ public class GetTrackPushConfigPageOutputVO
|
|||||||
/// 子系统名称
|
/// 子系统名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SubSystem { get; set; }
|
public string SubSystem { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 模板名称
|
|
||||||
/// </summary>
|
|
||||||
public string TrackTemplate { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 轨迹模板id
|
|
||||||
/// </summary>
|
|
||||||
public string TrackTemplateId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 轨迹模板ids
|
|
||||||
/// </summary>
|
|
||||||
public List<int> TrackTemplateIds { get; set; }
|
|
||||||
}
|
}
|
||||||
@ -1,14 +0,0 @@
|
|||||||
namespace SJZY.Track.Domain.Dtos.TrackTemplate;
|
|
||||||
|
|
||||||
public class GetTrackTemplateContentDropDownListVO : PageInfoInput
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 轨迹模板id
|
|
||||||
/// </summary>
|
|
||||||
public List<int> TrackTemplateIds { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 选中项
|
|
||||||
/// </summary>
|
|
||||||
public List<int>? SelectedIds { get; set; }
|
|
||||||
}
|
|
||||||
@ -15,5 +15,10 @@ public enum EnumPropertyEnums
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 单号类型
|
/// 单号类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Description("TrackOrderType")] 单号类型
|
[Description("TrackOrderType")] 单号类型,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹发生地
|
||||||
|
/// </summary>
|
||||||
|
[Description("TrackLocationValue")] 轨迹发生地
|
||||||
}
|
}
|
||||||
@ -1,9 +1,10 @@
|
|||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
|
using SJZY.Expand.ABP.Core.PublicMethords;
|
||||||
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.Aggregates.TrackTemplateAggregate;
|
|
||||||
using SJZY.Track.Domain.Dtos.Common;
|
using SJZY.Track.Domain.Dtos.Common;
|
||||||
using SJZY.Track.Domain.Dtos.TrackPull;
|
using SJZY.Track.Domain.Dtos.TrackPull;
|
||||||
|
using SJZY.Track.Domain.Enums;
|
||||||
using SJZY.Track.Domain.VEntities;
|
using SJZY.Track.Domain.VEntities;
|
||||||
|
|
||||||
namespace SJZY.Track.Repository.Repositories;
|
namespace SJZY.Track.Repository.Repositories;
|
||||||
@ -16,18 +17,16 @@ public class TrackPullConfigRepository : BasicRepository<TrackPullConfigEntity>,
|
|||||||
return await AsQueryable()
|
return await AsQueryable()
|
||||||
.LeftJoin<VSystemEntity>((trackPull, system) => trackPull.SubSystemId == system.Id && !system.IsDeleted)
|
.LeftJoin<VSystemEntity>((trackPull, system) => trackPull.SubSystemId == system.Id && !system.IsDeleted)
|
||||||
.LeftJoin<VServiceProviderEntity>((trackPull, system, service) => trackPull.ServiceProviderId == service.Id && !service.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)
|
.Filter(null, true)
|
||||||
.Where(trackPull => !trackPull.IsDeleted)
|
.Where(trackPull => !trackPull.IsDeleted)
|
||||||
.WhereIF(input.SubSystemId.HasValue, trackPull => trackPull.SubSystemId == input.SubSystemId)
|
.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))
|
.WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (trackPull, system, service) => service.Name.Contains(input.Keywords!))
|
||||||
.OrderByDescending(trackPull => trackPull.CreateTime)
|
.OrderByDescending(trackPull => trackPull.CreateTime)
|
||||||
.Select((trackPull, system, service, template) => new GetTrackPullConfigPageOutputVO
|
.Select((trackPull, system, service) => new GetTrackPullConfigPageOutputVO
|
||||||
{
|
{
|
||||||
Id = trackPull.Id,
|
Id = trackPull.Id,
|
||||||
SubSystem = system.CnName,
|
SubSystem = system.CnName,
|
||||||
ServiceProvider = service.Name,
|
ServiceProvider = service.Name,
|
||||||
TrackTemplate = template.Name,
|
|
||||||
CreateTime = trackPull.CreateTime
|
CreateTime = trackPull.CreateTime
|
||||||
})
|
})
|
||||||
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||||
@ -38,12 +37,13 @@ public class TrackPullConfigRepository : BasicRepository<TrackPullConfigEntity>,
|
|||||||
return await Context.Queryable<TrackPullContentConfigEntity>()
|
return await Context.Queryable<TrackPullContentConfigEntity>()
|
||||||
.InnerJoin<TrackContentEntity>((pullContent, trackContent) => pullContent.TrackContentId == trackContent.Id)
|
.InnerJoin<TrackContentEntity>((pullContent, trackContent) => pullContent.TrackContentId == trackContent.Id)
|
||||||
.InnerJoin<TrackPullConfigEntity>((pullContent, trackContent, trackPull) => pullContent.TrackPullConfigId == trackPull.Id)
|
.InnerJoin<TrackPullConfigEntity>((pullContent, trackContent, trackPull) => pullContent.TrackPullConfigId == trackPull.Id)
|
||||||
.InnerJoin<TrackTemplateContentEntity>((pullContent, trackContent, trackPull, templateContent) => trackPull.TrackTemplateId == templateContent.TrackTemplateId && pullContent.TrackContentId == templateContent.TrackContentId)
|
.LeftJoin<VEnumValueInfoEntity>((pullContent, trackContent, trackPull, enumValue) => enumValue.Property == EnumPropertyEnums.轨迹发生地.GetDescription() && pullContent.TrackPlaceValue == enumValue.Enumkey)
|
||||||
.Where(pullContent => pullContent.TrackPullConfigId == input.TrackPullConfigId)
|
.Where(pullContent => pullContent.TrackPullConfigId == input.TrackPullConfigId)
|
||||||
.OrderBy((pullContent, trackContent, trackPull, templateContent) => templateContent.Sort)
|
.OrderBy(pullContent => pullContent.CreateTime)
|
||||||
.Select((pullContent, trackContent, trackPull, templateContent) => new GetTrackPullContentPageOutputVO
|
.Select((pullContent, trackContent, trackPull, enumValue) => new GetTrackPullContentPageOutputVO
|
||||||
{
|
{
|
||||||
Id = pullContent.Id
|
Id = pullContent.Id,
|
||||||
|
TrackPlaceValue = enumValue.Disp
|
||||||
}, true)
|
}, true)
|
||||||
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||||
}
|
}
|
||||||
@ -53,16 +53,14 @@ public class TrackPullConfigRepository : BasicRepository<TrackPullConfigEntity>,
|
|||||||
return await AsQueryable()
|
return await AsQueryable()
|
||||||
.LeftJoin<VSystemEntity>((trackPull, system) => trackPull.SubSystemId == system.Id && !system.IsDeleted)
|
.LeftJoin<VSystemEntity>((trackPull, system) => trackPull.SubSystemId == system.Id && !system.IsDeleted)
|
||||||
.LeftJoin<VServiceProviderEntity>((trackPull, system, service) => trackPull.ServiceProviderId == service.Id && !service.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, paramsConfig) => trackPull.Id == paramsConfig.PullOrPushConfigId && !paramsConfig.IsPush && !paramsConfig.IsDeleted)
|
||||||
.InnerJoin<TrackPushPullParamsConfigEntity>((trackPull, system, service, template, paramsConfig) => trackPull.Id == paramsConfig.PullOrPushConfigId && !paramsConfig.IsPush && !paramsConfig.IsDeleted)
|
|
||||||
.Filter(null, true)
|
.Filter(null, true)
|
||||||
.Where(trackPull => trackPull.Id == id && !trackPull.IsDeleted)
|
.Where(trackPull => trackPull.Id == id && !trackPull.IsDeleted)
|
||||||
.Select((trackPull, system, service, template, paramsConfig) => new GetTrackPullConfigDetailOutputVO
|
.Select((trackPull, system, service, paramsConfig) => new GetTrackPullConfigDetailOutputVO
|
||||||
{
|
{
|
||||||
Id = trackPull.Id,
|
Id = trackPull.Id,
|
||||||
SubSystem = system.CnName,
|
SubSystem = system.CnName,
|
||||||
ServiceProvider = service.Name,
|
ServiceProvider = service.Name
|
||||||
TrackTemplate = template.Name
|
|
||||||
}, true)
|
}, true)
|
||||||
.SingleAsync();
|
.SingleAsync();
|
||||||
}
|
}
|
||||||
@ -90,9 +88,9 @@ public class TrackPullConfigRepository : BasicRepository<TrackPullConfigEntity>,
|
|||||||
return await Context.Insertable(insertObj).ExecuteCommandAsync() > 0;
|
return await Context.Insertable(insertObj).ExecuteCommandAsync() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> InsertContentRangeAsync(List<TrackPullContentConfigEntity> insertObjs)
|
public async Task<bool> InsertContentAsync(TrackPullContentConfigEntity insertObj)
|
||||||
{
|
{
|
||||||
return await Context.Insertable(insertObjs).ExecuteCommandAsync() > 0;
|
return await Context.Insertable(insertObj).ExecuteCommandAsync() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<TrackPushPullParamsConfigEntity> GetParamsSingleAsync(Expression<Func<TrackPushPullParamsConfigEntity, bool>> whereExpression)
|
public async Task<TrackPushPullParamsConfigEntity> GetParamsSingleAsync(Expression<Func<TrackPushPullParamsConfigEntity, bool>> whereExpression)
|
||||||
|
|||||||
@ -20,25 +20,18 @@ public class TrackPushConfigRepository : BasicRepository<TrackPushConfigEntity>,
|
|||||||
return await AsQueryable()
|
return await AsQueryable()
|
||||||
.LeftJoin<VSystemEntity>((trackPush, system) => trackPush.SubSystemId == system.Id && !system.IsDeleted)
|
.LeftJoin<VSystemEntity>((trackPush, system) => trackPush.SubSystemId == system.Id && !system.IsDeleted)
|
||||||
.LeftJoin<VExternalSubjectEntity>((trackPush, system, externalSubject) => trackPush.CustomId == externalSubject.Id && !externalSubject.IsDeleted)
|
.LeftJoin<VExternalSubjectEntity>((trackPush, system, externalSubject) => trackPush.CustomId == externalSubject.Id && !externalSubject.IsDeleted)
|
||||||
.LeftJoin<TrackTemplateEntity>((trackPush, system, externalSubject, template) => SqlFunc.SplitIn(trackPush.TrackTemplateId, template.Id.ToString()) && !template.IsDeleted)
|
|
||||||
.Filter(null, true)
|
.Filter(null, true)
|
||||||
.Where(trackPush => !trackPush.IsDeleted)
|
.Where(trackPush => !trackPush.IsDeleted)
|
||||||
.WhereIF(input.SubSystemId.HasValue, trackPush => trackPush.SubSystemId == input.SubSystemId)
|
.WhereIF(input.SubSystemId.HasValue, trackPush => trackPush.SubSystemId == input.SubSystemId)
|
||||||
.WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (trackPush, system, externalSubject, template) => externalSubject.Abbreviation.Contains(input.Keywords) || externalSubject.Name.Contains(input.Keywords) || template.Name.Contains(input.Keywords))
|
.WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (trackPush, system, externalSubject) => externalSubject.Abbreviation.Contains(input.Keywords!) || externalSubject.Name.Contains(input.Keywords!))
|
||||||
.OrderByDescending(trackPush => trackPush.CreateTime)
|
.OrderByDescending(trackPush => trackPush.CreateTime)
|
||||||
.Select((trackPush, system, externalSubject, template) => new GetTrackPushConfigPageOutputVO
|
.Select((trackPush, system, externalSubject) => new GetTrackPushConfigPageOutputVO
|
||||||
{
|
{
|
||||||
Id = trackPush.Id,
|
Id = trackPush.Id,
|
||||||
SubSystem = system.CnName,
|
SubSystem = system.CnName,
|
||||||
CustomName = externalSubject.Abbreviation,
|
CustomName = externalSubject.Abbreviation,
|
||||||
TrackTemplate = SqlFunc.Subqueryable<TrackTemplateEntity>()
|
|
||||||
.Where(template => SqlFunc.SplitIn(trackPush.TrackTemplateId, template.Id.ToString()) && !template.IsDeleted)
|
|
||||||
.SelectStringJoin(template => template.Name, ","),
|
|
||||||
TrackTemplateId = trackPush.TrackTemplateId,
|
|
||||||
CreateTime = trackPush.CreateTime
|
CreateTime = trackPush.CreateTime
|
||||||
})
|
})
|
||||||
.Distinct()
|
|
||||||
.Mapper(x => { x.TrackTemplateIds = x.TrackTemplateId.Split(',').Select(int.Parse).ToList(); })
|
|
||||||
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +67,6 @@ public class TrackPushConfigRepository : BasicRepository<TrackPushConfigEntity>,
|
|||||||
CustomName = externalSubject.Abbreviation,
|
CustomName = externalSubject.Abbreviation,
|
||||||
ServiceProvider = service.Name,
|
ServiceProvider = service.Name,
|
||||||
}, true)
|
}, true)
|
||||||
.Mapper(x => { x.TrackTemplateIds = x.TrackTemplateId.Split(',').Select(int.Parse).ToList(); })
|
|
||||||
.SingleAsync();
|
.SingleAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -71,8 +71,6 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<GetTemplateContentAttributeValueVO> GetTrackContentAttributeValue(GetTemplateContentAttributeValueInputVO input)
|
public async Task<GetTemplateContentAttributeValueVO> GetTrackContentAttributeValue(GetTemplateContentAttributeValueInputVO input)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,22 +174,6 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
|
|||||||
return await Context.Updateable(updateObjs).ExecuteCommandHasChangeAsync();
|
return await Context.Updateable(updateObjs).ExecuteCommandHasChangeAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<UnifyPageResultDto<DropdownListDataDto>> GetContentDropDownListAsync(GetTrackTemplateContentDropDownListVO input)
|
|
||||||
{
|
|
||||||
return await Context.Queryable<TrackTemplateContentEntity>()
|
|
||||||
.InnerJoin<TrackContentEntity>((templateContent, trackContent) => templateContent.TrackContentId == trackContent.Id)
|
|
||||||
.Where(templateContent => input.TrackTemplateIds.Contains(templateContent.TrackTemplateId))
|
|
||||||
.OrderByIF(input.SelectedIds.IsNullOrEmpty(), templateContent => templateContent.CreateTime, OrderByType.Desc)
|
|
||||||
.OrderByIF(!input.SelectedIds.IsNullOrEmpty(), templateContent => SqlFunc.IIF(input.SelectedIds.Contains(templateContent.TrackContentId), SqlFunc.DateAdd(SqlFunc.GetDate(), 1), templateContent.CreateTime), OrderByType.Desc)
|
|
||||||
.Select((templateContent, trackContent) => new DropdownListDataDto
|
|
||||||
{
|
|
||||||
Value = templateContent.TrackContentId,
|
|
||||||
Key = trackContent.Code + "-" + trackContent.Content
|
|
||||||
})
|
|
||||||
.Distinct()
|
|
||||||
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<T> ContentMaxAsync<T>(Expression<Func<TrackTemplateContentEntity, T>> columns, Expression<Func<TrackTemplateContentEntity, bool>> whereExpression)
|
public async Task<T> ContentMaxAsync<T>(Expression<Func<TrackTemplateContentEntity, T>> columns, Expression<Func<TrackTemplateContentEntity, bool>> whereExpression)
|
||||||
{
|
{
|
||||||
return await Context.Queryable<TrackTemplateContentEntity>().Where(whereExpression).MaxAsync(columns);
|
return await Context.Queryable<TrackTemplateContentEntity>().Where(whereExpression).MaxAsync(columns);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user