From be1a18dfcb399d0b59cf54b66fe3a4553d4219a4 Mon Sep 17 00:00:00 2001
From: xiaolipro <2357729423@qq.com>
Date: Mon, 4 Aug 2025 17:46:29 +0800
Subject: [PATCH] 1122222eee
---
.../Caching/AppNameDictCache.cs | 43 +++++
.../ProvideServices/GetDetailTimelineInput.cs | 10 -
.../Dtos/ProvideServices/UpdateOrderInput.cs | 6 -
.../TrackPull/EditTrackPullConfigInput.cs | 2 +-
.../Dtos/Warning/GetWarningRuleInput.cs | 2 +-
.../Queries/TimezoneQueries.cs | 98 ----------
.../Services/ProvideServices/OrderService.cs | 4 -
.../TimerTaskss/TrackButtomUpScanTask.cs | 79 +-------
.../TrackContents/TrackContentService.cs | 73 +++-----
.../Services/TrackFlags/TrackFlagService.cs | 53 +++---
.../Services/TrackNode/TrackNodeService.cs | 173 ------------------
.../Services/TrackOrders/TrackOrderService.cs | 51 ++----
.../TrackPull/TrackPullCacheService.cs | 7 +-
.../Services/TrackPull/TrackPullService.cs | 19 +-
.../Services/TrackPush/TrackPushService.cs | 8 +-
.../Services/Warning/ReturnWarningService.cs | 89 +++------
.../Warning/TransportWarningService.cs | 63 +++----
.../Services/Warning/WarningService.cs | 32 ++--
.../Aggregates/OrderAggregate/OrderEntity.cs | 6 -
.../ExpressionExtensions.cs | 33 ++++
.../CollectionExtensions.cs | 25 ---
21 files changed, 222 insertions(+), 654 deletions(-)
create mode 100644 src/TrackCenter.Application/Caching/AppNameDictCache.cs
delete mode 100644 src/TrackCenter.Application/Queries/TimezoneQueries.cs
delete mode 100644 src/TrackCenter.Application/Services/TrackNode/TrackNodeService.cs
create mode 100644 src/TrackCenter.Domain/ExpressionExtensions.cs
diff --git a/src/TrackCenter.Application/Caching/AppNameDictCache.cs b/src/TrackCenter.Application/Caching/AppNameDictCache.cs
new file mode 100644
index 00000000..24f210ef
--- /dev/null
+++ b/src/TrackCenter.Application/Caching/AppNameDictCache.cs
@@ -0,0 +1,43 @@
+using TrackCenter.Domain.VEntities;
+
+namespace TrackCenter.Application.Caching;
+
+///
+/// 系统id中文名称字典缓存
+///
+public class AppNameDictCache : BasicCacheForPeriodicRefresh, ISingletonDependency
+{
+ private readonly IBasicRepository _appRepository;
+
+ public AppNameDictCache(IBasicRepository appRepository) : base(RedisHelper.Client)
+ {
+ _appRepository = appRepository;
+ }
+
+ protected override string BuildRedisKey(string key) => $"{GlobalConst.TrackDataDictKeyPrefix}:AppName:{key}";
+
+ protected override TimeSpan RedisExpire => TimeSpan.FromSeconds(-1); // 设置缓存不过期,指定id系统被删除时仍能兜底提供系统中文名
+ protected override TimeSpan LocalExpire => TimeSpan.FromMinutes(10); // 本地缓存10分钟过期后在次请求会刷新数据
+ protected override TimeSpan MissingKeySetNullRedisExpire => TimeSpan.FromMinutes(1); // 缓存不存在时设置redisNull
+
+ protected override async ValueTask LoadAsync(string key)
+ {
+ if (key.IsNullOrEmpty()) return null;
+ return await _appRepository.GetFirstAsync(x => x.AppKey == key, x => x.Name);
+ }
+
+ protected override async ValueTask> LoadAsync(HashSet keys)
+ {
+ if (keys.Count == 0) return Empty.Dict;
+
+ var result = await _appRepository.GetListAsync(x => keys.Contains(x.AppKey), x => new
+ {
+ x.AppKey,
+ x.Name
+ });
+
+ return result.Count == 0
+ ? Empty.Dict
+ : result.ToDictionary(x => x.AppKey, y => y.Name);
+ }
+}
diff --git a/src/TrackCenter.Application/Dtos/ProvideServices/GetDetailTimelineInput.cs b/src/TrackCenter.Application/Dtos/ProvideServices/GetDetailTimelineInput.cs
index e1b11980..58b27001 100644
--- a/src/TrackCenter.Application/Dtos/ProvideServices/GetDetailTimelineInput.cs
+++ b/src/TrackCenter.Application/Dtos/ProvideServices/GetDetailTimelineInput.cs
@@ -6,14 +6,4 @@ public class GetDetailTimelineInput
/// 订单编号
///
public string OrderNumber { get; set; }
-
- ///
- /// 订单所属应用
- ///
- public string AppKey { get; set; }
-
- ///
- /// 当前用户登陆应用
- ///
- public int CurrenUserAppKey { get; set; }
}
diff --git a/src/TrackCenter.Application/Dtos/ProvideServices/UpdateOrderInput.cs b/src/TrackCenter.Application/Dtos/ProvideServices/UpdateOrderInput.cs
index 1ea12841..7d1d989a 100644
--- a/src/TrackCenter.Application/Dtos/ProvideServices/UpdateOrderInput.cs
+++ b/src/TrackCenter.Application/Dtos/ProvideServices/UpdateOrderInput.cs
@@ -76,12 +76,6 @@ public class UpdateOrderInput : OrderNoInfo
/// 订单航班信息
///
public List FlightInfos { get; set; } = new();
-
-
- ///
- /// 模板code
- ///
- public List? TemplateCodes { get; set; }
}
public class PullConfigInfo
diff --git a/src/TrackCenter.Application/Dtos/TrackPull/EditTrackPullConfigInput.cs b/src/TrackCenter.Application/Dtos/TrackPull/EditTrackPullConfigInput.cs
index 04252a6d..7049cb73 100644
--- a/src/TrackCenter.Application/Dtos/TrackPull/EditTrackPullConfigInput.cs
+++ b/src/TrackCenter.Application/Dtos/TrackPull/EditTrackPullConfigInput.cs
@@ -12,7 +12,7 @@ public class EditTrackPullConfigInput
///
/// 应用
///
- public int? AppKey { get; set; }
+ public string? AppKey { get; set; }
///
/// 服务商id
diff --git a/src/TrackCenter.Application/Dtos/Warning/GetWarningRuleInput.cs b/src/TrackCenter.Application/Dtos/Warning/GetWarningRuleInput.cs
index 04ed0869..79819989 100644
--- a/src/TrackCenter.Application/Dtos/Warning/GetWarningRuleInput.cs
+++ b/src/TrackCenter.Application/Dtos/Warning/GetWarningRuleInput.cs
@@ -8,7 +8,7 @@ public class GetWarningRuleInput
///
/// 应用
///
- public int? AppKey { get; set; }
+ public string? AppKey { get; set; }
///
/// kpi名称 模糊查询
diff --git a/src/TrackCenter.Application/Queries/TimezoneQueries.cs b/src/TrackCenter.Application/Queries/TimezoneQueries.cs
deleted file mode 100644
index bc3fd942..00000000
--- a/src/TrackCenter.Application/Queries/TimezoneQueries.cs
+++ /dev/null
@@ -1,98 +0,0 @@
-using Fake.DependencyInjection;
-using Fake.DomainDrivenDesign.Repositories.SqlSugarCore;
-using SqlSugar;
-using TrackCenter.Domain.VEntities;
-
-namespace TrackCenter.Repository.Queries;
-
-///
-/// 时区查询
-///
-public class TimezoneQueries : SqlSugarRootlessRepository, ITransientDependency
-{
- public ISqlSugarClient Context => GetDbContextAsync().Result;
-
- ///
- /// 获取城市时区
- ///
- /// 城市英文名称
- /// 时区
- public async Task GetCityTimezone(string cityEnName)
- {
- var key = GetCityKey(cityEnName);
- var timezone = RedisHelper.Client.Get(key);
- if (!string.IsNullOrEmpty(timezone))
- {
- return timezone;
- }
-
- var cityTimezone = await GetTimezoneByCityName(cityEnName);
- if (cityTimezone == null!)
- {
- await RedisHelper.Client.SetAsync(key, string.Empty, TimeSpan.FromSeconds(20));
- return string.Empty;
- }
-
- await RedisHelper.Client.SetAsync(key, cityTimezone.Timezone, TimeSpan.FromHours(24));
- return cityTimezone.Timezone;
- }
-
- ///
- /// 获取港口时区
- ///
- /// 港口三字码
- /// 时区
- public async Task GetPortTimezone(string airCode)
- {
- var key = GetPortKey(airCode);
- var timezone = RedisHelper.Client.Get(key);
- if (!string.IsNullOrEmpty(timezone))
- {
- return timezone;
- }
-
- var portTimezone = await GetTimezoneByPortCode(airCode);
- if (portTimezone == null!)
- {
- await RedisHelper.Client.SetAsync(key, string.Empty, TimeSpan.FromSeconds(20));
- return string.Empty;
- }
-
- await RedisHelper.Client.SetAsync(key, portTimezone.Timezone, TimeSpan.FromHours(24));
- return portTimezone.Timezone;
- }
-
- private string GetCityKey(string cityEnName)
- {
- return $"{GlobalConst.CityTimezoneKeyPrefix}:{cityEnName}";
- }
-
- private string GetPortKey(string airCode)
- {
- return $"{GlobalConst.PortTimezoneKeyPrefix}:{airCode}";
- }
-
- private Task GetTimezoneByCityName(string cityEnName)
- {
- return Context.Queryable().Where(val => !val.IsDeleted && val.EnName == cityEnName)
- .Select(val => new CityTimezoneDto()
- {
- CityEnName = val.EnName,
- Timezone = val.TimeZone
- })
- .FirstAsync();
- }
-
- private Task GetTimezoneByPortCode(string airCode)
- {
- return Context.Queryable()
- .InnerJoin((city, airport) => city.Id == airport.CityId)
- .Where((city, airport) => !airport.IsDeleted && !city.IsDeleted && airport.Code == airCode)
- .Select((city, airport) => new PortTimezoneDto()
- {
- PortCode = airport.Code,
- Timezone = city.TimeZone
- })
- .FirstAsync();
- }
-}
diff --git a/src/TrackCenter.Application/Services/ProvideServices/OrderService.cs b/src/TrackCenter.Application/Services/ProvideServices/OrderService.cs
index 76866f48..31999b50 100644
--- a/src/TrackCenter.Application/Services/ProvideServices/OrderService.cs
+++ b/src/TrackCenter.Application/Services/ProvideServices/OrderService.cs
@@ -79,7 +79,6 @@ public partial class OrderService : ApplicationServiceBase
order = ObjectMapper.Map(input);
order.OrderFlights = ObjectMapper.Map, List>(input.FlightInfos);
order.OrderPullStatus = BuiltOrderPullStatus(input.PullConfigInfos);
- order.TemplateCodes = input.TemplateCodes == null ? null : string.Join(',', input.TemplateCodes);
order.SetThirdPartyOrderNumber(order.OrderPullStatus);
var orderId = await _orderRepository.CreateOrderAsync(order);
@@ -135,7 +134,6 @@ public partial class OrderService : ApplicationServiceBase
var order2 = ObjectMapper.Map(input2, order);
order2.OrderFlights = ObjectMapper.Map, List>(input2.FlightInfos);
order2.OrderPullStatus = BuiltOrderPullStatus(input2.PullConfigInfos);
- order2.TemplateCodes = input2.TemplateCodes == null ? null : string.Join(',', input2.TemplateCodes);
order2.SetThirdPartyOrderNumber(order.OrderPullStatus);
updateOrders.Add(order2);
updateRecords.Add(new OrderOperationRecordIndex
@@ -170,7 +168,6 @@ public partial class OrderService : ApplicationServiceBase
var order = ObjectMapper.Map(insertInput);
order.OrderFlights = ObjectMapper.Map, List>(insertInput.FlightInfos);
order.OrderPullStatus = BuiltOrderPullStatus(insertInput.PullConfigInfos);
- order.TemplateCodes = insertInput.TemplateCodes == null ? null : string.Join(',', insertInput.TemplateCodes);
order.SetThirdPartyOrderNumber(order.OrderPullStatus);
insertOrders.Add(order);
createRecords.Add(new OrderOperationRecordIndex
@@ -228,7 +225,6 @@ public partial class OrderService : ApplicationServiceBase
order = ObjectMapper.Map(input, order);
order.OrderFlights = ObjectMapper.Map, List>(input.FlightInfos);
order.OrderPullStatus = BuiltOrderPullStatus(input.PullConfigInfos);
- order.TemplateCodes = input.TemplateCodes == null ? null : string.Join(',', input.TemplateCodes);
order.SetThirdPartyOrderNumber(order.OrderPullStatus);
await _orderRepository.UpdateOrderAsync(order);
}
diff --git a/src/TrackCenter.Application/Services/TimerTaskss/TrackButtomUpScanTask.cs b/src/TrackCenter.Application/Services/TimerTaskss/TrackButtomUpScanTask.cs
index f6c070ee..464e6dc7 100644
--- a/src/TrackCenter.Application/Services/TimerTaskss/TrackButtomUpScanTask.cs
+++ b/src/TrackCenter.Application/Services/TimerTaskss/TrackButtomUpScanTask.cs
@@ -7,7 +7,6 @@ using TrackCenter.Application.Helpers;
using TrackCenter.Application.Options;
using TrackCenter.Domain.Aggregates.OrderAggregate;
using TrackCenter.Domain.Enums;
-using TrackCenter.Repository.Queries;
namespace TrackCenter.Application.Services.TimerTaskss;
@@ -19,14 +18,11 @@ public class TrackButtomUpScanTask : ApplicationServiceBase
{
private readonly IOptionsSnapshot _options;
private readonly IOrderRepository _orderRepository;
- private readonly TimezoneQueries _timezoneQueries;
- public TrackButtomUpScanTask(IOptionsSnapshot options, IOrderRepository orderRepository,
- TimezoneQueries timezoneQueries)
+ public TrackButtomUpScanTask(IOptionsSnapshot options, IOrderRepository orderRepository)
{
_options = options;
_orderRepository = orderRepository;
- _timezoneQueries = timezoneQueries;
}
///
@@ -59,52 +55,6 @@ public class TrackButtomUpScanTask : ApplicationServiceBase
return "ok";
}
-
- ///
- /// 获取轨迹时区
- ///
- /// 配置信息
- /// 订单id
- /// 时区,是否执行了兜底轨迹时区
- private async Task<(float? trackTimeZone, bool hasTimezoneBottomLine)> GetTimezone(
- TrackPullContentConfigDto? matchedContentConfig,
- TrackRefreshContext context)
- {
- float? trackTimeZone = null;
- var hasTimezoneBottomLine = false; // 执行了兜底但是没有兜底住,需要记录
- if (matchedContentConfig?.TrackZonePlaceValue is not null)
- {
- //兜底没配置的就不需要兜底,拉取的发生地没就没
- var timezone = await GetTimezone(matchedContentConfig, context.OrderId);
-
- trackTimeZone = timezone;
- hasTimezoneBottomLine = !timezone.HasValue;
- }
-
- return (trackTimeZone, hasTimezoneBottomLine);
- }
-
- ///
- /// 获得轨迹地址
- ///
- /// 配置信息
- /// 订单id
- /// 时区,是否执行了兜底轨迹时区
- private async Task<(string? trackPlace, bool hasPlaceBottomLine)> GetTrackPlace(
- TrackPullContentConfigDto? matchedContentConfig, TrackRefreshContext context)
- {
- string? trackPlace = null;
- var hasPlaceBottomLine = false; //执行了兜底但是没有兜底住,需要记录
- if (matchedContentConfig?.TrackPlaceValue is not null)
- {
- //兜底没配置的就不需要兜底,拉取的发生地没就没
- trackPlace = await GetPlaceByOrder(matchedContentConfig!.TrackPlaceValue.Value, context.OrderId);
- hasPlaceBottomLine = string.IsNullOrWhiteSpace(trackPlace);
- }
-
- return (trackPlace, hasPlaceBottomLine);
- }
-
///
/// 根据订单id获取兜底位置
///
@@ -127,33 +77,6 @@ public class TrackButtomUpScanTask : ApplicationServiceBase
return _orderRepository.GetFirstAsync(x => x.Id == orderId, resultExpression);
}
- ///
- /// 获取时区
- ///
- ///
- ///
- ///
- private async Task GetTimezone(TrackPullContentConfigDto matchedContentConfig, int orderId)
- {
- var placeOrCode = await GetPlaceByOrder(matchedContentConfig!.TrackZonePlaceValue.Value, orderId);
- string timezone = null;
- if (!string.IsNullOrEmpty(placeOrCode))
- {
- if (matchedContentConfig!.TrackZonePlaceValue.Value == (int) TrackLocationValue.ArrivalPort
- || matchedContentConfig!.TrackZonePlaceValue.Value == (int) TrackLocationValue.LeavePort)
- {
- timezone = await _timezoneQueries.GetPortTimezone(placeOrCode);
- return DateTimeHelper.ConvertTimeZoneToFloat(timezone);
- }
-
- timezone = await _timezoneQueries.GetCityTimezone(placeOrCode);
- return DateTimeHelper.ConvertTimeZoneToFloat(timezone);
- }
-
- return null;
- }
-
-
///
/// 触发了兜底,但是没有兜底住,对订单进行标记
/// 1表示时区,2表示发生地,3表示两种
diff --git a/src/TrackCenter.Application/Services/TrackContents/TrackContentService.cs b/src/TrackCenter.Application/Services/TrackContents/TrackContentService.cs
index 58196408..0d1dae5a 100644
--- a/src/TrackCenter.Application/Services/TrackContents/TrackContentService.cs
+++ b/src/TrackCenter.Application/Services/TrackContents/TrackContentService.cs
@@ -1,25 +1,17 @@
using System.Linq.Expressions;
using Fake.Application.Dtos;
-using Microsoft.Extensions.Localization;
-using SJZY.Expand.ABP.Core.Localization;
-using SJZY.Expand.ABP.Core.PublicMethords;
-using SJZY.Expand.AliyunOSS;
using TrackCenter.Application.Dtos.ProvideServices;
using TrackCenter.Application.Dtos.TrackContents;
using TrackCenter.Application.Helpers;
using TrackCenter.Application.Helpers.OSS;
-using TrackCenter.Application.Services;
-using TrackCenter.Application.Localization;
using TrackCenter.Application.Services.TrackPush;
using TrackCenter.Domain.Aggregates.OrderAggregate;
using TrackCenter.Domain.Aggregates.TrackContentAggregate;
using TrackCenter.Domain.Aggregates.TrackDetailsAggregate;
using TrackCenter.Domain.Aggregates.TrackFlagAggregate;
using TrackCenter.Domain.Aggregates.TrackStatusAggregate;
-using TrackCenter.Domain.Aggregates.TrackTemplateAggregate;
using TrackCenter.Domain.Dtos.TrackContents;
using TrackCenter.Domain.Enums;
-using TrackCenter.Domain.Queries;
using TrackCenter.Repository;
namespace TrackCenter.Application.Services.TrackContents;
@@ -32,7 +24,6 @@ namespace TrackCenter.Application.Services.TrackContents;
public class TrackContentService : ApplicationServiceBase
{
private readonly ITrackContentRepository _trackContentRepository;
- private readonly ITrackTemplateRepository _trackTemplateRepository;
private readonly IBasicRepository _trackFlagBasicQuery;
private readonly IBasicRepository _trackStatusBasicQuery;
private readonly IOrderRepository _orderRepository;
@@ -45,14 +36,13 @@ public class TrackContentService : ApplicationServiceBase
IBasicRepository trackFlagBasicQuery,
IOrderRepository orderRepository,
ITrackDetailsEsRepository trackDetailsEsRepository,
- ITrackTemplateRepository trackTemplateRepository, TrackPushCacheService trackPushCacheService)
+ TrackPushCacheService trackPushCacheService)
{
_trackContentRepository = trackContentRepository;
_trackStatusBasicQuery = trackStatusBasicQuery;
_trackFlagBasicQuery = trackFlagBasicQuery;
_orderRepository = orderRepository;
_trackDetailsEsRepository = trackDetailsEsRepository;
- _trackTemplateRepository = trackTemplateRepository;
_trackPushCacheService = trackPushCacheService;
}
@@ -82,13 +72,22 @@ public class TrackContentService : ApplicationServiceBase
}
}
- return input.Options switch
+ switch (input.Options)
{
- OptionType.新增 => await AddAsync(input),
- OptionType.修改 => await UpdateAsync(input),
- OptionType.删除 => await DeleteAsync(input),
- _ => throw new BusinessException(message: "当前操作动作不合法")
- };
+ case OptionType.无:
+ break;
+ case OptionType.新增:
+ await AddAsync(input);
+ break;
+ case OptionType.删除:
+ await DeleteAsync(input);
+ break;
+ case OptionType.修改:
+ await UpdateAsync(input);
+ break;
+ default:
+ throw new ArgumentOutOfRangeException();
+ }
}
///
@@ -156,14 +155,14 @@ public class TrackContentService : ApplicationServiceBase
if (input.Options != OptionTypeNoNull.删除)
{
if (input.AppKey == input.MapAppKey)
- throw new BusinessException(message: _stringLocalizer["NotAllowedToMapApp"]);
+ throw new BusinessException("禁止自己映射自己");
Expression> isMapAnyExp = x =>
x.TrackContentId == input.TrackContentId && x.MapTrackContentId == input.MapTrackContentId;
if (input.Options == OptionTypeNoNull.修改) isMapAnyExp.And(x => x.Id != input.Id);
if (await _trackContentRepository.IsMapAnyAsync(isMapAnyExp))
- throw new BusinessException(message: _stringLocalizer["IsTrackContentMapAny"]);
+ throw new BusinessException("映射已经存在");
}
switch (input.Options)
@@ -176,7 +175,7 @@ public class TrackContentService : ApplicationServiceBase
case OptionTypeNoNull.修改:
var oldTrackContentMapEntity = await _trackContentRepository.GetMapByIdAsync(input.Id!.Value) ??
- throw new BusinessException(message: _stringLocalizer["NotFindData"]);
+ throw new BusinessException("找不到数据");
ObjectMapper.Map(input, oldTrackContentMapEntity);
@@ -188,8 +187,7 @@ public class TrackContentService : ApplicationServiceBase
break;
default:
- throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum,
- nameof(EditTrackContentMapInput.Options)]);
+ throw new ArgumentOutOfRangeException();
}
return true;
@@ -203,27 +201,16 @@ public class TrackContentService : ApplicationServiceBase
[HttpPost("GetTrackContentByCode")]
public async Task GetTrackContentByCodeAsync([FromBody] GetTrackContentByCodeInput input)
{
- if (input.AppKey <= 0)
- return new UnifyResultDto(false, "应用必须大于等于0");
-
- if (string.IsNullOrEmpty(input.Code))
- return new UnifyResultDto(false, "轨迹内容code不能为空");
-
var content = await _trackContentRepository.GetByCodeAsync(input.AppKey, input.Code);
if (content == null)
- return new UnifyResultDto(false, "在当前应用中未找到指定code的轨迹内容");
+ throw new BusinessException("在当前应用中未找到指定code的轨迹内容");
- var res = new UnifyResultDto(true)
+ return new GetTrackContentByCodeOutput
{
- Data = new GetTrackContentByCodeOutput
- {
- Content = content.Content,
- EnContent = content.EnContent,
- IsExternal = content.IsExternal
- }
+ Content = content.Content,
+ EnContent = content.EnContent,
+ IsExternal = content.IsExternal
};
-
- return res;
}
///
@@ -296,6 +283,7 @@ public class TrackContentService : ApplicationServiceBase
{
trackDetails = trackDetails.Where(m => m.Source != (int) TrackSourceEnum.ExternalServiceProvide).ToList();
}
+ var res = new List();
//进行推送时,匹配订单类型一致的轨迹
if (input.TrackOptionType == TrackOptionType.推送)
@@ -312,7 +300,6 @@ public class TrackContentService : ApplicationServiceBase
trackDetails = trackDetails.Where(m => trackCodes.Contains(m.TrackCode)).ToList();
}
- var res = new List();
//进行删除和推送行为无任何轨迹内容,直接返回为空即可
if (input.TrackOptionType is TrackOptionType.删除 or TrackOptionType.推送 && trackDetails.Count == 0)
{
@@ -324,14 +311,6 @@ public class TrackContentService : ApplicationServiceBase
if (contentList == null)
throw new BusinessException(message: "当前应用下未找到任何可用的轨迹内容!");
- //如果订单给了获取模板code,则进一步根据模板code进行过滤
- if (!string.IsNullOrEmpty(order.TemplateCodes))
- {
- var currentCodes = order.TemplateCodes.Split(",");
- var template = await _trackTemplateRepository.GetContentByTemplateCodes(currentCodes, input.AppKey);
- contentList = contentList.Where(m => template.Contains(m.Code)).ToList();
- }
-
foreach (var item in contentList)
{
//新增时,不允许重复的轨迹,跳过已存在轨迹内容
diff --git a/src/TrackCenter.Application/Services/TrackFlags/TrackFlagService.cs b/src/TrackCenter.Application/Services/TrackFlags/TrackFlagService.cs
index 9972dbbf..24bbc943 100644
--- a/src/TrackCenter.Application/Services/TrackFlags/TrackFlagService.cs
+++ b/src/TrackCenter.Application/Services/TrackFlags/TrackFlagService.cs
@@ -1,11 +1,9 @@
-using Microsoft.Extensions.Localization;
+using Fake.Application.Dtos;
using TrackCenter.Application.Dtos.TrackFlags;
using TrackCenter.Domain.Aggregates.TrackContentAggregate;
using TrackCenter.Domain.Aggregates.TrackFlagAggregate;
using TrackCenter.Domain.Dtos.TrackFlags;
using SqlSugar;
-using TrackCenter.Application.Localization;
-using Volo.Abp.DependencyInjection;
namespace TrackCenter.Application.Services.TrackFlags;
@@ -16,17 +14,14 @@ namespace TrackCenter.Application.Services.TrackFlags;
[Route("/Track/Flag")]
public class TrackFlagService : ApplicationServiceBase, ITransientDependency
{
- private readonly IStringLocalizer _stringLocalizer;
private readonly ITrackContentRepository _trackContentRepository;
private readonly ITrackFlagRepository _trackFlagRepository;
public TrackFlagService(
- IStringLocalizer stringLocalizer,
ITrackFlagRepository trackFlagRepository,
ITrackContentRepository trackContentRepository
)
{
- this._stringLocalizer = stringLocalizer;
this._trackFlagRepository = trackFlagRepository;
this._trackContentRepository = trackContentRepository;
}
@@ -36,15 +31,24 @@ public class TrackFlagService : ApplicationServiceBase, ITransientDependency
///
///
[HttpPost("Edit")]
- public async Task EditAsync(EditTrackFlagInput input)
+ public async Task EditAsync(EditTrackFlagInput input)
{
- return input.Options switch
+ switch (input.Options)
{
- OptionType.新增 => await AddAsync(input),
- OptionType.修改 => await UpdateAsync(input),
- OptionType.删除 => await DeleteAsync(input),
- _ => throw new BusinessException(message: "当前操作动作不合法")
- };
+ case OptionType.无:
+ break;
+ case OptionType.新增:
+ await AddAsync(input);
+ break;
+ case OptionType.删除:
+ await DeleteAsync(input);
+ break;
+ case OptionType.修改:
+ await UpdateAsync(input);
+ break;
+ default:
+ throw new ArgumentOutOfRangeException();
+ }
}
///
@@ -53,16 +57,11 @@ public class TrackFlagService : ApplicationServiceBase, ITransientDependency
///
///
[HttpGet("GetDetail")]
- public async Task> GetDetailAsync(int id)
+ public async Task GetDetailAsync(int id)
{
var detailInfo = await _trackFlagRepository.GetDetailAsync(id);
- if (detailInfo == null)
- {
- return new UnifyResultDto(false, null, "未查询到轨迹状态");
- }
-
- var dto = ObjectMapper.Map(detailInfo);
- return new UnifyResultDto(GlobalConst.SuccessCode, "", dto);
+ var dto = ObjectMapper.Map(detailInfo!);
+ return dto;
}
///
@@ -84,7 +83,7 @@ public class TrackFlagService : ApplicationServiceBase, ITransientDependency
#region 私有方法
- private async Task AddAsync(EditTrackFlagInput input)
+ private async Task AddAsync(EditTrackFlagInput input)
{
#region 业务校验
@@ -109,11 +108,9 @@ public class TrackFlagService : ApplicationServiceBase, ITransientDependency
var entity = ObjectMapper.Map(input);
var isTrue = await _trackFlagRepository.InsertAsync(entity);
-
- return new UnifyResultDto(GlobalConst.SuccessCode, "新增成功", isTrue);
}
- private async Task UpdateAsync(EditTrackFlagInput input)
+ private async Task UpdateAsync(EditTrackFlagInput input)
{
#region 业务校验
@@ -146,11 +143,9 @@ public class TrackFlagService : ApplicationServiceBase, ITransientDependency
ObjectMapper.Map(input, trackFlag);
var isTrue = await _trackFlagRepository.UpdateAsync(trackFlag);
-
- return new UnifyResultDto(GlobalConst.SuccessCode, "修改成功", isTrue);
}
- private async Task DeleteAsync(EditTrackFlagInput input)
+ private async Task DeleteAsync(EditTrackFlagInput input)
{
#region 业务校验
@@ -164,8 +159,6 @@ public class TrackFlagService : ApplicationServiceBase, ITransientDependency
#endregion
var isTrue = await _trackFlagRepository.SoftDeleteAsync(x => x.Id == input.Id);
-
- return new UnifyResultDto(GlobalConst.SuccessCode, "删除成功", isTrue);
}
#endregion
diff --git a/src/TrackCenter.Application/Services/TrackNode/TrackNodeService.cs b/src/TrackCenter.Application/Services/TrackNode/TrackNodeService.cs
deleted file mode 100644
index b961de04..00000000
--- a/src/TrackCenter.Application/Services/TrackNode/TrackNodeService.cs
+++ /dev/null
@@ -1,173 +0,0 @@
-using Fake.Application.Dtos;
-using TrackCenter.Application.Dtos.TrackNode;
-using TrackCenter.Application.Dtos.TrackStatus;
-using TrackCenter.Application.Helpers;
-using TrackCenter.Domain.Aggregates.TrackNodeAggregate;
-using TrackCenter.Domain.Aggregates.TrackStatusAggregate;
-using TrackCenter.Domain.Dtos.TrackNode;
-
-namespace TrackCenter.Application.Services.TrackNode;
-
-///
-/// 轨迹节点服务
-///
-[ApiExplorerSettings(GroupName = "轨迹节点")]
-[Route("/Track/Node")]
-public class TrackNodeService : ApplicationServiceBase
-{
- private readonly ITrackNodeRepository _trackNodeRepository;
- private readonly ITrackStatusRepository _trackStatusRepository;
-
- public TrackNodeService(
- ITrackNodeRepository trackNodeRepository, ITrackStatusRepository trackStatusRepository)
- {
- this._trackNodeRepository = trackNodeRepository;
- _trackStatusRepository = trackStatusRepository;
- }
-
- ///
- /// 轨迹节点编辑
- ///
- ///
- [HttpPost("Edit")]
- public async Task EditAsync(EditTrackNodeInput input)
- {
- switch (input.Options)
- {
- case OptionType.无:
- break;
- case OptionType.新增:
- await AddAsync(input);
- break;
- case OptionType.删除:
- await DeleteAsync(input);
- break;
- case OptionType.修改:
- await UpdateAsync(input);
- break;
- default:
- throw new BusinessException(message: "当前操作动作不合法");
- }
- }
-
- ///
- /// 获取分页轨迹节点
- ///
- ///
- ///
- [HttpPost("GetList")]
- public async Task> GetPageTrackNode(QueryTrackNodeRequest input)
- {
- var queryParam = ObjectMapper.Map(input);
- var resultDto = await _trackNodeRepository.GetPageList(queryParam);
- return resultDto;
- }
-
- ///
- /// 获取详情
- ///
- /// 节点id
- ///
- [HttpPost("GetDetail")]
- public async Task GetDetail(int nodeid)
- {
- var resultDto = await _trackNodeRepository.GetDetail(nodeid);
- return resultDto;
- }
-
- ///
- /// 获取分页轨迹字典,下拉框用的
- ///
- ///
- ///
- [HttpPost("GetTrackNodeOption")]
- public async Task> GetTrackNodeOption(QueryTrackNodeRequest input)
- {
- var queryParam = ObjectMapper.Map(input);
- var resultDto = await _trackNodeRepository.GetPageDicList(queryParam);
- return resultDto;
- }
-
- #region 私有方法
-
- private async Task AddAsync(EditTrackNodeInput input)
- {
- #region 业务校验
-
- if (string.IsNullOrEmpty(input.NodeName) || string.IsNullOrEmpty(input.NodeEnName) ||
- !input.AppKey.HasValue)
- {
- throw new BusinessException("NodeName,NodeEnName,AppKey 必填");
- }
-
- var trackNodesEntitys = await _trackNodeRepository.GetListAsync(a =>
- a.AppKey == input.AppKey &&
- (a.NodeName == input.NodeName || a.NodeEnName == input.NodeEnName));
- if (trackNodesEntitys.Any())
- {
- var trackNodeName = trackNodesEntitys.FirstOrDefault(a => a.NodeName == input.NodeName);
- if (trackNodeName != null)
- {
- throw new BusinessException(message: "该应用下节点名称已存在");
- }
-
- var trackNodeEnName = trackNodesEntitys.FirstOrDefault(a => a.NodeEnName == input.NodeEnName);
- if (trackNodeEnName != null)
- {
- throw new BusinessException(message: "该应用下节点英文名称已存在");
- }
- }
-
- #endregion
-
- if (!StringHelper.IsValidEnglishString(input.NodeEnName))
- {
- throw new BusinessException("节点英文名称必须是英文和常用英文符号");
- }
-
- var entity = ObjectMapper.Map(input);
- await _trackNodeRepository.InsertAsync(entity);
- }
-
- private async Task UpdateAsync(EditTrackNodeInput input)
- {
- #region 业务校验
-
- if (string.IsNullOrEmpty(input.NodeName) || string.IsNullOrEmpty(input.NodeEnName))
- {
- throw new BusinessException("NodeName,NodeEnName 必填");
- }
-
- var trackNodesEntitys = await _trackNodeRepository.GetFirstAsync(a => a.Id == input.Id);
- if (trackNodesEntitys == null)
- {
- throw new BusinessException("没有找到数据,更新失败");
- }
-
- #endregion
-
- trackNodesEntitys.NodeEnName = input.NodeEnName;
- trackNodesEntitys.NodeName = input.NodeName;
- await _trackNodeRepository.UpdateAsync(trackNodesEntitys);
- }
-
- private async Task DeleteAsync(EditTrackNodeInput input)
- {
- if (input.Id <= 0 || !input.AppKey.HasValue)
- {
- throw new BusinessException("AppKey 必填");
- }
-
- var trackStatus =
- await _trackStatusRepository.GetFirstAsync(val =>
- val.Node == input.Id && val.AppKey == input.AppKey);
- if (trackStatus != null)
- {
- throw new BusinessException("删除失败,该节点已被使用");
- }
-
- await _trackNodeRepository.DeleteById(input.Id);
- }
-
- #endregion
-}
diff --git a/src/TrackCenter.Application/Services/TrackOrders/TrackOrderService.cs b/src/TrackCenter.Application/Services/TrackOrders/TrackOrderService.cs
index e2106da6..55727c65 100644
--- a/src/TrackCenter.Application/Services/TrackOrders/TrackOrderService.cs
+++ b/src/TrackCenter.Application/Services/TrackOrders/TrackOrderService.cs
@@ -1,9 +1,9 @@
using System.Linq.Expressions;
-using SJZY.Expand.ABP.Core.Logger;
-using SJZY.Expand.AliyunOSS;
+using Fake.Application.Dtos;
using TrackCenter.Application.Dtos.ProvideServices;
using TrackCenter.Application.Dtos.TrackOrder;
using TrackCenter.Application.Helpers;
+using TrackCenter.Application.Helpers.OSS;
using TrackCenter.Application.Services.Warning.Handlers;
using TrackCenter.Domain.Aggregates.OrderAggregate;
using TrackCenter.Domain.Aggregates.TrackContentAggregate;
@@ -11,6 +11,7 @@ using TrackCenter.Domain.Aggregates.TrackDetailsAggregate;
using TrackCenter.Domain.Aggregates.TrackPushAggregate;
using TrackCenter.Domain.Aggregates.TrackStatusAggregate;
using TrackCenter.Domain.Dtos.Order;
+using TrackCenter.Repository.Aggregates.OrderAggregate;
namespace TrackCenter.Application.Services.TrackOrders;
@@ -23,8 +24,6 @@ public class TrackOrderService : ApplicationServiceBase
{
private readonly IOrderOperationRecordEsRepository _orderOperationRecordEsRepository;
private readonly IOrderRepository _orderRepository;
- private readonly ITrackContentRepository _trackContentRepository;
- private readonly ITrackStatusRepository _trackStatusRepository;
private readonly ITrackDetailsEsRepository _trackDetailsEsRepository;
private readonly ITrackPushRecordEsRepository _trackPushRecordEsRepository;
private readonly IServiceProvider _serviceProvider;
@@ -32,17 +31,14 @@ public class TrackOrderService : ApplicationServiceBase
public TrackOrderService(
IOrderRepository orderRepository,
ITrackDetailsEsRepository trackDetailsEsRepository,
- ITrackContentRepository trackContentRepository,
ITrackPushRecordEsRepository trackPushRecordEsRepository,
IOrderOperationRecordEsRepository orderOperationRecordEsRepository,
- ITrackStatusRepository trackStatusRepository, IServiceProvider serviceProvider)
+ IServiceProvider serviceProvider)
{
_orderRepository = orderRepository;
_trackDetailsEsRepository = trackDetailsEsRepository;
- _trackContentRepository = trackContentRepository;
_trackPushRecordEsRepository = trackPushRecordEsRepository;
_orderOperationRecordEsRepository = orderOperationRecordEsRepository;
- _trackStatusRepository = trackStatusRepository;
_serviceProvider = serviceProvider;
}
@@ -147,7 +143,7 @@ public class TrackOrderService : ApplicationServiceBase
whereExpression = m => m.Id == orderId;
//根据订单号+系统id查询
- if (!string.IsNullOrEmpty(orderNo) && appKey != null && appKey > 0)
+ if (!string.IsNullOrEmpty(orderNo) && !string.IsNullOrEmpty(appKey))
whereExpression = m => m.OrderNo == orderNo && m.AppKey == appKey;
if (whereExpression == default)
@@ -199,9 +195,6 @@ public class TrackOrderService : ApplicationServiceBase
case SortMethod.ByTrackTimeDesc:
list.Sort((a, b) => DateTimeHelper.ConvertUtc0Compare(b.TrackTime, b.TrackTimeZoneValue, a.TrackTime, a.TrackTimeZoneValue));
break;
- case SortMethod.ByTemplateAndTrackTime:
- case SortMethod.ByTemplateAndTrackTimeDesc:
- throw new BusinessException(message: "该接口暂不支持该模板排序方式,如需支持请联系轨迹中台负责人");
case SortMethod.ByCreateTime:
list.Sort((a, b) => a.CreateTime.CompareTo(b.CreateTime));
break;
@@ -222,41 +215,25 @@ public class TrackOrderService : ApplicationServiceBase
///
///
[HttpPost("GetDetailTimeline")]
- public async Task>> GetDetailTimeline(GetDetailTimelineInput input)
+ public async Task> GetDetailTimeline(GetDetailTimelineInput input)
{
- var res = new UnifyResultDto>(true);
+ var res = new List();
var order = await _orderRepository.GetFirstAsync(m => m.OrderNo == input.OrderNumber);
if (order == null)
- return new UnifyResultDto>(false, "订单不存在");
-
- if (input.AppKey <= 0)
- return new UnifyResultDto>(false, "应用不合法");
-
- if (input.CurrenUserAppKey <= 0)
- return new UnifyResultDto>(false, "当前登陆用户应用不合法");
-
- var system = await _orderRepository.GetSystemInfoById(input.CurrenUserAppKey);
- if (system == null)
- return new UnifyResultDto>(false, "未找到指定id的应用");
+ throw new BusinessException("订单不存在");
var trackDetails = await _trackDetailsEsRepository.GetListAsync(order.Id);
//时间轴不显示轨迹内容为空的轨迹,进行过滤
trackDetails = trackDetails.Where(x => !x.TrackContent.IsNullOrWhiteSpace() && x.TrackContent != GlobalConst.EmptyString).ToList();
- res.Data = new List();
foreach (var item in trackDetails)
{
- //如果是外部系统,且轨迹内容不对外则跳过这条轨迹内容
- if (system.SystemProperty == 2 && !item.IsExternal)
- continue;
-
//时间和时区任意一个为空则使用创建时间做为排序参照值
- var timeTick = ToUnixTimestamp((item.TrackTime == null
- || Math.Abs(item.TrackTimeZone - GlobalConst.NoneTrackTimeZone) < 1)
+ var timeTick = ToUnixTimestamp(Math.Abs(item.TrackTimeZone - GlobalConst.NoneTrackTimeZone) < 1
? item.CreateTime
: item.TrackTime);
- res.Data.Add(new GetDetailTimelineOutput()
+ res.Add(new GetDetailTimelineOutput()
{
IsHighlight = true,
IsShowHover = true,
@@ -282,17 +259,17 @@ public class TrackOrderService : ApplicationServiceBase
}
// 按轨迹发生时间正序排序
- res.Data = res.Data.OrderBy(m => m.TrackTime).ToList();
+ res = res.OrderBy(m => m.TrackTime).ToList();
if (!order.IsCompleted) //如果没完结则显示签收节点
{
var eddUnixTimestamp = order.EstimatedDeliveryDate.HasValue ? ToUnixTimestamp(DateTime.Parse(order.EstimatedDeliveryDate.ToString()!)) : 0;
- var isShowTime = eddUnixTimestamp > 0 && res.Data.All(m => m.TrackTime < eddUnixTimestamp);
+ var isShowTime = eddUnixTimestamp > 0 && res.All(m => m.TrackTime < eddUnixTimestamp);
//当存在需要显示的轨迹才需要补充签收节点
- if (res.Data.Count != 0)
+ if (res.Count != 0)
{
- res.Data.Add(new GetDetailTimelineOutput()
+ res.Add(new GetDetailTimelineOutput()
{
Content = "签收",
IsHighlight = false,
diff --git a/src/TrackCenter.Application/Services/TrackPull/TrackPullCacheService.cs b/src/TrackCenter.Application/Services/TrackPull/TrackPullCacheService.cs
index a90af809..749fc12d 100644
--- a/src/TrackCenter.Application/Services/TrackPull/TrackPullCacheService.cs
+++ b/src/TrackCenter.Application/Services/TrackPull/TrackPullCacheService.cs
@@ -1,14 +1,11 @@
-using SJZY.Expand.ABP.Core;
+using Fake.ObjectMapping;
using TrackCenter.Application.Dtos.TrackPull;
-using TrackCenter.Application.Services;
using TrackCenter.Domain.Aggregates.TrackPullAggregate;
using TrackCenter.Domain.Dtos.TrackPull;
-using Volo.Abp.DependencyInjection;
-using Volo.Abp.ObjectMapping;
namespace TrackCenter.Application.Services.TrackPull;
-public class TrackPullCacheService : ITransientDependency, ITrackPullCacheService
+public class TrackPullCacheService : ITransientDependency
{
private readonly IObjectMapper _objectMapper;
private readonly ITrackPullConfigRepository _trackPullConfigRepository;
diff --git a/src/TrackCenter.Application/Services/TrackPull/TrackPullService.cs b/src/TrackCenter.Application/Services/TrackPull/TrackPullService.cs
index 63fd0817..2ac04742 100644
--- a/src/TrackCenter.Application/Services/TrackPull/TrackPullService.cs
+++ b/src/TrackCenter.Application/Services/TrackPull/TrackPullService.cs
@@ -1,18 +1,14 @@
using System.ComponentModel;
using System.Linq.Expressions;
using Fake.Application.Dtos;
-using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Options;
-using SJZY.Expand.ABP.Core.Localization;
-using SJZY.Expand.ABP.Core.PublicMethords;
using TrackCenter.Application.Dtos.TrackPull;
-using TrackCenter.Application.Services;
using TrackCenter.Domain.Aggregates.TrackPullAggregate;
using TrackCenter.Domain.Dtos.TrackPull;
using SqlSugar;
using TrackCenter.Application.Helpers;
-using TrackCenter.Application.Localization;
using TrackCenter.Application.Options;
+using TrackCenter.Repository;
namespace TrackCenter.Application.Services.TrackPull;
@@ -212,7 +208,7 @@ public class TrackPullService : ApplicationServiceBase
if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(x =>
x.TrackContentId == input.TrackContentId)))
- throw new BusinessException("找不到配置");
+ throw new BusinessException("配置已存在");
if (!input.TrackStatusValues.IsNullOrEmpty())
{
@@ -223,7 +219,7 @@ public class TrackPullService : ApplicationServiceBase
});
if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(trackStatusValuesExp)))
- throw new BusinessException(message: _stringLocalizer["IsTrackPullContentStatusValueAny"]);
+ throw new BusinessException(message: "配置已存在");
}
if (!input.TrackKeywords.IsNullOrEmpty())
@@ -235,7 +231,7 @@ public class TrackPullService : ApplicationServiceBase
});
if (await _trackPullConfigRepository.IsContentAnyAsync(isContentAnyExp.And(trackKeywordExp)))
- throw new BusinessException(message: _stringLocalizer["IsTrackPullContentKeywordsAny"]);
+ throw new BusinessException(message: "配置已存在");
}
}
@@ -255,7 +251,7 @@ public class TrackPullService : ApplicationServiceBase
{
var oldTrackPullContentEntity =
await _trackPullConfigRepository.GetContentByIdAsync(input.Id!.Value) ??
- throw new BusinessException(message: _stringLocalizer["NotFindData"]);
+ throw new BusinessException(message: "找不到数据");
ObjectMapper.Map(input, oldTrackPullContentEntity);
@@ -269,7 +265,7 @@ public class TrackPullService : ApplicationServiceBase
{
var oldTrackPullContentEntity =
await _trackPullConfigRepository.GetContentByIdAsync(input.Id!.Value) ??
- throw new BusinessException(message: _stringLocalizer["NotFindData"]);
+ throw new BusinessException(message: "找不到数据");
await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.Id == input.Id);
await _trackPullCacheService.SetPullConfigAsync(oldTrackPullContentEntity.TrackPullConfigId);
@@ -278,8 +274,7 @@ public class TrackPullService : ApplicationServiceBase
}
default:
- throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum,
- nameof(EditTrackPullContentInput.Options)]);
+ throw new ArgumentOutOfRangeException();
}
return true;
diff --git a/src/TrackCenter.Application/Services/TrackPush/TrackPushService.cs b/src/TrackCenter.Application/Services/TrackPush/TrackPushService.cs
index 9f3fe036..47ff66f8 100644
--- a/src/TrackCenter.Application/Services/TrackPush/TrackPushService.cs
+++ b/src/TrackCenter.Application/Services/TrackPush/TrackPushService.cs
@@ -147,7 +147,7 @@ public class TrackPushService : ApplicationServiceBase, ISingletonDependency
case OptionTypeNoNull.修改:
var oldTrackPushEntity = await _trackPushConfigRepository.GetFirstAsync(x => x.Id == input.Id) ??
- throw new BusinessException(message: _stringLocalizer["NotFindData"]);
+ throw new BusinessException(message: "找不到数据");
ObjectMapper.Map(input, oldTrackPushEntity);
await _trackPushConfigRepository.UpdateAsync(oldTrackPushEntity);
@@ -157,7 +157,7 @@ public class TrackPushService : ApplicationServiceBase, ISingletonDependency
case OptionTypeNoNull.删除:
var entity = await _trackPushConfigRepository.GetFirstAsync(x => x.Id == input.Id) ??
- throw new BusinessException(message: _stringLocalizer["NotFindData"]);
+ throw new BusinessException(message: "找不到数据");
await _trackPushConfigRepository.SoftDeleteAsync(x => x.Id == input.Id);
await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.TrackPushConfigId == input.Id);
@@ -245,7 +245,7 @@ public class TrackPushService : ApplicationServiceBase, ISingletonDependency
case OptionTypeNoNull.修改:
{
var entity = await _trackPushConfigRepository.GetContentByIdAsync(input.Id!.Value) ??
- throw new BusinessException(message: _stringLocalizer["NotFindData"]);
+ throw new BusinessException(message: "找不到数据");
oldContentConfig = entity.DeepCopy();
ObjectMapper.Map(input, entity);
await _trackPushConfigRepository.UpdateContentAsync(entity);
@@ -256,7 +256,7 @@ public class TrackPushService : ApplicationServiceBase, ISingletonDependency
case OptionTypeNoNull.删除:
{
var entity = await _trackPushConfigRepository.GetContentByIdAsync(input.Id!.Value) ??
- throw new BusinessException(message: _stringLocalizer["NotFindData"]);
+ throw new BusinessException(message: "找不到数据");
oldContentConfig = entity;
trackPushConfigId = entity.TrackPushConfigId;
await _trackPushConfigRepository.SoftDeleteContentAsync(x => x.Id == input.Id);
diff --git a/src/TrackCenter.Application/Services/Warning/ReturnWarningService.cs b/src/TrackCenter.Application/Services/Warning/ReturnWarningService.cs
index 7bde51c2..4ea4b521 100644
--- a/src/TrackCenter.Application/Services/Warning/ReturnWarningService.cs
+++ b/src/TrackCenter.Application/Services/Warning/ReturnWarningService.cs
@@ -1,5 +1,6 @@
using DotNetCore.CAP;
-using SJZY.Expand.ABP.Core.PublicMethords;
+using Fake.Application.Dtos;
+using InterfaceForward.Domain.Shared.Helpers;
using TrackCenter.Application.Dtos.Warning;
using TrackCenter.Application.Dtos.Warning.Return;
using TrackCenter.Application.Events;
@@ -7,13 +8,10 @@ using TrackCenter.Domain.Aggregates.OrderAggregate;
using TrackCenter.Domain.Aggregates.WarningAggregate;
using TrackCenter.Domain.Dtos.Warning;
using TrackCenter.Domain.Enums;
-using TrackCenter.Domain.Queries;
-using SJZY.UserCenter.HttpApi.Services.User;
using TrackCenter.Application.Caching;
using TrackCenter.Application.Helpers;
using TrackCenter.Application.Services.Warning.Handlers;
using TrackCenter.Application.Services.Warning.Model;
-using Volo.Abp.Http.Client.DynamicProxying;
namespace TrackCenter.Application.Services.Warning;
@@ -25,39 +23,30 @@ namespace TrackCenter.Application.Services.Warning;
public class ReturnWarningService : ApplicationServiceBase
{
private readonly IOrderRepository _orderRepository;
- private readonly IVSystemQueries _vSystemQueries;
private readonly IReturnWarningHandler _returnWarningHandler;
private readonly IWarningRuleRepository _warningRuleRepository;
private readonly IWarningDetailsEsRepository _warningDetailsEsRepository;
private readonly ICapPublisher _capPublisher;
- private readonly IHttpClientProxy _requestCurrentUserService;
private readonly TrackStatusNameDictCache _trackStatusNameDictCache;
- private readonly CustomAbbreviationDictCache _customAbbreviationDictCache;
- private readonly SystemCnNameDictCache _systemCnNameDictCache;
+ private readonly AppNameDictCache _appNameDictCache;
public ReturnWarningService(
IOrderRepository orderRepository,
- IVSystemQueries vSystemQueries,
IReturnWarningHandler returnWarningHandler,
IWarningRuleRepository warningRuleRepository,
IWarningDetailsEsRepository warningDetailsEsRepository,
ICapPublisher capPublisher,
- IHttpClientProxy requestCurrentUserService,
TrackStatusNameDictCache trackStatusNameDictCache,
- CustomAbbreviationDictCache customAbbreviationDictCache,
- SystemCnNameDictCache systemCnNameDictCache
+ AppNameDictCache appNameDictCache
)
{
_orderRepository = orderRepository;
- _vSystemQueries = vSystemQueries;
_returnWarningHandler = returnWarningHandler;
_warningRuleRepository = warningRuleRepository;
_warningDetailsEsRepository = warningDetailsEsRepository;
_capPublisher = capPublisher;
- _requestCurrentUserService = requestCurrentUserService;
_trackStatusNameDictCache = trackStatusNameDictCache;
- _customAbbreviationDictCache = customAbbreviationDictCache;
- _systemCnNameDictCache = systemCnNameDictCache;
+ _appNameDictCache = appNameDictCache;
}
///
@@ -66,12 +55,12 @@ public class ReturnWarningService : ApplicationServiceBase
///
///
[HttpPost("GetReturnWarningRuleItem")]
- public async Task>> GetReturnWarningRuleItem(GetReturnWarningRuleItemInput input)
+ public async Task> GetReturnWarningRuleItem(GetReturnWarningRuleItemInput input)
{
var result = await _warningRuleRepository.GetReturnRuleItemsAsync(input.WarningId);
if (result.Count == 0)
- return new UnifyResultDto>(true, new List());
+ return new List();
var trackStatusIds = result
.SelectMany(x => x.TrackStatusIds.Split(',').Select(int.Parse))
@@ -83,10 +72,10 @@ public class ReturnWarningService : ApplicationServiceBase
Id = x.Id,
TrackStatus = BuildTrackStatus(x.TrackStatusIds),
ReturnTimeSpan = x.ReturnTimeSpan,
- NotifyUsers = x.NotifyUsers.ToObject>()
+ NotifyUsers = x.NotifyUsers.ToObject>()!
});
- return new UnifyResultDto>(true, map.ToList());
+ return map.ToList();
List BuildTrackStatus(string statusIds)
{
@@ -112,28 +101,25 @@ public class ReturnWarningService : ApplicationServiceBase
{
var vo = ObjectMapper.Map(input);
var result = await _warningDetailsEsRepository.GetPageReturnWarningDetailsAsync(vo);
- if (result.List.Count == 0)
+ if (result.Items.Count == 0)
{
- return new PagedResult(new List(),
- result.Pagination.PageIndex,
- result.Pagination.PageSize,
- result.Pagination.Total);
+ return new PagedResult(result.TotalCount, new List());
}
// 订单类型名称字典
var orderTypeDict = await _orderRepository.GetTrackOrderTypeDictAsync();
// 客户id简称字典
- var customIds = result.List.Select(x => x.CustomId).ToHashSet();
+ var customIds = result.Items.Select(x => x.CustomId).ToHashSet();
var customDict = await _customAbbreviationDictCache.SafeGetBatchAsync(customIds);
// 应用中文名字典
- var AppKeys = result.List.Select(x => x.AppKey).ToHashSet();
- var AppDict = await _systemCnNameDictCache.SafeGetBatchAsync(AppKeys);
+ var appKeys = result.Items.Select(x => x.AppKey).ToHashSet();
+ var appDict = await _appNameDictCache.SafeGetBatchAsync(appKeys);
- var map = result.List.Select(x => new ReturnWarningDetailsDto
+ var map = result.Items.Select(x => new ReturnWarningDetailsDto
{
EsId = x.Id,
AppKey = x.AppKey,
- AppName = AppDict.GetValueOrDefault(x.AppKey, GlobalConst.EmptyString),
+ AppName = appDict.GetValueOrDefault(x.AppKey, GlobalConst.EmptyString),
OrderType = x.OrderType,
OrderTypeName = orderTypeDict.GetValueOrDefault(x.OrderType.ToString(), GlobalConst.EmptyString),
OrderId = x.OrderId,
@@ -173,18 +159,14 @@ public class ReturnWarningService : ApplicationServiceBase
.OrderBy(x => x.Status == (int) ReturnWarningStatus.人工介入 ? 1 : 2)
.ThenByDescending(x => x.CreateTime); //同状态组按时间降序;
- return new PagedResult(
- sorted.ToList(),
- result.Pagination.PageIndex,
- result.Pagination.PageSize,
- result.Pagination.Total);
+ return new PagedResult(result.TotalCount, sorted.ToList());
// 通知用户提取用户名称
string ToUserNames(string? notifyUsers)
{
if (string.IsNullOrWhiteSpace(notifyUsers))
return string.Empty;
- return string.Join(',', notifyUsers.ToObject>().Select(x => x.UserName));
+ return string.Join(',', notifyUsers.ToObject>()!.Select(x => x.UserName));
}
// 时间
@@ -200,7 +182,7 @@ public class ReturnWarningService : ApplicationServiceBase
/// 获取回传报文日志
///
[HttpPost("GetReturnMessageRecord")]
- public async Task>> GetReturnMessageRecord(GetReturnMessageRecordInput input)
+ public async Task> GetReturnMessageRecord(GetReturnMessageRecordInput input)
{
var result = await _warningDetailsEsRepository.GetReturnMessageRecordListByIdAsync(input.WarningDetailsId);
@@ -213,7 +195,7 @@ public class ReturnWarningService : ApplicationServiceBase
CreateTime = x.CreateTime
});
- return new UnifyResultDto>(true, map.ToList());
+ return map.ToList();
}
///
@@ -222,7 +204,7 @@ public class ReturnWarningService : ApplicationServiceBase
///
///
[HttpPost("EditReturnWarningRuleItem")]
- public async Task EditReturnWarningRuleItem(EditReturnWarningRuleItemInput input)
+ public async Task EditReturnWarningRuleItem(EditReturnWarningRuleItemInput input)
{
var rule = await _warningRuleRepository.GetWarningRuleByIdAsync(input.WarningId, WarningRuleType.回传时效预警);
if (rule == null)
@@ -238,8 +220,6 @@ public class ReturnWarningService : ApplicationServiceBase
}
await _returnWarningHandler.HandleEditAsync(rule, bos);
-
- return new UnifyResultDto(true);
}
///
@@ -247,7 +227,7 @@ public class ReturnWarningService : ApplicationServiceBase
///
///
[HttpPost("ReturnPush")]
- public async Task ReturnPush(ReturnPushInput input)
+ public async Task ReturnPush(ReturnPushInput input)
{
if (input.WarningDetailIds.Count == 0)
{
@@ -275,22 +255,6 @@ public class ReturnWarningService : ApplicationServiceBase
throw new BusinessException(message: "一个能推送的也没有");
}
- // 获取当前用户信息
- var userInfo = await _requestCurrentUserService.Service.GetCurrentUserBasicInfoAsync();
- if (userInfo.Code != GlobalConst.SuccessCode || userInfo.Data is null)
- {
- throw new BusinessException(message: $"调用用户中心,获取用户信息失败:{userInfo.Msg}");
- }
-
- // 应用换code
- var AppKeys = filtered.Select(x => x.AppKey).ToHashSet();
- var AppCodeDict = (await _vSystemQueries
- .GetListAsync(x => AppKeys.Contains(x.Id), x => new
- {
- x.Id,
- x.Key
- })).ToDictionary(x => x.Id, x => x.Key);
-
// 3.进行推送
foreach (var detail in filtered)
{
@@ -298,14 +262,13 @@ public class ReturnWarningService : ApplicationServiceBase
{
OptionType = OptionType.新增,
AppKey = detail.AppKey,
- AppCode = AppCodeDict.GetValueOrDefault(detail.AppKey, $"系统代码{detail.AppKey}不存在"),
CustomId = detail.CustomId,
- OrderIdTrackMetadataDict = new Dictionary>
+ OrderIdTrackMetadataDict = new Dictionary
{
- [detail.OrderId] = KeyValuePair.Create(detail.TrackEsId, detail.TrackVersion)
+ [detail.OrderId] = TrackMetadata.Build(detail.Id, detail.TrackVersion, detail.CreateTime)
},
TrackCode = detail.TrackCode,
- OperationMan = userInfo.Data.UserName,
+ OperationMan = CurrentUser.UserName,
SystemPushInfo = new SystemPushStruct
{
TrackStatusId = detail.TrackStatusId,
@@ -323,7 +286,7 @@ public class ReturnWarningService : ApplicationServiceBase
await _capPublisher.PublishAsync(GlobalConst.TrackManualPushSubscribe, trackPushEvent);
}
- return new UnifyResultDto(true, $"即将进行{filtered.Count}个回传推送!");
+ return $"即将进行{filtered.Count}个回传推送!";
}
// 检查集合中是否存在交集
diff --git a/src/TrackCenter.Application/Services/Warning/TransportWarningService.cs b/src/TrackCenter.Application/Services/Warning/TransportWarningService.cs
index 7d05e8c8..89f158e1 100644
--- a/src/TrackCenter.Application/Services/Warning/TransportWarningService.cs
+++ b/src/TrackCenter.Application/Services/Warning/TransportWarningService.cs
@@ -1,4 +1,5 @@
-using SJZY.Expand.ABP.Core.PublicMethords;
+using Fake.Application.Dtos;
+using InterfaceForward.Domain.Shared.Helpers;
using TrackCenter.Application.Dtos.Warning;
using TrackCenter.Application.Dtos.Warning.Transport;
using TrackCenter.Application.Caching;
@@ -29,8 +30,7 @@ public class TransportWarningService : ApplicationServiceBase
private readonly ITrackDetailsEsRepository _trackDetailsEsRepository;
private readonly ITransportWarningHandler _transportWarningHandler;
private readonly TrackStatusNameDictCache _trackStatusNameDictCache;
- private readonly CustomAbbreviationDictCache _customAbbreviationDictCache;
- private readonly SystemCnNameDictCache _systemCnNameDictCache;
+ private readonly AppNameDictCache _appNameDictCache;
public TransportWarningService(
IOrderRepository orderRepository,
@@ -40,8 +40,7 @@ public class TransportWarningService : ApplicationServiceBase
ITrackDetailsEsRepository trackDetailsEsRepository,
ITransportWarningHandler transportWarningHandler,
TrackStatusNameDictCache trackStatusNameDictCache,
- CustomAbbreviationDictCache customAbbreviationDictCache,
- SystemCnNameDictCache systemCnNameDictCache
+ AppNameDictCache appNameDictCache
)
{
_orderRepository = orderRepository;
@@ -51,8 +50,7 @@ public class TransportWarningService : ApplicationServiceBase
_trackDetailsEsRepository = trackDetailsEsRepository;
_transportWarningHandler = transportWarningHandler;
_trackStatusNameDictCache = trackStatusNameDictCache;
- _customAbbreviationDictCache = customAbbreviationDictCache;
- _systemCnNameDictCache = systemCnNameDictCache;
+ _appNameDictCache = appNameDictCache;
}
///
@@ -61,10 +59,10 @@ public class TransportWarningService : ApplicationServiceBase
///
///
[HttpPost("GetTransportWarningScene")]
- public async Task>> GetTransportWarningScene(GetTransportWarningSceneInput input)
+ public async Task> GetTransportWarningScene(GetTransportWarningSceneInput input)
{
var entities = await _warningRuleRepository.GetTransportSceneAsync(input.WarningId);
- if (entities.Count == 0) return new UnifyResultDto>(true, Empty.List);
+ if (entities.Count == 0) return Empty.List;
var areaIds = entities
.Select(x => x.AreaId)
@@ -97,7 +95,7 @@ public class TransportWarningService : ApplicationServiceBase
AreaName = x.AreaId.HasValue ? areaNameDict?.GetValueOrDefault(x.AreaId.Value) : null
});
- return new UnifyResultDto>(true, map.ToList());
+ return map.ToList();
// 构建场景摘要
string BuildSummary(TransportWarningSceneEntity entity)
@@ -139,7 +137,7 @@ public class TransportWarningService : ApplicationServiceBase
///
///
[HttpPost("GetTransportWarningSceneRuleItem")]
- public async Task>> GetTransportWarningSceneRuleItem(GetTransportWarningSceneRuleItemInput input)
+ public async Task> GetTransportWarningSceneRuleItem(GetTransportWarningSceneRuleItemInput input)
{
var entities = await _warningRuleRepository.GetTransportSceneRuleItemsAsync(input.WarningId, input.SceneId);
@@ -162,7 +160,7 @@ public class TransportWarningService : ApplicationServiceBase
NotifyUsers = x.NotifyUsers.ToObject>()
});
- return new UnifyResultDto>(true, map.ToList());
+ return map.ToList();
}
///
@@ -178,16 +176,13 @@ public class TransportWarningService : ApplicationServiceBase
if (input.Status == (int) TransportWarningStatus.已超时)
vo.Status = (int) TransportWarningStatus.即将超时;
var result = await _warningDetailsEsRepository.GetPageTransportWarningDetailsAsync(vo);
- if (result.List.Count == 0)
+ if (result.Items.Count == 0)
{
- return new PagedResult(new List(),
- result.Pagination.PageIndex,
- result.Pagination.PageSize,
- result.Pagination.Total);
+ return new PagedResult(0, new List());
}
// 查最新轨迹(创建时间)
- var orderIds = result.List.Select(x => x.OrderId).ToHashSet();
+ var orderIds = result.Items.Select(x => x.OrderId).ToHashSet();
var orderIdTrackDict = await _trackDetailsEsRepository.GetLatestDictAsync(orderIds);
// 查轨迹状态最早轨迹
var orderIdTrackStatusEarliestTrackDict = await _trackDetailsEsRepository.GetTrackStatusEarliestDictAsync(orderIds);
@@ -195,13 +190,13 @@ public class TransportWarningService : ApplicationServiceBase
// 订单类型名称字典
var orderTypeDict = await _orderRepository.GetTrackOrderTypeDictAsync();
// 客户id简称字典
- var customIds = result.List.Select(x => x.CustomId).ToHashSet();
+ var customIds = result.Items.Select(x => x.CustomId).ToHashSet();
var customDict = await _customAbbreviationDictCache.SafeGetBatchAsync(customIds);
// 应用中文名字典
- var AppKeys = result.List.Select(x => x.AppKey).ToHashSet();
- var AppDict = await _systemCnNameDictCache.SafeGetBatchAsync(AppKeys);
+ var appKeys = result.Items.Select(x => x.AppKey).ToHashSet();
+ var appDict = await _appNameDictCache.SafeGetBatchAsync(appKeys);
- var map = result.List.Select(x =>
+ var map = result.Items.Select(x =>
{
var orderIdTrack = orderIdTrackDict.GetValueOrDefault(x.OrderId);
var orderIdTrackStatusEarliestTracks = orderIdTrackStatusEarliestTrackDict.GetValueOrDefault(x.OrderId);
@@ -211,7 +206,7 @@ public class TransportWarningService : ApplicationServiceBase
{
EsId = x.Id,
AppKey = x.AppKey,
- AppName = AppDict.GetValueOrDefault(x.AppKey, GlobalConst.EmptyString),
+ AppName = appDict.GetValueOrDefault(x.AppKey, GlobalConst.EmptyString),
CustomId = x.CustomId,
CustomName = customDict.GetValueOrDefault(x.CustomId, GlobalConst.EmptyString),
OrderId = x.OrderId,
@@ -259,18 +254,14 @@ public class TransportWarningService : ApplicationServiceBase
.ThenByDescending(x => x.CreateTime) //同状态组按时间降序
.ToList();
- return new PagedResult(
- sorted,
- result.Pagination.PageIndex,
- result.Pagination.PageSize,
- result.Pagination.Total);
+ return new PagedResult(0, sorted);
// 通知用户提取用户名称
string ToUserNames(string notifyUsers)
{
if (string.IsNullOrWhiteSpace(notifyUsers))
return string.Empty;
- return string.Join(',', notifyUsers.ToObject>().Select(x => x.UserName));
+ return string.Join(',', notifyUsers.ToObject>()!.Select(x => x.UserName));
}
// 格式化累计运输时间为文本形式
@@ -288,7 +279,7 @@ public class TransportWarningService : ApplicationServiceBase
///
///
[HttpPost("UpsertTransportWarningScene")]
- public async Task> UpsertTransportWarningScene(UpsertTransportWarningSceneInput input)
+ public async Task UpsertTransportWarningScene(UpsertTransportWarningSceneInput input)
{
var rule = await _warningRuleRepository.GetWarningRuleByIdAsync(input.WarningId, WarningRuleType.运输时效预警);
if (rule == null)
@@ -315,10 +306,10 @@ public class TransportWarningService : ApplicationServiceBase
if (oldBo != null)
await _transportWarningHandler.HandleSceneChangedAsync(rule, oldBo, postBo);
- return new UnifyResultDto(true, new IdBaseDto
+ return new IdBaseDto
{
Id = id
- });
+ };
}
///
@@ -327,7 +318,7 @@ public class TransportWarningService : ApplicationServiceBase
///
///
[HttpPost("DeleteTransportWarningScene")]
- public async Task DeleteTransportWarningScene(DeleteTransportWarningSceneInput input)
+ public async Task DeleteTransportWarningScene(DeleteTransportWarningSceneInput input)
{
var rule = await _warningRuleRepository.GetWarningRuleByIdAsync(input.WarningId, WarningRuleType.运输时效预警);
if (rule == null)
@@ -346,8 +337,6 @@ public class TransportWarningService : ApplicationServiceBase
// 处理删除后
await _transportWarningHandler.HandleSceneDeletedAsync(rule, TransportWarningSceneBO.From(scene));
-
- return new UnifyResultDto(true);
}
///
@@ -356,7 +345,7 @@ public class TransportWarningService : ApplicationServiceBase
///
///
[HttpPost("EditTransportWarningSceneRuleItem")]
- public async Task EditTransportWarningSceneRuleItem(EditTransportWarningSceneRuleItemInput input)
+ public async Task EditTransportWarningSceneRuleItem(EditTransportWarningSceneRuleItemInput input)
{
// 起始轨迹生成预警时间不能大于时效
if (input.Items.Count > 0 && input.Items.Any(x => x.StartTrackWarningTimeSpan >= x.TransportTimeSpan))
@@ -393,7 +382,5 @@ public class TransportWarningService : ApplicationServiceBase
var sceneBo = TransportWarningSceneBO.From(ruleScene);
await _transportWarningHandler.HandleEditAsync(rule, sceneBo, postRuleItems);
-
- return new UnifyResultDto(true);
}
}
diff --git a/src/TrackCenter.Application/Services/Warning/WarningService.cs b/src/TrackCenter.Application/Services/Warning/WarningService.cs
index f179980c..f017fbb0 100644
--- a/src/TrackCenter.Application/Services/Warning/WarningService.cs
+++ b/src/TrackCenter.Application/Services/Warning/WarningService.cs
@@ -18,7 +18,7 @@ public class WarningService : ApplicationServiceBase
private readonly ITransportWarningHandler _transportWarningHandler;
private readonly IReturnWarningHandler _returnWarningHandler;
private readonly CustomAbbreviationDictCache _customAbbreviationDictCache;
- private readonly SystemCnNameDictCache _systemCnNameDictCache;
+ private readonly AppNameDictCache _appNameDictCache;
public WarningService(
IWarningRuleRepository warningRuleRepository,
@@ -26,7 +26,7 @@ public class WarningService : ApplicationServiceBase
ITransportWarningHandler transportWarningHandler,
IReturnWarningHandler returnWarningHandler,
CustomAbbreviationDictCache customAbbreviationDictCache,
- SystemCnNameDictCache systemCnNameDictCache
+ AppNameDictCache appNameDictCache
)
{
_warningRuleRepository = warningRuleRepository;
@@ -34,7 +34,7 @@ public class WarningService : ApplicationServiceBase
_transportWarningHandler = transportWarningHandler;
_returnWarningHandler = returnWarningHandler;
_customAbbreviationDictCache = customAbbreviationDictCache;
- _systemCnNameDictCache = systemCnNameDictCache;
+ _appNameDictCache = appNameDictCache;
}
///
@@ -43,24 +43,24 @@ public class WarningService : ApplicationServiceBase
///
///
[HttpPost("GetWarningRule")]
- public async Task>> GetWarningRule(GetWarningRuleInput input)
+ public async Task> GetWarningRule(GetWarningRuleInput input)
{
var result = await _warningRuleRepository.GetWarningRuleListAsync(input.AppKey, input.CustomId, input.KpiName, input.IsEnabled, input.WarningType);
if (result.Count == 0)
- return new UnifyResultDto>(true, new List());
+ return new List();
// 客户id简称字典
var customIds = result.Select(x => x.CustomId).ToHashSet();
var customDict = await _customAbbreviationDictCache.SafeGetBatchAsync(customIds);
// 应用中文名字典
- var AppKeys = result.Select(x => x.AppKey).ToHashSet();
- var AppDict = await _systemCnNameDictCache.SafeGetBatchAsync(AppKeys);
+ var appKeys = result.Select(x => x.AppKey).ToHashSet();
+ var appDict = await _appNameDictCache.SafeGetBatchAsync(appKeys);
- return new UnifyResultDto>(true, result.Select(x => new WarningRuleDto
+ return result.Select(x => new WarningRuleDto
{
Id = x.Id,
AppKey = x.AppKey,
- AppName = AppDict.GetValueOrDefault(x.AppKey, GlobalConst.EmptyString),
+ AppName = appDict.GetValueOrDefault(x.AppKey, GlobalConst.EmptyString),
CustomId = x.CustomId,
CustomName = customDict.GetValueOrDefault(x.CustomId, GlobalConst.EmptyString),
Name = x.Name,
@@ -69,7 +69,7 @@ public class WarningService : ApplicationServiceBase
Version = x.Version,
CreateTime = x.CreateTime,
UpdateTime = x.UpdateTime,
- }).ToList());
+ }).ToList();
}
///
@@ -79,7 +79,7 @@ public class WarningService : ApplicationServiceBase
///
///
[HttpPost("UpdateEnabledStatus")]
- public async Task> UpdateEnabledStatus(UpdateEnabledStatusInput input)
+ public async Task UpdateEnabledStatus(UpdateEnabledStatusInput input)
{
var rule = await _warningRuleRepository.GetWarningRuleByIdAsync(input.WarningId, (WarningRuleType) input.WarningType);
if (rule == null)
@@ -105,10 +105,10 @@ public class WarningService : ApplicationServiceBase
// 预警规则主体状态变化处理
await HandleRuleEnabledChangedAsync(rule);
- return new UnifyResultDto(true, new IdBaseDto
+ return new IdBaseDto
{
Id = rule.Id
- });
+ };
}
///
@@ -117,7 +117,7 @@ public class WarningService : ApplicationServiceBase
///
///
[HttpPost("UpsertWarningRule")]
- public async Task> UpsertWarningRule(UpsertWarningRuleInput input)
+ public async Task UpsertWarningRule(UpsertWarningRuleInput input)
{
WarningRuleEntity? ruleEntity = null;
// 当为修改操作时,则要求被修改的主体必须存在
@@ -169,10 +169,10 @@ public class WarningService : ApplicationServiceBase
if (enabledChanged)
await HandleRuleEnabledChangedAsync(ruleEntity);
- return new UnifyResultDto(true, new IdBaseDto
+ return new IdBaseDto
{
Id = id
- });
+ };
}
private async Task HandleRuleEnabledChangedAsync(WarningRuleEntity rule)
diff --git a/src/TrackCenter.Domain/Aggregates/OrderAggregate/OrderEntity.cs b/src/TrackCenter.Domain/Aggregates/OrderAggregate/OrderEntity.cs
index f4db8fe3..8867eb0f 100644
--- a/src/TrackCenter.Domain/Aggregates/OrderAggregate/OrderEntity.cs
+++ b/src/TrackCenter.Domain/Aggregates/OrderAggregate/OrderEntity.cs
@@ -189,12 +189,6 @@ public class OrderEntity : FullAuditedAggregateRoot
[SugarColumn(ColumnName = "DestinationTimeZone")]
public float? DestinationTimeZone { get; set; }
- ///
- /// 模板code
- ///
- [SugarColumn(ColumnName = "TemplateCodes")]
- public string? TemplateCodes { get; set; }
-
///
/// 冗余订单第三方订单号(创建订单,更新订单时维护)
///
diff --git a/src/TrackCenter.Domain/ExpressionExtensions.cs b/src/TrackCenter.Domain/ExpressionExtensions.cs
new file mode 100644
index 00000000..3799f68b
--- /dev/null
+++ b/src/TrackCenter.Domain/ExpressionExtensions.cs
@@ -0,0 +1,33 @@
+namespace TrackCenter.Domain;
+
+public static class ExpressionExtensions
+{
+ public static Expression> And(this Expression> expr1, Expression> expr2)
+ {
+ Expression right = new RebindParameterVisitor(expr2.Parameters[0], expr1.Parameters[0]).Visit(expr2.Body);
+ return Expression.Lambda>((Expression) Expression.AndAlso(expr1.Body, right), (IEnumerable) expr1.Parameters);
+ }
+ public static Expression> Or(this Expression> expr1,
+ Expression> expr2)
+ {
+ var expr2Body = new RebindParameterVisitor(expr2.Parameters[0], expr1.Parameters[0]).Visit(expr2.Body);
+ return Expression.Lambda>(Expression.OrElse(expr1.Body, expr2Body), expr1.Parameters);
+ }
+
+ private class RebindParameterVisitor : ExpressionVisitor
+ {
+ private readonly ParameterExpression _oldParameter;
+ private readonly ParameterExpression _newParameter;
+
+ public RebindParameterVisitor(ParameterExpression oldParameter, ParameterExpression newParameter)
+ {
+ _oldParameter = oldParameter;
+ _newParameter = newParameter;
+ }
+
+ protected override Expression VisitParameter(ParameterExpression node)
+ {
+ return node == _oldParameter ? _newParameter : base.VisitParameter(node);
+ }
+ }
+}
diff --git a/src/TrackCenter.Repository/CollectionExtensions.cs b/src/TrackCenter.Repository/CollectionExtensions.cs
index 7d202630..ff0dd8f2 100644
--- a/src/TrackCenter.Repository/CollectionExtensions.cs
+++ b/src/TrackCenter.Repository/CollectionExtensions.cs
@@ -116,29 +116,4 @@ public static class CollectionExtensions
_ => false
};
}
-
-
- public static Expression> And(this Expression> expr1, Expression> expr2)
- {
- Expression right = new RebindParameterVisitor(expr2.Parameters[0], expr1.Parameters[0]).Visit(expr2.Body);
- return Expression.Lambda>((Expression) Expression.AndAlso(expr1.Body, right), (IEnumerable) expr1.Parameters);
- }
-
- private class RebindParameterVisitor : ExpressionVisitor
- {
- private readonly ParameterExpression _oldParameter;
- private readonly ParameterExpression _newParameter;
-
- public RebindParameterVisitor(ParameterExpression oldParameter, ParameterExpression newParameter)
- {
- _oldParameter = oldParameter;
- _newParameter = newParameter;
- }
-
- protected override Expression VisitParameter(ParameterExpression node)
- {
- return node == _oldParameter ? _newParameter : base.VisitParameter(node);
- }
- }
-
}