feat: 添加跨全局的Shared项目

This commit is contained in:
钟喜旺 2024-08-05 15:43:04 +08:00
parent a3c4199a30
commit 7cba774373
36 changed files with 215 additions and 174 deletions

View File

@ -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}

View File

@ -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; }
}

View File

@ -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;
@ -9,12 +9,12 @@ public class CreateWarningInput
/// 模板名称
/// </summary>
public string Name { get; set; } = null!;
/// <summary>
/// 子系统id
/// </summary>
public int SubSystemId { get; set; }
/// <summary>
/// 客户id
/// </summary>

View File

@ -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;

View File

@ -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;
@ -9,7 +9,7 @@ public class UpdateWarningInput
/// 预警id
/// </summary>
public int Id { get; set; }
/// <summary>
/// 模板名称
/// </summary>
@ -25,6 +25,7 @@ public class UpdateWarningInput
/// </summary>
public string NotifyTemplate { get; set; } = null!;
/// <summary>
/// 通知列表
/// </summary>

View File

@ -1,5 +1,5 @@
using Newtonsoft.Json.Linq;
using SJZY.Track.Domain.Enums;
using SJZY.Track.Share.Enums;
namespace SJZY.Track.Domain.Dtos.Forewarning;

View File

@ -1,4 +1,4 @@
using SJZY.Track.Domain.Enums;
using SJZY.Track.Share.Enums;
namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
@ -50,17 +50,17 @@ public class EditTrackPushConfigInput
/// 是否全量推送
/// </summary>
public bool? IsAllPush { get; set; }
/// <summary>
/// 时间格式枚举
/// </summary>
public DateTimeFormatEnum DateTimeFormatType { get; set; }
/// <summary>
/// 日期时间格式模板
/// </summary>
public string? DateTimeFormat { get; set; }
/// <summary>
/// 时区格式格式模板
/// </summary>

View File

@ -1,4 +1,4 @@
using SJZY.Track.Domain.Enums;
using SJZY.Track.Share.Enums;
namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
@ -73,17 +73,17 @@ public class TrackPushContentConfigDto
/// 扩展字段参数值
/// </summary>
public string? ExpandFieldsValue { get; set; }
/// <summary>
/// 时间格式枚举
/// </summary>
public DateTimeFormatEnum DateTimeFormatType { get; set; }
/// <summary>
/// 日期时间格式模板
/// </summary>
public string? DateTimeFormat { get; set; }
/// <summary>
/// 时区格式格式模板
/// </summary>

View File

@ -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>

View File

@ -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);

View File

@ -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,
@ -291,7 +291,7 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
return matched != null && matched.TrackCode == trackCode ? matched : default;
}
/// <summary>
/// 转换推送时间格式
/// </summary>

View File

@ -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;

View File

@ -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;
@ -42,7 +39,7 @@ public class RedisHostService:IHostedService
_forewarningCacheService.Clear(instance);
}
}
private string GetKey()
{
return $"{GlobalConst.PublishNotifyChannelKey}";

View File

@ -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,24 +12,19 @@ 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)
{
@ -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());

View File

@ -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();

View File

@ -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;

View File

@ -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;

View File

@ -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
{
@ -11,7 +11,7 @@ public interface IForewarningCacheService
/// <param name="customerId">客户id</param>
/// <returns></returns>
Task<List<ForewarningRuleCacheEntry>?> GetRulesAsync(int subSystemId, int customerId);
/// <summary>
/// 删除规则
/// </summary>
@ -25,7 +25,7 @@ public interface IForewarningCacheService
/// </summary>
/// <returns></returns>
Task Clear(ClearRulCacheEvent @event);
/// <summary>
/// 清除redis 缓存
/// </summary>

View File

@ -1,4 +1,4 @@
using SJZY.Track.Domain.Enums;
using SJZY.Track.Share.Enums;
namespace SJZY.Track.Domain.Aggregates.ForewarningAggregate;
@ -10,7 +10,7 @@ public class WarningFactorEntity : IFullAuditedBasicEntitys, IEntity
/// </summary>
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)]
public int Id { get; set; }
/// <summary>
/// 预警id
/// </summary>
@ -22,7 +22,7 @@ public class WarningFactorEntity : IFullAuditedBasicEntitys, IEntity
/// </summary>
[SugarColumn(ColumnName = "Type")]
public RuleFactorType Type { get; set; }
/// <summary>
/// 预警因素值(json数组字符串)
/// </summary>

View File

@ -1,4 +1,5 @@
using SJZY.Track.Domain.Enums;
using SJZY.Track.Share.Enums;
namespace SJZY.Track.Domain.Aggregates.ForewarningAggregate;

View File

