重构项目结构

This commit is contained in:
xiaolipro 2024-09-18 11:03:41 +08:00
parent f42e2db302
commit 8bc1c4917d
25 changed files with 32 additions and 76 deletions

View File

@ -26,8 +26,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "solution items", "solution
.editorconfig = .editorconfig
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
@ -58,10 +56,6 @@ 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
@ -73,7 +67,6 @@ 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,5 +1,3 @@
using SJZY.Track.Domain.Dtos.Forewarning;
namespace SJZY.Track.Application.Contract.Dtos.Forewarning;
public class CreateWarningInput

View File

@ -1,5 +1,3 @@
using SJZY.Track.Domain.Dtos.Forewarning;
namespace SJZY.Track.Application.Contract.Dtos.Forewarning;
public class EditWarningOutput

View File

@ -1,5 +1,3 @@
using SJZY.Track.Share.Enums;
namespace SJZY.Track.Application.Contract.Dtos.Forewarning;
public class UpdateWarningInput
@ -33,7 +31,7 @@ public class NotifyDto
public List<int> NotifyUserIds { get; set; }
/// <summary>
/// 通知方式
/// 通知方式(1站内信,2飞书)
/// </summary>
public List<NotifyMode> NotifyModes { get; set; }
public List<int> NotifyModes { get; set; }
}

View File

@ -1,17 +1,14 @@
using Newtonsoft.Json.Linq;
using SJZY.Track.Share.Enums;
namespace SJZY.Track.Domain.Dtos.Forewarning;
namespace SJZY.Track.Application.Contract.Dtos.Forewarning;
public class WarningFactorDto
{
/// <summary>
/// 因素类型
/// 因素类型(1表示货物类型,2表示月份,3表示分区或区域,4指示货物是否中转,5表示起运港口,6表示销售产品)
/// </summary>
public RuleFactorType FactorType { get; set; }
public int FactorType { get; set; }
/// <summary>
/// 因素值
/// 因素值(直接传json数组)
/// </summary>
public JArray FactorValue { get; set; } = new();
public List<object> FactorValue { get; set; } = new();
}

View File

@ -1,5 +1,3 @@
using SJZY.Track.Share.Enums;
namespace SJZY.Track.Application.Contract.Dtos.Forewarning;
public class WarningNotifyDto
@ -35,7 +33,7 @@ public class WarningNotifyDto
public List<string> NotifyUsers { get; set; }
/// <summary>
/// 通知方式
/// 通知方式(1站内信,2飞书)
/// </summary>
public List<NotifyMode> NotifyModes { get; set; }
public List<int> NotifyModes { get; set; }
}

View File

@ -1,5 +1,3 @@
using SJZY.Track.Share.Enums;
namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
public class EditTrackPushConfigInput
@ -49,7 +47,7 @@ public class EditTrackPushConfigInput
/// <summary>
/// 时间格式枚举
/// </summary>
public DateTimeFormatEnum DateTimeFormatType { get; set; }
public int DateTimeFormatType { get; set; }
/// <summary>
/// 日期时间格式模板

View File

