修改接口

This commit is contained in:
柳文翔 2024-03-01 23:08:25 +08:00
parent 777cf29baa
commit a327f0bcbf
10 changed files with 57 additions and 17 deletions

View File

@ -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; }
} }

View File

@ -0,0 +1,9 @@
namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
public class SortTrackPushContentInput
{
/// <summary>
/// 排序信息
/// </summary>
public List<Dictionary<int, int>> SortInfo { get; set; }
}

View File

@ -237,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;
}
} }

View File

@ -99,7 +99,7 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
throw new BusinessException(message: _stringLocalizer["TemplateExist"]); throw new BusinessException(message: _stringLocalizer["TemplateExist"]);
} }
#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);
@ -110,13 +110,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);
@ -128,13 +130,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);

View File

@ -15,5 +15,5 @@ public class KeywordsInputVO : PageInfoInput
/// <summary> /// <summary>
/// 选中项 /// 选中项
/// </summary> /// </summary>
public int? SelectedId { get; set; } public List<int>? SelectedId { get; set; }
} }

View File

@ -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; }
} }

View File

@ -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; }
} }

View File

@ -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; }
} }

View File

@ -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);
} }

View File

@ -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