添加oss

This commit is contained in:
eli 2024-11-14 16:11:27 +08:00
parent 69ca5f9bd7
commit 0f11a3b68b
5 changed files with 34 additions and 7 deletions

View File

@ -8,8 +8,12 @@ public class GetDetailTimelineInput
public string OrderNumber { get; set; }
/// <summary>
/// 子系统id
/// 订单所属子系统id
/// </summary>
public int SystemId{ get; set; }
public int SystemId { get; set; }
/// <summary>
/// 当前用户登陆子系统id
/// </summary>
public int CurrenUserSystemId { get; set; }
}

View File

@ -40,7 +40,7 @@ public class GetDetailTimelineOutput
/// <summary>
/// 文件 osskey 集合
/// </summary>
public List<FileItem> Files { get; set; }
public List<TrackFileItem> Files { get; set; }
/// <summary>
/// 是否高亮
@ -73,7 +73,7 @@ public class GetDetailTimelineOutput
public string? TrackPlaceNation { get; set; }
}
public class FileItem
public class TrackFileItem
{
/// <summary>
/// 文件osskey

View File

@ -10,6 +10,7 @@
<ItemGroup>
<PackageReference Include="BSI.Stack.Rabbit" Version="2.0.9" />
<PackageReference Include="Savorboard.CAP.InMemoryMessageQueue" Version="8.2.1"/>
<PackageReference Include="SJZY.Expand.AliyunOSS" Version="7.0.17" />
<PackageReference Include="SJZY.InterfaceRelay.Application.Contracts" Version="7.2.3"/>
<PackageReference Include="Volo.Abp.Http.Client" Version="7.0.2" />
<PackageReference Include="Volo.Abp.FluentValidation" Version="7.0.2" />

View File

@ -1,3 +1,4 @@
using SJZY.Expand.AliyunOSS;
using SJZY.Track.Application.Contract.Dtos.ProvideServices;
using SJZY.Track.Application.Contract.Dtos.TrackOrder;
using SJZY.Track.Domain.Aggregates.OrderAggregate;
@ -186,7 +187,10 @@ public class TrackOrderService : ApplicationService
if (input.SystemId <= 0)
return new UnifyResultDto<List<GetDetailTimelineOutput>>(false, "子系统id不合法");
var system = await _orderRepository.GetSystemInfoById(input.SystemId);
if (input.CurrenUserSystemId <= 0)
return new UnifyResultDto<List<GetDetailTimelineOutput>>(false, "当前登陆用户子系统id不合法");
var system = await _orderRepository.GetSystemInfoById(input.CurrenUserSystemId);
if (system == null)
return new UnifyResultDto<List<GetDetailTimelineOutput>>(false, "未找到制定id的子系统");
@ -211,11 +215,18 @@ public class TrackOrderService : ApplicationService
IsHighlight = true,
IsShowHover = true,
Remark = item.Remarks == null || item.Remarks == "--" ? "" : item.Remarks,
TrackTimeZone = $"GMT {(item.TrackTimeZone >= 0 ? "+" : "-")}{GetTimeZoneStr(item.TrackTimeZone)}",
TrackTimeZone = $"GMT{(item.TrackTimeZone >= 0 ? "+" : "-")}{GetTimeZoneStr(item.TrackTimeZone)}",
TrackTime = ToUnixTimestamp(item.TrackTime),
TrackPlace = item.TrackPlace,
EnContent = item.TrackEnContent,
//Files = string.IsNullOrEmpty(item.Files) || item.Files == "--" ? new List<string>() : item.Files.Split(",").ToList(),
Files = item.Files?.Any() == true
? new List<TrackFileItem>()
: item.Files!.Select(m => new TrackFileItem()
{
OssKey = m.OssKey,
FileName = m.FileName,
Url = m.OssKey.GetUrlByKey(),
}).ToList(),
Content = item.TrackContent,
TrackCode = item.TrackCode,
TrackPlaceNation = item.TrackPlaceNation,

View File

@ -6,6 +6,7 @@ using RabbitMQ.Client;
using SJZY.Expand.ABP.Core.Localization;
using SJZY.Expand.ABP.Core.Logger;
using SJZY.Expand.ABP.Core.PublicMethords;
using SJZY.Expand.AliyunOSS;
using SJZY.InterfaceRelay.Application.Contracts;
using SJZY.Track.Application.CAP;
using SJZY.Track.Application.Contract;
@ -148,6 +149,16 @@ public class SjzyTrackApplicationModule : AbpModule
context.Services.Configure<TrackAppOptions>(configuration.GetSection("TrackApp"));
context.Services.Configure<InterfaceRelayParamsConfigOptions>(
configuration.GetSection("InterfaceRelayParamsConfig"));
//注册阿里云OSS服务
context.Services.AddAliOSS(option =>
{
option.AccessKeyId = configuration["OSS:AccessKeyId"];
option.AccessKeySecret = configuration["OSS:AccessKeySecret"];
option.Endpoint = configuration["OSS:Endpoint"];
option.BucketName = configuration["OSS:BucketName"];
option.ReturnHttpsUrl = true;
});
}
public override void PreConfigureServices(ServiceConfigurationContext context)