update: 获取可用轨迹内容接口反参增加,【轨迹来源】【轨迹发生时间】【轨迹发生时区】并保证【轨迹内容】【轨迹英文内容】和新增的内容与轨迹明细表内容一致

This commit is contained in:
云龙 王 2024-11-22 16:10:10 +08:00
parent e07fc810c1
commit 7b9de2b9ec
2 changed files with 52 additions and 1 deletions

View File

@ -26,4 +26,19 @@ public class GetAvailableContentOutput
/// 是否对外
/// </summary>
public bool IsExternal { get; set; }
/// <summary>
/// 轨迹来源
/// </summary>
public int? Source { get; set; }
/// <summary>
/// 轨迹发生时间
/// </summary>
public DateTime? TrackTime { get; set; }
/// <summary>
/// 轨迹发生时区
/// </summary>
public float? TrackTimeZone { get; set; }
}

View File

@ -266,7 +266,7 @@ public class TrackContentService : ApplicationService
if (!item.IsAllowManuallyCreate && input.TrackOptionType == TrackOptionType.创建) //跳过不允许手动创建的轨迹内容
continue;
if (!item.IsAllowManuallyUpdate && input.TrackOptionType == TrackOptionType.修改) //跳过不允许手动创建的轨迹内容
if (!item.IsAllowManuallyUpdate && input.TrackOptionType == TrackOptionType.修改) //跳过不允许手动修改的轨迹内容
continue;
res.Data.Add(new GetAvailableContentOutput()
@ -279,6 +279,42 @@ public class TrackContentService : ApplicationService
});
}
if (input.TrackOptionType == TrackOptionType.创建
|| trackDetails == null
|| trackDetails.Count == 0)
{
return res;
}
//修改操作,查轨迹内容列表反映明细表数据,重新构造响应数据
var matchContent = new List<GetAvailableContentOutput>();
var contents = res.Data.Select(x => new
{
x.Id,
x.IsExternal,
x.Code
});
foreach (var content in contents)
{
var match = trackDetails
.Where(x => x.TrackCode == content.Code)
.Select(matchItem => new GetAvailableContentOutput
{
IsExternal = content.IsExternal,
Id = content.Id,
EnContent = matchItem.TrackEnContent,
Content = matchItem.TrackContent,
Code = matchItem.TrackCode,
TrackTime = matchItem.TrackTime,
TrackTimeZone = matchItem.TrackTimeZone,
Source = matchItem.Source
});
matchContent.AddRange(match);
}
res.Data = matchContent;
return res;
}