@ -1,6 +1,4 @@
using SJZY.Track.Share.Enums;
namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
public class TrackPushContentConfigDto
{
@ -77,7 +75,7 @@ public class TrackPushContentConfigDto
/// <summary>
/// 时间格式枚举
/// </summary>
public DateTimeFormatEnum DateTimeFormatType { get; set; }
public int DateTimeFormatType { get; set; }
/// <summary>
/// 日期时间格式模板

View File

@ -12,8 +12,5 @@
<PackageReference Include="SJZY.Expand.ABP.Common" Version="7.0.11" />
<PackageReference Include="Volo.Abp.Core" Version="7.0.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SJZY.Track.Shared\SJZY.Track.Shared.csproj" />
</ItemGroup>
</Project>

View File

@ -10,7 +10,6 @@ using SJZY.Track.Domain.Aggregates.OrderAggregate;
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
using SJZY.Track.Domain.Enums;
using SJZY.Track.Share.Enums;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Http.Client.DynamicProxying;
@ -303,10 +302,10 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe
/// <returns></returns>
private string DateTimeFormat(DateTime dateTime, double timezone, TrackPushContentConfigDto config)
{
if (config.DateTimeFormatType == DateTimeFormatEnum.Timestamp)
if (config.DateTimeFormatType == (int) DateTimeFormatEnum.Timestamp)
return DateTimeHelper.ConvertToUnixTimestamp(dateTime).ToString();
if (config.DateTimeFormatType == DateTimeFormatEnum.DateTimeAndTimezone
if (config.DateTimeFormatType == (int) DateTimeFormatEnum.DateTimeAndTimezone
&& !string.IsNullOrEmpty(config.DateTimeFormat)
&& !string.IsNullOrEmpty(config.TimezoneFormat))
{

View File

@ -1,12 +1,13 @@
using System.Dynamic;
using Nest;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using SJZY.Expand.ABP.Core.PublicMethords;
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.Share.Enums;
using SJZY.Track.Domain.Enums;
namespace SJZY.Track.Application.Helpers;
@ -72,7 +73,7 @@ public class ForewarningHelper
var row = 0;
for (var i = 0; i < times; i++)
{
foreach (var value in factor.FactorValue)
foreach (var value in factor.FactorValue.Select(JToken.FromObject))
{
var strValue = value.ToString();
if (strValue.IsNullOrEmpty())
@ -82,7 +83,7 @@ public class ForewarningHelper
for (var j = 0; j < repeat; j++, row++)
{
switch (factor.FactorType)
switch ((RuleFactorType) factor.FactorType)
{
case RuleFactorType.CargoType:
if (value.Type is not JTokenType.String)
@ -147,7 +148,7 @@ public class ForewarningHelper
{
return warningFactors.Select(x => new WarningFactorEntity
{
Type = x.FactorType,
Type = (RuleFactorType) x.FactorType,
Value = x.FactorValue.ToJson()
}).ToList();
}
@ -181,13 +182,13 @@ public class ForewarningHelper
EndTrackStatus = statusDic.TryGetValue(x.EndTrackStatusId, out var end) ? end : "",
NotifyUserIds = x.NotifyUserId.Split(',').Select(int.Parse).ToList(),
NotifyUsers = x.NotifyUser.Split(',').ToList(),
NotifyModes = x.NotifyMode.Split(',').Select(Enum.Parse<NotifyMode>).ToList(),
NotifyModes = x.NotifyMode.Split(',').Select(int.Parse).ToList(),
}).ToList(),
WarningFactors = warning.WarningFactors.Select(x => new WarningFactorWithIdDto
{
Id = x.Id,
FactorType = x.Type,
FactorValue = JArray.Parse(x.Value),
FactorType = (int) x.Type,
FactorValue = JsonConvert.DeserializeObject<List<object>>(x.Value)!,
}).ToList()
};
}

View File

@ -6,8 +6,8 @@ using SJZY.Track.Application.Contract.Dtos.Forewarning;
using SJZY.Track.Application.Contract.Services;
using SJZY.Track.Domain.Aggregates.ForewarningAggregate;
using SJZY.Track.Domain.Dtos.Forewarning;
using SJZY.Track.Domain.Enums;
using SJZY.Track.Domain.Queries;
using SJZY.Track.Share.Enums;
using SJZY.UserCenter.HttpApi.Services.Message;
using SJZY.UserCenter.SharedModel.Dtos.Message;
using SJZY.UserCenter.SharedModel.Enums;

View File

@ -77,7 +77,7 @@ public class TrackPushCacheService : ITrackPushCacheService, ITransientDependenc
IsCanUpdate = trackPushConfig.IsCanUpdate,
IsAllPush = trackPushConfig.IsAllPush,
IsCanDelete = trackPushConfig.IsCanDelete,
DateTimeFormatType = trackPushConfig.DateTimeFormatType,
DateTimeFormatType = (int) trackPushConfig.DateTimeFormatType,
DateTimeFormat = trackPushConfig.DateTimeFormat,
TimezoneFormat = trackPushConfig.TimezoneFormat,
ServiceProviderCode = item.ServiceProviderCode,

View File

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

View File

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

View File

@ -1,6 +1,6 @@
using System.Text;
using NUglify.Helpers;
using SJZY.Track.Share.Enums;
using SJZY.Track.Domain.Enums;
namespace SJZY.Track.Domain.Dtos.Forewarning;

View File

@ -1,4 +1,4 @@
using SJZY.Track.Share.Enums;
using SJZY.Track.Domain.Enums;
namespace SJZY.Track.Domain.Dtos.TrackPush;

View File

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

View File

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

View File

@ -1,4 +1,4 @@
namespace SJZY.Track.Share.Enums;
namespace SJZY.Track.Domain.Enums;
/// <summary>
/// 枚举表示不同类型的规则因素。

View File

@ -16,9 +16,5 @@
<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

@ -1,9 +1,9 @@
using SJZY.Track.Domain.Aggregates.ForewarningAggregate;
using SJZY.Track.Domain.Aggregates.KPIAreaAggregate;
using SJZY.Track.Domain.Dtos.Forewarning;
using SJZY.Track.Domain.Enums;
using SJZY.Track.Domain.Queries;
using SJZY.Track.Domain.VEntities;
using SJZY.Track.Share.Enums;
namespace SJZY.Track.Repository.Queries;

View File

@ -6,7 +6,6 @@ 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

@ -16,7 +16,6 @@
<ItemGroup>
<ProjectReference Include="..\SJZY.Track.Domain\SJZY.Track.Domain.csproj" />
<ProjectReference Include="..\SJZY.Track.Shared\SJZY.Track.Shared.csproj" />
</ItemGroup>
</Project>

View File

@ -1,13 +0,0 @@
<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>