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