修改接口

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>
public string TackTimeZoneName { get; set; }
public string? TackTimeZoneName { get; set; }
/// <summary>
/// 拉取轨迹内容代码
/// </summary>
public string TrackContentCodeName { get; set; }
public string? TrackContentCodeName { get; set; }
/// <summary>
/// 拉取轨迹内容
/// </summary>
public string TrackContentName { get; set; }
public string? TrackContentName { get; set; }
/// <summary>
/// 拉取轨迹发生地
/// </summary>
public string TrackPlaceName { get; set; }
public string? TrackPlaceName { get; set; }
/// <summary>
/// 拉取轨迹状态
/// </summary>
public string TrackStatusName { get; set; }
public string? TrackStatusName { get; set; }
/// <summary>
/// 轨迹模板id
@ -67,5 +67,5 @@ public class EditTrackPullConfigInput
/// <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;
}
/// <summary>
/// 轨迹推送配置内容排序
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("SortContent")]
public async Task<bool> SortContentAsync([FromBody] SortTrackPushContentInput input)
{
return true;
}
}

View File

@ -30,7 +30,7 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
{
_stringLocalizer = stringLocalizer;
_trackTemplateRepository = trackTemplateRepository;
_trackPullConfigRepository=trackPullConfigRepository;
_trackPullConfigRepository = trackPullConfigRepository;
}
/// <summary>
@ -99,7 +99,7 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
throw new BusinessException(message: _stringLocalizer["TemplateExist"]);
}
#endregion
#endregion 业务校验
var entity = ObjectMapper.Map<EditTrackTemplateInput, TrackTemplateEntity>(input);
var isTrue = await _trackTemplateRepository.InsertAsync(entity);
@ -110,13 +110,15 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
private async Task<UnifyResultDto> UpdateAsync(EditTrackTemplateInput input)
{
#region 业务校验
var isExist = await _trackTemplateRepository.GetFirstAsync(a =>
a.Id != input.Id && a.SubSystemId == input.SubSystemId && a.Code == input.Code);
if (isExist != null)
{
throw new BusinessException(message: _stringLocalizer["TemplateExist"]);
}
#endregion
#endregion 业务校验
var templateEntity = await _trackTemplateRepository.GetFirstAsync(a => a.Id == input.Id);
ObjectMapper.Map(input, templateEntity);
@ -128,13 +130,15 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
private async Task<UnifyResultDto> DeleteAsync(EditTrackTemplateInput input)
{
#region 业务校验
//查询看看在轨迹拉取里面有没有被占用
var isExisistTrackPullConfig = await _trackPullConfigRepository.GetFirstAsync(a => a.TrackTemplateId==input.Id);
if (isExisistTrackPullConfig!=null)
var isExisistTrackPullConfig = await _trackPullConfigRepository.GetFirstAsync(a => a.TrackTemplateId == input.Id);
if (isExisistTrackPullConfig != null)
{
throw new BusinessException(message: _stringLocalizer["IsExistTrackPullConfig"]);
}
#endregion
#endregion 业务校验
var isTrue = await _trackTemplateRepository.SoftDeleteAsync(x => x.Id == input.Id);

View File

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

View File

@ -23,4 +23,14 @@ public class GetTrackPushConfigPageOutputVO
/// 模板名称
/// </summary>
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>
/// 轨迹模板id
/// </summary>
public int TrackTemplateId { get; set; }
public List<int> TrackTemplateIds { get; set; }
}

View File

@ -68,4 +68,9 @@ public class GetTrackTemplateContentPageOutputVO
/// 修改人
/// </summary>
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>()
.Where(template => SqlFunc.SplitIn(trackPush.TrackTemplateId, template.Id.ToString()) && !template.IsDeleted)
.SelectStringJoin(template => template.Name, ","),
TrackTemplateId = trackPush.TrackTemplateId,
CreateTime = trackPush.CreateTime
})
.Distinct()
.Mapper(x => { x.TrackTemplateIds = x.TrackTemplateId.Split(',').Select(int.Parse).ToList(); })
.ToPagedListAsync(input.PageIndex, input.PageSize);
}

View File

@ -20,7 +20,7 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
public async Task<GetTrackTemplateDetailVO?> GetDetailAsync(int id)
{
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)
.Select((a, b) => new
GetTrackTemplateDetailVO
@ -84,8 +84,7 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
(templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) =>
templateContent.UpdateUserId == updateUser.Id && !updateUser.IsDeleted)
.Filter(null, true)
.Where(templateContent =>
templateContent.TrackTemplateId == input.TrackTemplateId && !templateContent.IsDeleted)
.Where(templateContent => input.TrackTemplateIds.Contains(templateContent.TrackTemplateId) && !templateContent.IsDeleted)
.OrderByDescending(templateContent => templateContent.CreateTime)
.Select((templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) =>
new GetTrackTemplateContentPageOutputVO