Merge remote-tracking branch 'origin/S02-轨迹中台' into S02-轨迹中台

This commit is contained in:
李鹏军 2024-03-13 10:40:19 +08:00
commit be086de68f
5 changed files with 127 additions and 2 deletions

View File

@ -17,6 +17,26 @@ public class GetPageTrackOrderInput : PageInfoInput
/// </summary>
public string? OrderNos { get; set; }
/// <summary>
/// tab标签类型 0 全部, 1 异常 2 预警
/// </summary>
public int TabType { get; set; }
/// <summary>
/// 订单类型
/// </summary>
public int? TrackOrderType { get; set; }
/// <summary>
/// 客户id
/// </summary>
public int? CustomerId { get; set; }
///// <summary>
///// 当tab选中 0 默认不传 1 直接写死传值 [1,4] 2 传 [2,4]
///// </summary>
//public List<int>? QuestionTypeIds { get; set; }
/// <summary>
/// 创建时间开始
/// </summary>
@ -73,6 +93,11 @@ public class TrackOrderDto
/// </summary>
public string? CustomerCode { get; set; }
/// <summary>
/// 客户id
/// </summary>
public int CustomerId { get; set; }
/// <summary>
/// 订单明细(json)
/// </summary>
@ -113,5 +138,28 @@ public class TrackOrderDto
/// </summary>
public string SubSystem { get; set; }
/// <summary>
/// 子系统id
/// </summary>
public int SubSystemId { get; set; }
/// <summary>
/// 问题类型(主数据枚举TrackQuestionType)
/// </summary>
public int QuestionType { get; set; }
/// <summary>
/// 问题类型名称
/// </summary>
public string? QuestionTypeName { get; set; }
/// <summary>
/// 问题描述(主数据枚举TrackProblemDescription)
/// </summary>
public int ProblemDescription { get; set; }
/// <summary>
/// 问题描述名称
/// </summary>
public string? ProblemDescriptionName { get; set; }
}

View File

@ -49,7 +49,7 @@ public class TrackPushPullService : ApplicationService
x.OrderNo
}).ToList();
// 批量获取轨迹
// 批量获取轨迹 这里报错了,我先随便给个 写死的主体值
await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(
"A012", group.Key.ServiceProviderCode, data,
GlobalConst.TrackRefreshSubscribe, JsonConvert.SerializeObject(group.Key));

View File

@ -108,6 +108,18 @@ public class OrderEntity : IFullAuditedBasicEntitys, IAggregateRoot
[SugarColumn(ColumnName = "LeaveCountry")]
public string LeaveCountry { get; set; } = null!;
/// <summary>
/// 问题类型(主数据枚举TrackQuestionType)
/// </summary>
[SugarColumn(ColumnName = "QuestionType")]
public int QuestionType { get; set; }
/// <summary>
/// 问题描述(主数据枚举TrackProblemDescription)
/// </summary>
[SugarColumn(ColumnName = "ProblemDescription")]
public int ProblemDescription { get; set; }
/// <summary>
/// 起运港口
/// </summary>

View File

@ -18,6 +18,25 @@ namespace SJZY.Track.Domain.Dtos.Order
///// </summary>
//public List<string>? OrderNos { get; set; }
/// <summary>
/// 当tab选中 0 默认不传 1 直接写死传值 [1,4] 2 传 [2,4]
/// </summary>
public int TabType { get; set; }
///// <summary>
///// 当tab选中 1 直接写死传值 [1,4] 2 传 [2,4]
///// </summary>
//public List<int>? QuestionTypeIds { get; set; }
/// <summary>
/// 订单类型
/// </summary>
public int? TrackOrderType { get; set; }
/// <summary>
/// 客户id
/// </summary>
public int? CustomerId { get; set; }
/// <summary>
/// 单号
@ -75,6 +94,11 @@ namespace SJZY.Track.Domain.Dtos.Order
/// </summary>
public string? CustomerCode { get; set; }
/// <summary>
/// 客户id
/// </summary>
public int CustomerId { get; set; }
///// <summary>
///// 订单明细(json)
///// </summary>
@ -124,5 +148,25 @@ namespace SJZY.Track.Domain.Dtos.Order
/// 轨迹模板Id数组
/// </summary>
public List<int>? TrackTemplateIds { get; set; }
/// <summary>
/// 问题类型(主数据枚举TrackQuestionType)
/// </summary>
public int QuestionType { get; set; }
/// <summary>
/// 问题类型名称
/// </summary>
public string? QuestionTypeName { get; set; }
/// <summary>
/// 问题描述(主数据枚举TrackProblemDescription)
/// </summary>
public int ProblemDescription { get; set; }
/// <summary>
/// 问题描述名称
/// </summary>
public string? ProblemDescriptionName { get; set; }
}
}

