From 500b4be531dafe07588d7e322edfabbb35fab523 Mon Sep 17 00:00:00 2001
From: moyongzhen <2534173414@qq.com>
Date: Thu, 29 Feb 2024 16:35:18 +0800
Subject: [PATCH 01/16] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E8=AE=A2=E5=8D=95?=
=?UTF-8?q?=EF=BC=8Ckeywords=E5=8F=82=E6=95=B0=E9=BB=98=E8=AE=A4=E4=BC=A0?=
=?UTF-8?q?=20""=20=E7=A9=BA=E5=AD=97=E7=AC=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../ProvideServices/GetPageTrackOrderInput.cs | 29 +++++++++++++++++++
.../TrackContents/GetPageTrackContentInput.cs | 4 +--
.../Dtos/TrackStatus/GetTrackStatusListDto.cs | 4 +--
.../GetPageTrackTemplateInput.cs | 4 +--
.../Services/ProvideServices/OrderService.cs | 4 ++-
.../OrderAggregate/IOrderRepository.cs | 8 +++++
.../Dtos/Order/GetOrderDetailsInputVO.cs | 18 ++++++++++++
.../Dtos/Order/GetPageTrackOrderInputVO.cs | 21 ++++++++++++++
src/SJZY.Track.Repository/OrderRepository.cs | 29 ++++++++++++++++++-
9 files changed, 113 insertions(+), 8 deletions(-)
create mode 100644 src/SJZY.Track.Domain/Dtos/Order/GetOrderDetailsInputVO.cs
create mode 100644 src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs
diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs
index 62a1bdb2..e2fb21f2 100644
--- a/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs
+++ b/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs
@@ -8,7 +8,25 @@ namespace SJZY.Track.Application.Dtos.ProvideServices
{
public class GetPageTrackOrderInput : PageInfoInput
{
+ ///
+ /// 子系统id
+ ///
+ public int SubSystemId { get; set; }
+ ///
+ /// 单号
+ ///
+ public List OrderNos { get; set; }
+
+ ///
+ /// 创建时间开始
+ ///
+ public DateTime? CreateTimeStart { get; set; }
+
+ ///
+ /// 创建时间截止
+ ///
+ public DateTime? createTimeEnd { get; set; }
}
///
@@ -16,6 +34,17 @@ namespace SJZY.Track.Application.Dtos.ProvideServices
///
public class TrackOrderDto
{
+ ///
+ /// 轨迹订单id
+ ///
+ public int Id { get; set; }
+ ///
+ /// 订单类型
+ ///
+ public string OrderType { get; set; }
+
+
+ public string OrderNumber { get; set; }
}
}
diff --git a/src/SJZY.Track.Application/Dtos/TrackContents/GetPageTrackContentInput.cs b/src/SJZY.Track.Application/Dtos/TrackContents/GetPageTrackContentInput.cs
index a494d030..7a009ccb 100644
--- a/src/SJZY.Track.Application/Dtos/TrackContents/GetPageTrackContentInput.cs
+++ b/src/SJZY.Track.Application/Dtos/TrackContents/GetPageTrackContentInput.cs
@@ -15,8 +15,8 @@ namespace SJZY.Track.Application.Dtos.TrackContents
///
/// 关键字
- ///
- public string Keywords { get; set; }
+ ///
+ public string Keywords { get; set; } = "";
}
public class GetTrackContentListDto
diff --git a/src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusListDto.cs b/src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusListDto.cs
index ec218c97..ecdb123d 100644
--- a/src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusListDto.cs
+++ b/src/SJZY.Track.Application/Dtos/TrackStatus/GetTrackStatusListDto.cs
@@ -65,11 +65,11 @@ namespace SJZY.Track.Application.Dtos.TrackStatus
///
/// 子系统id
///
- public int SubSystemId { get; set; }
+ public int SubSystemId { get; set; }
///
/// 关键字
///
- public string Keywords { get; set; }
+ public string Keywords { get; set; } = "";
}
}
diff --git a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs
index 357784df..3be009ac 100644
--- a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs
+++ b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetPageTrackTemplateInput.cs
@@ -13,8 +13,8 @@
///
/// 关键字
///
- public string Keywords { get; set; }
-
+ public string Keywords { get; set; } = "";
+
///
/// 轨迹模版id,轨迹映射的查询使用
///
diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs
index 7381144c..55560ce6 100644
--- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs
+++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs
@@ -79,13 +79,15 @@ public class OrderService : ApplicationService
#region 轨迹订单列表
///
- ///
+ /// 获取分页的轨迹订单
///
///
///
[HttpPost("/Order/GetTrackOrderList")]
public async Task> GetPageTrackOrder(GetPageTrackOrderInput input)
{
+
+
return null;
}
#endregion
diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs
index e076b731..ded90121 100644
--- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs
+++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs
@@ -10,6 +10,7 @@ public interface IOrderRepository : IBasicRepository
///
///
Task CreateOrderAsync(OrderEntity order);
+ Task> GetOrderDetails(GetOrderDetailsInputVO input);
///
/// 根据订单号,获取订单模板
@@ -19,6 +20,13 @@ public interface IOrderRepository : IBasicRepository
///
Task> GetOrderTemplatesAsync(int orderType, List distinctOrderNumbers);
+ ///
+ /// 获取分页的轨迹订单
+ ///
+ ///
+ ///
+ Task> GetPageTrackOrder(GetPageTrackOrderInputVO input);
+
///
/// 关联订单
///
diff --git a/src/SJZY.Track.Domain/Dtos/Order/GetOrderDetailsInputVO.cs b/src/SJZY.Track.Domain/Dtos/Order/GetOrderDetailsInputVO.cs
new file mode 100644
index 00000000..082b245a
--- /dev/null
+++ b/src/SJZY.Track.Domain/Dtos/Order/GetOrderDetailsInputVO.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SJZY.Track.Domain.Dtos.Order
+{
+ public class GetOrderDetailsInputVO
+ {
+
+ }
+
+ public class TrackOrderDetailVO
+ {
+
+ }
+}
diff --git a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs
new file mode 100644
index 00000000..882f2db8
--- /dev/null
+++ b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SJZY.Track.Domain.Dtos.Order
+{
+ public class GetPageTrackOrderInputVO
+ {
+
+ }
+
+ ///
+ /// 轨迹订单VO
+ ///
+ public class TrackOrderVO
+ {
+
+ }
+}
diff --git a/src/SJZY.Track.Repository/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs
index 645fb94b..303a6c5b 100644
--- a/src/SJZY.Track.Repository/OrderRepository.cs
+++ b/src/SJZY.Track.Repository/OrderRepository.cs
@@ -1,4 +1,5 @@
-using SJZY.Track.Domain;
+using Microsoft.AspNetCore.Mvc;
+using SJZY.Track.Domain;
using SJZY.Track.Domain.Aggregates.OrderAggregate;
using SJZY.Track.Domain.Dtos.Order;
@@ -57,4 +58,30 @@ public class OrderRepository : BasicRepository, IOrderRepository, I
tran.Complete();
}
+
+ #region 轨迹订单明细
+
+ ///
+ /// 根据轨迹订单id获取轨迹明细列表
+ ///
+ ///
+ ///
+ public async Task> GetOrderDetails(GetOrderDetailsInputVO input)
+ {
+ return null;
+ }
+ #endregion
+
+ #region 轨迹订单分页
+ ///
+ /// 获取分页的轨迹订单
+ ///
+ ///
+ ///
+ public async Task> GetPageTrackOrder(GetPageTrackOrderInputVO input)
+ {
+
+ return null;
+ }
+ #endregion
}
\ No newline at end of file
From 95dee9ec69e49fa4897785f5c922e3dfa867d068 Mon Sep 17 00:00:00 2001
From: moyongzhen <2534173414@qq.com>
Date: Thu, 29 Feb 2024 17:18:10 +0800
Subject: [PATCH 02/16] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E5=86=85=E5=AE=B9?=
=?UTF-8?q?=E5=AD=90=E7=B3=BB=E7=BB=9F=E5=90=8D=E7=A7=B0=E8=81=94=E8=A1=A8?=
=?UTF-8?q?=E5=90=8D=E7=A7=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/SJZY.Track.Repository/OrderRepository.cs | 1 +
src/SJZY.Track.Repository/TrackContentRepository.cs | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/SJZY.Track.Repository/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs
index 303a6c5b..ae51a536 100644
--- a/src/SJZY.Track.Repository/OrderRepository.cs
+++ b/src/SJZY.Track.Repository/OrderRepository.cs
@@ -80,6 +80,7 @@ public class OrderRepository : BasicRepository, IOrderRepository, I
///
public async Task> GetPageTrackOrder(GetPageTrackOrderInputVO input)
{
+ //await Context.Queryable((a,b)= );
return null;
}
diff --git a/src/SJZY.Track.Repository/TrackContentRepository.cs b/src/SJZY.Track.Repository/TrackContentRepository.cs
index 32ebd92d..896d02d4 100644
--- a/src/SJZY.Track.Repository/TrackContentRepository.cs
+++ b/src/SJZY.Track.Repository/TrackContentRepository.cs
@@ -25,7 +25,7 @@ public class TrackContentRepository : BasicRepository, ITrac
var detail = await Context.Queryable()
.LeftJoin((a, b) => a.TrackStatusId==b.Id)
.LeftJoin((a, b, c) => a.TrackFlagId==c.Id)
- .LeftJoin((a, b, c, d) => a.SubSystemId == b.Id)
+ .LeftJoin((a, b, c, d) => a.SubSystemId == d.Id)
.Where((a, b, c, d) => a.Id == id)
.Select((a, b, c, d) => new GetTrackContentDetailVO
{
From 812546bfa344948802dc93cfb7d42338135cbe25 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com>
Date: Thu, 29 Feb 2024 17:22:13 +0800
Subject: [PATCH 03/16] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?=
=?UTF-8?q?=E6=8B=89=E5=8F=96=E9=85=8D=E7=BD=AE=E7=BC=96=E8=BE=91=20?=
=?UTF-8?q?=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../AutoMapper/TrackPullAutoMapperProfile.cs | 17 +++
.../TrackPull/EditTrackPullConfigInput.cs | 71 ++++++++++
.../Services/TrackPull/TrackPullService.cs | 122 +++++++++++++++++-
.../ITrackPullConfigRepository.cs | 12 ++
.../ITrackTemplateRepository.cs | 2 +
.../TrackPullConfigRepository.cs | 37 ++++++
.../TrackTemplateRepository.cs | 5 +
7 files changed, 265 insertions(+), 1 deletion(-)
create mode 100644 src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs
create mode 100644 src/SJZY.Track.Application/Dtos/TrackPull/EditTrackPullConfigInput.cs
diff --git a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs
new file mode 100644
index 00000000..15d39d05
--- /dev/null
+++ b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs
@@ -0,0 +1,17 @@
+using AutoMapper;
+using SJZY.Track.Application.Dtos.TrackPull;
+using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
+using Volo.Abp.AutoMapper;
+
+namespace SJZY.Track.Application.AutoMapper
+{
+ public class TrackPullAutoMapperProfile : Profile
+ {
+ public TrackPullAutoMapperProfile()
+ {
+ CreateMap(MemberList.None);
+ CreateMap(MemberList.None).Ignore(dest => dest.Id)
+ .ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => false));
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Dtos/TrackPull/EditTrackPullConfigInput.cs b/src/SJZY.Track.Application/Dtos/TrackPull/EditTrackPullConfigInput.cs
new file mode 100644
index 00000000..71fe55cf
--- /dev/null
+++ b/src/SJZY.Track.Application/Dtos/TrackPull/EditTrackPullConfigInput.cs
@@ -0,0 +1,71 @@
+namespace SJZY.Track.Application.Dtos.TrackPull;
+
+public class EditTrackPullConfigInput
+{
+ public int? Id { get; set; }
+
+ ///
+ /// 操作类型
+ ///
+ public OptionTypeNoNull Options { get; set; }
+
+ ///
+ /// 拉取轨迹订单号
+ ///
+ public string OrderNoName { get; set; }
+
+ ///
+ /// 返参解析对象
+ ///
+ public int ParseMethod { get; set; }
+
+ ///
+ /// 定时任务(分钟)
+ ///
+ public int PullInterval { get; set; }
+
+ ///
+ /// 服务商id
+ ///
+ public int ServiceProviderId { get; set; }
+
+ ///
+ /// 子系统id
+ ///
+ public int SubSystemId { get; set; }
+
+ ///
+ /// 拉取轨迹时区
+ ///
+ public string TackTimeZoneName { get; set; }
+
+ ///
+ /// 拉取轨迹内容代码
+ ///
+ public string TrackContentCodeName { get; set; }
+
+ ///
+ /// 拉取轨迹内容
+ ///
+ public string TrackContentName { get; set; }
+
+ ///
+ /// 拉取轨迹发生地
+ ///
+ public string TrackPlaceName { get; set; }
+
+ ///
+ /// 拉取轨迹状态
+ ///
+ public string TrackStatusName { get; set; }
+
+ ///
+ /// 轨迹模板id
+ ///
+ public int TrackTemplateId { get; set; }
+
+ ///
+ /// 拉取轨迹发生时间
+ ///
+ public string TrackTimeName { get; set; }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs
index 004198e0..646e439b 100644
--- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs
+++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs
@@ -1,8 +1,14 @@
using Microsoft.Extensions.Localization;
+using SJZY.Expand.ABP.Core.Localization;
+using SJZY.Expand.ABP.Core.PublicMethords;
+using SJZY.Track.Application.Dtos.TrackPull;
+using SJZY.Track.Application.Dtos.TrackTemplates;
using SJZY.Track.Application.Localization;
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
+using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
using SJZY.Track.Domain.Dtos.Common;
using SJZY.Track.Domain.Dtos.TrackPull;
+using System.Linq.Expressions;
using Volo.Abp.DependencyInjection;
namespace SJZY.Track.Application.Services.TrackPull;
@@ -16,13 +22,16 @@ public class TrackPullService : ApplicationService, ITransientDependency
{
private readonly IStringLocalizer _stringLocalizer;
private readonly ITrackPullConfigRepository _trackPullConfigRepository;
+ private readonly ITrackTemplateRepository _trackTemplateRepository;
public TrackPullService(
IStringLocalizer stringLocalizer,
- ITrackPullConfigRepository trackPullConfigRepository)
+ ITrackPullConfigRepository trackPullConfigRepository,
+ ITrackTemplateRepository trackTemplateRepository)
{
_stringLocalizer = stringLocalizer;
_trackPullConfigRepository = trackPullConfigRepository;
+ _trackTemplateRepository = trackTemplateRepository;
}
///
@@ -68,4 +77,115 @@ public class TrackPullService : ApplicationService, ITransientDependency
{
return await _trackPullConfigRepository.GetContentDetailAsync(id);
}
+
+ ///
+ /// 轨迹拉取配置编辑
+ ///
+ ///
+ ///
+ [HttpPost("Edit")]
+ public async Task EditAsync([FromBody] EditTrackPullConfigInput input)
+ {
+ if (input.Options != OptionTypeNoNull.删除)
+ {
+ Expression> isAnyExp = x =>
+ x.SubSystemId == input.SubSystemId && x.TrackTemplateId == input.TrackTemplateId && x.ServiceProviderId == input.ServiceProviderId;
+ if (input.Options == OptionTypeNoNull.修改) isAnyExp.And(x => x.Id != input.Id);
+
+ if (await _trackPullConfigRepository.IsAnyAsync(isAnyExp))
+ throw new BusinessException(message: _stringLocalizer["IsTrackPullConfigAny"]);
+ }
+
+ switch (input.Options)
+ {
+ case OptionTypeNoNull.新增:
+ {
+ var trackPullEntity = ObjectMapper.Map(input);
+ var trackPullParamsEntity = ObjectMapper.Map(input);
+
+ var trackTemplateContentEntities = await _trackTemplateRepository.GetContentListAsync(x => x.TrackTemplateId == input.TrackTemplateId);
+
+ var trackPullContentEntities = new List();
+
+ using (var ts = TransactionScopeHelper.Create())
+ {
+ int id = await _trackPullConfigRepository.InsertReturnIdentityAsync(trackPullEntity);
+
+ trackPullParamsEntity.PullOrPushConfigId = id;
+ await _trackPullConfigRepository.InsertParamsAsync(trackPullParamsEntity);
+
+ foreach (var item in trackTemplateContentEntities)
+ {
+ trackPullContentEntities.Add(new()
+ {
+ TrackPullConfigId = id,
+ TrackContentId = item.TrackContentId
+ });
+ }
+ await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities);
+
+ ts.Complete();
+ }
+ }
+ break;
+
+ case OptionTypeNoNull.修改:
+ {
+ var oldTrackPullEntity = await _trackPullConfigRepository.GetFirstAsync(x => x.Id == input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]);
+
+ var oldTrackPullParamsEntity = await _trackPullConfigRepository.GetParamsSingleAsync(x => x.PullOrPushConfigId == input.Id && !x.IsPush);
+
+ var trackPullContentEntities = new List();
+
+ if (oldTrackPullEntity.TrackTemplateId != input.TrackTemplateId)
+ {
+ var trackTemplateContentEntities = await _trackTemplateRepository.GetContentListAsync(x => x.TrackTemplateId == input.TrackTemplateId);
+
+ foreach (var item in trackTemplateContentEntities)
+ {
+ trackPullContentEntities.Add(new()
+ {
+ TrackPullConfigId = oldTrackPullEntity.Id,
+ TrackContentId = item.TrackContentId
+ });
+ }
+ }
+
+ ObjectMapper.Map(input, oldTrackPullEntity);
+ ObjectMapper.Map(input, oldTrackPullParamsEntity);
+
+ using (var ts = TransactionScopeHelper.Create())
+ {
+ await _trackPullConfigRepository.UpdateAsync(oldTrackPullEntity);
+ await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPullParamsEntity);
+
+ if (oldTrackPullEntity.TrackTemplateId != input.TrackTemplateId)
+ {
+ await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id);
+ await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities);
+ }
+
+ ts.Complete();
+ }
+ }
+ break;
+
+ case OptionTypeNoNull.删除:
+ using (var ts = TransactionScopeHelper.Create())
+ {
+ await _trackPullConfigRepository.SoftDeleteAsync(x => x.Id == input.Id);
+ await _trackPullConfigRepository.SoftDeleteParamsAsync(x => x.PullOrPushConfigId == input.Id && !x.IsPush);
+ await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id);
+
+ ts.Complete();
+ }
+ break;
+
+ default:
+ throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum,
+ nameof(EditTrackPullConfigInput.Options)]);
+ }
+
+ return true;
+ }
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs
index 6de7445c..3d34310a 100644
--- a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs
+++ b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs
@@ -32,4 +32,16 @@ public interface ITrackPullConfigRepository : IBasicRepository
///
Task GetContentDetailAsync(int id);
+
+ Task InsertParamsAsync(TrackPushPullParamsConfigEntity insertObj);
+
+ Task InsertContentRangeAsync(List insertObjs);
+
+ Task GetParamsSingleAsync(Expression> whereExpression);
+
+ Task UpdateParamsAsync(TrackPushPullParamsConfigEntity updateObj);
+
+ Task SoftDeleteContentAsync(Expression> whereExpression);
+
+ Task SoftDeleteParamsAsync(Expression> whereExpression);
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs
index ac26857b..cbc2ccf3 100644
--- a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs
+++ b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs
@@ -34,4 +34,6 @@ public interface ITrackTemplateRepository : IBasicRepository UpdateContentAsync(TrackTemplateContentEntity updateObj);
Task SoftDeleteContentAsync(int id);
+
+ Task> GetContentListAsync(Expression> whereExpression);
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs
index 8965f22a..564cb0f3 100644
--- a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs
+++ b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs
@@ -4,6 +4,7 @@ using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
using SJZY.Track.Domain.Dtos.Common;
using SJZY.Track.Domain.Dtos.TrackPull;
using SJZY.Track.Domain.VEntities;
+using System.Linq.Expressions;
namespace SJZY.Track.Repository;
@@ -83,4 +84,40 @@ public class TrackPullConfigRepository : BasicRepository,
}, true)
.SingleAsync();
}
+
+ public async Task InsertParamsAsync(TrackPushPullParamsConfigEntity insertObj)
+ {
+ return await Context.Insertable(insertObj).ExecuteCommandAsync() > 0;
+ }
+
+ public async Task InsertContentRangeAsync(List insertObjs)
+ {
+ return await Context.Insertable(insertObjs).ExecuteCommandAsync() > 0;
+ }
+
+ public async Task GetParamsSingleAsync(Expression> whereExpression)
+ {
+ return await Context.Queryable().SingleAsync(whereExpression);
+ }
+
+ public async Task UpdateParamsAsync(TrackPushPullParamsConfigEntity updateObj)
+ {
+ return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync();
+ }
+
+ public async Task SoftDeleteContentAsync(Expression> whereExpression)
+ {
+ return await Context.Updateable()
+ .Where(whereExpression)
+ .SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), true)
+ .ExecuteCommandHasChangeAsync();
+ }
+
+ public async Task SoftDeleteParamsAsync(Expression> whereExpression)
+ {
+ return await Context.Updateable()
+ .Where(whereExpression)
+ .SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), true)
+ .ExecuteCommandHasChangeAsync();
+ }
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Repository/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplateRepository.cs
index ee2ee76f..f8659624 100644
--- a/src/SJZY.Track.Repository/TrackTemplateRepository.cs
+++ b/src/SJZY.Track.Repository/TrackTemplateRepository.cs
@@ -157,4 +157,9 @@ public class TrackTemplateRepository : BasicRepository, ITr
.SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), true)
.ExecuteCommandHasChangeAsync();
}
+
+ public async Task> GetContentListAsync(Expression> whereExpression)
+ {
+ return await Context.Queryable().Where(whereExpression).ToListAsync();
+ }
}
\ No newline at end of file
From dba6172aab73afd8ce0d46d2e2f26a4c07c87967 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com>
Date: Thu, 29 Feb 2024 17:24:58 +0800
Subject: [PATCH 04/16] =?UTF-8?q?=E8=BF=98=E5=8E=9F=E8=AF=AD=E6=B3=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/SJZY.Track.Repository/TrackPullConfigRepository.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs
index 564cb0f3..058146bd 100644
--- a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs
+++ b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs
@@ -47,8 +47,8 @@ public class TrackPullConfigRepository : BasicRepository,
}, true)
.Mapper(x =>
{
- x.TrackKeywords = [.. x.TrackKeyword.Split(',')];
- x.TrackKeywordsReverse = [.. x.TrackKeywordReverse.Split(',')];
+ x.TrackKeywords = x.TrackKeyword.Split(',').ToList();
+ x.TrackKeywordsReverse = x.TrackKeywordReverse.Split(',').ToList();
})
.ToPagedListAsync(input.PageIndex, input.PageSize);
}
From 5ddfaf5ec34521d914bdf374086513b8e4353a23 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com>
Date: Thu, 29 Feb 2024 17:46:14 +0800
Subject: [PATCH 05/16] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?=
=?UTF-8?q?=E6=8B=89=E5=8F=96=E9=85=8D=E7=BD=AE=E5=86=85=E5=AE=B9=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9=20=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../AutoMapper/TrackPullAutoMapperProfile.cs | 1 +
.../TrackPull/UpdateTrackPullContentInput.cs | 51 +++++++++++++++++++
.../Services/TrackPull/TrackPullService.cs | 17 +++++++
.../ITrackPullConfigRepository.cs | 4 ++
.../TrackPullConfigRepository.cs | 10 ++++
5 files changed, 83 insertions(+)
create mode 100644 src/SJZY.Track.Application/Dtos/TrackPull/UpdateTrackPullContentInput.cs
diff --git a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs
index 15d39d05..3577eceb 100644
--- a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs
+++ b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs
@@ -12,6 +12,7 @@ namespace SJZY.Track.Application.AutoMapper
CreateMap(MemberList.None);
CreateMap(MemberList.None).Ignore(dest => dest.Id)
.ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => false));
+ CreateMap(MemberList.None);
}
}
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Dtos/TrackPull/UpdateTrackPullContentInput.cs b/src/SJZY.Track.Application/Dtos/TrackPull/UpdateTrackPullContentInput.cs
new file mode 100644
index 00000000..74a54567
--- /dev/null
+++ b/src/SJZY.Track.Application/Dtos/TrackPull/UpdateTrackPullContentInput.cs
@@ -0,0 +1,51 @@
+namespace SJZY.Track.Application.Dtos.TrackPull;
+
+public class UpdateTrackPullContentInput
+{
+ public int Id { get; set; }
+
+ ///
+ /// 服务商轨迹代码参数值
+ ///
+ public string TrackContentCodeValue { get; set; }
+
+ ///
+ /// 轨迹内容id
+ ///
+ public int TrackContentId { get; set; }
+
+ ///
+ /// 服务商轨迹内容参数值
+ ///
+ public string TrackContentValue { get; set; }
+
+ ///
+ /// 轨迹关键词(正向)
+ ///
+ public string TrackKeyword { get; set; }
+
+ ///
+ /// 轨迹关键词(反向)
+ ///
+ public string TrackKeywordReverse { get; set; }
+
+ ///
+ /// 轨迹发生地参数值
+ ///
+ public int? TrackPlaceValue { get; set; }
+
+ ///
+ /// 轨迹拉取配置id
+ ///
+ public int TrackPullConfigId { get; set; }
+
+ ///
+ /// 服务商轨迹状态参数值
+ ///
+ public string TrackStatusValue { get; set; }
+
+ ///
+ /// 轨迹时区GMT
+ ///
+ public string TrackTimeZone { get; set; }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs
index 646e439b..f76abe50 100644
--- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs
+++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs
@@ -188,4 +188,21 @@ public class TrackPullService : ApplicationService, ITransientDependency
return true;
}
+
+ ///
+ /// 轨迹拉取配置内容修改
+ ///
+ ///
+ ///
+ [HttpPost("UpdateContent")]
+ public async Task UpdateContentAsync([FromBody] UpdateTrackPullContentInput input)
+ {
+ var oldTrackPullContentEntity = await _trackPullConfigRepository.GetContentByIdAsync(input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]);
+
+ ObjectMapper.Map(input, oldTrackPullContentEntity);
+
+ await _trackPullConfigRepository.UpdateContentAsync(oldTrackPullContentEntity);
+
+ return true;
+ }
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs
index 3d34310a..c7a36732 100644
--- a/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs
+++ b/src/SJZY.Track.Domain/Aggregates/TrackPullAggregate/ITrackPullConfigRepository.cs
@@ -44,4 +44,8 @@ public interface ITrackPullConfigRepository : IBasicRepository SoftDeleteContentAsync(Expression> whereExpression);
Task SoftDeleteParamsAsync(Expression> whereExpression);
+
+ Task GetContentByIdAsync(int id);
+
+ Task UpdateContentAsync(TrackPullContentConfigEntity updateObj);
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs
index 058146bd..dbcb40be 100644
--- a/src/SJZY.Track.Repository/TrackPullConfigRepository.cs
+++ b/src/SJZY.Track.Repository/TrackPullConfigRepository.cs
@@ -120,4 +120,14 @@ public class TrackPullConfigRepository : BasicRepository,
.SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), true)
.ExecuteCommandHasChangeAsync();
}
+
+ public async Task GetContentByIdAsync(int id)
+ {
+ return await Context.Queryable().InSingleAsync(id);
+ }
+
+ public async Task UpdateContentAsync(TrackPullContentConfigEntity updateObj)
+ {
+ return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync();
+ }
}
\ No newline at end of file
From 57749fc32e6b053376dd3a4435569912b0b23e64 Mon Sep 17 00:00:00 2001
From: moyongzhen <2534173414@qq.com>
Date: Thu, 29 Feb 2024 18:33:43 +0800
Subject: [PATCH 06/16] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8E=88=E6=9D=83?=
=?UTF-8?q?=E6=8B=A6=E6=88=AA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/SJZY.Track.Application/ApplicationModule.cs | 9 ++++++++-
.../Services/TrackStatus/TrackStatusService.cs | 3 ++-
.../Services/TrackTemplates/TrackTemplateService.cs | 1 +
src/SJZY.Track.Repository/OrderRepository.cs | 1 +
4 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/SJZY.Track.Application/ApplicationModule.cs b/src/SJZY.Track.Application/ApplicationModule.cs
index ba3bc813..94127ff2 100644
--- a/src/SJZY.Track.Application/ApplicationModule.cs
+++ b/src/SJZY.Track.Application/ApplicationModule.cs
@@ -2,6 +2,7 @@
using SJZY.Track.Application.Localization;
using SJZY.UserCenter.Contracts;
using SJZY.UserCenter.SharedModel;
+using SJZY.UserCenter.SharedModel.Pub;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AutoMapper;
using Volo.Abp.FluentValidation;
@@ -18,7 +19,8 @@ namespace SJZY.Track.Application
typeof(AbpLocalizationModule),
typeof(AbpVirtualFileSystemModule),
typeof(AbpHttpClientModule),
- typeof(SJZYTrackDomainModule)
+ typeof(SJZYTrackDomainModule),
+ typeof(SjzyUserCenterHttpApiModule)
)]
public class ApplicationModule : AbpModule
{
@@ -46,6 +48,11 @@ namespace SJZY.Track.Application
.AddBaseTypes(typeof(SjzyBasicLocalization))
.AddVirtualJson("/Localization/Resources");
});
+ //授权拦截提示
+ context.Services.Configure(options =>
+ {
+ options.Filters.Add(new ApiAsyncAuthorizationFilter());
+ });
//用户中心
context.Services.AddHttpClientProxies(typeof(SjzyUserCenterHttpApiModule).Assembly, "UserCenter", false);
diff --git a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs
index 7b076868..bd58470f 100644
--- a/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs
+++ b/src/SJZY.Track.Application/Services/TrackStatus/TrackStatusService.cs
@@ -1,4 +1,5 @@
-using Microsoft.Extensions.Localization;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.Extensions.Localization;
using SJZY.Track.Application.Dtos.TrackStatus;
using SJZY.Track.Application.Localization;
using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs
index 422aafde..e77a574d 100644
--- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs
+++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs
@@ -1,4 +1,5 @@
using System.Linq.Expressions;
+using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Localization;
using SJZY.Expand.ABP.Core.Localization;
using SJZY.Track.Application.Dtos.TrackTemplates;
diff --git a/src/SJZY.Track.Repository/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs
index ae51a536..3fbb9dfb 100644
--- a/src/SJZY.Track.Repository/OrderRepository.cs
+++ b/src/SJZY.Track.Repository/OrderRepository.cs
@@ -81,6 +81,7 @@ public class OrderRepository : BasicRepository, IOrderRepository, I
public async Task> GetPageTrackOrder(GetPageTrackOrderInputVO input)
{
//await Context.Queryable((a,b)= );
+ //await Context.Queryable((a,b)=> )
return null;
}
From b139734d57cd76bc974841ce53700ba02530c501 Mon Sep 17 00:00:00 2001
From: moyongzhen <2534173414@qq.com>
Date: Thu, 29 Feb 2024 19:06:34 +0800
Subject: [PATCH 07/16] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=B0=E5=A2=9E?=
=?UTF-8?q?=E7=BC=96=E8=BE=91=E6=97=B6=EF=BC=8C=E8=8E=B7=E5=8F=96=E4=B8=8D?=
=?UTF-8?q?=E5=88=B0=E7=94=A8=E6=88=B7id=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../AutoMapper/OrderAutoMapperProfile.cs | 5 +++
.../ProvideServices/GetPageTrackOrderInput.cs | 2 +-
.../SJZY.Track.Application.csproj | 2 --
.../Services/ProvideServices/OrderService.cs | 4 ++-
.../Dtos/Order/GetPageTrackOrderInputVO.cs | 36 ++++++++++++++++++-
.../SJZY.Track.Domain.csproj | 1 +
src/SJZY.Track.Repository/DataBaseContext.cs | 24 +++++++++++++
src/SJZY.Track.Repository/OrderRepository.cs | 11 +++++-
.../SJZYTrackRepositoryModule.cs | 4 +++
9 files changed, 83 insertions(+), 6 deletions(-)
diff --git a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs
index 2dac9751..4a0bb612 100644
--- a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs
+++ b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs
@@ -1,6 +1,8 @@
using AutoMapper;
+using AutoMapper.Internal.Mappers;
using SJZY.Track.Application.Dtos.ProvideServices;
using SJZY.Track.Domain.Aggregates.OrderAggregate;
+using SJZY.Track.Domain.Dtos.Order;
namespace SJZY.Track.Application.AutoMapper;
@@ -15,5 +17,8 @@ public class OrderAutoMapperProfile : Profile
.ForMember(dest => dest.ServiceProviderId, opt => opt.MapFrom(m => m.ServiceProviderId ?? 0))
.ForMember(dest => dest.TrackTemplateId, opt => opt.MapFrom(m => m.TemplateId));
CreateMap(MemberList.None);
+
+ CreateMap(MemberList.None);
+
}
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs
index e2fb21f2..4709c862 100644
--- a/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs
+++ b/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs
@@ -16,7 +16,7 @@ namespace SJZY.Track.Application.Dtos.ProvideServices
///
/// 单号
///
- public List OrderNos { get; set; }
+ public List? OrderNos { get; set; }
///
/// 创建时间开始
diff --git a/src/SJZY.Track.Application/SJZY.Track.Application.csproj b/src/SJZY.Track.Application/SJZY.Track.Application.csproj
index e8f1425c..43edd929 100644
--- a/src/SJZY.Track.Application/SJZY.Track.Application.csproj
+++ b/src/SJZY.Track.Application/SJZY.Track.Application.csproj
@@ -19,8 +19,6 @@
-
-
diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs
index 55560ce6..1c5c25dd 100644
--- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs
+++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs
@@ -1,5 +1,6 @@
using SJZY.Track.Application.Dtos.ProvideServices;
using SJZY.Track.Domain.Aggregates.OrderAggregate;
+using SJZY.Track.Domain.Dtos.Order;
namespace SJZY.Track.Application.Services.ProvideServices;
@@ -86,7 +87,8 @@ public class OrderService : ApplicationService
[HttpPost("/Order/GetTrackOrderList")]
public async Task> GetPageTrackOrder(GetPageTrackOrderInput input)
{
-
+ var vo = ObjectMapper.Map(input);
+ var jj = await _orderRepository.GetPageTrackOrder(vo);
return null;
}
diff --git a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs
index 882f2db8..5dcbafaf 100644
--- a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs
+++ b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs
@@ -6,9 +6,27 @@ using System.Threading.Tasks;
namespace SJZY.Track.Domain.Dtos.Order
{
- public class GetPageTrackOrderInputVO
+ public class GetPageTrackOrderInputVO : PageInfoInput
{
+ ///
+ /// 子系统id
+ ///
+ public int SubSystemId { get; set; }
+ ///
+ /// 单号
+ ///
+ public List OrderNos { get; set; }
+
+ ///
+ /// 创建时间开始
+ ///
+ public DateTime? CreateTimeStart { get; set; }
+
+ ///
+ /// 创建时间截止
+ ///
+ public DateTime? createTimeEnd { get; set; }
}
///
@@ -16,6 +34,22 @@ namespace SJZY.Track.Domain.Dtos.Order
///
public class TrackOrderVO
{
+ ///
+ /// 轨迹订单id
+ ///
+ public int Id { get; set; }
+ ///
+ /// 订单类型
+ ///
+ public string OrderType { get; set; }
+
+
+ public string OrderNumber { get; set; }
+
+ ///
+ /// 轨迹模版
+ ///
+ public string TrackTemplateNames { get; set; }
}
}
diff --git a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj
index aac0e12d..5ebeded5 100644
--- a/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj
+++ b/src/SJZY.Track.Domain/SJZY.Track.Domain.csproj
@@ -9,6 +9,7 @@
+
diff --git a/src/SJZY.Track.Repository/DataBaseContext.cs b/src/SJZY.Track.Repository/DataBaseContext.cs
index b9712ab1..14dbada8 100644
--- a/src/SJZY.Track.Repository/DataBaseContext.cs
+++ b/src/SJZY.Track.Repository/DataBaseContext.cs
@@ -1,4 +1,6 @@
#pragma warning disable 1591
+using SJZY.UserCenter.HttpApi.Services;
+
namespace SJZY.Track.Repository
{
///
@@ -22,6 +24,17 @@ namespace SJZY.Track.Repository
entityInfo.SetValue(DateTime.Now);
if (entityInfo.PropertyName == nameof(ICreateBaicEntity.CreateUserId))
{
+ if (oldValue == null || (int)oldValue == 0)
+ {
+ try
+ {
+ entityInfo.SetValue(CurrentUserRequest.CurrentUser?.UserId);
+ }
+ catch
+ {
+
+ }
+ }
//entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId);
}
}
@@ -32,6 +45,17 @@ namespace SJZY.Track.Repository
entityInfo.SetValue(DateTime.Now);
else if (entityInfo.PropertyName == nameof(IUpdateBasicEntity.UpdateUserId))
{
+ if (oldValue == null || (int)oldValue == 1)
+ {
+ try
+ {
+ entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId);
+ }
+ catch
+ {
+
+ }
+ }
//entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId);
}
//删除
diff --git a/src/SJZY.Track.Repository/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs
index 3fbb9dfb..98a60b5f 100644
--- a/src/SJZY.Track.Repository/OrderRepository.cs
+++ b/src/SJZY.Track.Repository/OrderRepository.cs
@@ -81,7 +81,16 @@ public class OrderRepository : BasicRepository, IOrderRepository, I
public async Task> GetPageTrackOrder(GetPageTrackOrderInputVO input)
{
//await Context.Queryable((a,b)= );
- //await Context.Queryable((a,b)=> )
+ await Context.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, a.Id==b.OrderId))
+ .GroupBy((a, b) => new { a.Id })
+ .Select((a, b) => new TrackOrderVO
+ {
+ Id=a.Id,
+ OrderNumber=a.OrderNo,
+
+
+
+ }).ToPageListAsync(input.PageIndex, input.PageSize);
return null;
}
diff --git a/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs b/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs
index b58d19b1..a482fb7f 100644
--- a/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs
+++ b/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs
@@ -43,6 +43,10 @@ public class SJZYTrackRepositoryModule : AbpModule
});
}
+
+
+
+
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddTransient(typeof(IBasicQuery<>), typeof(BasicQuery<>));
From 2603cd1ac46c93f41308a647e55ba1bd3bcc2dab Mon Sep 17 00:00:00 2001
From: moyongzhen <2534173414@qq.com>
Date: Thu, 29 Feb 2024 19:45:13 +0800
Subject: [PATCH 08/16] =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=97=B6=EF=BC=8C?=
=?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2=E7=B1=BB=E5=9E=8B=E7=9A=84=E5=BF=85?=
=?UTF-8?q?=E9=A1=BB=E5=8A=A0=3F=E5=8F=AF=E7=A9=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../TrackContents/EditTrackContentInput.cs | 6 ++--
.../Dtos/TrackStatus/EditTrackStatusInput.cs | 6 ++--
.../Dtos/TrackTemplates/GetTrackDetailDto.cs | 4 +--
src/SJZY.Track.Repository/OrderRepository.cs | 29 +++++++++++++------
4 files changed, 28 insertions(+), 17 deletions(-)
diff --git a/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs b/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs
index 23294dfe..9879ffb8 100644
--- a/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs
+++ b/src/SJZY.Track.Application/Dtos/TrackContents/EditTrackContentInput.cs
@@ -31,17 +31,17 @@ namespace SJZY.Track.Application.Dtos.TrackContents
///
/// 轨迹内容代码
///
- public string Code { get; set; }
+ public string? Code { get; set; }
///
/// 轨迹内容
///
- public string Content { get; set; }
+ public string? Content { get; set; }
///
/// 轨迹内容英文
///
- public string EnContent { get; set; }
+ public string? EnContent { get; set; }
///
/// 轨迹标记id
diff --git a/src/SJZY.Track.Application/Dtos/TrackStatus/EditTrackStatusInput.cs b/src/SJZY.Track.Application/Dtos/TrackStatus/EditTrackStatusInput.cs
index a77a4f1c..ce9a0ebf 100644
--- a/src/SJZY.Track.Application/Dtos/TrackStatus/EditTrackStatusInput.cs
+++ b/src/SJZY.Track.Application/Dtos/TrackStatus/EditTrackStatusInput.cs
@@ -31,16 +31,16 @@ namespace SJZY.Track.Application.Dtos.TrackStatus
///
/// 轨迹状态代码
///
- public string Code { get; set; }
+ public string? Code { get; set; }
///
/// 轨迹状态
///
- public string TrackStatus { get; set; }
+ public string? TrackStatus { get; set; }
///
/// 轨迹状态英文
///
- public string EntrackStatus { get; set; }
+ public string? EntrackStatus { get; set; }
}
}
diff --git a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs
index 6269ba0b..f4ac73d8 100644
--- a/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs
+++ b/src/SJZY.Track.Application/Dtos/TrackTemplates/GetTrackDetailDto.cs
@@ -85,11 +85,11 @@
///
/// 模板名称
///
- public string Name { set; get; }
+ public string? Name { set; get; }
///
/// 模板代码
///
- public string Code { set; get; }
+ public string? Code { set; get; }
}
}
diff --git a/src/SJZY.Track.Repository/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs
index 98a60b5f..3196cbdd 100644
--- a/src/SJZY.Track.Repository/OrderRepository.cs
+++ b/src/SJZY.Track.Repository/OrderRepository.cs
@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Mvc;
using SJZY.Track.Domain;
using SJZY.Track.Domain.Aggregates.OrderAggregate;
+using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
using SJZY.Track.Domain.Dtos.Order;
namespace SJZY.Track.Repository;
@@ -81,16 +82,26 @@ public class OrderRepository : BasicRepository, IOrderRepository, I
public async Task> GetPageTrackOrder(GetPageTrackOrderInputVO input)
{
//await Context.Queryable((a,b)= );
- await Context.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, a.Id==b.OrderId))
- .GroupBy((a, b) => new { a.Id })
- .Select((a, b) => new TrackOrderVO
- {
- Id=a.Id,
- OrderNumber=a.OrderNo,
-
-
+ //await Context.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, a.Id==b.OrderId))
+ // .GroupBy((a, b) => new { a.Id })
+ // .Select((a, b) => new TrackOrderVO
+ // {
+ // Id=a.Id,
+ // OrderNumber=a.OrderNo,
+ // TrackTemplateNames = SqlFunc.AggregateConcat(b.)
- }).ToPageListAsync(input.PageIndex, input.PageSize);
+
+ // }).ToPageListAsync(input.PageIndex, input.PageSize);
+
+ //await Context.Queryable()
+ // .Includes(a => a.OrderTemplates)
+ // .Select(a => new TrackOrderVO
+ // {
+ // Id=a.Id,
+ // OrderNumber=a.OrderNo,
+ // TrackTemplateNames = SqlFunc.Subqueryable().Where(z=>z.OrderId==a.Id).SelectStringJoin(z=>z.)
+ // })
+ // .ToPageListAsync(input.PageIndex, input.PageSize);
return null;
}
From 2e125f8662e558c747bf5869f0005172ea168b22 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com>
Date: Thu, 29 Feb 2024 20:12:03 +0800
Subject: [PATCH 09/16] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=86=B2=E7=AA=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../AutoMapper/OrderAutoMapperProfile.cs | 6 +-
.../Dtos/ProvideServices/DeleteOrderInput.cs | 20 +---
.../Dtos/ProvideServices/OrderNoInfo.cs | 19 +++
...reateOrderInput.cs => UpsertOrderInput.cs} | 2 +-
.../Dtos/ProvideServices/UpsertTrackInput.cs | 24 ++++
.../ProvideServices/OrderLinkService.cs | 1 +
.../Services/ProvideServices/OrderService.cs | 12 +-
.../ProvideServices/TrackQueryService.cs | 42 +++----
.../Services/ProvideServices/TrackService.cs | 84 ++++++++++++-
.../OrderAggregate/IOrderRepository.cs | 16 +--
.../OrderAggregate/OrderFlightEntity.cs | 10 +-
.../OrderAggregate/OrderLinkEntity.cs | 10 +-
.../OrderAggregate/OrderTemplateEntity.cs | 17 ++-
.../TrackContentEntity.cs | 6 +-
.../ITrackDetailsRepository.cs | 8 +-
.../TrackDetailsIndex.cs | 2 +-
.../TrackStatusAggregate/TrackStatusEntity.cs | 6 +-
.../ITrackTemplateRepository.cs | 5 +-
.../Dtos/Order/OrderIdentifier.cs | 23 ++++
...TemplateDto.cs => OrderTemplateLinkDto.cs} | 4 +-
.../Dtos/TrackDetails/MatchTrackContentDto.cs | 19 +++
...ntOrderlyDto.cs => OrderedTrackCodeDto.cs} | 2 +-
src/SJZY.Track.Domain/IBasicRepository.cs | 4 +-
.../{ => Queries}/IBasicQuery.cs | 2 +-
.../Queries/ITrackQueries.cs | 34 ++++++
src/SJZY.Track.Repository/BasicQuery.cs | 2 +-
src/SJZY.Track.Repository/DataBaseContext.cs | 110 +++++++++---------
src/SJZY.Track.Repository/OrderRepository.cs | 35 +++---
.../Queries/TrackQueries.cs | 78 +++++++++++++
.../SJZYTrackRepositoryModule.cs | 4 +-
.../TrackDetailsRepository.cs | 55 ++++++---
.../TrackTemplateRepository.cs | 40 +++----
32 files changed, 504 insertions(+), 198 deletions(-)
create mode 100644 src/SJZY.Track.Application/Dtos/ProvideServices/OrderNoInfo.cs
rename src/SJZY.Track.Application/Dtos/ProvideServices/{CreateOrderInput.cs => UpsertOrderInput.cs} (93%)
create mode 100644 src/SJZY.Track.Application/Dtos/ProvideServices/UpsertTrackInput.cs
create mode 100644 src/SJZY.Track.Domain/Dtos/Order/OrderIdentifier.cs
rename src/SJZY.Track.Domain/Dtos/Order/{OrderTemplateDto.cs => OrderTemplateLinkDto.cs} (70%)
create mode 100644 src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentDto.cs
rename src/SJZY.Track.Domain/Dtos/TrackTemplate/{TemplateContentOrderlyDto.cs => OrderedTrackCodeDto.cs} (86%)
rename src/SJZY.Track.Domain/{ => Queries}/IBasicQuery.cs (96%)
create mode 100644 src/SJZY.Track.Domain/Queries/ITrackQueries.cs
create mode 100644 src/SJZY.Track.Repository/Queries/TrackQueries.cs
diff --git a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs
index 4a0bb612..fabc4fdd 100644
--- a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs
+++ b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs
@@ -1,5 +1,4 @@
using AutoMapper;
-using AutoMapper.Internal.Mappers;
using SJZY.Track.Application.Dtos.ProvideServices;
using SJZY.Track.Domain.Aggregates.OrderAggregate;
using SJZY.Track.Domain.Dtos.Order;
@@ -10,15 +9,14 @@ public class OrderAutoMapperProfile : Profile
{
public OrderAutoMapperProfile()
{
- CreateMap(MemberList.None);
+ CreateMap(MemberList.None);
CreateMap(MemberList.None);
CreateMap(MemberList.None)
.ForMember(dest => dest.ServiceProviderId, opt => opt.MapFrom(m => m.ServiceProviderId ?? 0))
.ForMember(dest => dest.TrackTemplateId, opt => opt.MapFrom(m => m.TemplateId));
CreateMap(MemberList.None);
-
- CreateMap(MemberList.None);
+ CreateMap(MemberList.None);
}
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/DeleteOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/DeleteOrderInput.cs
index b48f8af7..c4fba2a8 100644
--- a/src/SJZY.Track.Application/Dtos/ProvideServices/DeleteOrderInput.cs
+++ b/src/SJZY.Track.Application/Dtos/ProvideServices/DeleteOrderInput.cs
@@ -1,23 +1,5 @@
-using System.ComponentModel.DataAnnotations;
-
-namespace SJZY.Track.Application.Dtos.ProvideServices;
+namespace SJZY.Track.Application.Dtos.ProvideServices;
public class DeleteOrderInput : OrderNoInfo
{
-}
-
-public class OrderNoInfo
-{
- ///
- /// 订单类型,必填
- ///
- [Required]
- public int OrderType { get; set; }
-
- ///
- /// 订单号,必填
- ///
- [Required]
- [MaxLength(100)]
- public string OrderNo { get; set; } = null!;
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/OrderNoInfo.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/OrderNoInfo.cs
new file mode 100644
index 00000000..6f98fafc
--- /dev/null
+++ b/src/SJZY.Track.Application/Dtos/ProvideServices/OrderNoInfo.cs
@@ -0,0 +1,19 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace SJZY.Track.Application.Dtos.ProvideServices;
+
+public class OrderNoInfo
+{
+ ///
+ /// 订单类型,必填
+ ///
+ [Required]
+ public int OrderType { get; set; }
+
+ ///
+ /// 订单号,必填
+ ///
+ [Required]
+ [MaxLength(100)]
+ public string OrderNo { get; set; } = null!;
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/UpsertOrderInput.cs
similarity index 93%
rename from src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs
rename to src/SJZY.Track.Application/Dtos/ProvideServices/UpsertOrderInput.cs
index 47888316..c03d2478 100644
--- a/src/SJZY.Track.Application/Dtos/ProvideServices/CreateOrderInput.cs
+++ b/src/SJZY.Track.Application/Dtos/ProvideServices/UpsertOrderInput.cs
@@ -2,7 +2,7 @@
namespace SJZY.Track.Application.Dtos.ProvideServices;
-public class CreateOrderInput : UpdateOrderInput
+public class UpsertOrderInput : UpdateOrderInput
{
///
/// 客户id
diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/UpsertTrackInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/UpsertTrackInput.cs
new file mode 100644
index 00000000..fa2112ee
--- /dev/null
+++ b/src/SJZY.Track.Application/Dtos/ProvideServices/UpsertTrackInput.cs
@@ -0,0 +1,24 @@
+namespace SJZY.Track.Application.Dtos.ProvideServices;
+
+public class UpsertTrackInput : OrderNoInfo
+{
+ ///
+ /// 轨迹内容代码
+ ///
+ public string TrackCode { get; set; }
+
+ ///
+ /// 轨迹发生地
+ ///
+ public string TrackPlace { get; set; }
+
+ ///
+ /// 轨迹发生时间
+ ///
+ public DateTime TrackTime { get; set; }
+
+ ///
+ /// 轨迹发生时区
+ ///
+ public float TraceTimeZone { get; set; }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs
index d4ec1f87..e21ca538 100644
--- a/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs
+++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderLinkService.cs
@@ -1,5 +1,6 @@
using SJZY.Track.Application.Dtos.ProvideServices;
using SJZY.Track.Domain.Aggregates.OrderAggregate;
+using SJZY.Track.Domain.Queries;
namespace SJZY.Track.Application.Services.ProvideServices;
diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs
index 1c5c25dd..f75a8de9 100644
--- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs
+++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs
@@ -23,8 +23,8 @@ public class OrderService : ApplicationService
///
///
///
- [HttpPost("Order/CreateOrUpdate")]
- public async Task CreateOrUpdateOrderAsync(CreateOrderInput input)
+ [HttpPost("Order/Upsert")]
+ public async Task UpsertAsync(UpsertOrderInput input)
{
var order = await _orderRepository.GetFirstAsync(x =>
x.OrderType == input.OrderType && x.OrderNo == input.OrderNo);
@@ -35,7 +35,7 @@ public class OrderService : ApplicationService
return "更新成功";
}
- order = ObjectMapper.Map(input);
+ order = ObjectMapper.Map(input);
order.SubSystemId = 1;
order.OrderTemplates = ObjectMapper.Map, List>(input.Templates);
order.OrderFlights = ObjectMapper.Map, List>(input.FlightInfos);
@@ -60,12 +60,13 @@ public class OrderService : ApplicationService
throw new BusinessException(message: $"订单:{input.OrderNo}不存在");
}
- await _orderRepository.SoftDeleteAsync(x => x.Id == orderId);
+ await _orderRepository.DeleteOrderAsync(orderId);
return true;
}
#region 轨迹订单明细
+
///
/// 根据轨迹订单id获取轨迹订单明细列表
///
@@ -76,9 +77,11 @@ public class OrderService : ApplicationService
{
return null;
}
+
#endregion
#region 轨迹订单列表
+
///
/// 获取分页的轨迹订单
///
@@ -92,6 +95,7 @@ public class OrderService : ApplicationService
return null;
}
+
#endregion
private async Task UpdateOrderAsync(UpdateOrderInput input, OrderEntity order)
diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs
index 7792631f..587c316b 100644
--- a/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs
+++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackQueryService.cs
@@ -1,7 +1,6 @@
using SJZY.Track.Application.Dtos.ProvideServices;
-using SJZY.Track.Domain.Aggregates.OrderAggregate;
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
-using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
+using SJZY.Track.Domain.Queries;
namespace SJZY.Track.Application.Services.ProvideServices;
@@ -12,15 +11,13 @@ namespace SJZY.Track.Application.Services.ProvideServices;
public class TrackQueryService : ApplicationService
{
private readonly ITrackDetailsRepository _trackDetailsRepository;
- private readonly IOrderRepository _orderRepository;
- private readonly ITrackTemplateRepository _trackTemplateRepository;
+ private readonly ITrackQueries _trackQueries;
- public TrackQueryService(ITrackDetailsRepository trackDetailsRepository, IOrderRepository orderRepository,
- ITrackTemplateRepository trackTemplateRepository)
+ public TrackQueryService(ITrackDetailsRepository trackDetailsRepository,
+ ITrackQueries trackQueries)
{
_trackDetailsRepository = trackDetailsRepository;
- _orderRepository = orderRepository;
- _trackTemplateRepository = trackTemplateRepository;
+ _trackQueries = trackQueries;
}
///
@@ -29,8 +26,8 @@ public class TrackQueryService : ApplicationService
///
///
///
- [HttpPost("TrackQuery/GetByOrderNos")]
- public async Task> GetByOrderNosAsync(GetTrackInput input)
+ [HttpPost("Track/Query")]
+ public async Task> QueryAsync(GetTrackInput input)
{
if (input.OrderNos.Count > 500)
{
@@ -38,8 +35,8 @@ public class TrackQueryService : ApplicationService
}
var res = new List();
- input.OrderNos = input.OrderNos.Distinct().ToList();
- var details = await _trackDetailsRepository.GetListAsync(input.OrderNos);
+ input.OrderNos = input.OrderNos.Distinct().ToList(); // 单号去重
+ var details = await _trackDetailsRepository.GetListAsync(input.OrderType, input.OrderNos);
var isTurn = input.TimeZone != 0;
foreach (var group in details.GroupBy(x => x.OrderId))
@@ -78,18 +75,21 @@ public class TrackQueryService : ApplicationService
list.ForEach(item => item.TrackDetails.Sort((a, b) => b.Time.CompareTo(a.Time)));
break;
case SortMethod.ByTemplate:
- var orderTemplates = await _orderRepository.GetOrderTemplatesAsync(input.OrderType, input.OrderNos);
+ var orderTemplates = await _trackQueries
+ .GetOrderTemplateLinksAsync(input.OrderType, input.OrderNos);
var distinctTemplateIds = orderTemplates.Select(x => x.TemplateId).Distinct().ToList();
- var templateContent =
- await _trackTemplateRepository.GetTemplateContentOrderlyAsync(distinctTemplateIds);
+ var templateContent = await _trackQueries.GetOrderedTrackCodesAsync(distinctTemplateIds);
list.ForEach(item =>
{
- var template = orderTemplates.FirstOrDefault(x => x.OrderNo == item.OrderNo);
- if (template == default) return;
- var codes = templateContent
- .Where(x => x.TemplateId == template.TemplateId)
- .Select(x => x.Code)
- .ToList();
+ var codes = new List();
+ // 多模板拼接显示
+ foreach (var orderTemplate in orderTemplates.Where(x => x.OrderNo == item.OrderNo))
+ {
+ codes.AddRange(templateContent
+ .Where(t => t.TemplateId == orderTemplate.TemplateId)
+ .Select(t => t.Code));
+ }
+
item.TrackDetails = item.TrackDetails
.Where(x => codes.Contains(x.Code)) // 剔除不在模板内容中的元素
.OrderBy(x => codes.IndexOf(x.Code)) // 按照在模板内容的位置排序
diff --git a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs
index c5cddf06..5147ae93 100644
--- a/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs
+++ b/src/SJZY.Track.Application/Services/ProvideServices/TrackService.cs
@@ -1,5 +1,85 @@
-namespace SJZY.Track.Application.Services.ProvideServices;
+using SJZY.Track.Application.Dtos.ProvideServices;
+using SJZY.Track.Domain.Aggregates.OrderAggregate;
+using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
+using SJZY.Track.Domain.Queries;
+using SJZY.UserCenter.HttpApi.Services;
-public class TrackService
+namespace SJZY.Track.Application.Services.ProvideServices;
+
+///
+/// 轨迹服务
+///
+[ApiExplorerSettings(GroupName = "提供接口")]
+public class TrackService : ApplicationService
{
+ private readonly IOrderRepository _orderRepository;
+ private readonly ITrackDetailsRepository _trackDetailsRepository;
+ private readonly ITrackQueries _trackQueries;
+
+ public TrackService(ITrackQueries trackQueries, IOrderRepository orderRepository,
+ ITrackDetailsRepository trackDetailsRepository)
+ {
+ _trackQueries = trackQueries;
+ _orderRepository = orderRepository;
+ _trackDetailsRepository = trackDetailsRepository;
+ }
+
+ ///
+ /// 新增/更新订单轨迹接口
+ ///
+ ///
+ ///
+ ///
+ [HttpPost("Track/Upsert")]
+ public async Task UpsertTrackAsync(UpsertTrackInput input)
+ {
+ var orderId = await _orderRepository.GetFirstAsync(x =>
+ x.OrderType == input.OrderType && x.OrderNo == input.OrderNo, x => x.Id);
+ if (orderId == default)
+ {
+ throw new BusinessException(message: $"订单:{input.OrderNo}不存在");
+ }
+
+ // 不存在则新增轨迹,存在则更新
+ var track = await _trackDetailsRepository.GetFirstOrDefaultAsync(orderId, input.TrackCode);
+ if (track == default)
+ {
+ var trackContent = await _trackQueries.MatchTrackContentAsync(orderId, input.TrackCode);
+ if (trackContent == default)
+ {
+ throw new BusinessException(message: $"订单:{input.OrderNo} 所绑定的模板,没有一条内容可以匹配轨迹代码:{input.TrackCode}");
+ }
+
+ track = new TrackDetailsIndex
+ {
+ OrderId = orderId,
+ OrderNo = input.OrderNo,
+ OrderType = input.OrderType,
+ TrackStatus = trackContent.Status,
+ TrackCode = input.TrackCode,
+ TrackContent = trackContent.Content,
+ TrackEnContent = trackContent.EnContent,
+ TrackPlace = input.TrackPlace,
+ TrackTime = input.TrackTime,
+ TraceTimeZone = input.TraceTimeZone,
+ CreateUserId = CurrentUserRequest.CurrentUser.UserId,
+ CreateTime = DateTime.Now
+ };
+ await _trackDetailsRepository.CreateAsync(track);
+ }
+ else
+ {
+ track.UpdateUserId = CurrentUserRequest.CurrentUser.UserId;
+ track.UpdateTime = DateTime.Now;
+ track.TrackPlace = input.TrackPlace;
+ track.TrackTime = input.TrackTime;
+ track.TraceTimeZone = input.TraceTimeZone;
+ await _trackDetailsRepository.UpdateAsync(track);
+ }
+
+ // 根据订单关联关系向下刷,不同子系统还需要做内容映射
+
+ // 推送
+ return true;
+ }
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs
index ded90121..93d162e2 100644
--- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs
+++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/IOrderRepository.cs
@@ -10,15 +10,8 @@ public interface IOrderRepository : IBasicRepository
///
///
Task CreateOrderAsync(OrderEntity order);
- Task> GetOrderDetails(GetOrderDetailsInputVO input);
- ///
- /// 根据订单号,获取订单模板
- ///
- /// 订单类型
- ///
- ///
- Task> GetOrderTemplatesAsync(int orderType, List distinctOrderNumbers);
+ Task> GetOrderDetails(GetOrderDetailsInputVO input);
///
/// 获取分页的轨迹订单
@@ -47,4 +40,11 @@ public interface IOrderRepository : IBasicRepository
///
///
Task UpdateOrderAsync(OrderEntity order);
+
+ ///
+ /// 删除订单
+ ///
+ ///
+ ///
+ Task DeleteOrderAsync(int orderId);
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderFlightEntity.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderFlightEntity.cs
index c76d4d54..4e5f2017 100644
--- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderFlightEntity.cs
+++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderFlightEntity.cs
@@ -4,7 +4,7 @@
/// 订单航班表(1:N)
///
[SugarTable("t_order_flight")]
-public class OrderFlightEntity : ICreateBaicEntity, IEntity
+public class OrderFlightEntity : ICreateBaicEntity, ISoftDeleteBasicEntity, IEntity
{
///
/// 自增主键
@@ -33,10 +33,18 @@ public class OrderFlightEntity : ICreateBaicEntity, IEntity
///
/// 创建人
///
+ [SugarColumn(ColumnName = "CreateUserId")]
public int CreateUserId { get; set; }
///
/// 创建时间
///
+ [SugarColumn(ColumnName = "CreateTime")]
public DateTime? CreateTime { get; set; }
+
+ ///
+ /// 是否删除
+ ///
+ [SugarColumn(ColumnName = "IsDeleted")]
+ public bool IsDeleted { get; set; }
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs
index 68b20740..112fc472 100644
--- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs
+++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderLinkEntity.cs
@@ -4,7 +4,7 @@
/// 轨迹订单关联表(1:N)
///
[SugarTable("t_order_link")]
-public class OrderLinkEntity : ICreateBaicEntity, IEntity
+public class OrderLinkEntity : ICreateBaicEntity, ISoftDeleteBasicEntity, IEntity
{
///
/// 自增主键
@@ -39,10 +39,18 @@ public class OrderLinkEntity : ICreateBaicEntity, IEntity
///
/// 创建人
///
+ [SugarColumn(ColumnName = "CreateUserId")]
public int CreateUserId { get; set; }
///
/// 创建时间
///
+ [SugarColumn(ColumnName = "CreateTime")]
public DateTime? CreateTime { get; set; }
+
+ ///
+ /// 是否删除
+ ///
+ [SugarColumn(ColumnName = "IsDeleted")]
+ public bool IsDeleted { get; set; }
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderTemplateEntity.cs b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderTemplateEntity.cs
index 91219904..88559ae6 100644
--- a/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderTemplateEntity.cs
+++ b/src/SJZY.Track.Domain/Aggregates/OrderAggregate/OrderTemplateEntity.cs
@@ -4,7 +4,7 @@
/// 轨迹订单模板表(1:N)
///
[SugarTable("t_order_template")]
-public class OrderTemplateEntity : ICreateBaicEntity, IEntity
+public class OrderTemplateEntity : ICreateBaicEntity, ISoftDeleteBasicEntity, IEntity
{
///
/// 自增主键
@@ -30,6 +30,21 @@ public class OrderTemplateEntity : ICreateBaicEntity, IEntity
[SugarColumn(ColumnName = "TrackTemplateId")]
public int TrackTemplateId { get; set; }
+ ///
+ /// 创建人
+ ///
+ [SugarColumn(ColumnName = "CreateUserId")]
public int CreateUserId { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "CreateTime")]
public DateTime? CreateTime { get; set; }
+
+ ///
+ /// 是否删除
+ ///
+ [SugarColumn(ColumnName = "IsDeleted")]
+ public bool IsDeleted { get; set; }
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentEntity.cs
index adf4b23b..02fac985 100644
--- a/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentEntity.cs
+++ b/src/SJZY.Track.Domain/Aggregates/TrackContentAggregate/TrackContentEntity.cs
@@ -16,19 +16,19 @@ public class TrackContentEntity : IFullAuditedBasicEntitys, IAggregateRoot
/// 轨迹内容代码
///
[SugarColumn(ColumnName = "Code")]
- public string Code { get; set; }
+ public string Code { get; set; } = null!;
///
/// 轨迹内容
///
[SugarColumn(ColumnName = "Content")]
- public string Content { get; set; }
+ public string Content { get; set; } = null!;
///
/// 轨迹内容英文
///
[SugarColumn(ColumnName = "EnContent")]
- public string EnContent { get; set; }
+ public string EnContent { get; set; } = null!;
///
/// 子系统id
diff --git a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs
index 5e83c476..444dd072 100644
--- a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs
+++ b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/ITrackDetailsRepository.cs
@@ -4,9 +4,13 @@ namespace SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
public interface ITrackDetailsRepository
{
- Task WriteTrack(TrackDetailsIndex index);
+ Task GetFirstOrDefaultAsync(int orderId, string inputTrackCode);
- Task> GetListAsync(List orderNos);
+ Task UpdateAsync(TrackDetailsIndex index);
+
+ Task CreateAsync(TrackDetailsIndex index);
+
+ Task> GetListAsync(int orderType, List orderNos);
Task<(List list, long total)> GetListAsync(TrackDetailsQueryInput input);
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs
index 9040ecc2..a8160da6 100644
--- a/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs
+++ b/src/SJZY.Track.Domain/Aggregates/TrackDetailsAggregate/TrackDetailsIndex.cs
@@ -21,7 +21,7 @@ public class TrackDetailsIndex : IdBaseIndex
///
/// 订单类型(主数据枚举TrackOrderType)
///
- public string OrderType { get; set; }
+ public int OrderType { get; set; }
///
/// 轨迹状态
diff --git a/src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/TrackStatusEntity.cs b/src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/TrackStatusEntity.cs
index 7d1b1a0d..dd98a21d 100644
--- a/src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/TrackStatusEntity.cs
+++ b/src/SJZY.Track.Domain/Aggregates/TrackStatusAggregate/TrackStatusEntity.cs
@@ -16,13 +16,13 @@ public class TrackStatusEntity : IFullAuditedBasicEntitys, IAggregateRoot
/// 轨迹状态代码
///
[SugarColumn(ColumnName = "Code")]
- public string Code { get; set; }
+ public string Code { get; set; } = null!;
///
/// 轨迹状态英文
///
[SugarColumn(ColumnName = "EnStatus")]
- public string EnStatus { get; set; }
+ public string EnStatus { get; set; } = null!;
///
/// 所属节点(主数据枚举ServiceNode)
@@ -34,7 +34,7 @@ public class TrackStatusEntity : IFullAuditedBasicEntitys, IAggregateRoot
/// 轨迹状态
///
[SugarColumn(ColumnName = "Status")]
- public string Status { get; set; }
+ public string Status { get; set; } = null!;
///
/// 子系统id
diff --git a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs
index f7c5fb2b..13d2ff0a 100644
--- a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs
+++ b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs
@@ -4,8 +4,6 @@ namespace SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
public interface ITrackTemplateRepository : IBasicRepository
{
- Task> GetTemplateContentOrderlyAsync(List distinctTemplateIds);
-
Task GetDetailAsync(int id);
Task> GetPageTrackTemplate(GetPageTrackTemplateVO input);
@@ -35,5 +33,6 @@ public interface ITrackTemplateRepository : IBasicRepository SoftDeleteContentAsync(int id);
- Task> GetContentListAsync(Expression> whereExpression);
+ Task> GetContentListAsync(
+ Expression> whereExpression);
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Domain/Dtos/Order/OrderIdentifier.cs b/src/SJZY.Track.Domain/Dtos/Order/OrderIdentifier.cs
new file mode 100644
index 00000000..248ec7e9
--- /dev/null
+++ b/src/SJZY.Track.Domain/Dtos/Order/OrderIdentifier.cs
@@ -0,0 +1,23 @@
+namespace SJZY.Track.Domain.Dtos.Order;
+
+///
+/// 订单标识符
+///
+public readonly struct OrderIdentifier
+{
+ public OrderIdentifier(int orderType, string orderNo)
+ {
+ OrderType = orderType;
+ OrderNo = orderNo;
+ }
+
+ ///
+ /// 订单类型
+ ///
+ public int OrderType { get; }
+
+ ///
+ /// 订单号
+ ///
+ public string OrderNo { get; }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Domain/Dtos/Order/OrderTemplateDto.cs b/src/SJZY.Track.Domain/Dtos/Order/OrderTemplateLinkDto.cs
similarity index 70%
rename from src/SJZY.Track.Domain/Dtos/Order/OrderTemplateDto.cs
rename to src/SJZY.Track.Domain/Dtos/Order/OrderTemplateLinkDto.cs
index c2655b43..6ca82ed3 100644
--- a/src/SJZY.Track.Domain/Dtos/Order/OrderTemplateDto.cs
+++ b/src/SJZY.Track.Domain/Dtos/Order/OrderTemplateLinkDto.cs
@@ -1,11 +1,11 @@
namespace SJZY.Track.Domain.Dtos.Order;
-public class OrderTemplateDto
+public class OrderTemplateLinkDto
{
///
/// 订单号
///
- public string OrderNo { get; set; }
+ public string OrderNo { get; set; } = null!;
///
/// 模板id
diff --git a/src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentDto.cs b/src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentDto.cs
new file mode 100644
index 00000000..c6e07352
--- /dev/null
+++ b/src/SJZY.Track.Domain/Dtos/TrackDetails/MatchTrackContentDto.cs
@@ -0,0 +1,19 @@
+namespace SJZY.Track.Domain.Dtos.TrackDetails;
+
+public class MatchTrackContentDto
+{
+ ///
+ /// 轨迹内容
+ ///
+ public string Content { get; set; }
+
+ ///
+ /// 轨迹内容英文
+ ///
+ public string EnContent { get; set; }
+
+ ///
+ /// 轨迹状态
+ ///
+ public string Status { get; set; }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Domain/Dtos/TrackTemplate/TemplateContentOrderlyDto.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/OrderedTrackCodeDto.cs
similarity index 86%
rename from src/SJZY.Track.Domain/Dtos/TrackTemplate/TemplateContentOrderlyDto.cs
rename to src/SJZY.Track.Domain/Dtos/TrackTemplate/OrderedTrackCodeDto.cs
index d7ef08ef..60362986 100644
--- a/src/SJZY.Track.Domain/Dtos/TrackTemplate/TemplateContentOrderlyDto.cs
+++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/OrderedTrackCodeDto.cs
@@ -1,6 +1,6 @@
namespace SJZY.Track.Domain.Dtos.TrackTemplate;
-public class TemplateContentOrderlyDto
+public class OrderedTrackCodeDto
{
///
/// 模板id
diff --git a/src/SJZY.Track.Domain/IBasicRepository.cs b/src/SJZY.Track.Domain/IBasicRepository.cs
index b085429b..71bc3175 100644
--- a/src/SJZY.Track.Domain/IBasicRepository.cs
+++ b/src/SJZY.Track.Domain/IBasicRepository.cs
@@ -1,4 +1,6 @@
-namespace SJZY.Track.Domain;
+using SJZY.Track.Domain.Queries;
+
+namespace SJZY.Track.Domain;
public interface IBasicRepository : IBasicQuery where T : IAggregateRoot
{
diff --git a/src/SJZY.Track.Domain/IBasicQuery.cs b/src/SJZY.Track.Domain/Queries/IBasicQuery.cs
similarity index 96%
rename from src/SJZY.Track.Domain/IBasicQuery.cs
rename to src/SJZY.Track.Domain/Queries/IBasicQuery.cs
index f050d54d..894e72a9 100644
--- a/src/SJZY.Track.Domain/IBasicQuery.cs
+++ b/src/SJZY.Track.Domain/Queries/IBasicQuery.cs
@@ -1,4 +1,4 @@
-namespace SJZY.Track.Domain;
+namespace SJZY.Track.Domain.Queries;
public interface IBasicQuery where T : IEntity
{
diff --git a/src/SJZY.Track.Domain/Queries/ITrackQueries.cs b/src/SJZY.Track.Domain/Queries/ITrackQueries.cs
new file mode 100644
index 00000000..df41882c
--- /dev/null
+++ b/src/SJZY.Track.Domain/Queries/ITrackQueries.cs
@@ -0,0 +1,34 @@
+using SJZY.Track.Domain.Dtos.Order;
+using SJZY.Track.Domain.Dtos.TrackDetails;
+using SJZY.Track.Domain.Dtos.TrackTemplate;
+
+namespace SJZY.Track.Domain.Queries;
+
+///
+/// 提供接口专用查询
+///
+public interface ITrackQueries
+{
+ ///
+ /// 根据订单号,获取订单模板
+ ///
+ /// 订单类型
+ /// 订单号
+ ///
+ Task> GetOrderTemplateLinksAsync(int orderType, List orderNumbers);
+
+ ///
+ /// 根据订单模板,获取有序的轨迹code
+ ///
+ /// 模板id
+ ///
+ Task> GetOrderedTrackCodesAsync(List templateIds);
+
+ ///
+ /// 根据订单id找到订单模板,匹配模板命中的轨迹内容
+ ///
+ /// 订单id
+ /// 轨迹代码
+ ///
+ Task MatchTrackContentAsync(int orderId, string code);
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Repository/BasicQuery.cs b/src/SJZY.Track.Repository/BasicQuery.cs
index 275b3b4d..4d8e70d1 100644
--- a/src/SJZY.Track.Repository/BasicQuery.cs
+++ b/src/SJZY.Track.Repository/BasicQuery.cs
@@ -1,5 +1,5 @@
using System.Linq.Expressions;
-using SJZY.Track.Domain;
+using SJZY.Track.Domain.Queries;
using SJZY.Track.Domain.SeedWork;
namespace SJZY.Track.Repository;
diff --git a/src/SJZY.Track.Repository/DataBaseContext.cs b/src/SJZY.Track.Repository/DataBaseContext.cs
index 14dbada8..88539836 100644
--- a/src/SJZY.Track.Repository/DataBaseContext.cs
+++ b/src/SJZY.Track.Repository/DataBaseContext.cs
@@ -1,77 +1,77 @@
-#pragma warning disable 1591
-using SJZY.UserCenter.HttpApi.Services;
+using SJZY.UserCenter.HttpApi.Services;
-namespace SJZY.Track.Repository
+#pragma warning disable 1591
+
+namespace SJZY.Track.Repository;
+
+///
+/// Sqlsugar 上下文对象
+///
+public class DataBaseContext
{
- ///
- /// Sqlsugar 上下文对象
- ///
- public class DataBaseContext
+ #region 审计属性自动赋值
+
+ public static void OnExcutingAction(object oldValue, DataFilterModel entityInfo)
{
+ //过滤掉 "v_" 开头的表
+ if (entityInfo.EntityColumnInfo.DbTableName.StartsWith("v_", StringComparison.OrdinalIgnoreCase))
+ throw new Exception("非法的操作,不允许编辑映射表");
- #region 审计属性自动赋值
-
- public static void OnExcutingAction(object oldValue, DataFilterModel entityInfo)
+ //新增
+ if (entityInfo.OperationType == DataFilterType.InsertByObject)
{
- //过滤掉 "v_" 开头的表
- if (entityInfo.EntityColumnInfo.DbTableName.StartsWith("v_", StringComparison.OrdinalIgnoreCase))
- throw new Exception("非法的操作,不允许编辑映射表");
-
- //新增
- if (entityInfo.OperationType == DataFilterType.InsertByObject)
+ if (entityInfo.PropertyName == nameof(ICreateBaicEntity.CreateTime))
+ entityInfo.SetValue(DateTime.Now);
+ if (entityInfo.PropertyName == nameof(ICreateBaicEntity.CreateUserId))
{
- if (entityInfo.PropertyName == nameof(ICreateBaicEntity.CreateTime))
- entityInfo.SetValue(DateTime.Now);
- if (entityInfo.PropertyName == nameof(ICreateBaicEntity.CreateUserId))
+ if (oldValue == null || (int)oldValue == 0)
{
- if (oldValue == null || (int)oldValue == 0)
+ try
+ {
+ entityInfo.SetValue(CurrentUserRequest.CurrentUser?.UserId);
+ }
+ catch
{
- try
- {
- entityInfo.SetValue(CurrentUserRequest.CurrentUser?.UserId);
- }
- catch
- {
-
- }
}
- //entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId);
}
+ //entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId);
}
- //修改
- else if (entityInfo.OperationType == DataFilterType.UpdateByObject)
+ }
+ //修改
+ else if (entityInfo.OperationType == DataFilterType.UpdateByObject)
+ {
+ if (entityInfo.PropertyName == nameof(IUpdateBasicEntity.UpdateTime))
+ entityInfo.SetValue(DateTime.Now);
+ else if (entityInfo.PropertyName == nameof(IUpdateBasicEntity.UpdateUserId))
{
- if (entityInfo.PropertyName == nameof(IUpdateBasicEntity.UpdateTime))
- entityInfo.SetValue(DateTime.Now);
- else if (entityInfo.PropertyName == nameof(IUpdateBasicEntity.UpdateUserId))
+ if (oldValue == null || (int)oldValue == 1)
{
- if (oldValue == null || (int)oldValue == 1)
+ try
+ {
+ entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId);
+ }
+ catch
{
- try
- {
- entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId);
- }
- catch
- {
-
- }
}
- //entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId);
}
- //删除
- else if (entityInfo.PropertyName == nameof(IDeleteBasicEntity.IsDeleted))
+ //entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId);
+ }
+ //删除
+ else if (entityInfo.PropertyName == nameof(IDeleteBasicEntity.IsDeleted))
+ {
+ var currentType = entityInfo.EntityValue.GetType();
+ bool.TryParse(
+ currentType.GetProperty(entityInfo.PropertyName)?.GetValue(entityInfo.EntityValue)?.ToString(),
+ out bool isdelete);
+ if (isdelete)
{
- var currentType = entityInfo.EntityValue.GetType();
- bool.TryParse(currentType.GetProperty(entityInfo.PropertyName)?.GetValue(entityInfo.EntityValue)?.ToString(), out bool isdelete);
- if (isdelete)
- {
- //currentType.GetProperty(nameof(IDeleteBasicEntity.DeleteUserId))?.SetValue(entityInfo.EntityValue, 5);
- currentType.GetProperty(nameof(IDeleteBasicEntity.DeleteTime))?.SetValue(entityInfo.EntityValue, DateTime.Now);
- }
+ //currentType.GetProperty(nameof(IDeleteBasicEntity.DeleteUserId))?.SetValue(entityInfo.EntityValue, 5);
+ currentType.GetProperty(nameof(IDeleteBasicEntity.DeleteTime))
+ ?.SetValue(entityInfo.EntityValue, DateTime.Now);
}
}
}
-
- #endregion 审计属性自动赋值
}
+
+ #endregion 审计属性自动赋值
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Repository/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs
index 3196cbdd..c932f142 100644
--- a/src/SJZY.Track.Repository/OrderRepository.cs
+++ b/src/SJZY.Track.Repository/OrderRepository.cs
@@ -1,7 +1,5 @@
-using Microsoft.AspNetCore.Mvc;
-using SJZY.Track.Domain;
+using SJZY.Track.Domain;
using SJZY.Track.Domain.Aggregates.OrderAggregate;
-using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
using SJZY.Track.Domain.Dtos.Order;
namespace SJZY.Track.Repository;
@@ -16,20 +14,6 @@ public class OrderRepository : BasicRepository, IOrderRepository, I
.ExecuteCommandAsync();
}
- public async Task> GetOrderTemplatesAsync(int orderType,
- List distinctOrderNumbers)
- {
- return await AsQueryable()
- .LeftJoin((a, b) => a.Id == b.OrderId)
- .Where(a => a.OrderType == orderType && distinctOrderNumbers.Contains(a.OrderNo))
- .Select((a, b) => new OrderTemplateDto
- {
- OrderNo = a.OrderNo,
- TemplateId = b.TrackTemplateId
- })
- .ToListAsync();
- }
-
public async Task LinkOrderAsync(List orderLinkEntities)
{
await Context.Insertable(orderLinkEntities).ExecuteCommandAsync();
@@ -60,6 +44,20 @@ public class OrderRepository : BasicRepository, IOrderRepository, I
tran.Complete();
}
+ public async Task DeleteOrderAsync(int orderId)
+ {
+ using var tran = TransactionHelper.GetReadCommitted();
+
+ // 软删订单主表
+ await SoftDeleteAsync(x => x.Id == orderId);
+
+ // 软删订单模板
+ // 软删订单航班
+ // 软删订单关联关系
+
+ tran.Complete();
+ }
+
#region 轨迹订单明细
///
@@ -71,9 +69,11 @@ public class OrderRepository : BasicRepository, IOrderRepository, I
{
return null;
}
+
#endregion
#region 轨迹订单分页
+
///
/// 获取分页的轨迹订单
///
@@ -105,5 +105,6 @@ public class OrderRepository : BasicRepository, IOrderRepository, I
return null;
}
+
#endregion
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Repository/Queries/TrackQueries.cs b/src/SJZY.Track.Repository/Queries/TrackQueries.cs
new file mode 100644
index 00000000..da7c4dab
--- /dev/null
+++ b/src/SJZY.Track.Repository/Queries/TrackQueries.cs
@@ -0,0 +1,78 @@
+using SJZY.Track.Domain.Aggregates.OrderAggregate;
+using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
+using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
+using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
+using SJZY.Track.Domain.Dtos.Order;
+using SJZY.Track.Domain.Dtos.TrackDetails;
+using SJZY.Track.Domain.Dtos.TrackTemplate;
+using SJZY.Track.Domain.Queries;
+
+namespace SJZY.Track.Repository.Queries;
+
+public class TrackQueries : ISugarRepository, ITrackQueries,
+ ITransientDependency
+{
+ public ISqlSugarClient Context { get; set; }
+
+ public TrackQueries()
+ {
+ Context = SqlsugarScopeBasic.GetContextSafely("default");
+ }
+
+ public async Task> GetOrderTemplateLinksAsync(int orderType,
+ params string[] orderNumbers)
+ {
+ return await Context.Queryable()
+ .LeftJoin((a, b) => a.Id == b.OrderId)
+ .Where(a => a.OrderType == orderType && orderNumbers.Contains(a.OrderNo))
+ .Select((a, b) => new OrderTemplateLinkDto
+ {
+ OrderNo = a.OrderNo,
+ TemplateId = b.TrackTemplateId
+ })
+ .ToListAsync();
+ }
+
+ public async Task> GetOrderTemplateLinksAsync(int orderType, List orderNumbers)
+ {
+ return await Context.Queryable()
+ .LeftJoin((a, b) => a.Id == b.OrderId)
+ .Where(a => a.OrderType == orderType && orderNumbers.Contains(a.OrderNo))
+ .Select((a, b) => new OrderTemplateLinkDto
+ {
+ OrderNo = a.OrderNo,
+ TemplateId = b.TrackTemplateId
+ })
+ .ToListAsync();
+ }
+
+ public async Task> GetOrderedTrackCodesAsync(List templateIds)
+ {
+ return await Context.Queryable()
+ .LeftJoin((a, b) => a.TrackContentId == b.Id)
+ .Where(a => templateIds.Contains(a.TrackTemplateId))
+ .OrderBy(a => a.Sort)
+ .Select((a, b) => new OrderedTrackCodeDto
+ {
+ TemplateId = a.Id,
+ Code = b.Code
+ })
+ .ToListAsync();
+ }
+
+ public async Task MatchTrackContentAsync(int orderId, string code)
+ {
+ return await Context.Queryable()
+ .LeftJoin((x, a) => x.TrackTemplateId == a.TrackTemplateId)
+ .LeftJoin((x, a, b) => a.TrackContentId == b.Id)
+ .LeftJoin((x, a, b, c) => b.TrackStatusId == c.Id)
+ .Where((x, a, b) => x.OrderId == orderId && b.Code == code)
+ .Select((x, a, b, c) => new MatchTrackContentDto
+ {
+ Content = b.Content,
+ EnContent = b.EnContent,
+ Status = c.Status
+ })
+ .FirstAsync();
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs b/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs
index a482fb7f..799c900a 100644
--- a/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs
+++ b/src/SJZY.Track.Repository/SJZYTrackRepositoryModule.cs
@@ -3,6 +3,7 @@ using Microsoft.Extensions.DependencyInjection;
using SJZY.Expand.ABP.Core.SqlSugar.Options;
using SJZY.Expand.ElasticSearch;
using SJZY.Track.Domain;
+using SJZY.Track.Domain.Queries;
using Volo.Abp.Autofac;
using Volo.Abp.Modularity;
@@ -44,9 +45,6 @@ public class SJZYTrackRepositoryModule : AbpModule
}
-
-
-
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddTransient(typeof(IBasicQuery<>), typeof(BasicQuery<>));
diff --git a/src/SJZY.Track.Repository/TrackDetailsRepository.cs b/src/SJZY.Track.Repository/TrackDetailsRepository.cs
index 3a0677b9..ef51db46 100644
--- a/src/SJZY.Track.Repository/TrackDetailsRepository.cs
+++ b/src/SJZY.Track.Repository/TrackDetailsRepository.cs
@@ -1,6 +1,4 @@
using Nest;
-using SJZY.Expand.ABP.Core.Logger;
-using SJZY.Expand.ABP.Core.PublicMethords;
using SJZY.Expand.ElasticSearch.Services;
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
using SJZY.Track.Domain.Dtos.TrackDetails;
@@ -10,26 +8,49 @@ namespace SJZY.Track.Repository;
internal class TrackDetailsRepository : ElasticSearchContextAbstract, ITrackDetailsRepository,
ITransientDependency
{
+ public string IndexName => $"{TrackDetailsIndex.IndexName}-{DateTime.Now:yyyy.MM.dd}";
+
public TrackDetailsRepository(ConnectionFactory connectionFactory) : base(connectionFactory)
{
}
- public async Task WriteTrack(TrackDetailsIndex index)
+ public async Task GetFirstOrDefaultAsync(int orderId, string trackCode)
{
- try
+ var r = await Context.SearchAsync(s => s
+ .Index($"{TrackDetailsIndex.IndexName}-{DateTime.Now:yyyy.MM.dd}")
+ .Query(q =>
+ q.Term(t => t.Field(f => f.OrderId).Value(orderId))
+ && q.Term(t => t.Field(f => f.TrackCode).Value(trackCode))
+ )
+ );
+
+ if (r.IsValid)
{
- //await Context.IndexDocumentAsync(idx);
- var response = await Context.IndexAsync(index,
- request => request.Index($"{TrackDetailsIndex.IndexName}-{DateTime.Now:yyyy.MM.dd}"));
- if (!response.IsValid) LogHelper.Error("数据添加失败,原因:" + response.DebugInformation);
- }
- catch (Exception ex)
- {
- LogHelper.Error($"日志插入ES失败:{ex.Message}。{index.ToJson()}");
+ return r.Documents.FirstOrDefault();
}
+
+ return default;
}
- public async Task> GetListAsync(List orderNos)
+ public async Task UpdateAsync(TrackDetailsIndex index)
+ {
+ var response = await Context.UpdateAsync(index.Id, u => u
+ .Index(IndexName)
+ .Doc(index)
+ //.Refresh(Refresh.True) // 可选:立即刷新索引使更改立即可见
+ );
+ if (!response.IsValid)
+ throw new Exception($"数据修改失败,原因:{response.DebugInformation}");
+ }
+
+ public async Task CreateAsync(TrackDetailsIndex index)
+ {
+ var response = await Context.IndexAsync(index, request => request.Index(IndexName));
+ if (!response.IsValid)
+ throw new Exception($"数据添加失败,原因:{response.DebugInformation}");
+ }
+
+ public async Task> GetListAsync(int orderType, List orderNos)
{
if (orderNos.Count < 1) return new List();
@@ -42,9 +63,11 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract f.TrackTime)
.Field(f => f.TraceTimeZone)
))
- .Query(q => q.Terms(t => t
- .Field(f => f.OrderNo)
- .Terms(orderNos)))
+ .Query(q =>
+ q.Terms(t => t
+ .Field(f => f.OrderNo)
+ .Terms(orderNos))
+ && q.Term(f => f.OrderType, orderType))
);
return data.Documents.ToList();
diff --git a/src/SJZY.Track.Repository/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplateRepository.cs
index 41569c12..43fff1f5 100644
--- a/src/SJZY.Track.Repository/TrackTemplateRepository.cs
+++ b/src/SJZY.Track.Repository/TrackTemplateRepository.cs
@@ -10,24 +10,8 @@ using SJZY.Track.Repository.Enum;
namespace SJZY.Track.Repository;
-///
public class TrackTemplateRepository : BasicRepository, ITrackTemplateRepository, IScopedDependency
{
- public async Task> GetTemplateContentOrderlyAsync(List distinctTemplateIds)
- {
- return await Context.Queryable()
- .LeftJoin((a, b) => a.Id == b.TrackTemplateId)
- .LeftJoin((a, b, c) => b.TrackContentId == c.Id)
- .Where(a => distinctTemplateIds.Contains(a.Id))
- .OrderBy((a, b) => b.Sort)
- .Select((a, b, c) => new TemplateContentOrderlyDto
- {
- TemplateId = a.Id,
- Code = c.Code
- })
- .ToListAsync();
- }
-
///
/// 获取轨迹模版明细
///
@@ -40,13 +24,13 @@ public class TrackTemplateRepository : BasicRepository, ITr
.Where((a, b) => a.Id == id)
.Select((a, b) => new
GetTrackTemplateDetailVO
- {
- Id = a.Id,
- Code = a.Code,
- Name = a.Name,
- SubSystemId = a.SubSystemId,
- SubSystem = b.CnName
- }).FirstAsync();
+ {
+ Id = a.Id,
+ Code = a.Code,
+ Name = a.Name,
+ SubSystemId = a.SubSystemId,
+ SubSystem = b.CnName
+ }).FirstAsync();
return detail;
}
@@ -58,13 +42,14 @@ public class TrackTemplateRepository : BasicRepository, ITr
///
public async Task> GetPageTrackTemplate(GetPageTrackTemplateVO input)
{
- UnifyPageResultDto pagedList = new UnifyPageResultDto();
- pagedList = await Context.Queryable()
+ UnifyPageResultDto pagedList = await Context.Queryable()
.LeftJoin((a, b) => a.SubSystemId == b.Id)
.WhereIF(input.SubSystemId > 0, (a, b) => a.SubSystemId == input.SubSystemId)
.WhereIF(!input.Keywords.IsNullOrWhiteSpace(),
(a, b) => a.Name.Contains(input.Keywords) || a.Code.Contains(input.Keywords))
- .OrderByIF(input.TrackTemplateId > 0, (a, b) => SqlFunc.IIF(a.Id == input.TrackTemplateId, SqlFunc.DateAdd(SqlFunc.GetDate(), 1), a.CreateTime), OrderByType.Desc)
+ .OrderByIF(input.TrackTemplateId > 0,
+ (a, b) => SqlFunc.IIF(a.Id == input.TrackTemplateId, SqlFunc.DateAdd(SqlFunc.GetDate(), 1),
+ a.CreateTime), OrderByType.Desc)
.Select((a, b) => new GetTrackTemplateListVO
{
Id = a.Id,
@@ -168,7 +153,8 @@ public class TrackTemplateRepository : BasicRepository, ITr
.ExecuteCommandHasChangeAsync();
}
- public async Task> GetContentListAsync(Expression> whereExpression)
+ public async Task> GetContentListAsync(
+ Expression> whereExpression)
{
return await Context.Queryable().Where(whereExpression).ToListAsync();
}
From 159ac8b029010407c2e1bc8e672eb64dccf90fcf Mon Sep 17 00:00:00 2001
From: moyongzhen <2534173414@qq.com>
Date: Thu, 29 Feb 2024 21:09:25 +0800
Subject: [PATCH 10/16] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=88=86=E9=A1=B5?=
=?UTF-8?q?=E7=9A=84=E8=BD=A8=E8=BF=B9=E8=AE=A2=E5=8D=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../AutoMapper/OrderAutoMapperProfile.cs | 4 ++
.../ProvideServices/GetPageTrackOrderInput.cs | 60 ++++++++++++++++--
.../Services/ProvideServices/OrderService.cs | 9 +--
.../Dtos/Order/GetPageTrackOrderInputVO.cs | 57 +++++++++++++++--
src/SJZY.Track.Repository/OrderRepository.cs | 62 +++++++++++++------
5 files changed, 159 insertions(+), 33 deletions(-)
diff --git a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs
index fabc4fdd..a8d93386 100644
--- a/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs
+++ b/src/SJZY.Track.Application/AutoMapper/OrderAutoMapperProfile.cs
@@ -1,7 +1,9 @@
using AutoMapper;
+using AutoMapper.Internal.Mappers;
using SJZY.Track.Application.Dtos.ProvideServices;
using SJZY.Track.Domain.Aggregates.OrderAggregate;
using SJZY.Track.Domain.Dtos.Order;
+using System.Diagnostics;
namespace SJZY.Track.Application.AutoMapper;
@@ -18,5 +20,7 @@ public class OrderAutoMapperProfile : Profile
CreateMap(MemberList.None);
CreateMap(MemberList.None);
+ CreateMap(MemberList.None);
+ CreateMap, UnifyPageResultDto>(MemberList.None);
}
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs b/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs
index 4709c862..06335e34 100644
--- a/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs
+++ b/src/SJZY.Track.Application/Dtos/ProvideServices/GetPageTrackOrderInput.cs
@@ -26,7 +26,7 @@ namespace SJZY.Track.Application.Dtos.ProvideServices
///
/// 创建时间截止
///
- public DateTime? createTimeEnd { get; set; }
+ public DateTime? CreateTimeEnd { get; set; }
}
///
@@ -40,11 +40,63 @@ namespace SJZY.Track.Application.Dtos.ProvideServices
public int Id { get; set; }
///
- /// 订单类型
+ /// 订单类型id
///
- public string OrderType { get; set; }
+ public int OrderType { get; set; }
+ ///
+ /// 订单号
+ ///
+ public string? OrderNumber { get; set; }
- public string OrderNumber { get; set; }
+ ///
+ /// 轨迹模版
+ ///
+ public string? TrackTemplateNames { get; set; }
+
+ ///
+ /// 客户简称
+ ///
+ public string? CustomerShortName { get; set; }
+
+ ///
+ /// 客户代码
+ ///
+ public string? CustomerCode { get; set; }
+
+ ///
+ /// 订单明细(json)
+ ///
+ public string? OrderDetails { get; set; }
+
+ ///
+ /// 最新轨迹内容
+ ///
+ public string? NewestTrackContent { get; set; }
+
+ ///
+ /// 最新轨迹内容英文
+ ///
+ public string? NewestTrackEnContent { get; set; }
+
+ ///
+ /// 最新轨迹发生地
+ ///
+ public string? NewestTrackPlace { get; set; }
+
+ ///
+ /// 是否完结
+ ///
+ public bool IsFinish { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public DateTime? CreateTime { get; set; }
+
+ ///
+ /// 子系统
+ ///
+ public string SubSystem { get; set; }
}
}
diff --git a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs
index f75a8de9..8b6b8e19 100644
--- a/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs
+++ b/src/SJZY.Track.Application/Services/ProvideServices/OrderService.cs
@@ -1,4 +1,5 @@
-using SJZY.Track.Application.Dtos.ProvideServices;
+using SJZY.Expand.ABP.Core.Common.Dto;
+using SJZY.Track.Application.Dtos.ProvideServices;
using SJZY.Track.Domain.Aggregates.OrderAggregate;
using SJZY.Track.Domain.Dtos.Order;
@@ -91,9 +92,9 @@ public class OrderService : ApplicationService
public async Task> GetPageTrackOrder(GetPageTrackOrderInput input)
{
var vo = ObjectMapper.Map(input);
- var jj = await _orderRepository.GetPageTrackOrder(vo);
-
- return null;
+ var pageList = await _orderRepository.GetPageTrackOrder(vo);
+ var pageResultDto = ObjectMapper.Map, UnifyPageResultDto>(pageList);
+ return pageResultDto;
}
#endregion
diff --git a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs
index 5dcbafaf..c95fae3e 100644
--- a/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs
+++ b/src/SJZY.Track.Domain/Dtos/Order/GetPageTrackOrderInputVO.cs
@@ -40,16 +40,63 @@ namespace SJZY.Track.Domain.Dtos.Order
public int Id { get; set; }
///
- /// 订单类型
+ /// 订单类型id
///
- public string OrderType { get; set; }
+ public int OrderType { get; set; }
-
- public string OrderNumber { get; set; }
+ ///
+ /// 订单号
+ ///
+ public string? OrderNumber { get; set; }
///
/// 轨迹模版
///
- public string TrackTemplateNames { get; set; }
+ public string? TrackTemplateNames { get; set; }
+
+ ///
+ /// 客户简称
+ ///
+ public string? CustomerShortName { get; set; }
+
+ ///
+ /// 客户代码
+ ///
+ public string? CustomerCode { get; set; }
+
+ ///
+ /// 订单明细(json)
+ ///
+ public string? OrderDetails { get; set; }
+
+ ///
+ /// 最新轨迹内容
+ ///
+ public string? NewestTrackContent { get; set; }
+
+ ///
+ /// 最新轨迹内容英文
+ ///
+ public string? NewestTrackEnContent { get; set; }
+
+ ///
+ /// 最新轨迹发生地
+ ///
+ public string? NewestTrackPlace { get; set; }
+
+ ///
+ /// 是否完结
+ ///
+ public bool IsFinish { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public DateTime? CreateTime { get; set; }
+
+ ///
+ /// 子系统
+ ///
+ public string SubSystem { get; set; }
}
}
diff --git a/src/SJZY.Track.Repository/OrderRepository.cs b/src/SJZY.Track.Repository/OrderRepository.cs
index c932f142..1d7ebfa2 100644
--- a/src/SJZY.Track.Repository/OrderRepository.cs
+++ b/src/SJZY.Track.Repository/OrderRepository.cs
@@ -1,6 +1,10 @@
-using SJZY.Track.Domain;
+using Nest;
+using SJZY.Track.Domain;
using SJZY.Track.Domain.Aggregates.OrderAggregate;
+using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
using SJZY.Track.Domain.Dtos.Order;
+using SJZY.Track.Domain.VEntities;
+using SJZY.Track.Repository.VData.Entitys;
namespace SJZY.Track.Repository;
@@ -81,29 +85,47 @@ public class OrderRepository : BasicRepository, IOrderRepository, I
///
public async Task> GetPageTrackOrder(GetPageTrackOrderInputVO input)
{
- //await Context.Queryable((a,b)= );
- //await Context.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, a.Id==b.OrderId))
- // .GroupBy((a, b) => new { a.Id })
- // .Select((a, b) => new TrackOrderVO
- // {
- // Id=a.Id,
- // OrderNumber=a.OrderNo,
- // TrackTemplateNames = SqlFunc.AggregateConcat(b.)
+ var pageList = await Context.Queryable()
+ .LeftJoin((a, b) => a.CustomId==b.Id)
+ .LeftJoin((a, b, c) => a.SubSystemId==c.Id)
+ .Select((a, b, c) => new TrackOrderVO
+ {
+ Id = a.Id,
+ OrderNumber= a.OrderNo,
+ OrderType = a.OrderType,
+ CustomerShortName= b.Abbreviation,
+ CustomerCode= b.Code,
+ TrackTemplateNames = "",
+ OrderDetails="",
+ NewestTrackContent= a.LatestTrackContent,
+ NewestTrackEnContent= a.LatestTrackEnContent,
+ NewestTrackPlace= a.LatestTrackPlace,
+ IsFinish=a.IsCompleted,
+ CreateTime=a.CreateTime,
+ SubSystem= c.CnName
+ })
+ .ToPagedListAsync(input.PageIndex, input.PageSize);
+
+ if (pageList.List.Any())
+ {
+ var orderIds = pageList.List.Select(a => a.Id);
+ //查询轨迹模版
- // }).ToPageListAsync(input.PageIndex, input.PageSize);
+ var trackTemplateList = await Context.Queryable()
+ .LeftJoin((a, b) => a.TrackTemplateId==b.Id)
+ .Where((a, b) => orderIds.Contains(a.OrderId))
+ .Select((a, b) => new { OrderId = a.OrderId, Name = b.Name })
+ .ToListAsync();
- //await Context.Queryable()
- // .Includes(a => a.OrderTemplates)
- // .Select(a => new TrackOrderVO
- // {
- // Id=a.Id,
- // OrderNumber=a.OrderNo,
- // TrackTemplateNames = SqlFunc.Subqueryable().Where(z=>z.OrderId==a.Id).SelectStringJoin(z=>z.)
- // })
- // .ToPageListAsync(input.PageIndex, input.PageSize);
+ pageList.List.ForEach(a =>
+ {
+ var templateListOfOrderId = trackTemplateList.Where(b => b.OrderId== a.Id);
+ a.TrackTemplateNames = templateListOfOrderId.Select(c => c.Name).JoinAsString(",");
+ });
+ }
- return null;
+ return pageList;
}
#endregion
From 2998d69ed967eb3cde148a16ba3013dbd014c5e0 Mon Sep 17 00:00:00 2001
From: moyongzhen <2534173414@qq.com>
Date: Fri, 1 Mar 2024 09:11:27 +0800
Subject: [PATCH 11/16] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=A0=87=E8=AE=B0?=
=?UTF-8?q?=E7=BC=96=E8=BE=91=E8=BE=93=E5=85=A5=E5=8F=82=E6=95=B0=EF=BC=8C?=
=?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2=E7=B1=BB=E5=9E=8B=E5=8A=A0=E4=B8=8A?=
=?UTF-8?q?=20=3F=20=E5=8F=AF=E7=A9=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Dtos/TrackFlags/EditTrackFlagInput.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/SJZY.Track.Application/Dtos/TrackFlags/EditTrackFlagInput.cs b/src/SJZY.Track.Application/Dtos/TrackFlags/EditTrackFlagInput.cs
index 05c9b56c..901f5e5a 100644
--- a/src/SJZY.Track.Application/Dtos/TrackFlags/EditTrackFlagInput.cs
+++ b/src/SJZY.Track.Application/Dtos/TrackFlags/EditTrackFlagInput.cs
@@ -26,12 +26,12 @@ namespace SJZY.Track.Application.Dtos.TrackFlags
///
/// 标记
///
- public string Flag { get; set; }
+ public string? Flag { get; set; }
///
/// 代码
///
- public string Code { get; set; }
+ public string? Code { get; set; }
///
/// 是否完结
From c3886b1d8b45222930626d00ae3c1943b8942bfd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com>
Date: Fri, 1 Mar 2024 09:26:11 +0800
Subject: [PATCH 12/16] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?=
=?UTF-8?q?=E6=8E=A8=E9=80=81=E9=85=8D=E7=BD=AE=E5=88=97=E8=A1=A8=20?=
=?UTF-8?q?=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../AutoMapper/TrackPullAutoMapperProfile.cs | 17 ++++-----
.../AutoMapper/TrackPushAutoMapperProfile.cs | 10 +++++
.../Services/TrackPull/TrackPullService.cs | 1 -
.../Services/TrackPush/TrackPushService.cs | 38 +++++++++++++++++++
.../ITrackPushConfigRepository.cs | 6 ++-
.../GetTrackPullConfigPageOutputVO.cs | 2 +-
.../GetTrackPushConfigPageOutputVO.cs | 26 +++++++++++++
.../TrackPushConfigRepository.cs | 29 ++++++++++++++
8 files changed, 117 insertions(+), 12 deletions(-)
create mode 100644 src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs
create mode 100644 src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs
create mode 100644 src/SJZY.Track.Domain/Dtos/TrackPush/GetTrackPushConfigPageOutputVO.cs
diff --git a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs
index 3577eceb..da6207a5 100644
--- a/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs
+++ b/src/SJZY.Track.Application/AutoMapper/TrackPullAutoMapperProfile.cs
@@ -3,16 +3,15 @@ using SJZY.Track.Application.Dtos.TrackPull;
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
using Volo.Abp.AutoMapper;
-namespace SJZY.Track.Application.AutoMapper
+namespace SJZY.Track.Application.AutoMapper;
+
+public class TrackPullAutoMapperProfile : Profile
{
- public class TrackPullAutoMapperProfile : Profile
+ public TrackPullAutoMapperProfile()
{
- public TrackPullAutoMapperProfile()
- {
- CreateMap(MemberList.None);
- CreateMap(MemberList.None).Ignore(dest => dest.Id)
- .ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => false));
- CreateMap(MemberList.None);
- }
+ CreateMap(MemberList.None);
+ CreateMap(MemberList.None).Ignore(dest => dest.Id)
+ .ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => false));
+ CreateMap(MemberList.None);
}
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs b/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs
new file mode 100644
index 00000000..420b0e23
--- /dev/null
+++ b/src/SJZY.Track.Application/AutoMapper/TrackPushAutoMapperProfile.cs
@@ -0,0 +1,10 @@
+using AutoMapper;
+
+namespace SJZY.Track.Application.AutoMapper;
+
+public class TrackPushAutoMapperProfile : Profile
+{
+ public TrackPushAutoMapperProfile()
+ {
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs
index f76abe50..fcd56e92 100644
--- a/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs
+++ b/src/SJZY.Track.Application/Services/TrackPull/TrackPullService.cs
@@ -2,7 +2,6 @@
using SJZY.Expand.ABP.Core.Localization;
using SJZY.Expand.ABP.Core.PublicMethords;
using SJZY.Track.Application.Dtos.TrackPull;
-using SJZY.Track.Application.Dtos.TrackTemplates;
using SJZY.Track.Application.Localization;
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs
new file mode 100644
index 00000000..b04e1194
--- /dev/null
+++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs
@@ -0,0 +1,38 @@
+using Microsoft.Extensions.Localization;
+using SJZY.Track.Application.Localization;
+using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
+using SJZY.Track.Domain.Dtos.Common;
+using SJZY.Track.Domain.Dtos.TrackPush;
+using Volo.Abp.DependencyInjection;
+
+namespace SJZY.Track.Application.Services.TrackPush;
+
+///
+/// 轨迹推送
+///
+[ApiExplorerSettings(GroupName = "轨迹推送")]
+[Route("/Track/PushConfig")]
+public class TrackPushService : ApplicationService, ITransientDependency
+{
+ private readonly IStringLocalizer _stringLocalizer;
+ private readonly ITrackPushConfigRepository _trackPushConfigRepository;
+
+ public TrackPushService(
+ IStringLocalizer stringLocalizer,
+ ITrackPushConfigRepository trackPushConfigRepository)
+ {
+ _stringLocalizer = stringLocalizer;
+ _trackPushConfigRepository = trackPushConfigRepository;
+ }
+
+ ///
+ /// 轨迹推送配置列表
+ ///
+ ///
+ ///
+ [HttpPost("GetPage")]
+ public async Task> GetPageAsync([FromBody] KeywordsInputVO input)
+ {
+ return await _trackPushConfigRepository.GetPageAsync(input);
+ }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs
index abceffa6..82866c1f 100644
--- a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs
+++ b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs
@@ -1,5 +1,9 @@
-namespace SJZY.Track.Domain.Aggregates.TrackPushAggregate;
+using SJZY.Track.Domain.Dtos.Common;
+using SJZY.Track.Domain.Dtos.TrackPush;
+
+namespace SJZY.Track.Domain.Aggregates.TrackPushAggregate;
public interface ITrackPushConfigRepository : IBasicRepository
{
+ Task