@ -1,3 +1,5 @@
using SJZY.Track.Share.Enums;
namespace SJZY.Track.Domain.Aggregates.ForewarningAggregate;
[SugarTable("t_warning_rule")]
@ -14,7 +16,7 @@ public class WarningRuleEntity : IFullAuditedBasicEntitys, IEntity
/// </summary>
[SugarColumn(ColumnName = "WarningId")]
public int WarningId { get; set; }
/// <summary>
/// 时效(小时)
/// </summary>
@ -38,7 +40,7 @@ public class WarningRuleEntity : IFullAuditedBasicEntitys, IEntity
/// </summary>
[SugarColumn(ColumnName = "StartTrackStatusId")]
public int StartTrackStatusId { get; set; }
/// <summary>
/// 起始轨迹状态(冗余)
/// </summary>
@ -50,7 +52,7 @@ public class WarningRuleEntity : IFullAuditedBasicEntitys, IEntity
/// </summary>
[SugarColumn(ColumnName = "EndTrackStatusId")]
public int EndTrackStatusId { get; set; }
/// <summary>
/// 终止轨迹状态(冗余)
/// </summary>
@ -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; }
}

View File

@ -1,4 +1,4 @@
using SJZY.Track.Domain.Enums;
using SJZY.Track.Share.Enums;
namespace SJZY.Track.Domain.Aggregates.TrackPushAggregate;
@ -55,19 +55,19 @@ public class TrackPushConfigEntity : IFullAuditedBasicEntitys, IAggregateRoot
/// </summary>
[SugarColumn(ColumnName = "IsAllPush")]
public bool IsAllPush { get; set; }
/// <summary>
/// 日期时间格式类型
/// </summary>
[SugarColumn(ColumnName = "DateTimeFormatType")]
public DateTimeFormatEnum DateTimeFormatType { get; set; }
/// <summary>
/// 日期时间格式模板
/// </summary>
[SugarColumn(ColumnName = "DateTimeFormat")]
public string? DateTimeFormat { get; set; }
/// <summary>
/// 时区格式格式模板
/// </summary>

View File

@ -1,4 +1,4 @@
namespace SJZY.Track.Application.Contract.Dtos.Common;
namespace SJZY.Track.Domain.Dtos.Common;
public class IdWithNameDto
{

View File

@ -1,4 +1,4 @@
namespace SJZY.Track.Application.Contract.Dtos.Forewarning;
namespace SJZY.Track.Domain.Dtos.Forewarning;
public class AreaCacheEntry
{
@ -6,22 +6,22 @@ public class AreaCacheEntry
/// 国家或地区
/// </summary>
public string Country { get; set; } = null!;
/// <summary>
/// 省份
/// </summary>
public string? Province { get; set; }
/// <summary>
/// 城市
/// </summary>
public string? City { get; set; }
/// <summary>
/// 开始邮编
/// </summary>
public string? LeftPostcode { get; set; }
/// <summary>
/// 截止邮编
/// </summary>

View File

@ -0,0 +1,7 @@
namespace SJZY.Track.Domain.Dtos.Forewarning;
public class ClearRulCacheEvent
{
public List<RuleAreaBaseInfo> Items { get; set; }
}

View File

@ -1,4 +1,4 @@
namespace SJZY.Track.Application.Contract.Dtos.Forewarning;
namespace SJZY.Track.Domain.Dtos.Forewarning;
public class ForewarningRuleCacheEntry
{
@ -11,7 +11,7 @@ public class ForewarningRuleCacheEntry
/// 预警id
/// </summary>
public int WarningId { get; set; }
/// <summary>
/// 时效(小时) e.g. 24
/// </summary>
@ -46,7 +46,7 @@ public class ForewarningRuleCacheEntry
/// 月份
/// </summary>
public List<int>? Months { get; set; }
/// <summary>
/// 区域
/// </summary>

View File

@ -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;
@ -85,7 +85,7 @@ public class GetWarningNotifiesVo
/// 通知人
/// </summary>
public int NotifyUserId { get; set; }
/// <summary>
/// 因素类型排序
/// </summary>

View File

@ -1,4 +1,4 @@
using SJZY.Track.Domain.Enums;
using SJZY.Track.Share.Enums;
namespace SJZY.Track.Domain.Dtos.TrackPush;
@ -55,17 +55,17 @@ public class GetTrackPushConfigDetailOutputVO
/// 是否全量推送
/// </summary>
public bool IsAllPush { get; set; }
/// <summary>
/// 时间格式枚举
/// </summary>
public DateTimeFormatEnum? DateTimeFormatType { get; set; }
/// <summary>
/// 日期时间格式模板
/// </summary>
public string? DateTimeFormat { get; set; }
/// <summary>
/// 时区格式格式模板
/// </summary>

View File

@ -16,5 +16,9 @@
<Compile Remove="Aggregates\KPIAreaAggregate.cs" />
<Compile Remove="Aggregates\ForewarningAggregate\RuleAreaEntity.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SJZY.Track.Shared\SJZY.Track.Shared.csproj" />
</ItemGroup>
</Project>

View File

@ -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;

View File

@ -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>

View File

@ -1,4 +1,4 @@
namespace SJZY.Track.Domain.Enums;
namespace SJZY.Track.Share.Enums;
/// <summary>
/// 时间样式枚举

View File

@ -1,4 +1,4 @@
namespace SJZY.Track.Domain.Enums;
namespace SJZY.Track.Share.Enums;
public enum NotifyMode
{

View File

@ -1,4 +1,4 @@
namespace SJZY.Track.Domain.Enums;
namespace SJZY.Track.Share.Enums;
/// <summary>

View 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>