View File

@ -5,6 +5,7 @@ using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
using SJZY.Track.Domain.Dtos.Order;
using SJZY.Track.Domain.VEntities;
using SJZY.Track.Repository.VData.Entitys;
using SqlSugar;
namespace SJZY.Track.Repository.Repositories;
@ -121,10 +122,22 @@ public class OrderRepository : BasicRepository<OrderEntity>, IOrderRepository, I
public async Task<UnifyPageResultDto<TrackOrderVO>> GetPageTrackOrder(GetPageTrackOrderInputVO input)
{
List<string> orderNoList = new List<string>();
List<int> questionTypeIds = new List<int>();
int ques = 0;
if (!input.OrderNos.IsNullOrWhiteSpace())
{
orderNoList = input.OrderNos.Split(new char[] { ',', ',', ':', ':' }).ToList();
}
if (input.TabType==1)
{
questionTypeIds= new List<int> { 1, 4 };
ques = questionTypeIds.Sum();
}
else if (input.TabType==2)
{
questionTypeIds= new List<int> { 2, 4 };
ques = questionTypeIds.Sum();
}
var pageList = await Context.Queryable<OrderEntity>()
.LeftJoin<VExternalSubjectEntity>((a, b) => a.CustomId == b.Id && b.IsDeleted == false)
@ -137,6 +150,9 @@ public class OrderRepository : BasicRepository<OrderEntity>, IOrderRepository, I
(a, b, c) => a.CreateTime >= input.CreateTimeStart)
.WhereIF((!input.CreateTimeStart.HasValue) && input.CreateTimeEnd.HasValue,
(a, b, c) => a.CreateTime <= input.CreateTimeEnd)
.WhereIF(input.CustomerId>0, (a, b, c) => a.CustomId==input.CustomerId)
.WhereIF(input.TrackOrderType>0, (a, b, c) => a.OrderType==input.TrackOrderType)
.WhereIF(input.TabType>0 && (!questionTypeIds.IsNullOrEmpty()), (a, b, c) => (a.QuestionType&ques)>0)
.OrderByDescending((a, b, c) => a.CreateTime)
.Select((a, b, c) => new TrackOrderVO
{
@ -148,6 +164,11 @@ public class OrderRepository : BasicRepository<OrderEntity>, IOrderRepository, I
.Return("箱/袋单").ElseIF(a.OrderType == 4).Return("FBA订单").End(""),
CustomerShortName = b.Abbreviation,
CustomerCode = b.Code,
CustomerId = a.CustomId,
QuestionType = a.QuestionType,
QuestionTypeName = SqlFunc.IF(a.QuestionType == 1).Return("异常").ElseIF(a.QuestionType == 2).Return("预警").End(""),
ProblemDescription = a.ProblemDescription,
ProblemDescriptionName =SqlFunc.IF(a.ProblemDescription == 1).Return("推送异常").ElseIF(a.ProblemDescription == 2).Return("推送预警").End(""),
//TrackTemplateNames = SqlFunc.Subqueryable<OrderTemplateEntity>()
// .LeftJoin<TrackTemplateEntity>((aa, bb) => aa.TrackTemplateId == bb.Id)
// .Where((aa, bb) => a.Id == aa.OrderId).SelectStringJoin((aa, bb) => bb.Name, ","),
@ -206,7 +227,7 @@ public class OrderRepository : BasicRepository<OrderEntity>, IOrderRepository, I
a.TrackTemplateNames = trackTemplateList.Where(b => b.OrderId == a.Id).Select(a => a.Name)
.JoinAsString(",");
a.TrackTemplateIds = trackTemplateList.Where(b => b.OrderId == a.Id).Select(a => a.TemplateId).ToList();
a.TrackTemplateIds = trackTemplateList.Where(b => b.OrderId == a.Id).Where(b => b.TemplateId>0).Select(a => a.TemplateId).ToList();
});
}