Merge branch 'dev' of http://192.168.80.50:3000/Dotnet/SJZY.Track.Api into dev
This commit is contained in:
commit
e4da002a82
@ -0,0 +1,41 @@
|
|||||||
|
namespace SJZY.Track.Application.Contract.Dtos.TrackContents;
|
||||||
|
|
||||||
|
public class EditTrackContentMapInput
|
||||||
|
{
|
||||||
|
public int? Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 映射子系统id
|
||||||
|
/// </summary>
|
||||||
|
public int MapSubSystemId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 映射轨迹内容代码
|
||||||
|
/// </summary>
|
||||||
|
public string MapTrackContentCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 映射轨迹内容id
|
||||||
|
/// </summary>
|
||||||
|
public int MapTrackContentId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 操作类型
|
||||||
|
/// </summary>
|
||||||
|
public OptionTypeNoNull Options { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 源子系统id
|
||||||
|
/// </summary>
|
||||||
|
public int SubSystemId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 源轨迹内容代码
|
||||||
|
/// </summary>
|
||||||
|
public string TrackContentCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 源轨迹内容id
|
||||||
|
/// </summary>
|
||||||
|
public int TrackContentId { get; set; }
|
||||||
|
}
|
||||||
@ -37,27 +37,27 @@ public class EditTrackPullConfigInput
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 拉取轨迹时区
|
/// 拉取轨迹时区
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TackTimeZoneName { get; set; }
|
public string? TackTimeZoneName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 拉取轨迹内容代码
|
/// 拉取轨迹内容代码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TrackContentCodeName { get; set; }
|
public string? TrackContentCodeName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 拉取轨迹内容
|
/// 拉取轨迹内容
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TrackContentName { get; set; }
|
public string? TrackContentName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 拉取轨迹发生地
|
/// 拉取轨迹发生地
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TrackPlaceName { get; set; }
|
public string? TrackPlaceName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 拉取轨迹状态
|
/// 拉取轨迹状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TrackStatusName { get; set; }
|
public string? TrackStatusName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹模板id
|
/// 轨迹模板id
|
||||||
@ -67,5 +67,5 @@ public class EditTrackPullConfigInput
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 拉取轨迹发生时间
|
/// 拉取轨迹发生时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TrackTimeName { get; set; }
|
public string? TrackTimeName { get; set; }
|
||||||
}
|
}
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
|
||||||
|
|
||||||
|
public class SortTrackPushContentInput
|
||||||
|
{
|
||||||
|
}
|
||||||
@ -15,6 +15,7 @@ namespace SJZY.Track.Application.AutoMapper
|
|||||||
CreateMap<GetTrackContentListVO, GetTrackContentListDto>(MemberList.None);
|
CreateMap<GetTrackContentListVO, GetTrackContentListDto>(MemberList.None);
|
||||||
CreateMap<UnifyPageResultDto<GetTrackContentListVO>, UnifyPageResultDto<GetTrackContentListDto>>(
|
CreateMap<UnifyPageResultDto<GetTrackContentListVO>, UnifyPageResultDto<GetTrackContentListDto>>(
|
||||||
MemberList.None);
|
MemberList.None);
|
||||||
|
CreateMap<EditTrackContentMapInput, TrackContentMapEntity>(MemberList.None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,8 +1,14 @@
|
|||||||
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.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.Dtos.TrackContents;
|
using SJZY.Track.Domain.Dtos.TrackContents;
|
||||||
|
using System.Linq.Expressions;
|
||||||
using Volo.Abp.DependencyInjection;
|
using Volo.Abp.DependencyInjection;
|
||||||
|
|
||||||
namespace SJZY.Track.Application.Services.TrackContents
|
namespace SJZY.Track.Application.Services.TrackContents
|
||||||
@ -93,7 +99,7 @@ namespace SJZY.Track.Application.Services.TrackContents
|
|||||||
throw new BusinessException(message: _stringLocalizer["TrackContentExist"]);
|
throw new BusinessException(message: _stringLocalizer["TrackContentExist"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion 业务逻辑校验
|
||||||
|
|
||||||
var entity = ObjectMapper.Map<EditTrackContentInput, TrackContentEntity>(input);
|
var entity = ObjectMapper.Map<EditTrackContentInput, TrackContentEntity>(input);
|
||||||
var isTrue = await _trackContentRepository.InsertAsync(entity);
|
var isTrue = await _trackContentRepository.InsertAsync(entity);
|
||||||
@ -104,6 +110,7 @@ namespace SJZY.Track.Application.Services.TrackContents
|
|||||||
private async Task<UnifyResultDto> UpdateAsync(EditTrackContentInput input)
|
private async Task<UnifyResultDto> UpdateAsync(EditTrackContentInput input)
|
||||||
{
|
{
|
||||||
#region 业务逻辑校验
|
#region 业务逻辑校验
|
||||||
|
|
||||||
var trackContentEntity = await _trackContentRepository.GetFirstAsync(a => a.Id != input.Id &&
|
var trackContentEntity = await _trackContentRepository.GetFirstAsync(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));
|
||||||
@ -111,11 +118,38 @@ namespace SJZY.Track.Application.Services.TrackContents
|
|||||||
{
|
{
|
||||||
throw new BusinessException(message: _stringLocalizer["TrackContentExist"]);
|
throw new BusinessException(message: _stringLocalizer["TrackContentExist"]);
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
#endregion 业务逻辑校验
|
||||||
|
|
||||||
//更新的时候需要覆盖内容映射轨迹代码
|
//更新的时候需要覆盖内容映射轨迹代码
|
||||||
var templateEntity = await _trackContentRepository.GetFirstAsync(a => a.Id == input.Id);
|
var templateEntity = await _trackContentRepository.GetFirstAsync(a => a.Id == input.Id);
|
||||||
|
|
||||||
|
bool isTrue = false;
|
||||||
|
|
||||||
|
using (var ts = TransactionScopeHelper.Create())
|
||||||
|
{
|
||||||
|
// 如果轨迹内容的子系统和code发生变化,同步到轨迹映射表
|
||||||
|
if (templateEntity.SubSystemId != input.SubSystemId || templateEntity.Code != input.Code)
|
||||||
|
{
|
||||||
|
await _trackContentRepository.UpdateMapAsync(x => new TrackContentMapEntity
|
||||||
|
{
|
||||||
|
SubSystemId = input.SubSystemId,
|
||||||
|
TrackContentCode = input.Code
|
||||||
|
}, x => x.TrackContentId == input.Id);
|
||||||
|
|
||||||
|
await _trackContentRepository.UpdateMapAsync(x => new TrackContentMapEntity
|
||||||
|
{
|
||||||
|
MapSubSystemId = input.SubSystemId,
|
||||||
|
MapTrackContentCode = input.Code
|
||||||
|
}, x => x.MapTrackContentId == input.Id);
|
||||||
|
}
|
||||||
|
|
||||||
ObjectMapper.Map(input, templateEntity);
|
ObjectMapper.Map(input, templateEntity);
|
||||||
var isTrue = await _trackContentRepository.UpdateAsync(templateEntity);
|
|
||||||
|
isTrue = await _trackContentRepository.UpdateAsync(templateEntity);
|
||||||
|
|
||||||
|
ts.Complete();
|
||||||
|
}
|
||||||
|
|
||||||
return new UnifyResultDto("200", "修改成功", isTrue);
|
return new UnifyResultDto("200", "修改成功", isTrue);
|
||||||
}
|
}
|
||||||
@ -123,13 +157,88 @@ namespace SJZY.Track.Application.Services.TrackContents
|
|||||||
private async Task<UnifyResultDto> DeleteAsync(EditTrackContentInput input)
|
private async Task<UnifyResultDto> DeleteAsync(EditTrackContentInput input)
|
||||||
{
|
{
|
||||||
#region 业务校验
|
#region 业务校验
|
||||||
|
|
||||||
//需要加个判断,存在内容映射,则出提示
|
//需要加个判断,存在内容映射,则出提示
|
||||||
#endregion
|
|
||||||
|
#endregion 业务校验
|
||||||
|
|
||||||
var isTrue = await _trackContentRepository.SoftDeleteAsync(x => x.Id == input.Id);
|
var isTrue = await _trackContentRepository.SoftDeleteAsync(x => x.Id == input.Id);
|
||||||
|
|
||||||
return new UnifyResultDto("200", "删除成功", isTrue);
|
return new UnifyResultDto("200", "删除成功", isTrue);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion 私有方法
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹内容映射列表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("GetMapPage")]
|
||||||
|
public async Task<UnifyPageResultDto<GetTrackContentMapPageOutputVO>> GetMapPageAsync([FromBody] GetTrackContentMapPageInputVO input)
|
||||||
|
{
|
||||||
|
return await _trackContentRepository.GetMapPageAsync(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹内容映射详情
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("GetMapDetail")]
|
||||||
|
public async Task<GetTrackContentMapDetailOutputVO> GetMapDetailAsync(int id)
|
||||||
|
{
|
||||||
|
return await _trackContentRepository.GetMapDetailAsync(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹内容映射编辑
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("EditMap")]
|
||||||
|
public async Task<bool> EditMapAsync([FromBody] EditTrackContentMapInput input)
|
||||||
|
{
|
||||||
|
if (input.Options != OptionTypeNoNull.删除)
|
||||||
|
{
|
||||||
|
Expression<Func<TrackContentMapEntity, bool>> isMapAnyExp = x =>
|
||||||
|
x.TrackContentId == input.TrackContentId && x.MapTrackContentId == input.MapTrackContentId;
|
||||||
|
if (input.Options == OptionTypeNoNull.修改) isMapAnyExp.And(x => x.Id != input.Id);
|
||||||
|
|
||||||
|
if (await _trackContentRepository.IsMapAnyAsync(isMapAnyExp))
|
||||||
|
throw new BusinessException(message: _stringLocalizer["IsTrackContentMapAny"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (input.Options)
|
||||||
|
{
|
||||||
|
case OptionTypeNoNull.新增:
|
||||||
|
{
|
||||||
|
var trackContentMapEntity = ObjectMapper.Map<EditTrackContentMapInput, TrackContentMapEntity>(input);
|
||||||
|
|
||||||
|
await _trackContentRepository.InsertMapAsync(trackContentMapEntity);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OptionTypeNoNull.修改:
|
||||||
|
{
|
||||||
|
var oldTrackContentMapEntity = await _trackContentRepository.GetMapByIdAsync(input.Id!.Value) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
||||||
|
|
||||||
|
ObjectMapper.Map(input, oldTrackContentMapEntity);
|
||||||
|
|
||||||
|
await _trackContentRepository.UpdateMapAsync(oldTrackContentMapEntity);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OptionTypeNoNull.删除:
|
||||||
|
await _trackContentRepository.SoftDeleteMapAsync(x => x.Id == input.Id);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum,
|
||||||
|
nameof(EditTrackContentMapInput.Options)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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,12 +153,18 @@ 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.删除:
|
||||||
|
{
|
||||||
|
var oldTrackPushEntity = await _trackPushConfigRepository.GetFirstAsync(x => x.Id == input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
||||||
|
|
||||||
using (var ts = TransactionScopeHelper.Create())
|
using (var ts = TransactionScopeHelper.Create())
|
||||||
{
|
{
|
||||||
await _trackPushConfigRepository.SoftDeleteAsync(x => x.Id == input.Id);
|
await _trackPushConfigRepository.SoftDeleteAsync(x => x.Id == input.Id);
|
||||||
@ -160,9 +172,11 @@ 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);
|
||||||
|
|
||||||
ts.Complete();
|
ts.Complete();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -223,4 +237,15 @@ public class TrackPushService : ApplicationService, ITransientDependency
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹推送配置内容排序
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("SortContent")]
|
||||||
|
public async Task<bool> SortContentAsync([FromBody] SortTrackPushContentInput input)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
|
|||||||
{
|
{
|
||||||
_stringLocalizer = stringLocalizer;
|
_stringLocalizer = stringLocalizer;
|
||||||
_trackTemplateRepository = trackTemplateRepository;
|
_trackTemplateRepository = trackTemplateRepository;
|
||||||
_trackPullConfigRepository=trackPullConfigRepository;
|
_trackPullConfigRepository = trackPullConfigRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -100,7 +100,7 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
|
|||||||
throw new BusinessException("轨迹代码重复");
|
throw new BusinessException("轨迹代码重复");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion 业务校验
|
||||||
|
|
||||||
var entity = ObjectMapper.Map<EditTrackTemplateInput, TrackTemplateEntity>(input);
|
var entity = ObjectMapper.Map<EditTrackTemplateInput, TrackTemplateEntity>(input);
|
||||||
var isTrue = await _trackTemplateRepository.InsertAsync(entity);
|
var isTrue = await _trackTemplateRepository.InsertAsync(entity);
|
||||||
@ -111,13 +111,15 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
|
|||||||
private async Task<UnifyResultDto> UpdateAsync(EditTrackTemplateInput input)
|
private async Task<UnifyResultDto> UpdateAsync(EditTrackTemplateInput input)
|
||||||
{
|
{
|
||||||
#region 业务校验
|
#region 业务校验
|
||||||
|
|
||||||
var isExist = await _trackTemplateRepository.GetFirstAsync(a =>
|
var isExist = await _trackTemplateRepository.GetFirstAsync(a =>
|
||||||
a.Id != input.Id && a.SubSystemId == input.SubSystemId && a.Code == input.Code);
|
a.Id != input.Id && a.SubSystemId == input.SubSystemId && a.Code == input.Code);
|
||||||
if (isExist != null)
|
if (isExist != null)
|
||||||
{
|
{
|
||||||
throw new BusinessException(message: _stringLocalizer["TemplateExist"]);
|
throw new BusinessException(message: _stringLocalizer["TemplateExist"]);
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
#endregion 业务校验
|
||||||
|
|
||||||
var templateEntity = await _trackTemplateRepository.GetFirstAsync(a => a.Id == input.Id);
|
var templateEntity = await _trackTemplateRepository.GetFirstAsync(a => a.Id == input.Id);
|
||||||
ObjectMapper.Map(input, templateEntity);
|
ObjectMapper.Map(input, templateEntity);
|
||||||
@ -129,13 +131,15 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
|
|||||||
private async Task<UnifyResultDto> DeleteAsync(EditTrackTemplateInput input)
|
private async Task<UnifyResultDto> DeleteAsync(EditTrackTemplateInput input)
|
||||||
{
|
{
|
||||||
#region 业务校验
|
#region 业务校验
|
||||||
|
|
||||||
//查询看看在轨迹拉取里面有没有被占用
|
//查询看看在轨迹拉取里面有没有被占用
|
||||||
var isExisistTrackPullConfig = await _trackPullConfigRepository.GetFirstAsync(a => a.TrackTemplateId==input.Id);
|
var isExisistTrackPullConfig = await _trackPullConfigRepository.GetFirstAsync(a => a.TrackTemplateId == input.Id);
|
||||||
if (isExisistTrackPullConfig!=null)
|
if (isExisistTrackPullConfig != null)
|
||||||
{
|
{
|
||||||
throw new BusinessException(message: _stringLocalizer["IsExistTrackPullConfig"]);
|
throw new BusinessException(message: _stringLocalizer["IsExistTrackPullConfig"]);
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
#endregion 业务校验
|
||||||
|
|
||||||
var isTrue = await _trackTemplateRepository.SoftDeleteAsync(x => x.Id == input.Id);
|
var isTrue = await _trackTemplateRepository.SoftDeleteAsync(x => x.Id == input.Id);
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,26 @@
|
|||||||
using SJZY.Track.Domain.Dtos.TrackContents;
|
using SJZY.Track.Domain.Dtos.TrackContents;
|
||||||
using SJZY.Track.Domain.Dtos.TrackStatus;
|
|
||||||
|
|
||||||
namespace SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
namespace SJZY.Track.Domain.Aggregates.TrackContentAggregate;
|
||||||
|
|
||||||
public interface ITrackContentRepository : IBasicRepository<TrackContentEntity>
|
public interface ITrackContentRepository : IBasicRepository<TrackContentEntity>
|
||||||
{
|
{
|
||||||
Task<GetTrackContentDetailVO?> GetDetailAsync(int id);
|
Task<GetTrackContentDetailVO?> GetDetailAsync(int id);
|
||||||
|
|
||||||
Task<UnifyPageResultDto<GetTrackContentListVO>> GetPageTrackContent(GetPageTrackContentVO input);
|
Task<UnifyPageResultDto<GetTrackContentListVO>> GetPageTrackContent(GetPageTrackContentVO input);
|
||||||
|
|
||||||
|
Task<UnifyPageResultDto<GetTrackContentMapPageOutputVO>> GetMapPageAsync(GetTrackContentMapPageInputVO input);
|
||||||
|
|
||||||
|
Task<GetTrackContentMapDetailOutputVO> GetMapDetailAsync(int id);
|
||||||
|
|
||||||
|
Task<bool> IsMapAnyAsync(Expression<Func<TrackContentMapEntity, bool>> whereExpression);
|
||||||
|
|
||||||
|
Task<bool> InsertMapAsync(TrackContentMapEntity insertObj);
|
||||||
|
|
||||||
|
Task<TrackContentMapEntity> GetMapByIdAsync(int id);
|
||||||
|
|
||||||
|
Task<bool> UpdateMapAsync(TrackContentMapEntity updateObj);
|
||||||
|
|
||||||
|
Task<bool> SoftDeleteMapAsync(Expression<Func<TrackContentMapEntity, bool>> whereExpression);
|
||||||
|
|
||||||
|
Task<bool> UpdateMapAsync(Expression<Func<TrackContentMapEntity, TrackContentMapEntity>> columns, Expression<Func<TrackContentMapEntity, bool>> whereExpression);
|
||||||
}
|
}
|
||||||
@ -15,5 +15,5 @@ public class KeywordsInputVO : PageInfoInput
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 选中项
|
/// 选中项
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int? SelectedId { get; set; }
|
public List<int>? SelectedId { get; set; }
|
||||||
}
|
}
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
namespace SJZY.Track.Domain.Dtos.TrackContents;
|
||||||
|
|
||||||
|
public class GetTrackContentMapDetailOutputVO
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 映射子系统
|
||||||
|
/// </summary>
|
||||||
|
public string MapSubSystem { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 映射子系统id
|
||||||
|
/// </summary>
|
||||||
|
public int MapSubSystemId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 映射轨迹内容
|
||||||
|
/// </summary>
|
||||||
|
public string MapTrackContent { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 映射轨迹内容id
|
||||||
|
/// </summary>
|
||||||
|
public int MapTrackContentId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 子系统
|
||||||
|
/// </summary>
|
||||||
|
public string SubSystem { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 子系统id
|
||||||
|
/// </summary>
|
||||||
|
public int SubSystemId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 源轨迹内容
|
||||||
|
/// </summary>
|
||||||
|
public string TrackContent { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 源轨迹内容id
|
||||||
|
/// </summary>
|
||||||
|
public int TrackContentId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 源轨迹内容代码
|
||||||
|
/// </summary>
|
||||||
|
public string TrackContentCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 映射轨迹内容代码
|
||||||
|
/// </summary>
|
||||||
|
public string MapTrackContentCode { get; set; }
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
using SJZY.Track.Domain.Dtos.Common;
|
||||||
|
|
||||||
|
namespace SJZY.Track.Domain.Dtos.TrackContents;
|
||||||
|
|
||||||
|
public class GetTrackContentMapPageInputVO : KeywordsInputVO
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 映射子系统id
|
||||||
|
/// </summary>
|
||||||
|
public int? MapSubSystemId { get; set; }
|
||||||
|
}
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
namespace SJZY.Track.Domain.Dtos.TrackContents;
|
||||||
|
|
||||||
|
public class GetTrackContentMapPageOutputVO
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹内容代码
|
||||||
|
/// </summary>
|
||||||
|
public string Code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹内容
|
||||||
|
/// </summary>
|
||||||
|
public string Content { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹内容英文
|
||||||
|
/// </summary>
|
||||||
|
public string EnContent { get; set; }
|
||||||
|
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 映射轨迹内容代码
|
||||||
|
/// </summary>
|
||||||
|
public string MapCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 映射内容
|
||||||
|
/// </summary>
|
||||||
|
public string MapContent { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 映射内容英文
|
||||||
|
/// </summary>
|
||||||
|
public string MapEnContent { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 映射子系统
|
||||||
|
/// </summary>
|
||||||
|
public string MapSubSystem { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 映射轨迹状态
|
||||||
|
/// </summary>
|
||||||
|
public string MapTrackStatus { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 子系统
|
||||||
|
/// </summary>
|
||||||
|
public string SubSystem { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹状态
|
||||||
|
/// </summary>
|
||||||
|
public string TrackStatus { get; set; }
|
||||||
|
}
|
||||||
@ -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>
|
||||||
|
|||||||
@ -23,4 +23,14 @@ public class GetTrackPushConfigPageOutputVO
|
|||||||
/// 模板名称
|
/// 模板名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TrackTemplate { get; set; }
|
public string TrackTemplate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹模板id
|
||||||
|
/// </summary>
|
||||||
|
public string TrackTemplateId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹模板ids
|
||||||
|
/// </summary>
|
||||||
|
public List<int> TrackTemplateIds { get; set; }
|
||||||
}
|
}
|
||||||
@ -5,5 +5,5 @@ public class GetTrackTemplateContentPageInputVO : PageInfoInput
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 轨迹模板id
|
/// 轨迹模板id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int TrackTemplateId { get; set; }
|
public List<int> TrackTemplateIds { get; set; }
|
||||||
}
|
}
|
||||||
@ -68,4 +68,9 @@ public class GetTrackTemplateContentPageOutputVO
|
|||||||
/// 修改人
|
/// 修改人
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string UpdateUser { get; set; }
|
public string UpdateUser { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 轨迹内容id
|
||||||
|
/// </summary>
|
||||||
|
public int TrackContentId { get; set; }
|
||||||
}
|
}
|
||||||
@ -11,4 +11,9 @@ public class GlobalConst
|
|||||||
/// 轨迹新增/更新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";
|
||||||
}
|
}
|
||||||
@ -3,15 +3,15 @@ using SJZY.Track.Domain.Aggregates.TrackFlagAggregate;
|
|||||||
using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
|
||||||
using SJZY.Track.Domain.Dtos.TrackContents;
|
using SJZY.Track.Domain.Dtos.TrackContents;
|
||||||
using SJZY.Track.Domain.VEntities;
|
using SJZY.Track.Domain.VEntities;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
|
||||||
namespace SJZY.Track.Repository.Repositories;
|
namespace SJZY.Track.Repository.Repositories;
|
||||||
|
|
||||||
public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrackContentRepository, IScopedDependency
|
public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrackContentRepository, IScopedDependency
|
||||||
{
|
{
|
||||||
|
|
||||||
public TrackContentRepository()
|
public TrackContentRepository()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -24,20 +24,20 @@ public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrac
|
|||||||
var detail = await Context.Queryable<TrackContentEntity>()
|
var detail = await Context.Queryable<TrackContentEntity>()
|
||||||
.LeftJoin<TrackStatusEntity>((a, b) => a.TrackStatusId == b.Id && b.IsDeleted == false)
|
.LeftJoin<TrackStatusEntity>((a, b) => a.TrackStatusId == b.Id && b.IsDeleted == false)
|
||||||
.LeftJoin<TrackFlagEntity>((a, b, c) => a.TrackFlagId == c.Id && c.IsDeleted == false)
|
.LeftJoin<TrackFlagEntity>((a, b, c) => a.TrackFlagId == c.Id && c.IsDeleted == false)
|
||||||
.LeftJoin<VSystemEntity>((a, b, c, d) => a.SubSystemId == d.Id&&d.IsDeleted==false)
|
.LeftJoin<VSystemEntity>((a, b, c, d) => a.SubSystemId == d.Id && d.IsDeleted == false)
|
||||||
.Where((a, b, c, d) => a.Id == id)
|
.Where((a, b, c, d) => a.Id == id)
|
||||||
.Select((a, b, c, d) => new GetTrackContentDetailVO
|
.Select((a, b, c, d) => new GetTrackContentDetailVO
|
||||||
{
|
{
|
||||||
Id = a.Id,
|
Id = a.Id,
|
||||||
SubSystemId = a.SubSystemId,
|
SubSystemId = a.SubSystemId,
|
||||||
SubSystem = d.CnName,
|
SubSystem = d.CnName,
|
||||||
TrackStatusId=a.TrackStatusId,
|
TrackStatusId = a.TrackStatusId,
|
||||||
TrackStatus= b.Status,
|
TrackStatus = b.Status,
|
||||||
Code = a.Code,
|
Code = a.Code,
|
||||||
Content = a.Content,
|
Content = a.Content,
|
||||||
EnContent = a.EnContent,
|
EnContent = a.EnContent,
|
||||||
TrackFlagId=a.TrackFlagId,
|
TrackFlagId = a.TrackFlagId,
|
||||||
TrackFlag=c.Name
|
TrackFlag = c.Name
|
||||||
})
|
})
|
||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
return detail;
|
return detail;
|
||||||
@ -52,8 +52,8 @@ public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrac
|
|||||||
{
|
{
|
||||||
UnifyPageResultDto<GetTrackContentListVO> pagedList = new UnifyPageResultDto<GetTrackContentListVO>();
|
UnifyPageResultDto<GetTrackContentListVO> pagedList = new UnifyPageResultDto<GetTrackContentListVO>();
|
||||||
pagedList = await Context.Queryable<TrackContentEntity>()
|
pagedList = await Context.Queryable<TrackContentEntity>()
|
||||||
.LeftJoin<TrackStatusEntity>((a, b) => a.TrackStatusId==b.Id&&b.IsDeleted==false)
|
.LeftJoin<TrackStatusEntity>((a, b) => a.TrackStatusId == b.Id && b.IsDeleted == false)
|
||||||
.LeftJoin<TrackFlagEntity>((a, b, c) => a.TrackFlagId==c.Id&&c.IsDeleted==false)
|
.LeftJoin<TrackFlagEntity>((a, b, c) => a.TrackFlagId == c.Id && c.IsDeleted == false)
|
||||||
.LeftJoin<VSystemEntity>((a, b, c, d) => a.SubSystemId == d.Id && d.IsDeleted == false)
|
.LeftJoin<VSystemEntity>((a, b, c, d) => a.SubSystemId == d.Id && d.IsDeleted == false)
|
||||||
.LeftJoin<VUserEntity>((a, b, c, d, e) => a.CreateUserId == e.Id && e.IsDeleted == false)
|
.LeftJoin<VUserEntity>((a, b, c, d, e) => a.CreateUserId == e.Id && e.IsDeleted == false)
|
||||||
.LeftJoin<VUserEntity>((a, b, c, d, e, f) => a.UpdateUserId == f.Id && f.IsDeleted == false)
|
.LeftJoin<VUserEntity>((a, b, c, d, e, f) => a.UpdateUserId == f.Id && f.IsDeleted == false)
|
||||||
@ -71,11 +71,11 @@ public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrac
|
|||||||
Code = a.Code,
|
Code = a.Code,
|
||||||
Content = a.Content,
|
Content = a.Content,
|
||||||
EnContent = a.EnContent,
|
EnContent = a.EnContent,
|
||||||
TrackStatus= b.Status,
|
TrackStatus = b.Status,
|
||||||
Node = SqlFunc.IF(b.Node == 1).Return("揽收").ElseIF(b.Node == 2).Return("干线").ElseIF(b.Node == 3).Return("清关")
|
Node = SqlFunc.IF(b.Node == 1).Return("揽收").ElseIF(b.Node == 2).Return("干线").ElseIF(b.Node == 3).Return("清关")
|
||||||
.ElseIF(b.Node == 4).Return("中转").ElseIF(b.Node == 5).Return("派送")
|
.ElseIF(b.Node == 4).Return("中转").ElseIF(b.Node == 5).Return("派送")
|
||||||
.End(""),
|
.End(""),
|
||||||
TrackFlag= c.Name,
|
TrackFlag = c.Name,
|
||||||
CreateTime = a.CreateTime,
|
CreateTime = a.CreateTime,
|
||||||
CreateUser = e.Name,
|
CreateUser = e.Name,
|
||||||
UpdateTime = a.UpdateTime,
|
UpdateTime = a.UpdateTime,
|
||||||
@ -83,10 +83,95 @@ public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrac
|
|||||||
})
|
})
|
||||||
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||||
|
|
||||||
var ff = await Context.Queryable<TrackContentEntity>().Where(a => 1==1).ToListAsync();
|
var ff = await Context.Queryable<TrackContentEntity>().Where(a => 1 == 1).ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return pagedList;
|
return pagedList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<UnifyPageResultDto<GetTrackContentMapPageOutputVO>> GetMapPageAsync(GetTrackContentMapPageInputVO input)
|
||||||
|
{
|
||||||
|
return await Context.Queryable<TrackContentMapEntity>()
|
||||||
|
.InnerJoin<TrackContentEntity>((contentMap, sourceContent) => contentMap.TrackContentId == sourceContent.Id && !sourceContent.IsDeleted)
|
||||||
|
.InnerJoin<TrackContentEntity>((contentMap, sourceContent, targetContent) => contentMap.MapTrackContentId == targetContent.Id && !targetContent.IsDeleted)
|
||||||
|
.LeftJoin<VSystemEntity>((contentMap, sourceContent, targetContent, sourceSystem) => contentMap.SubSystemId == sourceSystem.Id && !sourceSystem.IsDeleted)
|
||||||
|
.LeftJoin<VSystemEntity>((contentMap, sourceContent, targetContent, sourceSystem, targetSystem) => contentMap.MapSubSystemId == targetSystem.Id && !targetSystem.IsDeleted)
|
||||||
|
.LeftJoin<TrackStatusEntity>((contentMap, sourceContent, targetContent, sourceSystem, targetSystem, sourceStatus) => sourceContent.TrackStatusId == sourceStatus.Id && !sourceStatus.IsDeleted)
|
||||||
|
.LeftJoin<TrackStatusEntity>((contentMap, sourceContent, targetContent, sourceSystem, targetSystem, sourceStatus, targetStatus) => targetContent.TrackStatusId == targetStatus.Id && !targetStatus.IsDeleted)
|
||||||
|
.Filter(null, true)
|
||||||
|
.Where(contentMap => !contentMap.IsDeleted)
|
||||||
|
.WhereIF(input.SubSystemId.HasValue, contentMap => contentMap.SubSystemId == input.SubSystemId)
|
||||||
|
.WhereIF(input.MapSubSystemId.HasValue, contentMap => contentMap.MapSubSystemId == input.MapSubSystemId)
|
||||||
|
.WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (contentMap, sourceContent) => sourceContent.Code.Contains(input.Keywords) || sourceContent.Content.Contains(input.Keywords) || sourceContent.EnContent.Contains(input.Keywords))
|
||||||
|
.OrderByDescending(contentMap => contentMap.CreateTime)
|
||||||
|
.Select((contentMap, sourceContent, targetContent, sourceSystem, targetSystem, sourceStatus, targetStatus) => new GetTrackContentMapPageOutputVO
|
||||||
|
{
|
||||||
|
Id = contentMap.Id,
|
||||||
|
SubSystem = sourceSystem.CnName,
|
||||||
|
Code = contentMap.TrackContentCode,
|
||||||
|
TrackStatus = sourceStatus.Status,
|
||||||
|
Content = sourceContent.Content,
|
||||||
|
EnContent = sourceContent.EnContent,
|
||||||
|
MapSubSystem = targetSystem.CnName,
|
||||||
|
MapCode = contentMap.MapTrackContentCode,
|
||||||
|
MapTrackStatus = targetStatus.Status,
|
||||||
|
MapContent = targetContent.Content,
|
||||||
|
MapEnContent = targetContent.EnContent
|
||||||
|
})
|
||||||
|
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<GetTrackContentMapDetailOutputVO> GetMapDetailAsync(int id)
|
||||||
|
{
|
||||||
|
return await Context.Queryable<TrackContentMapEntity>()
|
||||||
|
.InnerJoin<TrackContentEntity>((contentMap, sourceContent) => contentMap.TrackContentId == sourceContent.Id && !sourceContent.IsDeleted)
|
||||||
|
.InnerJoin<TrackContentEntity>((contentMap, sourceContent, targetContent) => contentMap.MapTrackContentId == targetContent.Id && !targetContent.IsDeleted)
|
||||||
|
.LeftJoin<VSystemEntity>((contentMap, sourceContent, targetContent, sourceSystem) => contentMap.SubSystemId == sourceSystem.Id && !sourceSystem.IsDeleted)
|
||||||
|
.LeftJoin<VSystemEntity>((contentMap, sourceContent, targetContent, sourceSystem, targetSystem) => contentMap.MapSubSystemId == targetSystem.Id && !targetSystem.IsDeleted)
|
||||||
|
.Filter(null, true)
|
||||||
|
.Where(contentMap => !contentMap.IsDeleted)
|
||||||
|
.Select((contentMap, sourceContent, targetContent, sourceSystem, targetSystem) => new GetTrackContentMapDetailOutputVO
|
||||||
|
{
|
||||||
|
Id = contentMap.Id,
|
||||||
|
SubSystemId = contentMap.SubSystemId,
|
||||||
|
SubSystem = sourceSystem.CnName,
|
||||||
|
TrackContent = contentMap.TrackContentCode + "-" + sourceContent.Content,
|
||||||
|
MapSubSystem = targetSystem.CnName,
|
||||||
|
MapTrackContent = contentMap.MapTrackContentCode + "-" + targetContent.Content
|
||||||
|
}, true)
|
||||||
|
.SingleAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> IsMapAnyAsync(Expression<Func<TrackContentMapEntity, bool>> whereExpression)
|
||||||
|
{
|
||||||
|
return await Context.Queryable<TrackContentMapEntity>().Where(whereExpression).AnyAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> InsertMapAsync(TrackContentMapEntity insertObj)
|
||||||
|
{
|
||||||
|
return await Context.Insertable(insertObj).ExecuteCommandAsync() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<TrackContentMapEntity> GetMapByIdAsync(int id)
|
||||||
|
{
|
||||||
|
return await Context.Queryable<TrackContentMapEntity>().InSingleAsync(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> UpdateMapAsync(TrackContentMapEntity updateObj)
|
||||||
|
{
|
||||||
|
return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> SoftDeleteMapAsync(Expression<Func<TrackContentMapEntity, bool>> whereExpression)
|
||||||
|
{
|
||||||
|
return await Context.Updateable<TrackContentMapEntity>()
|
||||||
|
.Where(whereExpression)
|
||||||
|
.SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), true)
|
||||||
|
.ExecuteCommandHasChangeAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> UpdateMapAsync(Expression<Func<TrackContentMapEntity, TrackContentMapEntity>> columns, Expression<Func<TrackContentMapEntity, bool>> whereExpression)
|
||||||
|
{
|
||||||
|
return await Context.Updateable<TrackContentMapEntity>().SetColumns(columns).Where(whereExpression)
|
||||||
|
.ExecuteCommandAsync() > 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -32,9 +32,11 @@ public class TrackPushConfigRepository : BasicRepository<TrackPushConfigEntity>,
|
|||||||
TrackTemplate = SqlFunc.Subqueryable<TrackTemplateEntity>()
|
TrackTemplate = SqlFunc.Subqueryable<TrackTemplateEntity>()
|
||||||
.Where(template => SqlFunc.SplitIn(trackPush.TrackTemplateId, template.Id.ToString()) && !template.IsDeleted)
|
.Where(template => SqlFunc.SplitIn(trackPush.TrackTemplateId, template.Id.ToString()) && !template.IsDeleted)
|
||||||
.SelectStringJoin(template => template.Name, ","),
|
.SelectStringJoin(template => template.Name, ","),
|
||||||
|
TrackTemplateId = trackPush.TrackTemplateId,
|
||||||
CreateTime = trackPush.CreateTime
|
CreateTime = trackPush.CreateTime
|
||||||
})
|
})
|
||||||
.Distinct()
|
.Distinct()
|
||||||
|
.Mapper(x => { x.TrackTemplateIds = x.TrackTemplateId.Split(',').Select(int.Parse).ToList(); })
|
||||||
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,6 +70,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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
|
|||||||
public async Task<GetTrackTemplateDetailVO?> GetDetailAsync(int id)
|
public async Task<GetTrackTemplateDetailVO?> GetDetailAsync(int id)
|
||||||
{
|
{
|
||||||
var detail = await Context.Queryable<TrackTemplateEntity>()
|
var detail = await Context.Queryable<TrackTemplateEntity>()
|
||||||
.LeftJoin<VSystemEntity>((a, b) => a.SubSystemId == b.Id&&b.IsDeleted==false)
|
.LeftJoin<VSystemEntity>((a, b) => a.SubSystemId == b.Id && b.IsDeleted == false)
|
||||||
.Where((a, b) => a.Id == id)
|
.Where((a, b) => a.Id == id)
|
||||||
.Select((a, b) => new
|
.Select((a, b) => new
|
||||||
GetTrackTemplateDetailVO
|
GetTrackTemplateDetailVO
|
||||||
@ -84,8 +84,7 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
|
|||||||
(templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) =>
|
(templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) =>
|
||||||
templateContent.UpdateUserId == updateUser.Id && !updateUser.IsDeleted)
|
templateContent.UpdateUserId == updateUser.Id && !updateUser.IsDeleted)
|
||||||
.Filter(null, true)
|
.Filter(null, true)
|
||||||
.Where(templateContent =>
|
.Where(templateContent => input.TrackTemplateIds.Contains(templateContent.TrackTemplateId) && !templateContent.IsDeleted)
|
||||||
templateContent.TrackTemplateId == input.TrackTemplateId && !templateContent.IsDeleted)
|
|
||||||
.OrderByDescending(templateContent => templateContent.CreateTime)
|
.OrderByDescending(templateContent => templateContent.CreateTime)
|
||||||
.Select((templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) =>
|
.Select((templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) =>
|
||||||
new GetTrackTemplateContentPageOutputVO
|
new GetTrackTemplateContentPageOutputVO
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user