Merge remote-tracking branch 'origin/S04轨迹预警' into S04轨迹预警
This commit is contained in:
commit
62fc0a5168
@ -25,6 +25,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "solution items", "solution
|
||||
.gitignore = .gitignore
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SJZY.Track.Shared", "src\SJZY.Track.Shared\SJZY.Track.Shared.csproj", "{CB860739-8617-48C2-80E3-9F1FBC8D6980}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -55,6 +57,10 @@ Global
|
||||
{073EB297-E752-49AC-BED8-B4AEBAB518F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{073EB297-E752-49AC-BED8-B4AEBAB518F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{073EB297-E752-49AC-BED8-B4AEBAB518F6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CB860739-8617-48C2-80E3-9F1FBC8D6980}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CB860739-8617-48C2-80E3-9F1FBC8D6980}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CB860739-8617-48C2-80E3-9F1FBC8D6980}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CB860739-8617-48C2-80E3-9F1FBC8D6980}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@ -66,6 +72,7 @@ Global
|
||||
{390A44FB-0DB5-4B66-86AB-7712DC3030F5} = {DAC93270-5A25-40E5-B851-E7CA398DBC31}
|
||||
{3A53539C-4A85-4E5D-A071-7B4B193AB0E0} = {0E2537C3-6EF3-4085-9BD2-CF923E53F82A}
|
||||
{073EB297-E752-49AC-BED8-B4AEBAB518F6} = {DAC93270-5A25-40E5-B851-E7CA398DBC31}
|
||||
{CB860739-8617-48C2-80E3-9F1FBC8D6980} = {DAC93270-5A25-40E5-B851-E7CA398DBC31}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = { 8289A516 - 787C - 4D9D - B972 - E7047BDD206B}
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
using SJZY.Track.Domain.Dtos.Forewarning;
|
||||
|
||||
namespace SJZY.Track.Application.Contract.Dtos.Forewarning;
|
||||
|
||||
|
||||
public class ClearRulCacheEvent
|
||||
{
|
||||
public List<RuleAreaBaseInfo> Items { get; set; }
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
using SJZY.Track.Domain.Dtos.Forewarning;
|
||||
using SJZY.Track.Domain.Enums;
|
||||
using SJZY.Track.Share.Enums;
|
||||
|
||||
namespace SJZY.Track.Application.Contract.Dtos.Forewarning;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
using SJZY.Track.Domain.Dtos.Forewarning;
|
||||
using SJZY.Track.Domain.Enums;
|
||||
using SJZY.Track.Share.Enums;
|
||||
|
||||
namespace SJZY.Track.Application.Contract.Dtos.Forewarning;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
using SJZY.Track.Domain.Dtos.Forewarning;
|
||||
using SJZY.Track.Domain.Enums;
|
||||
using SJZY.Track.Share.Enums;
|
||||
|
||||
namespace SJZY.Track.Application.Contract.Dtos.Forewarning;
|
||||
|
||||
@ -25,6 +25,7 @@ public class UpdateWarningInput
|
||||
/// </summary>
|
||||
public string NotifyTemplate { get; set; } = null!;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 通知列表
|
||||
/// </summary>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SJZY.Track.Domain.Enums;
|
||||
using SJZY.Track.Share.Enums;
|
||||
|
||||
namespace SJZY.Track.Domain.Dtos.Forewarning;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using SJZY.Track.Domain.Enums;
|
||||
using SJZY.Track.Share.Enums;
|
||||
|
||||
namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using SJZY.Track.Domain.Enums;
|
||||
using SJZY.Track.Share.Enums;
|
||||
|
||||
namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
|
||||
|
||||
|
||||
@ -13,7 +13,10 @@
|
||||
<PackageReference Include="Volo.Abp.Core" Version="7.0.2" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SJZY.Track.Domain\SJZY.Track.Domain.csproj" />
|
||||
<ProjectReference Include="..\SJZY.Track.Shared\SJZY.Track.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Dtos\Common\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -15,7 +15,7 @@ public class TrackPullAutoMapperProfile : Profile
|
||||
.ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => false));
|
||||
CreateMap<EditTrackPullContentInput, TrackPullContentConfigEntity>(MemberList.None)
|
||||
.ForMember(dest => dest.TrackKeyword, opt => opt.MapFrom(src => string.Join(',', src.TrackKeywords)))
|
||||
.ForMember(dest => dest.TrackZonePlaceValue, opt => opt.MapFrom(src => string.Join(',', src.TrackTimePlaceValue)))
|
||||
.ForMember(dest => dest.TrackZonePlaceValue, opt => opt.MapFrom(src => src.TrackTimePlaceValue))
|
||||
.ForMember(dest => dest.TrackKeywordReverse, opt => opt.MapFrom(src => string.Join(',', src.TrackKeywordReverses)));
|
||||
CreateMap<GetTrackPullConfigDetailOutputVO, TrackPullParamConfigDto>(MemberList.None);
|
||||
CreateMap<GetTrackPullContentListCacheVO, TrackPullContentConfigDto>(MemberList.None);
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using System.Globalization;
|
||||
using DotNetCore.CAP;
|
||||
using DotNetCore.CAP;
|
||||
using Newtonsoft.Json;
|
||||
using SJZY.Expand.ABP.Core.PublicMethords;
|
||||
using SJZY.InterfaceRelay.Application.Contracts;
|
||||
@ -12,6 +11,7 @@ using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
|
||||
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
||||
using SJZY.Track.Domain.Consts;
|
||||
using SJZY.Track.Domain.Enums;
|
||||
using SJZY.Track.Share.Enums;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
using Volo.Abp.Http.Client.DynamicProxying;
|
||||
|
||||
@ -21,11 +21,11 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
|
||||
{
|
||||
private readonly IHttpClientProxy<IInterfaceForwardServiceV2> _httpClientProxy;
|
||||
private readonly IOrderRepository _orderRepository;
|
||||
private readonly ITrackPushCacheService _trackPushCacheService;
|
||||
private readonly ITrackDetailsRepository _trackDetailsRepository;
|
||||
private readonly ITrackPushCacheService _trackPushCacheService;
|
||||
private readonly ITrackPushRecordsRepository _trackPushRecordsRepository;
|
||||
private List<TrackPushContentConfigDto> _pushConfigs = null!;
|
||||
private List<OrderEntity> _orders = null!;
|
||||
private List<TrackPushContentConfigDto> _pushConfigs = null!;
|
||||
|
||||
public TrackPushEventHandler(IHttpClientProxy<IInterfaceForwardServiceV2> httpClientProxy,
|
||||
IOrderRepository orderRepository, ITrackPushCacheService trackPushCacheService,
|
||||
|
||||
@ -2,11 +2,11 @@ using System.Dynamic;
|
||||
using Nest;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SJZY.Expand.ABP.Core.PublicMethords;
|
||||
using SJZY.Track.Application.Contract.Dtos.Common;
|
||||
using SJZY.Track.Application.Contract.Dtos.Forewarning;
|
||||
using SJZY.Track.Domain.Aggregates.ForewarningAggregate;
|
||||
using SJZY.Track.Domain.Dtos.Common;
|
||||
using SJZY.Track.Domain.Dtos.Forewarning;
|
||||
using SJZY.Track.Domain.Enums;
|
||||
using SJZY.Track.Share.Enums;
|
||||
|
||||
namespace SJZY.Track.Application.Helpers;
|
||||
|
||||
|
||||
@ -1,11 +1,8 @@
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using SJZY.Expand.ABP.Core;
|
||||
using SJZY.Track.Application.Contract.Dtos.Forewarning;
|
||||
using SJZY.Track.Application.Contract.Events;
|
||||
using SJZY.Track.Application.Contract.Services;
|
||||
using SJZY.Track.Domain.Aggregates.ForewarningAggregate;
|
||||
using SJZY.Track.Domain.Consts;
|
||||
using SJZY.Track.Domain.Dtos.Forewarning;
|
||||
using SJZY.UserCenter.SharedModel.Dtos.PHP.User;
|
||||
|
||||
namespace SJZY.Track.Application.HostServices;
|
||||
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
using System.Collections.Concurrent;
|
||||
using SJZY.Expand.ABP.Core;
|
||||
using SJZY.Expand.ABP.Core.PublicMethords;
|
||||
using SJZY.Track.Application.Contract.Dtos.Forewarning;
|
||||
using SJZY.Track.Application.Contract.Services;
|
||||
using SJZY.Track.Domain.Aggregates.ForewarningAggregate;
|
||||
using SJZY.Track.Domain.Aggregates.KPIAreaAggregate;
|
||||
using SJZY.Track.Domain.Consts;
|
||||
using SJZY.Track.Domain.Dtos.Forewarning;
|
||||
@ -13,25 +12,20 @@ namespace SJZY.Track.Application.Services.ForewarningServices;
|
||||
|
||||
public class ForewarningCacheService : IForewarningCacheService, ISingletonDependency
|
||||
{
|
||||
readonly IKpiAreaRepository _kpiAreaRepository;
|
||||
private readonly IWarningQueries _warningQueries;
|
||||
|
||||
private const string GlobalWaningLockKey = "GlobalWaningLockKey_GlobalLock";
|
||||
private readonly ConcurrentDictionary<int, List<AreaCacheEntry>> _areas = new();
|
||||
readonly IKpiAreaRepository _kpiAreaRepository;
|
||||
|
||||
private readonly ConcurrentDictionary<string, List<ForewarningRuleCacheEntry>> _rules = new();
|
||||
private readonly ConcurrentDictionary<int, List<AreaCacheEntry>> _areas = new();
|
||||
private readonly IWarningQueries _warningQueries;
|
||||
object _lock = new object();
|
||||
|
||||
public ForewarningCacheService(IKpiAreaRepository kpiAreaRepository, IWarningQueries warningQueries)
|
||||
{
|
||||
_kpiAreaRepository = kpiAreaRepository;
|
||||
_warningQueries = warningQueries;
|
||||
}
|
||||
|
||||
string WarningKey(int subSystemId, int customerId) =>
|
||||
$"{GlobalConst.TrackWarningKeyPrefix}:{subSystemId}:{customerId}";
|
||||
|
||||
string AreaKey(int areaId) => $"{GlobalConst.TrackAreaKeyPrefix}:{areaId}";
|
||||
|
||||
public async Task<List<ForewarningRuleCacheEntry>?> GetRulesAsync(int subSystemId, int customerId)
|
||||
{
|
||||
var key = WarningKey(subSystemId, customerId);
|
||||
@ -43,6 +37,58 @@ public class ForewarningCacheService : IForewarningCacheService, ISingletonDepen
|
||||
return await GetRules(subSystemId, customerId);
|
||||
}
|
||||
|
||||
public Task DeleteRulesAsync(int subSystemId, int customerId)
|
||||
{
|
||||
_rules.Remove(WarningKey(subSystemId, customerId),out _);
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task Clear(ClearRulCacheEvent @event)
|
||||
{
|
||||
foreach (var item in @event.Items)
|
||||
{
|
||||
DeleteRulesAsync(item.SystemId, item.CustomerId);
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public async Task ClearRedisBySystemIdAndCustomer(int subSystemId,int customerId)
|
||||
{
|
||||
await RedisHelper.Client.DelAsync(WarningKey(subSystemId, customerId));
|
||||
var eventModel = new ClearRulCacheEvent
|
||||
{
|
||||
Items = new List<RuleAreaBaseInfo>()
|
||||
{
|
||||
new RuleAreaBaseInfo(subSystemId, customerId)
|
||||
}
|
||||
};
|
||||
|
||||
await PublishEvent(eventModel);
|
||||
}
|
||||
|
||||
public async Task ClearRedisByAreaId(int areaId)
|
||||
{
|
||||
var baseInfos = await _warningQueries.GetWarningRuleByAreaId(areaId);
|
||||
if(baseInfos==null||baseInfos.Count==0) return;
|
||||
baseInfos = baseInfos.DistinctBy(val => WarningKey(val.SystemId, val.CustomerId)).ToList();
|
||||
|
||||
var willDelKeys = baseInfos.Select(val => WarningKey(val.SystemId, val.CustomerId)).ToArray();
|
||||
await RedisHelper.Client.DelAsync(willDelKeys);
|
||||
await RedisHelper.Client.DelAsync(AreaKey(areaId));
|
||||
var eventModel = new ClearRulCacheEvent
|
||||
{
|
||||
Items = baseInfos
|
||||
};
|
||||
|
||||
await PublishEvent(eventModel);
|
||||
}
|
||||
|
||||
string WarningKey(int subSystemId, int customerId) =>
|
||||
$"{GlobalConst.TrackWarningKeyPrefix}:{subSystemId}:{customerId}";
|
||||
|
||||
string AreaKey(int areaId) => $"{GlobalConst.TrackAreaKeyPrefix}:{areaId}";
|
||||
|
||||
private List<ForewarningRuleCacheEntry> WriteRules(List<WarningRuleCacheDto> rules)
|
||||
{
|
||||
List<ForewarningRuleCacheEntry> result = new List<ForewarningRuleCacheEntry>();
|
||||
@ -118,13 +164,6 @@ public class ForewarningCacheService : IForewarningCacheService, ISingletonDepen
|
||||
}
|
||||
}
|
||||
|
||||
public Task DeleteRulesAsync(int subSystemId, int customerId)
|
||||
{
|
||||
_rules.Remove(WarningKey(subSystemId, customerId),out _);
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private List<AreaCacheEntry>? GetAreaInfoByAreaId(int areaId)
|
||||
{
|
||||
if (_areas.TryGetValue(areaId, out var areaInfos)) return areaInfos;
|
||||
@ -176,46 +215,6 @@ public class ForewarningCacheService : IForewarningCacheService, ISingletonDepen
|
||||
return result;
|
||||
}
|
||||
|
||||
public Task Clear(ClearRulCacheEvent @event)
|
||||
{
|
||||
foreach (var item in @event.Items)
|
||||
{
|
||||
DeleteRulesAsync(item.SystemId, item.CustomerId);
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public async Task ClearRedisBySystemIdAndCustomer(int subSystemId,int customerId)
|
||||
{
|
||||
await RedisHelper.Client.DelAsync(WarningKey(subSystemId, customerId));
|
||||
var eventModel = new ClearRulCacheEvent
|
||||
{
|
||||
Items = new List<RuleAreaBaseInfo>()
|
||||
{
|
||||
new RuleAreaBaseInfo(subSystemId, customerId)
|
||||
}
|
||||
};
|
||||
|
||||
await PublishEvent(eventModel);
|
||||
}
|
||||
|
||||
public async Task ClearRedisByAreaId(int areaId)
|
||||
{
|
||||
var baseInfos = await _warningQueries.GetWarningRuleByAreaId(areaId);
|
||||
if(baseInfos==null||baseInfos.Count==0) return;
|
||||
baseInfos = baseInfos.DistinctBy(val => WarningKey(val.SystemId, val.CustomerId)).ToList();
|
||||
|
||||
var willDelKeys = baseInfos.Select(val => WarningKey(val.SystemId, val.CustomerId)).ToArray();
|
||||
await RedisHelper.Client.DelAsync(willDelKeys);
|
||||
await RedisHelper.Client.DelAsync(AreaKey(areaId));
|
||||
var eventModel = new ClearRulCacheEvent
|
||||
{
|
||||
Items = baseInfos
|
||||
};
|
||||
|
||||
await PublishEvent(eventModel);
|
||||
}
|
||||
|
||||
private async Task PublishEvent(ClearRulCacheEvent @event)
|
||||
{
|
||||
await RedisHelper.Client.PublishAsync(GlobalConst.PublishNotifyChannelKey, @event.ToJson());
|
||||
|
||||
@ -3,7 +3,9 @@ using FreeRedis;
|
||||
using SJZY.Expand.ABP.Core;
|
||||
using SJZY.Track.Application.Contract.Dtos.Forewarning;
|
||||
using SJZY.Track.Application.Contract.Services;
|
||||
using SJZY.Track.Domain.Aggregates.ForewarningAggregate;
|
||||
using SJZY.Track.Domain.Consts;
|
||||
using SJZY.Track.Domain.Dtos.Forewarning;
|
||||
using SJZY.Track.Domain.Queries;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
|
||||
@ -78,6 +80,50 @@ public class ForewarningNotifyService : IForewarningNotifyService, ITransientDep
|
||||
if (res == null) throw new BusinessException(message: "轨迹预警计算失败");
|
||||
}
|
||||
|
||||
public async Task SendNotificationAsync()
|
||||
{
|
||||
var max = GetTimestamp(DateTime.Now);
|
||||
var set = await RedisHelper.Client.ZRangeByScoreAsync(GlobalConst.ForewarningNotifyKey, 0, max);
|
||||
|
||||
if (set.IsNullOrEmpty()) return;
|
||||
|
||||
var entries = set.Select(x => new WarningNotifyCacheEntry(x)).ToList();
|
||||
var ruleIds = entries.Select(x => x.RuleId).ToList();
|
||||
var notifyRules = await _warningQueries.GetWarningNotifyRulesAsync(ruleIds);
|
||||
|
||||
/*
|
||||
*
|
||||
预警名称:字节全程时效
|
||||
预警规则:
|
||||
{起飞-落地+普货+12345678+美国 时效9,预警时效7,次数3} 命中订单总数:124,详情点击https://middlebusiness.pet.shijizhongyun.com/trajectoryCenter/trajectoryOrder
|
||||
{清关-提货+普货+12345678+美国 时效4,预警时效3,次数1} 命中订单总数:3250,详情点击https://middlebusiness.pet.shijizhongyun.com/trajectoryCenter/trajectoryOrder
|
||||
预警名称:字节全程时效
|
||||
预警规则:
|
||||
{起飞-落地+普货+12345678+美国 时效9,预警时效7,次数3} 命中订单总数:124,详情点击https://middlebusiness.pet.shijizhongyun.com/trajectoryCenter/trajectoryOrder
|
||||
{清关-提货+普货+12345678+美国 时效4,预警时效3,次数1} 命中订单总数:3250,详情点击https://middlebusiness.pet.shijizhongyun.com/trajectoryCenter/trajectoryOrder
|
||||
*/
|
||||
foreach (var group in notifyRules.GroupBy(x => new { x.NotifyMode, x.NotifyUserId }))
|
||||
{
|
||||
var notifyContent = new StringBuilder();
|
||||
|
||||
foreach (var warningGroup in group.GroupBy(x => x.WarningName))
|
||||
{
|
||||
notifyContent.AppendLine($"预警名称:{warningGroup.Key}");
|
||||
notifyContent.AppendLine($"预警规则:");
|
||||
|
||||
foreach (var rule in warningGroup.ToList())
|
||||
{
|
||||
var cnt = entries.Count(x => x.RuleId == rule.RuleId);
|
||||
if (cnt > 0)
|
||||
{
|
||||
notifyContent.AppendLine(
|
||||
$"{rule.ToString()} 命中订单总数:{cnt},详情点击https://middlebusiness.pet.shijizhongyun.com/trajectoryCenter/trajectoryOrder");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static List<ForewarningRuleCacheEntry> MatchRule(List<ForewarningRuleCacheEntry> rules,
|
||||
WarningOrderDto order)
|
||||
{
|
||||
@ -137,50 +183,6 @@ public class ForewarningNotifyService : IForewarningNotifyService, ITransientDep
|
||||
return res;
|
||||
}
|
||||
|
||||
public async Task SendNotificationAsync()
|
||||
{
|
||||
var max = GetTimestamp(DateTime.Now);
|
||||
var set = await RedisHelper.Client.ZRangeByScoreAsync(GlobalConst.ForewarningNotifyKey, 0, max);
|
||||
|
||||
if (set.IsNullOrEmpty()) return;
|
||||
|
||||
var entries = set.Select(x => new WarningNotifyCacheEntry(x)).ToList();
|
||||
var ruleIds = entries.Select(x => x.RuleId).ToList();
|
||||
var notifyRules = await _warningQueries.GetWarningNotifyRulesAsync(ruleIds);
|
||||
|
||||
/*
|
||||
*
|
||||
预警名称:字节全程时效
|
||||
预警规则:
|
||||
{起飞-落地+普货+12345678+美国 时效9,预警时效7,次数3} 命中订单总数:124,详情点击https://middlebusiness.pet.shijizhongyun.com/trajectoryCenter/trajectoryOrder
|
||||
{清关-提货+普货+12345678+美国 时效4,预警时效3,次数1} 命中订单总数:3250,详情点击https://middlebusiness.pet.shijizhongyun.com/trajectoryCenter/trajectoryOrder
|
||||
预警名称:字节全程时效
|
||||
预警规则:
|
||||
{起飞-落地+普货+12345678+美国 时效9,预警时效7,次数3} 命中订单总数:124,详情点击https://middlebusiness.pet.shijizhongyun.com/trajectoryCenter/trajectoryOrder
|
||||
{清关-提货+普货+12345678+美国 时效4,预警时效3,次数1} 命中订单总数:3250,详情点击https://middlebusiness.pet.shijizhongyun.com/trajectoryCenter/trajectoryOrder
|
||||
*/
|
||||
foreach (var group in notifyRules.GroupBy(x => new { x.NotifyMode, x.NotifyUserId }))
|
||||
{
|
||||
var notifyContent = new StringBuilder();
|
||||
|
||||
foreach (var warningGroup in group.GroupBy(x => x.WarningName))
|
||||
{
|
||||
notifyContent.AppendLine($"预警名称:{warningGroup.Key}");
|
||||
notifyContent.AppendLine($"预警规则:");
|
||||
|
||||
foreach (var rule in warningGroup.ToList())
|
||||
{
|
||||
var cnt = entries.Count(x => x.RuleId == rule.RuleId);
|
||||
if (cnt > 0)
|
||||
{
|
||||
notifyContent.AppendLine(
|
||||
$"{rule.ToString()} 命中订单总数:{cnt},详情点击https://middlebusiness.pet.shijizhongyun.com/trajectoryCenter/trajectoryOrder");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static long GetTimestamp(DateTime dateTime)
|
||||
{
|
||||
return new DateTimeOffset(dateTime).ToUnixTimeSeconds();
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using SJZY.Track.Application.Contract.Dtos.Common;
|
||||
using SJZY.Track.Application.Contract.Dtos.Forewarning;
|
||||
using SJZY.Track.Application.Contract.Services;
|
||||
using SJZY.Track.Application.Helpers;
|
||||
using SJZY.Track.Domain.Aggregates.ForewarningAggregate;
|
||||
using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
|
||||
using SJZY.Track.Domain.Dtos.Common;
|
||||
using SJZY.Track.Domain.Dtos.Forewarning;
|
||||
using SJZY.Track.Domain.Dtos.TrackStatus;
|
||||
using SJZY.Track.Domain.Queries;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using SJZY.Track.Application.Contract.Services;
|
||||
using SJZY.Track.Domain.Aggregates.ForewarningAggregate;
|
||||
using SJZY.Track.Domain.Aggregates.KPIAreaAggregate;
|
||||
using SJZY.Track.Domain.Dtos.Forewarning;
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
using SJZY.Track.Application.Contract.Dtos.Forewarning;
|
||||
using SJZY.Track.Domain.Dtos.Forewarning;
|
||||
|
||||
namespace SJZY.Track.Application.Contract.Services;
|
||||
namespace SJZY.Track.Domain.Aggregates.ForewarningAggregate;
|
||||
|
||||
public interface IForewarningCacheService
|
||||
{
|
||||
@ -1,4 +1,4 @@
|
||||
using SJZY.Track.Domain.Enums;
|
||||
using SJZY.Track.Share.Enums;
|
||||
|
||||
namespace SJZY.Track.Domain.Aggregates.ForewarningAggregate;
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using SJZY.Track.Domain.Enums;
|
||||
using SJZY.Track.Share.Enums;
|
||||
|
||||
namespace SJZY.Track.Domain.Aggregates.ForewarningAggregate;
|
||||
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using SJZY.Track.Share.Enums;
|
||||
|
||||
namespace SJZY.Track.Domain.Aggregates.ForewarningAggregate;
|
||||
|
||||
[SugarTable("t_warning_rule")]
|
||||
@ -92,4 +94,16 @@ public class WarningRuleEntity : IFullAuditedBasicEntitys, IEntity
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "ProductCode")]
|
||||
public string? ProductCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 通知方式
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "NotifyMode")]
|
||||
public NotifyMode NotifyMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 通知人
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "NotifyUserId")]
|
||||
public int NotifyUserId { get; set; }
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
using SJZY.Track.Domain.Enums;
|
||||
using SJZY.Track.Share.Enums;
|
||||
|
||||
namespace SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
namespace SJZY.Track.Application.Contract.Dtos.Common;
|
||||
namespace SJZY.Track.Domain.Dtos.Common;
|
||||
|
||||
public class IdWithNameDto
|
||||
{
|
||||
@ -1,4 +1,4 @@
|
||||
namespace SJZY.Track.Application.Contract.Dtos.Forewarning;
|
||||
namespace SJZY.Track.Domain.Dtos.Forewarning;
|
||||
|
||||
public class AreaCacheEntry
|
||||
{
|
||||
@ -0,0 +1,7 @@
|
||||
namespace SJZY.Track.Domain.Dtos.Forewarning;
|
||||
|
||||
|
||||
public class ClearRulCacheEvent
|
||||
{
|
||||
public List<RuleAreaBaseInfo> Items { get; set; }
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
namespace SJZY.Track.Application.Contract.Dtos.Forewarning;
|
||||
namespace SJZY.Track.Domain.Dtos.Forewarning;
|
||||
|
||||
public class ForewarningRuleCacheEntry
|
||||
{
|
||||
@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using NUglify.Helpers;
|
||||
using SJZY.Track.Domain.Enums;
|
||||
using SJZY.Track.Share.Enums;
|
||||
|
||||
namespace SJZY.Track.Domain.Dtos.Forewarning;
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using SJZY.Track.Domain.Enums;
|
||||
using SJZY.Track.Share.Enums;
|
||||
|
||||
namespace SJZY.Track.Domain.Dtos.TrackPush;
|
||||
|
||||
|
||||
@ -17,4 +17,8 @@
|
||||
<Compile Remove="Aggregates\ForewarningAggregate\RuleAreaEntity.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SJZY.Track.Shared\SJZY.Track.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -6,6 +6,7 @@ using SJZY.Track.Domain.Dtos.Common;
|
||||
using SJZY.Track.Domain.Dtos.TrackPush;
|
||||
using SJZY.Track.Domain.Enums;
|
||||
using SJZY.Track.Domain.VEntities;
|
||||
using SJZY.Track.Share.Enums;
|
||||
|
||||
namespace SJZY.Track.Repository.Repositories;
|
||||
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SJZY.Track.Domain\SJZY.Track.Domain.csproj" />
|
||||
<ProjectReference Include="..\SJZY.Track.Shared\SJZY.Track.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
namespace SJZY.Track.Domain.Enums;
|
||||
namespace SJZY.Track.Share.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// 时间样式枚举
|
||||
@ -1,4 +1,4 @@
|
||||
namespace SJZY.Track.Domain.Enums;
|
||||
namespace SJZY.Track.Share.Enums;
|
||||
|
||||
public enum NotifyMode
|
||||
{
|
||||
@ -1,4 +1,4 @@
|
||||
namespace SJZY.Track.Domain.Enums;
|
||||
namespace SJZY.Track.Share.Enums;
|
||||
|
||||
|
||||
/// <summary>
|
||||
13
src/SJZY.Track.Shared/SJZY.Track.Shared.csproj
Normal file
13
src/SJZY.Track.Shared/SJZY.Track.Shared.csproj
Normal file
@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="../../common.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>SJZY.Track.Share</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Loading…
Reference in New Issue
Block a user