Merge remote-tracking branch 'origin/S01-轨迹中台' into S01-轨迹中台
This commit is contained in:
commit
3c6008a2b5
@ -41,6 +41,11 @@
|
|||||||
/// 轨迹标记id
|
/// 轨迹标记id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int TrackFlagId { get; set; }
|
public int TrackFlagId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否完结
|
||||||
|
/// </summary>
|
||||||
|
public bool IsFinish { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GetTrackContentDetailDto
|
public class GetTrackContentDetailDto
|
||||||
@ -94,5 +99,10 @@
|
|||||||
/// 轨迹标记
|
/// 轨迹标记
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TrackFlag { get; set; }
|
public string TrackFlag { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否完结
|
||||||
|
/// </summary>
|
||||||
|
public bool IsFinish { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -84,5 +84,10 @@
|
|||||||
/// 修改人
|
/// 修改人
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string UpdateUser { get; set; }
|
public string UpdateUser { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否完结
|
||||||
|
/// </summary>
|
||||||
|
public bool IsFinish { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -27,10 +27,10 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string? Code { get; set; }
|
public string? Code { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// 是否完结
|
///// 是否完结
|
||||||
/// </summary>
|
///// </summary>
|
||||||
public bool IsFinish { get; set; }
|
//public bool IsFinish { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GetTrackFlagDetailDto
|
public class GetTrackFlagDetailDto
|
||||||
@ -60,9 +60,9 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Flag { get; set; }
|
public string Flag { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// 是否完结
|
///// 是否完结
|
||||||
/// </summary>
|
///// </summary>
|
||||||
public bool IsFinish { get; set; }
|
//public bool IsFinish { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -22,10 +22,10 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Flag { get; set; }
|
public string Flag { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// 是否完结
|
///// 是否完结
|
||||||
/// </summary>
|
///// </summary>
|
||||||
public bool IsFinish { get; set; }
|
//public bool IsFinish { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建时间
|
/// 创建时间
|
||||||
|
|||||||
@ -9,7 +9,8 @@ namespace SJZY.Track.Application.AutoMapper
|
|||||||
{
|
{
|
||||||
public TrackContentAutoMapperProfile()
|
public TrackContentAutoMapperProfile()
|
||||||
{
|
{
|
||||||
CreateMap<EditTrackContentInput, TrackContentEntity>(MemberList.None);
|
CreateMap<EditTrackContentInput, TrackContentEntity>(MemberList.None)
|
||||||
|
.ForMember(dest => dest.IsCompleted, opt => opt.MapFrom(source => source.IsFinish));
|
||||||
CreateMap<GetTrackContentDetailVO, GetTrackContentDetailDto>(MemberList.None);
|
CreateMap<GetTrackContentDetailVO, GetTrackContentDetailDto>(MemberList.None);
|
||||||
CreateMap<GetPageTrackContentInput, GetPageTrackContentVO>(MemberList.None);
|
CreateMap<GetPageTrackContentInput, GetPageTrackContentVO>(MemberList.None);
|
||||||
CreateMap<GetTrackContentListVO, GetTrackContentListDto>(MemberList.None);
|
CreateMap<GetTrackContentListVO, GetTrackContentListDto>(MemberList.None);
|
||||||
|
|||||||
@ -10,16 +10,12 @@ namespace SJZY.Track.Application.AutoMapper
|
|||||||
public TrackFlagAutoMapperProfile()
|
public TrackFlagAutoMapperProfile()
|
||||||
{
|
{
|
||||||
CreateMap<EditTrackFlagInput, TrackFlagEntity>(MemberList.None)
|
CreateMap<EditTrackFlagInput, TrackFlagEntity>(MemberList.None)
|
||||||
.ForMember(dest => dest.Name, opt => opt.MapFrom(source => source.Flag))
|
.ForMember(dest => dest.Name, opt => opt.MapFrom(source => source.Flag));
|
||||||
.ForMember(dest => dest.IsCompleted, opt => opt.MapFrom(source => source.IsFinish));
|
//.ForMember(dest => dest.IsCompleted, opt => opt.MapFrom(source => source.IsFinish));
|
||||||
CreateMap<GetTrackFlagDetailVO, GetTrackFlagDetailDto>(MemberList.None);
|
CreateMap<GetTrackFlagDetailVO, GetTrackFlagDetailDto>(MemberList.None);
|
||||||
CreateMap<GetTrackFlagListVO, GetTrackFlagListDto>(MemberList.None);
|
CreateMap<GetTrackFlagListVO, GetTrackFlagListDto>(MemberList.None);
|
||||||
CreateMap<UnifyPageResultDto<GetTrackFlagListVO>, UnifyPageResultDto<GetTrackFlagListDto>>(MemberList.None);
|
CreateMap<UnifyPageResultDto<GetTrackFlagListVO>, UnifyPageResultDto<GetTrackFlagListDto>>(MemberList.None);
|
||||||
CreateMap<GetPageTrackFlagInput, GetPageTrackFlagVO>(MemberList.None);
|
CreateMap<GetPageTrackFlagInput, GetPageTrackFlagVO>(MemberList.None);
|
||||||
|
|
||||||
//var pageResultDto =
|
|
||||||
// ObjectMapper.Map<UnifyPageResultDto<GetTrackFlagListVO>, UnifyPageResultDto<GetTrackFlagListDto>>(
|
|
||||||
// resultDto);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,12 +1,9 @@
|
|||||||
using Microsoft.Extensions.Localization;
|
using Microsoft.Extensions.Localization;
|
||||||
using SJZY.Expand.ABP.Core.Common.Dto;
|
|
||||||
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.TrackContents;
|
using SJZY.Track.Application.Contract.Dtos.TrackContents;
|
||||||
using SJZY.Track.Application.Contract.Dtos.TrackPull;
|
|
||||||
using SJZY.Track.Application.Localization;
|
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.TrackTemplateAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
|
||||||
using SJZY.Track.Domain.Dtos.TrackContents;
|
using SJZY.Track.Domain.Dtos.TrackContents;
|
||||||
using SJZY.Track.Domain.Queries;
|
using SJZY.Track.Domain.Queries;
|
||||||
@ -36,8 +33,8 @@ namespace SJZY.Track.Application.Services.TrackContents
|
|||||||
{
|
{
|
||||||
this._stringLocalizer = stringLocalizer;
|
this._stringLocalizer = stringLocalizer;
|
||||||
this._trackContentRepository = trackContentRepository;
|
this._trackContentRepository = trackContentRepository;
|
||||||
this._trackContentMapBasicQuery=trackContentMapBasicQuery;
|
this._trackContentMapBasicQuery = trackContentMapBasicQuery;
|
||||||
this._trackTemplateContentBasicQuery=trackTemplateContentBasicQuery;
|
this._trackTemplateContentBasicQuery = trackTemplateContentBasicQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -106,6 +103,7 @@ 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);
|
||||||
@ -117,6 +115,7 @@ 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));
|
||||||
@ -166,18 +165,19 @@ namespace SJZY.Track.Application.Services.TrackContents
|
|||||||
#region 业务校验
|
#region 业务校验
|
||||||
|
|
||||||
//查询是否关联了轨迹模版内容
|
//查询是否关联了轨迹模版内容
|
||||||
var trackTemplateContents = await _trackTemplateContentBasicQuery.GetListAsync(a => a.TrackContentId==input.Id);
|
var trackTemplateContents = await _trackTemplateContentBasicQuery.GetListAsync(a => a.TrackContentId == input.Id);
|
||||||
if (trackTemplateContents.Any())
|
if (trackTemplateContents.Any())
|
||||||
{
|
{
|
||||||
throw new BusinessException(message: "该轨迹内容关联轨迹模板,禁止删除");
|
throw new BusinessException(message: "该轨迹内容关联轨迹模板,禁止删除");
|
||||||
}
|
}
|
||||||
|
|
||||||
//需要加个判断,存在内容映射,则出提示
|
//需要加个判断,存在内容映射,则出提示
|
||||||
var trackContentMapEntities = await _trackContentMapBasicQuery.GetListAsync(a => a.TrackContentId==input.Id|| a.MapTrackContentId==input.Id);
|
var trackContentMapEntities = await _trackContentMapBasicQuery.GetListAsync(a => a.TrackContentId == input.Id || a.MapTrackContentId == input.Id);
|
||||||
if (trackContentMapEntities.Any())
|
if (trackContentMapEntities.Any())
|
||||||
{
|
{
|
||||||
throw new BusinessException(message: "无法删除该内容,该轨迹内容已在轨迹内容映射中使用了,请检查");
|
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);
|
||||||
|
|||||||
@ -129,7 +129,8 @@ namespace SJZY.Track.Application.Services.TrackFlags
|
|||||||
var isExistContent = await _trackContentRepository.GetFirstAsync(a => a.TrackFlagId==input.Id);
|
var isExistContent = await _trackContentRepository.GetFirstAsync(a => a.TrackFlagId==input.Id);
|
||||||
if (isExistContent!=null)
|
if (isExistContent!=null)
|
||||||
{
|
{
|
||||||
throw new BusinessException(message: _stringLocalizer["IsExistTrackFlag"]);
|
//throw new BusinessException(message: _stringLocalizer["IsExistTrackFlag"]);
|
||||||
|
throw new BusinessException(message: "该标记关联轨迹内容,禁止删除");
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
var isTrue = await _trackFlagRepository.SoftDeleteAsync(x => x.Id == input.Id);
|
var isTrue = await _trackFlagRepository.SoftDeleteAsync(x => x.Id == input.Id);
|
||||||
|
|||||||
@ -5,7 +5,6 @@ using SJZY.Expand.ABP.Core.PublicMethords;
|
|||||||
using SJZY.Track.Application.Contract.Dtos.TrackPull;
|
using SJZY.Track.Application.Contract.Dtos.TrackPull;
|
||||||
using SJZY.Track.Application.Localization;
|
using SJZY.Track.Application.Localization;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
|
||||||
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.TrackPull;
|
using SJZY.Track.Domain.Dtos.TrackPull;
|
||||||
|
|||||||
@ -6,16 +6,17 @@ using Volo.Abp.DependencyInjection;
|
|||||||
|
|
||||||
namespace SJZY.Track.Application.Services.TrackPush;
|
namespace SJZY.Track.Application.Services.TrackPush;
|
||||||
|
|
||||||
public class TrackPushCacheService:ITrackPushCacheService, ITransientDependency
|
public class TrackPushCacheService : ITrackPushCacheService, ITransientDependency
|
||||||
{
|
{
|
||||||
private readonly IBasicQuery<TrackPushConfigEntity> _trackPushConfigQuery;
|
private readonly IBasicQuery<TrackPushConfigEntity> _trackPushConfigQuery;
|
||||||
|
|
||||||
private string RedisKey(int customId) => GlobalConst.TrackPushKeyPrefix + customId;
|
private string RedisKey(int customId) => GlobalConst.TrackPushKeyPrefix + customId;
|
||||||
|
|
||||||
public TrackPushCacheService(IBasicQuery<TrackPushConfigEntity> trackPushConfigQuery)
|
public TrackPushCacheService(IBasicQuery<TrackPushConfigEntity> trackPushConfigQuery)
|
||||||
{
|
{
|
||||||
_trackPushConfigQuery = trackPushConfigQuery;
|
_trackPushConfigQuery = trackPushConfigQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> IsPushAsync(int customId)
|
public async Task<bool> IsPushAsync(int customId)
|
||||||
{
|
{
|
||||||
var isPush =
|
var isPush =
|
||||||
@ -30,7 +31,7 @@ public class TrackPushCacheService:ITrackPushCacheService, ITransientDependency
|
|||||||
|
|
||||||
return (bool)isPush;
|
return (bool)isPush;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task UpdateAsync(int customId, bool isPush)
|
public async Task UpdateAsync(int customId, bool isPush)
|
||||||
{
|
{
|
||||||
await RedisHelper.Client.SetAsync(RedisKey(customId), isPush);
|
await RedisHelper.Client.SetAsync(RedisKey(customId), isPush);
|
||||||
|
|||||||
@ -3,6 +3,7 @@ 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.Contract.Services;
|
||||||
using SJZY.Track.Application.Localization;
|
using SJZY.Track.Application.Localization;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
||||||
@ -26,17 +27,20 @@ public class TrackPushService : ApplicationService, ITransientDependency
|
|||||||
private readonly ITrackPushConfigRepository _trackPushConfigRepository;
|
private readonly ITrackPushConfigRepository _trackPushConfigRepository;
|
||||||
private readonly ITrackTemplateRepository _trackTemplateRepository;
|
private readonly ITrackTemplateRepository _trackTemplateRepository;
|
||||||
private readonly ITrackPullConfigRepository _trackPullConfigRepository;
|
private readonly ITrackPullConfigRepository _trackPullConfigRepository;
|
||||||
|
private readonly ITrackPushCacheService _trackPushCacheService;
|
||||||
|
|
||||||
public TrackPushService(
|
public TrackPushService(
|
||||||
IStringLocalizer<TrackLocalizationResource> stringLocalizer,
|
IStringLocalizer<TrackLocalizationResource> stringLocalizer,
|
||||||
ITrackPushConfigRepository trackPushConfigRepository,
|
ITrackPushConfigRepository trackPushConfigRepository,
|
||||||
ITrackTemplateRepository trackTemplateRepository,
|
ITrackTemplateRepository trackTemplateRepository,
|
||||||
ITrackPullConfigRepository trackPullConfigRepository)
|
ITrackPullConfigRepository trackPullConfigRepository,
|
||||||
|
ITrackPushCacheService trackPushCacheService)
|
||||||
{
|
{
|
||||||
_stringLocalizer = stringLocalizer;
|
_stringLocalizer = stringLocalizer;
|
||||||
_trackPushConfigRepository = trackPushConfigRepository;
|
_trackPushConfigRepository = trackPushConfigRepository;
|
||||||
_trackTemplateRepository = trackTemplateRepository;
|
_trackTemplateRepository = trackTemplateRepository;
|
||||||
_trackPullConfigRepository = trackPullConfigRepository;
|
_trackPullConfigRepository = trackPullConfigRepository;
|
||||||
|
_trackPushCacheService = trackPushCacheService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -129,7 +133,7 @@ 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);
|
if (input.IsAutoPush) await _trackPushCacheService.IsPushAsync(input.CustomId);
|
||||||
|
|
||||||
ts.Complete();
|
ts.Complete();
|
||||||
}
|
}
|
||||||
@ -154,8 +158,8 @@ 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);
|
await _trackPushCacheService.UpdateAsync(oldCustomId, false);
|
||||||
if (input.IsAutoPush) await RedisHelper.Client.SAddAsync(GlobalConst.AutoPushRosterRedisKey, input.CustomId);
|
if (input.IsAutoPush) await _trackPushCacheService.IsPushAsync(input.CustomId);
|
||||||
|
|
||||||
ts.Complete();
|
ts.Complete();
|
||||||
}
|
}
|
||||||
@ -173,7 +177,7 @@ public class TrackPushService : ApplicationService, ITransientDependency
|
|||||||
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 RedisHelper.Client.SRemAsync(GlobalConst.AutoPushRosterRedisKey, oldTrackPushEntity.CustomId);
|
await _trackPushCacheService.UpdateAsync(oldTrackPushEntity.CustomId, false);
|
||||||
|
|
||||||
ts.Complete();
|
ts.Complete();
|
||||||
}
|
}
|
||||||
@ -215,26 +219,42 @@ public class TrackPushService : ApplicationService, ITransientDependency
|
|||||||
{
|
{
|
||||||
case OptionTypeNoNull.新增:
|
case OptionTypeNoNull.新增:
|
||||||
{
|
{
|
||||||
var trackPushContentEntity = ObjectMapper.Map<EditTrackPushContentInput, TrackPushContentConfigEntity>(input);
|
int maxSort = await _trackPushConfigRepository.ContentMaxAsync(x => x.Sort, x => x.TrackPushConfigId == input.TrackPushConfigId);
|
||||||
|
|
||||||
await _trackPushConfigRepository.InsertContentAsync(trackPushContentEntity);
|
var entity = ObjectMapper.Map<EditTrackPushContentInput, TrackPushContentConfigEntity>(input);
|
||||||
|
entity.Sort = maxSort + 1;
|
||||||
|
|
||||||
|
await _trackPushConfigRepository.InsertContentAsync(entity);
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
case OptionTypeNoNull.修改:
|
case OptionTypeNoNull.修改:
|
||||||
{
|
{
|
||||||
var oldTrackPushContentEntity = await _trackPushConfigRepository.GetContentByIdAsync(input.Id!.Value) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
var entity = await _trackPushConfigRepository.GetContentByIdAsync(input.Id!.Value) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
||||||
|
|
||||||
ObjectMapper.Map(input, oldTrackPushContentEntity);
|
ObjectMapper.Map(input, entity);
|
||||||
|
|
||||||
await _trackPushConfigRepository.UpdateContentAsync(oldTrackPushContentEntity);
|
await _trackPushConfigRepository.UpdateContentAsync(entity);
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
case OptionTypeNoNull.删除:
|
case OptionTypeNoNull.删除:
|
||||||
await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.Id == input.Id);
|
{
|
||||||
|
var entity = await _trackPushConfigRepository.GetContentByIdAsync(input.Id!.Value) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
||||||
|
|
||||||
break;
|
using (var ts = TransactionScopeHelper.Create())
|
||||||
|
{
|
||||||
|
await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.Id == input.Id);
|
||||||
|
|
||||||
|
await _trackPushConfigRepository.UpdateContentAsync(x => x.Sort == x.Sort - 1, x => x.TrackPushConfigId == entity.TrackPushConfigId && x.Sort > entity.Sort);
|
||||||
|
|
||||||
|
ts.Complete();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum,
|
throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum,
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
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;
|
||||||
using SJZY.Track.Application.Contract.Dtos.TrackPush;
|
|
||||||
using SJZY.Track.Application.Contract.Dtos.TrackTemplates;
|
using SJZY.Track.Application.Contract.Dtos.TrackTemplates;
|
||||||
using SJZY.Track.Application.Localization;
|
using SJZY.Track.Application.Localization;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
|
||||||
@ -216,29 +215,45 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
|
|||||||
switch (input.Options)
|
switch (input.Options)
|
||||||
{
|
{
|
||||||
case OptionTypeNoNull.新增:
|
case OptionTypeNoNull.新增:
|
||||||
|
{
|
||||||
|
int maxSort = await _trackTemplateRepository.ContentMaxAsync(x => x.Sort, x => x.TrackTemplateId == input.TrackTemplateId);
|
||||||
|
|
||||||
var entity = ObjectMapper.Map<EditTrackTemplateContentInput, TrackTemplateContentEntity>(input);
|
var entity = ObjectMapper.Map<EditTrackTemplateContentInput, TrackTemplateContentEntity>(input);
|
||||||
|
entity.Sort = maxSort + 1;
|
||||||
|
|
||||||
await _trackTemplateRepository.InsertContentAsync(entity);
|
await _trackTemplateRepository.InsertContentAsync(entity);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case OptionTypeNoNull.修改:
|
case OptionTypeNoNull.修改:
|
||||||
|
{
|
||||||
var oldEntity = await _trackTemplateRepository.GetContentByIdAsync(input.Id!.Value) ??
|
var entity = await _trackTemplateRepository.GetContentByIdAsync(input.Id!.Value) ??
|
||||||
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
||||||
|
|
||||||
ObjectMapper.Map(input, oldEntity);
|
ObjectMapper.Map(input, entity);
|
||||||
|
|
||||||
await _trackTemplateRepository.UpdateContentAsync(oldEntity);
|
await _trackTemplateRepository.UpdateContentAsync(entity);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case OptionTypeNoNull.删除:
|
case OptionTypeNoNull.删除:
|
||||||
|
{
|
||||||
|
var entity = await _trackTemplateRepository.GetContentByIdAsync(input.Id!.Value) ??
|
||||||
|
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
||||||
|
|
||||||
await _trackTemplateRepository.SoftDeleteContentAsync(input.Id!.Value);
|
using (var ts = TransactionScopeHelper.Create())
|
||||||
|
{
|
||||||
|
await _trackTemplateRepository.SoftDeleteContentAsync(input.Id!.Value);
|
||||||
|
|
||||||
break;
|
await _trackTemplateRepository.UpdateContentAsync(x => x.Sort == x.Sort - 1, x => x.TrackTemplateId == entity.TrackTemplateId && x.Sort > entity.Sort);
|
||||||
|
|
||||||
|
ts.Complete();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum,
|
throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum,
|
||||||
|
|||||||
@ -47,4 +47,10 @@ public class TrackContentEntity : IFullAuditedBasicEntitys, IAggregateRoot
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnName = "TrackStatusId")]
|
[SugarColumn(ColumnName = "TrackStatusId")]
|
||||||
public int TrackStatusId { get; set; }
|
public int TrackStatusId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否完结
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "IsCompleted")]
|
||||||
|
public bool IsCompleted { get; set; }
|
||||||
}
|
}
|
||||||
@ -30,9 +30,9 @@ public class TrackFlagEntity : IFullAuditedBasicEntitys, IAggregateRoot
|
|||||||
[SugarColumn(ColumnName = "SubSystemId")]
|
[SugarColumn(ColumnName = "SubSystemId")]
|
||||||
public int SubSystemId { get; set; }
|
public int SubSystemId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// 是否完结
|
///// 是否完结
|
||||||
/// </summary>
|
///// </summary>
|
||||||
[SugarColumn(ColumnName = "IsCompleted")]
|
//[SugarColumn(ColumnName = "IsCompleted")]
|
||||||
public bool IsCompleted { get; set; }
|
//public bool IsCompleted { get; set; }
|
||||||
}
|
}
|
||||||
@ -26,4 +26,8 @@ public interface ITrackPushConfigRepository : IBasicRepository<TrackPushConfigEn
|
|||||||
Task<List<TrackPushContentConfigEntity>> GetContentListAsync(Expression<Func<TrackPushContentConfigEntity, bool>> whereExpression);
|
Task<List<TrackPushContentConfigEntity>> GetContentListAsync(Expression<Func<TrackPushContentConfigEntity, bool>> whereExpression);
|
||||||
|
|
||||||
Task<bool> UpdateContentRangeAsync(List<TrackPushContentConfigEntity> updateObjs);
|
Task<bool> UpdateContentRangeAsync(List<TrackPushContentConfigEntity> updateObjs);
|
||||||
|
|
||||||
|
Task<T> ContentMaxAsync<T>(Expression<Func<TrackPushContentConfigEntity, T>> columns, Expression<Func<TrackPushContentConfigEntity, bool>> whereExpression);
|
||||||
|
|
||||||
|
Task<bool> UpdateContentAsync(Expression<Func<TrackPushContentConfigEntity, bool>> columns, Expression<Func<TrackPushContentConfigEntity, bool>> whereExpression);
|
||||||
}
|
}
|
||||||
@ -40,4 +40,8 @@ public interface ITrackTemplateRepository : IBasicRepository<TrackTemplateEntity
|
|||||||
Task<bool> UpdateContentRangeAsync(List<TrackTemplateContentEntity> updateObjs);
|
Task<bool> UpdateContentRangeAsync(List<TrackTemplateContentEntity> updateObjs);
|
||||||
|
|
||||||
Task<UnifyPageResultDto<DropdownListDataDto>> GetContentDropDownListAsync(GetTrackTemplateContentDropDownListVO input);
|
Task<UnifyPageResultDto<DropdownListDataDto>> GetContentDropDownListAsync(GetTrackTemplateContentDropDownListVO input);
|
||||||
|
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
@ -90,5 +90,10 @@ namespace SJZY.Track.Domain.Dtos.TrackContents
|
|||||||
/// 修改人
|
/// 修改人
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string UpdateUser { get; set; }
|
public string UpdateUser { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否完结
|
||||||
|
/// </summary>
|
||||||
|
public bool IsFinish { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,5 +57,10 @@ namespace SJZY.Track.Domain.Dtos.TrackContents
|
|||||||
/// 轨迹标记
|
/// 轨迹标记
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TrackFlag { get; set; }
|
public string TrackFlag { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否完结
|
||||||
|
/// </summary>
|
||||||
|
public bool IsFinish { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,10 +46,10 @@ namespace SJZY.Track.Domain.Dtos.TrackFlags
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Flag { get; set; }
|
public string Flag { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// 是否完结
|
///// 是否完结
|
||||||
/// </summary>
|
///// </summary>
|
||||||
public bool IsFinish { get; set; }
|
//public bool IsFinish { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建时间
|
/// 创建时间
|
||||||
|
|||||||
@ -33,9 +33,9 @@ namespace SJZY.Track.Domain.Dtos.TrackFlags
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Flag { get; set; }
|
public string Flag { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// 是否完结
|
///// 是否完结
|
||||||
/// </summary>
|
///// </summary>
|
||||||
public bool IsFinish { get; set; }
|
//public bool IsFinish { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,9 +26,4 @@ public class GlobalConst
|
|||||||
/// 轨迹要推送的客户redis key前缀
|
/// 轨迹要推送的客户redis key前缀
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string TrackPushKeyPrefix = "TrackPush:";
|
public const string TrackPushKeyPrefix = "TrackPush:";
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 自动推送名单RedisKey
|
|
||||||
/// </summary>
|
|
||||||
public const string AutoPushRosterRedisKey = "AutoPushRoster";
|
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ public class ProvideQueries : ISugarRepository, IProvideQueries,
|
|||||||
Content = b.Content,
|
Content = b.Content,
|
||||||
EnContent = b.EnContent,
|
EnContent = b.EnContent,
|
||||||
Status = c.Status,
|
Status = c.Status,
|
||||||
IsCompleted = d.IsCompleted
|
IsCompleted = b.IsCompleted
|
||||||
})
|
})
|
||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,7 +37,8 @@ public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrac
|
|||||||
Content = a.Content,
|
Content = a.Content,
|
||||||
EnContent = a.EnContent,
|
EnContent = a.EnContent,
|
||||||
TrackFlagId = a.TrackFlagId,
|
TrackFlagId = a.TrackFlagId,
|
||||||
TrackFlag = c.Name
|
TrackFlag = c.Name,
|
||||||
|
IsFinish = a.IsCompleted
|
||||||
})
|
})
|
||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
return detail;
|
return detail;
|
||||||
@ -79,7 +80,8 @@ public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrac
|
|||||||
CreateTime = a.CreateTime,
|
CreateTime = a.CreateTime,
|
||||||
CreateUser = e.Name,
|
CreateUser = e.Name,
|
||||||
UpdateTime = a.UpdateTime,
|
UpdateTime = a.UpdateTime,
|
||||||
UpdateUser = f.Name
|
UpdateUser = f.Name,
|
||||||
|
IsFinish= a.IsCompleted
|
||||||
})
|
})
|
||||||
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||||
|
|
||||||
|
|||||||
@ -26,8 +26,8 @@ public class TrackFlagRepository : BasicRepository<TrackFlagEntity>, ITrackFlagR
|
|||||||
SubSystemId = a.SubSystemId,
|
SubSystemId = a.SubSystemId,
|
||||||
SubSystem = b.CnName,
|
SubSystem = b.CnName,
|
||||||
Code = a.Code,
|
Code = a.Code,
|
||||||
Flag = a.Name,
|
Flag = a.Name
|
||||||
IsFinish=a.IsCompleted
|
//,IsFinish=a.IsCompleted
|
||||||
})
|
})
|
||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
return detail;
|
return detail;
|
||||||
@ -54,7 +54,7 @@ public class TrackFlagRepository : BasicRepository<TrackFlagEntity>, ITrackFlagR
|
|||||||
SubSystem = b.CnName,
|
SubSystem = b.CnName,
|
||||||
Code = a.Code,
|
Code = a.Code,
|
||||||
Flag = a.Name,
|
Flag = a.Name,
|
||||||
IsFinish=a.IsCompleted,
|
//IsFinish=a.IsCompleted,
|
||||||
CreateTime = a.CreateTime,
|
CreateTime = a.CreateTime,
|
||||||
CreateUser = c.Name,
|
CreateUser = c.Name,
|
||||||
UpdateTime = a.UpdateTime,
|
UpdateTime = a.UpdateTime,
|
||||||
|
|||||||
@ -124,4 +124,14 @@ public class TrackPushConfigRepository : BasicRepository<TrackPushConfigEntity>,
|
|||||||
{
|
{
|
||||||
return await Context.Updateable(updateObjs).ExecuteCommandHasChangeAsync();
|
return await Context.Updateable(updateObjs).ExecuteCommandHasChangeAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<T> ContentMaxAsync<T>(Expression<Func<TrackPushContentConfigEntity, T>> columns, Expression<Func<TrackPushContentConfigEntity, bool>> whereExpression)
|
||||||
|
{
|
||||||
|
return await Context.Queryable<TrackPushContentConfigEntity>().Where(whereExpression).MaxAsync(columns);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> UpdateContentAsync(Expression<Func<TrackPushContentConfigEntity, bool>> columns, Expression<Func<TrackPushContentConfigEntity, bool>> whereExpression)
|
||||||
|
{
|
||||||
|
return await Context.Updateable<TrackPushContentConfigEntity>().SetColumns(columns).Where(whereExpression).ExecuteCommandHasChangeAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -179,4 +179,14 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
|
|||||||
.Distinct()
|
.Distinct()
|
||||||
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> UpdateContentAsync(Expression<Func<TrackTemplateContentEntity, bool>> columns, Expression<Func<TrackTemplateContentEntity, bool>> whereExpression)
|
||||||
|
{
|
||||||
|
return await Context.Updateable<TrackTemplateContentEntity>().SetColumns(columns).Where(whereExpression).ExecuteCommandHasChangeAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user