修改轨迹推送
This commit is contained in:
parent
e40ea3bdba
commit
777cf29baa
@ -1,8 +1,10 @@
|
|||||||
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;
|
||||||
using SJZY.Track.Application.Localization;
|
using SJZY.Track.Application.Localization;
|
||||||
|
using SJZY.Track.Domain.Aggregates.DemoAggregate;
|
||||||
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;
|
||||||
@ -66,7 +68,7 @@ public class TrackPushService : ApplicationService, ITransientDependency
|
|||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("GetDetail")]
|
[HttpGet("GetDetail")]
|
||||||
public async Task<GetTrackPushConfigDetailOutputVO?> GetDetailAsync(int id)
|
public async Task<GetTrackPushConfigDetailOutputVO> GetDetailAsync(int id)
|
||||||
{
|
{
|
||||||
var res = await _trackPushConfigRepository.GetDetailAsync(id);
|
var res = await _trackPushConfigRepository.GetDetailAsync(id);
|
||||||
if (res is null) return null;
|
if (res is null) return null;
|
||||||
@ -126,6 +128,8 @@ public class TrackPushService : ApplicationService, ITransientDependency
|
|||||||
trackPushParamsEntity.PullOrPushConfigId = id;
|
trackPushParamsEntity.PullOrPushConfigId = id;
|
||||||
await _trackPullConfigRepository.InsertParamsAsync(trackPushParamsEntity);
|
await _trackPullConfigRepository.InsertParamsAsync(trackPushParamsEntity);
|
||||||
|
|
||||||
|
if (input.IsAutoPush) await RedisHelper.Client.SAddAsync(GlobalConst.AutoPushRosterRedisKey, input.CustomId);
|
||||||
|
|
||||||
ts.Complete();
|
ts.Complete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -135,6 +139,8 @@ public class TrackPushService : ApplicationService, ITransientDependency
|
|||||||
{
|
{
|
||||||
var oldTrackPushEntity = await _trackPushConfigRepository.GetFirstAsync(x => x.Id == input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
var oldTrackPushEntity = await _trackPushConfigRepository.GetFirstAsync(x => x.Id == input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
||||||
|
|
||||||
|
int oldCustomId = oldTrackPushEntity.CustomId;
|
||||||
|
|
||||||
var oldTrackPushParamsEntity =
|
var oldTrackPushParamsEntity =
|
||||||
await _trackPullConfigRepository.GetParamsSingleAsync(x =>
|
await _trackPullConfigRepository.GetParamsSingleAsync(x =>
|
||||||
x.PullOrPushConfigId == input.Id && x.IsPush);
|
x.PullOrPushConfigId == input.Id && x.IsPush);
|
||||||
@ -147,22 +153,30 @@ public class TrackPushService : ApplicationService, ITransientDependency
|
|||||||
await _trackPushConfigRepository.UpdateAsync(oldTrackPushEntity);
|
await _trackPushConfigRepository.UpdateAsync(oldTrackPushEntity);
|
||||||
await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPushParamsEntity);
|
await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPushParamsEntity);
|
||||||
|
|
||||||
|
await RedisHelper.Client.SRemAsync(GlobalConst.AutoPushRosterRedisKey, oldCustomId);
|
||||||
|
if (input.IsAutoPush) await RedisHelper.Client.SAddAsync(GlobalConst.AutoPushRosterRedisKey, input.CustomId);
|
||||||
|
|
||||||
ts.Complete();
|
ts.Complete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OptionTypeNoNull.删除:
|
case OptionTypeNoNull.删除:
|
||||||
using (var ts = TransactionScopeHelper.Create())
|
|
||||||
{
|
{
|
||||||
await _trackPushConfigRepository.SoftDeleteAsync(x => x.Id == input.Id);
|
var oldTrackPushEntity = await _trackPushConfigRepository.GetFirstAsync(x => x.Id == input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
||||||
await _trackPullConfigRepository.SoftDeleteParamsAsync(x =>
|
|
||||||
x.PullOrPushConfigId == input.Id && x.IsPush);
|
|
||||||
await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.TrackPushConfigId == input.Id);
|
|
||||||
|
|
||||||
ts.Complete();
|
using (var ts = TransactionScopeHelper.Create())
|
||||||
|
{
|
||||||
|
await _trackPushConfigRepository.SoftDeleteAsync(x => x.Id == input.Id);
|
||||||
|
await _trackPullConfigRepository.SoftDeleteParamsAsync(x =>
|
||||||
|
x.PullOrPushConfigId == input.Id && x.IsPush);
|
||||||
|
await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.TrackPushConfigId == input.Id);
|
||||||
|
|
||||||
|
await RedisHelper.Client.SRemAsync(GlobalConst.AutoPushRosterRedisKey, oldTrackPushEntity.CustomId);
|
||||||
|
|
||||||
|
ts.Complete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -91,6 +91,11 @@ public class GetTrackPushConfigDetailOutputVO
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string TrackTemplateId { get; set; }
|
public string TrackTemplateId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹模板ids
|
||||||
|
/// </summary>
|
||||||
|
public List<int> TrackTemplateIds { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 推送轨迹发生时间
|
/// 推送轨迹发生时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -6,9 +6,14 @@ public class GlobalConst
|
|||||||
/// 轨迹明细es索引名称
|
/// 轨迹明细es索引名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string TrackIndex = "sjzy_track_details";
|
public const string TrackIndex = "sjzy_track_details";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹新增/更新cap订阅名称
|
/// 轨迹新增/更新cap订阅名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string TrackUpsertSubscribe = "SJZY.Track.Upsert";
|
public const string TrackUpsertSubscribe = "SJZY.Track.Upsert";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 自动推送名单RedisKey
|
||||||
|
/// </summary>
|
||||||
|
public const string AutoPushRosterRedisKey = "AutoPushRoster";
|
||||||
}
|
}
|
||||||
@ -68,6 +68,7 @@ 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user