change:【轨迹的完成根据拉取配置判断】

https://www.tapd.cn/60863849/prong/stories/view/1160863849001017014
This commit is contained in:
李鹏军 2024-03-30 15:49:55 +08:00
parent f7c091dee6
commit a58b9e264a
8 changed files with 276 additions and 301 deletions

View File

@ -5,9 +5,11 @@
"Apollo": { "Apollo": {
"AppId": "SJZY.Track.Configuration", "AppId": "SJZY.Track.Configuration",
"Env": "DEV", "Env": "DEV",
"Namespace": "Test", "Namespace": "Dev",
"MetaServer": "http://apollo-service-test-apollo-configservice.apollo.svc.cluster.local:8080", "MetaServer": "http://apollo-service-test-apollo-configservice.apollo.svc.cluster.local:8080",
"ConfigServer": [ "http://apollo-service-test-apollo-configservice.apollo.svc.cluster.local:8080" ] "ConfigServer": [
"http://apollo-service-test-apollo-configservice.apollo.svc.cluster.local:8080"
]
} }
}, },
"Kestrel": { "Kestrel": {

View File

@ -94,10 +94,5 @@
/// 轨迹标记 /// 轨迹标记
/// </summary> /// </summary>
public string TrackFlag { get; set; } public string TrackFlag { get; set; }
/// <summary>
/// 是否完结
/// </summary>
public bool IsFinish { get; set; }
} }
} }

View File

@ -84,10 +84,5 @@
/// 修改人 /// 修改人
/// </summary> /// </summary>
public string UpdateUser { get; set; } public string UpdateUser { get; set; }
/// <summary>
/// 是否完结
/// </summary>
public bool IsFinish { get; set; }
} }
} }

View File

@ -53,4 +53,9 @@ public class EditTrackPullContentInput
/// 轨迹时区GMT /// 轨迹时区GMT
/// </summary> /// </summary>
public double? TrackTimeZone { get; set; } public double? TrackTimeZone { get; set; }
/// <summary>
/// 是否完结
/// </summary>
public bool IsCompleted { get; set; }
} }

View File

