add:轨迹标记、状态添加是否广播字段
This commit is contained in:
parent
ba868dc168
commit
b14a52776b
@ -40,7 +40,7 @@ public class EditTrackContentInput
|
||||
/// <summary>
|
||||
/// 轨迹标记id
|
||||
/// </summary>
|
||||
public int TrackFlagId { get; set; }
|
||||
public int[] TrackFlagIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否对外
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
namespace SJZY.Track.Application.Contract.Dtos.TrackFlags;
|
||||
namespace SJZY.Track.Application.Contract.Dtos.TrackFlags;
|
||||
|
||||
public class EditTrackFlagInput
|
||||
{
|
||||
@ -27,10 +27,10 @@ public class EditTrackFlagInput
|
||||
/// </summary>
|
||||
public string? Code { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// 是否完结
|
||||
///// </summary>
|
||||
//public bool IsFinish { get; set; }
|
||||
/// <summary>
|
||||
/// 是否广播
|
||||
/// </summary>
|
||||
public bool IsToMq { get; set; }
|
||||
}
|
||||
|
||||
public class GetTrackFlagDetailDto
|
||||
@ -56,7 +56,7 @@ public class GetTrackFlagDetailDto
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
public string Flag { get; set; }
|
||||
|
||||
|
||||
@ -41,4 +41,9 @@ public class EditTrackStatusInput
|
||||
/// 是否完结
|
||||
/// </summary>
|
||||
public bool IsCompleted { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否广播
|
||||
/// </summary>
|
||||
public bool IsToMq { get; set; }
|
||||
}
|
||||
|
||||
@ -187,6 +187,7 @@ public class TrackContentService : ApplicationService
|
||||
#endregion 业务逻辑校验
|
||||
|
||||
var entity = ObjectMapper.Map<EditTrackContentInput, TrackContentEntity>(input);
|
||||
entity.TrackFlagId = input.TrackFlagIds.JoinAsString(",");
|
||||
var isTrue = await _trackContentRepository.InsertAsync(entity);
|
||||
|
||||
return new UnifyResultDto(GlobalConst.SuccessCode, "新增成功", isTrue);
|
||||
@ -254,7 +255,7 @@ public class TrackContentService : ApplicationService
|
||||
}
|
||||
|
||||
ObjectMapper.Map(input, trackContent);
|
||||
|
||||
trackContent.TrackFlagId = input.TrackFlagIds.JoinAsString(",");
|
||||
isTrue = await _trackContentRepository.UpdateAsync(trackContent);
|
||||
|
||||
ts.Complete();
|
||||
|
||||
@ -92,8 +92,6 @@ public class TrackFlagService : ApplicationService, ITransientDependency
|
||||
a.SubSystemId == input.SubSystemId && (a.Code == input.Code || a.Name == input.Flag));
|
||||
if (trackFlagsEntitys.Any())
|
||||
{
|
||||
//throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]);
|
||||
//throw new BusinessException(message: "当前子系统下已存在轨迹标记代码");
|
||||
var trackFlagCode = trackFlagsEntitys.FirstOrDefault(a => a.Code == input.Code);
|
||||
if (trackFlagCode != null)
|
||||
{
|
||||
@ -125,8 +123,6 @@ public class TrackFlagService : ApplicationService, ITransientDependency
|
||||
a.Name == input.Flag));
|
||||
if (trackFlagsEntitys.Any())
|
||||
{
|
||||
//throw new BusinessException(message: _stringLocalizer["TrackFlagExist"]);
|
||||
//throw new BusinessException(message: "当前子系统下已存在轨迹标记代码");
|
||||
var trackFlagCode = trackFlagsEntitys.FirstOrDefault(a => a.Code == input.Code);
|
||||
if (trackFlagCode != null)
|
||||
{
|
||||
@ -142,9 +138,14 @@ public class TrackFlagService : ApplicationService, ITransientDependency
|
||||
|
||||
#endregion
|
||||
|
||||
var templateEntity = await _trackFlagRepository.GetFirstAsync(a => a.Id == input.Id);
|
||||
ObjectMapper.Map(input, templateEntity);
|
||||
var isTrue = await _trackFlagRepository.UpdateAsync(templateEntity);
|
||||
var trackFlag = await _trackFlagRepository.GetFirstAsync(a => a.Id == input.Id);
|
||||
if (trackFlag == null)
|
||||
{
|
||||
throw new BusinessException(message: "轨迹标记不存在");
|
||||
}
|
||||
|
||||
ObjectMapper.Map(input, trackFlag);
|
||||
var isTrue = await _trackFlagRepository.UpdateAsync(trackFlag);
|
||||
|
||||
return new UnifyResultDto(GlobalConst.SuccessCode, "修改成功", isTrue);
|
||||
}
|
||||
@ -157,7 +158,6 @@ public class TrackFlagService : ApplicationService, ITransientDependency
|
||||
await _trackContentRepository.GetFirstAsync(a => SqlFunc.SplitIn(a.TrackFlagId, input.Id.ToString()));
|
||||
if (isExistContent != null)
|
||||
{
|
||||
//throw new BusinessException(message: _stringLocalizer["IsExistTrackFlag"]);
|
||||
throw new BusinessException(message: "该标记关联轨迹内容,禁止删除");
|
||||
}
|
||||
|
||||
|
||||
@ -1,10 +1,7 @@
|
||||
using Microsoft.Extensions.Localization;
|
||||
using SJZY.Track.Application.Contract.Dtos.TrackStatus;
|
||||
using SJZY.Track.Application.Localization;
|
||||
using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
||||
using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
|
||||
using SJZY.Track.Domain.Dtos.TrackStatus;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
|
||||
namespace SJZY.Track.Application.Services.TrackStatus;
|
||||
|
||||
@ -13,21 +10,18 @@ namespace SJZY.Track.Application.Services.TrackStatus;
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "轨迹状态")]
|
||||
[Route("/Track/Status")]
|
||||
public class TrackStatusService : ApplicationService, ITransientDependency
|
||||
public class TrackStatusService : ApplicationService
|
||||
{
|
||||
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
|
||||
private readonly ITrackContentRepository _trackContentRepository;
|
||||
private readonly ITrackStatusRepository _trackStatusRepository;
|
||||
|
||||
public TrackStatusService(
|
||||
IStringLocalizer<TrackLocalizationResource> stringLocalizer,
|
||||
ITrackStatusRepository trackStatusRepository,
|
||||
ITrackContentRepository trackContentRepository
|
||||
)
|
||||
{
|
||||
this._stringLocalizer = stringLocalizer;
|
||||
this._trackStatusRepository = trackStatusRepository;
|
||||
this._trackContentRepository = trackContentRepository;
|
||||
_trackStatusRepository = trackStatusRepository;
|
||||
_trackContentRepository = trackContentRepository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -92,8 +86,6 @@ public class TrackStatusService : ApplicationService, ITransientDependency
|
||||
a.Status == input.TrackStatus || a.EnStatus == input.EnTrackStatus));
|
||||
if (trackStatusEntitys.Any())
|
||||
{
|
||||
//throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]);
|
||||
//throw new BusinessException(message: "当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在");
|
||||
var trackStatusCode = trackStatusEntitys.FirstOrDefault(t => t.Code == input.Code);
|
||||
if (trackStatusCode != null)
|
||||
{
|
||||
@ -130,8 +122,6 @@ public class TrackStatusService : ApplicationService, ITransientDependency
|
||||
a.Status == input.TrackStatus || a.EnStatus == input.EnTrackStatus));
|
||||
if (trackStatusEntitys.Any())
|
||||
{
|
||||
//throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]);
|
||||
//throw new BusinessException(message: "当前子系统下,轨迹状态代码或轨迹状态或轨迹状态英文存在");
|
||||
var trackStatusCode = trackStatusEntitys.FirstOrDefault(t => t.Code == input.Code);
|
||||
if (trackStatusCode != null)
|
||||
{
|
||||
@ -153,9 +143,14 @@ public class TrackStatusService : ApplicationService, ITransientDependency
|
||||
|
||||
#endregion
|
||||
|
||||
var templateEntity = await _trackStatusRepository.GetFirstAsync(a => a.Id == input.Id);
|
||||
ObjectMapper.Map(input, templateEntity);
|
||||
var isTrue = await _trackStatusRepository.UpdateAsync(templateEntity);
|
||||
var trackStatus = await _trackStatusRepository.GetFirstAsync(a => a.Id == input.Id);
|
||||
if (trackStatus == null)
|
||||
{
|
||||
throw new BusinessException(message: "轨迹状态不存在");
|
||||
}
|
||||
|
||||
ObjectMapper.Map(input, trackStatus);
|
||||
var isTrue = await _trackStatusRepository.UpdateAsync(trackStatus);
|
||||
|
||||
return new UnifyResultDto(GlobalConst.SuccessCode, "修改成功", isTrue);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user