Merge branch 'S01-轨迹中台' into test

This commit is contained in:
dingenwen 2024-03-02 16:34:29 +08:00
commit 7bfba6e382
6 changed files with 48 additions and 13 deletions

View File

@ -1,6 +1,7 @@
using System.Linq.Expressions; using System.Linq.Expressions;
using Microsoft.Extensions.Localization; using Microsoft.Extensions.Localization;
using SJZY.Expand.ABP.Core.Localization; using SJZY.Expand.ABP.Core.Localization;
using SJZY.Expand.ABP.Core.PublicMethords;
using SJZY.Track.Application.Contract.Dtos.TrackPush; using SJZY.Track.Application.Contract.Dtos.TrackPush;
using SJZY.Track.Application.Contract.Dtos.TrackTemplates; using SJZY.Track.Application.Contract.Dtos.TrackTemplates;
using SJZY.Track.Application.Localization; using SJZY.Track.Application.Localization;
@ -183,6 +184,17 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
return await _trackTemplateRepository.GetContentDetailAsync(id); return await _trackTemplateRepository.GetContentDetailAsync(id);
} }
/// <summary>
/// 轨迹模板内容下拉框
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("GetContentDropDownList")]
public async Task<List<DropdownListDataDto>> GetContentDropDownListAsync([FromBody] GetTrackTemplateContentDropDownListVO input)
{
return await _trackTemplateRepository.GetContentDropDownListAsync(input);
}
/// <summary> /// <summary>
/// 轨迹模板内容编辑 /// 轨迹模板内容编辑
/// </summary> /// </summary>

View File

@ -1,4 +1,5 @@
using SJZY.Track.Domain.Dtos.TrackTemplate; using SJZY.Expand.ABP.Core.PublicMethords;
using SJZY.Track.Domain.Dtos.TrackTemplate;
namespace SJZY.Track.Domain.Aggregates.TrackTemplateAggregate; namespace SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
@ -37,4 +38,6 @@ public interface ITrackTemplateRepository : IBasicRepository<TrackTemplateEntity
Expression<Func<TrackTemplateContentEntity, bool>> whereExpression); Expression<Func<TrackTemplateContentEntity, bool>> whereExpression);
Task<bool> UpdateContentRangeAsync(List<TrackTemplateContentEntity> updateObjs); Task<bool> UpdateContentRangeAsync(List<TrackTemplateContentEntity> updateObjs);
Task<List<DropdownListDataDto>> GetContentDropDownListAsync(GetTrackTemplateContentDropDownListVO input);
} }

View File

@ -0,0 +1,14 @@
namespace SJZY.Track.Domain.Dtos.TrackTemplate;
public class GetTrackTemplateContentDropDownListVO : PageInfoInput
{
/// <summary>
/// 轨迹模板id
/// </summary>
public List<int> TrackTemplateIds { get; set; }
/// <summary>
/// 选中项
/// </summary>
public List<int>? SelectedIds { get; set; }
}

View File

@ -6,9 +6,4 @@ public class GetTrackTemplateContentPageInputVO : PageInfoInput
/// 轨迹模板id /// 轨迹模板id
/// </summary> /// </summary>
public List<int> TrackTemplateIds { get; set; } public List<int> TrackTemplateIds { get; set; }
/// <summary>
/// 选中项
/// </summary>
public List<int>? SelectedIds { get; set; }
} }

View File

@ -54,10 +54,8 @@ public class TrackStatusRepository : BasicRepository<TrackStatusEntity>, ITrackS
EntrackStatus = a.EnStatus, EntrackStatus = a.EnStatus,
TrackStatus = a.Status, TrackStatus = a.Status,
NodeId = a.Node, NodeId = a.Node,
Node = SqlFunc.IF(a.Node == 1).Return("揽收").ElseIF(a.Node == 2).Return("干线").ElseIF(a.Node == 3) Node = SqlFunc.IF(a.Node == 1).Return("揽收").ElseIF(a.Node == 2).Return("清关").ElseIF(a.Node == 3)
.Return("清关") .Return("干线").ElseIF(a.Node == 4).Return("派送").ElseIF(a.Node == 5).Return("其他").End(""),
.ElseIF(a.Node == 4).Return("中转").ElseIF(a.Node == 5).Return("派送")
.End(""),
CreateTime = a.CreateTime, CreateTime = a.CreateTime,
CreateUser = c.Name, CreateUser = c.Name,
UpdateTime = a.UpdateTime, UpdateTime = a.UpdateTime,

View File

@ -85,8 +85,6 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
templateContent.UpdateUserId == updateUser.Id && !updateUser.IsDeleted) templateContent.UpdateUserId == updateUser.Id && !updateUser.IsDeleted)
.Filter(null, true) .Filter(null, true)
.Where(templateContent => input.TrackTemplateIds.Contains(templateContent.TrackTemplateId) && !templateContent.IsDeleted) .Where(templateContent => input.TrackTemplateIds.Contains(templateContent.TrackTemplateId) && !templateContent.IsDeleted)
.OrderByIF(input.SelectedIds.IsNullOrEmpty(), templateContent => templateContent.CreateTime, OrderByType.Desc)
.OrderByIF(!input.SelectedIds.IsNullOrEmpty(), templateContent => SqlFunc.IIF(input.SelectedIds.Contains(templateContent.TrackContentId), SqlFunc.DateAdd(SqlFunc.GetDate(), 1), templateContent.CreateTime), OrderByType.Desc)
.Select((templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) => .Select((templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) =>
new GetTrackTemplateContentPageOutputVO new GetTrackTemplateContentPageOutputVO
{ {
@ -99,7 +97,6 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
UpdateTime = templateContent.UpdateTime, UpdateTime = templateContent.UpdateTime,
UpdateUser = updateUser.Name UpdateUser = updateUser.Name
}, true) }, true)
.Distinct()
.ToPagedListAsync(input.PageIndex, input.PageSize); .ToPagedListAsync(input.PageIndex, input.PageSize);
} }
@ -165,4 +162,20 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
{ {
return await Context.Updateable(updateObjs).ExecuteCommandHasChangeAsync(); return await Context.Updateable(updateObjs).ExecuteCommandHasChangeAsync();
} }
public async Task<List<DropdownListDataDto>> GetContentDropDownListAsync(GetTrackTemplateContentDropDownListVO input)
{
return await Context.Queryable<TrackTemplateContentEntity>()
.InnerJoin<TrackContentEntity>((templateContent, trackContent) => templateContent.TrackContentId == trackContent.Id)
.Where(templateContent => input.TrackTemplateIds.Contains(templateContent.TrackTemplateId))
.OrderByIF(input.SelectedIds.IsNullOrEmpty(), templateContent => templateContent.CreateTime, OrderByType.Desc)
.OrderByIF(!input.SelectedIds.IsNullOrEmpty(), templateContent => SqlFunc.IIF(input.SelectedIds.Contains(templateContent.TrackContentId), SqlFunc.DateAdd(SqlFunc.GetDate(), 1), templateContent.CreateTime), OrderByType.Desc)
.Select((templateContent, trackContent) => new DropdownListDataDto
{
Value = templateContent.TrackContentId,
Key = trackContent.Code + "-" + trackContent.Content
})
.Distinct()
.ToListAsync();
}
} }