@ -1,40 +1,31 @@
using Microsoft.Extensions.Localization; using System.Linq.Expressions;
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.TrackContents; using SJZY.Track.Application.Contract.Dtos.TrackContents;
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.TrackTemplateAggregate;
using SJZY.Track.Domain.Dtos.TrackContents; using SJZY.Track.Domain.Dtos.TrackContents;
using SJZY.Track.Domain.Queries;
using System.Linq.Expressions;
using Volo.Abp.DependencyInjection;
namespace SJZY.Track.Application.Services.TrackContents namespace SJZY.Track.Application.Services.TrackContents;
/// <summary>
/// 轨迹内容服务
/// </summary>
[ApiExplorerSettings(GroupName = "轨迹内容")]
[Route("/Track/Content")]
public class TrackContentService : ApplicationService
{ {
/// <summary>
/// 轨迹内容服务
/// </summary>
[ApiExplorerSettings(GroupName = "轨迹内容")]
[Route("/Track/Content")]
public class TrackContentService : ApplicationService, ITransientDependency
{
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer; private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
private readonly ITrackContentRepository _trackContentRepository; private readonly ITrackContentRepository _trackContentRepository;
private readonly IBasicQuery<TrackContentMapEntity> _trackContentMapBasicQuery;
private readonly IBasicQuery<TrackTemplateContentEntity> _trackTemplateContentBasicQuery;
public TrackContentService( public TrackContentService(
IStringLocalizer<TrackLocalizationResource> stringLocalizer, IStringLocalizer<TrackLocalizationResource> stringLocalizer,
ITrackContentRepository trackContentRepository, ITrackContentRepository trackContentRepository
IBasicQuery<TrackContentMapEntity> trackContentMapBasicQuery,
IBasicQuery<TrackTemplateContentEntity> trackTemplateContentBasicQuery
) )
{ {
this._stringLocalizer = stringLocalizer; _stringLocalizer = stringLocalizer;
this._trackContentRepository = trackContentRepository; _trackContentRepository = trackContentRepository;
this._trackContentMapBasicQuery = trackContentMapBasicQuery;
this._trackTemplateContentBasicQuery = trackTemplateContentBasicQuery;
} }
/// <summary> /// <summary>
@ -106,11 +97,13 @@ namespace SJZY.Track.Application.Services.TrackContents
{ {
throw new BusinessException(message: "该子系统下轨迹代码已存在"); throw new BusinessException(message: "该子系统下轨迹代码已存在");
} }
var contents = trackContentEntitys.FirstOrDefault(a => a.Content == input.Content); var contents = trackContentEntitys.FirstOrDefault(a => a.Content == input.Content);
if (contents != null) if (contents != null)
{ {
throw new BusinessException(message: "该子系统下轨迹内容已存在"); throw new BusinessException(message: "该子系统下轨迹内容已存在");
} }
var contentEns = trackContentEntitys.FirstOrDefault(a => a.EnContent == input.EnContent); var contentEns = trackContentEntitys.FirstOrDefault(a => a.EnContent == input.EnContent);
if (contentEns != null) if (contentEns != null)
{ {
@ -143,11 +136,13 @@ namespace SJZY.Track.Application.Services.TrackContents
{ {
throw new BusinessException(message: "该子系统下轨迹代码已存在"); throw new BusinessException(message: "该子系统下轨迹代码已存在");
} }
var contents = trackContentEntitys.FirstOrDefault(a => a.Content == input.Content); var contents = trackContentEntitys.FirstOrDefault(a => a.Content == input.Content);
if (contents != null) if (contents != null)
{ {
throw new BusinessException(message: "该子系统下轨迹内容已存在"); throw new BusinessException(message: "该子系统下轨迹内容已存在");
} }
var contentEns = trackContentEntitys.FirstOrDefault(a => a.EnContent == input.EnContent); var contentEns = trackContentEntitys.FirstOrDefault(a => a.EnContent == input.EnContent);
if (contentEns != null) if (contentEns != null)
{ {
@ -160,7 +155,7 @@ namespace SJZY.Track.Application.Services.TrackContents
//更新的时候需要覆盖内容映射轨迹代码 //更新的时候需要覆盖内容映射轨迹代码
var templateEntity = await _trackContentRepository.GetFirstAsync(a => a.Id == input.Id); var templateEntity = await _trackContentRepository.GetFirstAsync(a => a.Id == input.Id);
bool isTrue = false; bool isTrue;
using (var ts = TransactionScopeHelper.Create()) using (var ts = TransactionScopeHelper.Create())
{ {
@ -193,6 +188,7 @@ namespace SJZY.Track.Application.Services.TrackContents
private async Task<UnifyResultDto> DeleteAsync(EditTrackContentInput input) private async Task<UnifyResultDto> DeleteAsync(EditTrackContentInput input)
{ {
#region 业务校验 #region 业务校验
//查询是否关联了轨迹模版内容 //查询是否关联了轨迹模版内容
var isExistTemplate = await _trackContentRepository.GetTemplateIsExist(input.Id); var isExistTemplate = await _trackContentRepository.GetTemplateIsExist(input.Id);
if (isExistTemplate) if (isExistTemplate)
@ -211,6 +207,7 @@ namespace SJZY.Track.Application.Services.TrackContents
//{ //{
// 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);
@ -226,7 +223,8 @@ namespace SJZY.Track.Application.Services.TrackContents
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("GetMapPage")] [HttpPost("GetMapPage")]
public async Task<UnifyPageResultDto<GetTrackContentMapPageOutputVO>> GetMapPageAsync([FromBody] GetTrackContentMapPageInputVO input) public async Task<UnifyPageResultDto<GetTrackContentMapPageOutputVO>> GetMapPageAsync(
[FromBody] GetTrackContentMapPageInputVO input)
{ {
return await _trackContentRepository.GetMapPageAsync(input); return await _trackContentRepository.GetMapPageAsync(input);
} }
@ -252,7 +250,8 @@ namespace SJZY.Track.Application.Services.TrackContents
{ {
if (input.Options != OptionTypeNoNull.删除) if (input.Options != OptionTypeNoNull.删除)
{ {
if (input.SubSystemId == input.MapSubSystemId) throw new BusinessException(message: _stringLocalizer["NotAllowedToMapSubSystem"]); if (input.SubSystemId == input.MapSubSystemId)
throw new BusinessException(message: _stringLocalizer["NotAllowedToMapSubSystem"]);
Expression<Func<TrackContentMapEntity, bool>> isMapAnyExp = x => Expression<Func<TrackContentMapEntity, bool>> isMapAnyExp = x =>
x.TrackContentId == input.TrackContentId && x.MapTrackContentId == input.MapTrackContentId; x.TrackContentId == input.TrackContentId && x.MapTrackContentId == input.MapTrackContentId;
@ -274,7 +273,8 @@ namespace SJZY.Track.Application.Services.TrackContents
case OptionTypeNoNull.修改: case OptionTypeNoNull.修改:
{ {
var oldTrackContentMapEntity = await _trackContentRepository.GetMapByIdAsync(input.Id!.Value) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]); var oldTrackContentMapEntity = await _trackContentRepository.GetMapByIdAsync(input.Id!.Value) ??
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
ObjectMapper.Map(input, oldTrackContentMapEntity); ObjectMapper.Map(input, oldTrackContentMapEntity);
@ -293,5 +293,4 @@ namespace SJZY.Track.Application.Services.TrackContents
return true; return true;
} }
}
} }

View File

@ -152,6 +152,7 @@ public class TrackPullService : ApplicationService
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);
await _trackPullCacheService.SetPullConfigAsync(input.Id);
ts.Complete(); ts.Complete();
} }
@ -182,19 +183,19 @@ public class TrackPullService : ApplicationService
if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
x.TrackContentId == input.TrackContentId))) x.TrackContentId == input.TrackContentId)))
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentAny"]); throw new BusinessException(message: _stringLocalizer["IsTrackPullContentAny"]);
else if (!input.TrackContentCodeValue.IsNullOrWhiteSpace() && if (!input.TrackContentCodeValue.IsNullOrWhiteSpace() &&
await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
x.TrackContentCodeValue == input.TrackContentCodeValue))) x.TrackContentCodeValue == input.TrackContentCodeValue)))
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentCodeValueAny"]); throw new BusinessException(message: _stringLocalizer["IsTrackPullContentCodeValueAny"]);
else if (!input.TrackStatusValue.IsNullOrWhiteSpace() && if (!input.TrackStatusValue.IsNullOrWhiteSpace() &&
await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
x.TrackStatusValue == input.TrackStatusValue))) x.TrackStatusValue == input.TrackStatusValue)))
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentStatusValueAny"]); throw new BusinessException(message: _stringLocalizer["IsTrackPullContentStatusValueAny"]);
else if (!input.TrackContentValue.IsNullOrWhiteSpace() && if (!input.TrackContentValue.IsNullOrWhiteSpace() &&
await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x => await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
x.TrackContentValue == input.TrackContentValue))) x.TrackContentValue == input.TrackContentValue)))
throw new BusinessException(message: _stringLocalizer["IsTrackPullContentValueAny"]); throw new BusinessException(message: _stringLocalizer["IsTrackPullContentValueAny"]);
else if (!input.TrackKeywords.IsNullOrEmpty()) if (!input.TrackKeywords.IsNullOrEmpty())
{ {
Expression<Func<TrackPullContentConfigEntity, bool>> trackKeywordExp = _ => false; Expression<Func<TrackPullContentConfigEntity, bool>> trackKeywordExp = _ => false;
input.TrackKeywords!.ForEach(item => input.TrackKeywords!.ForEach(item =>

View File

@ -1,10 +1,4 @@
using System; namespace SJZY.Track.Domain.Dtos.TrackContents
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SJZY.Track.Domain.Dtos.TrackContents
{ {
public class GetPageTrackContentVO : PageInfoInput public class GetPageTrackContentVO : PageInfoInput
{ {
@ -90,10 +84,5 @@ 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; }
} }
} }

View File

@ -1,10 +1,4 @@
using System; namespace SJZY.Track.Domain.Dtos.TrackContents
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SJZY.Track.Domain.Dtos.TrackContents
{ {
public class GetTrackContentDetailVO public class GetTrackContentDetailVO
{ {
@ -57,10 +51,5 @@ 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; }
} }
} }