Merge branch 'S01-轨迹中台' into dev

This commit is contained in:
moyongzhen 2024-02-29 19:08:00 +08:00
commit 2825c7f720
20 changed files with 442 additions and 8 deletions

View File

@ -2,6 +2,7 @@
using SJZY.Track.Application.Localization; using SJZY.Track.Application.Localization;
using SJZY.UserCenter.Contracts; using SJZY.UserCenter.Contracts;
using SJZY.UserCenter.SharedModel; using SJZY.UserCenter.SharedModel;
using SJZY.UserCenter.SharedModel.Pub;
using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AutoMapper; using Volo.Abp.AutoMapper;
using Volo.Abp.FluentValidation; using Volo.Abp.FluentValidation;
@ -18,7 +19,8 @@ namespace SJZY.Track.Application
typeof(AbpLocalizationModule), typeof(AbpLocalizationModule),
typeof(AbpVirtualFileSystemModule), typeof(AbpVirtualFileSystemModule),
typeof(AbpHttpClientModule), typeof(AbpHttpClientModule),
typeof(SJZYTrackDomainModule) typeof(SJZYTrackDomainModule),
typeof(SjzyUserCenterHttpApiModule)
)] )]
public class ApplicationModule : AbpModule public class ApplicationModule : AbpModule
{ {
@ -46,6 +48,11 @@ namespace SJZY.Track.Application
.AddBaseTypes(typeof(SjzyBasicLocalization)) .AddBaseTypes(typeof(SjzyBasicLocalization))
.AddVirtualJson("/Localization/Resources"); .AddVirtualJson("/Localization/Resources");
}); });
//授权拦截提示
context.Services.Configure<MvcOptions>(options =>
{
options.Filters.Add(new ApiAsyncAuthorizationFilter());
});
//用户中心 //用户中心
context.Services.AddHttpClientProxies(typeof(SjzyUserCenterHttpApiModule).Assembly, "UserCenter", false); context.Services.AddHttpClientProxies(typeof(SjzyUserCenterHttpApiModule).Assembly, "UserCenter", false);

View File

@ -1,6 +1,8 @@
using AutoMapper; using AutoMapper;
using AutoMapper.Internal.Mappers;
using SJZY.Track.Application.Dtos.ProvideServices; using SJZY.Track.Application.Dtos.ProvideServices;
using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Aggregates.OrderAggregate;
using SJZY.Track.Domain.Dtos.Order;
namespace SJZY.Track.Application.AutoMapper; namespace SJZY.Track.Application.AutoMapper;
@ -15,5 +17,8 @@ public class OrderAutoMapperProfile : Profile
.ForMember(dest => dest.ServiceProviderId, opt => opt.MapFrom(m => m.ServiceProviderId ?? 0)) .ForMember(dest => dest.ServiceProviderId, opt => opt.MapFrom(m => m.ServiceProviderId ?? 0))
.ForMember(dest => dest.TrackTemplateId, opt => opt.MapFrom(m => m.TemplateId)); .ForMember(dest => dest.TrackTemplateId, opt => opt.MapFrom(m => m.TemplateId));
CreateMap<OrderFligthInfo, OrderFlightEntity>(MemberList.None); CreateMap<OrderFligthInfo, OrderFlightEntity>(MemberList.None);
CreateMap<GetPageTrackOrderInput, GetPageTrackOrderInputVO>(MemberList.None);
} }
} }

View File

@ -0,0 +1,18 @@
using AutoMapper;
using SJZY.Track.Application.Dtos.TrackPull;
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
using Volo.Abp.AutoMapper;
namespace SJZY.Track.Application.AutoMapper
{
public class TrackPullAutoMapperProfile : Profile
{
public TrackPullAutoMapperProfile()
{
CreateMap<EditTrackPullConfigInput, TrackPullConfigEntity>(MemberList.None);
CreateMap<EditTrackPullConfigInput, TrackPushPullParamsConfigEntity>(MemberList.None).Ignore(dest => dest.Id)
.ForMember(dest => dest.IsPush, opt => opt.MapFrom(source => false));
CreateMap<UpdateTrackPullContentInput, TrackPullContentConfigEntity>(MemberList.None);
}
}
}

View File

@ -16,7 +16,7 @@ namespace SJZY.Track.Application.Dtos.ProvideServices
/// <summary> /// <summary>
/// 单号 /// 单号
/// </summary> /// </summary>
public List<string> OrderNos { get; set; } public List<string>? OrderNos { get; set; }
/// <summary> /// <summary>
/// 创建时间开始 /// 创建时间开始

View File

@ -0,0 +1,71 @@
namespace SJZY.Track.Application.Dtos.TrackPull;
public class EditTrackPullConfigInput
{
public int? Id { get; set; }
/// <summary>
/// 操作类型
/// </summary>
public OptionTypeNoNull Options { get; set; }
/// <summary>
/// 拉取轨迹订单号
/// </summary>
public string OrderNoName { get; set; }
/// <summary>
/// 返参解析对象
/// </summary>
public int ParseMethod { get; set; }
/// <summary>
/// 定时任务(分钟)
/// </summary>
public int PullInterval { get; set; }
/// <summary>
/// 服务商id
/// </summary>
public int ServiceProviderId { get; set; }
/// <summary>
/// 子系统id
/// </summary>
public int SubSystemId { get; set; }
/// <summary>
/// 拉取轨迹时区
/// </summary>
public string TackTimeZoneName { get; set; }
/// <summary>
/// 拉取轨迹内容代码
/// </summary>
public string TrackContentCodeName { get; set; }
/// <summary>
/// 拉取轨迹内容
/// </summary>
public string TrackContentName { get; set; }
/// <summary>
/// 拉取轨迹发生地
/// </summary>
public string TrackPlaceName { get; set; }
/// <summary>
/// 拉取轨迹状态
/// </summary>
public string TrackStatusName { get; set; }
/// <summary>
/// 轨迹模板id
/// </summary>
public int TrackTemplateId { get; set; }
/// <summary>
/// 拉取轨迹发生时间
/// </summary>
public string TrackTimeName { get; set; }
}

View File

@ -0,0 +1,51 @@
namespace SJZY.Track.Application.Dtos.TrackPull;
public class UpdateTrackPullContentInput
{
public int Id { get; set; }
/// <summary>
/// 服务商轨迹代码参数值
/// </summary>
public string TrackContentCodeValue { get; set; }
/// <summary>
/// 轨迹内容id
/// </summary>
public int TrackContentId { get; set; }
/// <summary>
/// 服务商轨迹内容参数值
/// </summary>
public string TrackContentValue { get; set; }
/// <summary>
/// 轨迹关键词(正向)
/// </summary>
public string TrackKeyword { get; set; }
/// <summary>
/// 轨迹关键词(反向)
/// </summary>
public string TrackKeywordReverse { get; set; }
/// <summary>
/// 轨迹发生地参数值
/// </summary>
public int? TrackPlaceValue { get; set; }
/// <summary>
/// 轨迹拉取配置id
/// </summary>
public int TrackPullConfigId { get; set; }
/// <summary>
/// 服务商轨迹状态参数值
/// </summary>
public string TrackStatusValue { get; set; }
/// <summary>
/// 轨迹时区GMT
/// </summary>
public string TrackTimeZone { get; set; }
}

View File

@ -19,8 +19,6 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="SJZY.Expand.AliyunOSS" Version="7.0.10" /> <PackageReference Include="SJZY.Expand.AliyunOSS" Version="7.0.10" />
<PackageReference Include="SJZY.Expand.Excel" Version="7.0.5" /> <PackageReference Include="SJZY.Expand.Excel" Version="7.0.5" />
<PackageReference Include="SJZY.UserCenter.HttpApi" Version="3.0.3-testbuild" />
<PackageReference Include="SJZY.UserCenter.SharedModel" Version="3.0.3-testbuild" />
<PackageReference Include="Volo.Abp.Http.Client" Version="7.0.2" /> <PackageReference Include="Volo.Abp.Http.Client" Version="7.0.2" />
<PackageReference Include="Volo.Abp.FluentValidation" Version="7.0.2" /> <PackageReference Include="Volo.Abp.FluentValidation" Version="7.0.2" />
</ItemGroup> </ItemGroup>

View File

@ -1,5 +1,6 @@
using SJZY.Track.Application.Dtos.ProvideServices; using SJZY.Track.Application.Dtos.ProvideServices;
using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Aggregates.OrderAggregate;
using SJZY.Track.Domain.Dtos.Order;
namespace SJZY.Track.Application.Services.ProvideServices; namespace SJZY.Track.Application.Services.ProvideServices;
@ -86,7 +87,8 @@ public class OrderService : ApplicationService
[HttpPost("/Order/GetTrackOrderList")] [HttpPost("/Order/GetTrackOrderList")]
public async Task<UnifyPageResultDto<TrackOrderDto>> GetPageTrackOrder(GetPageTrackOrderInput input) public async Task<UnifyPageResultDto<TrackOrderDto>> GetPageTrackOrder(GetPageTrackOrderInput input)
{ {
var vo = ObjectMapper.Map<GetPageTrackOrderInput, GetPageTrackOrderInputVO>(input);
var jj = await _orderRepository.GetPageTrackOrder(vo);
return null; return null;
} }

View File

@ -1,8 +1,14 @@
using Microsoft.Extensions.Localization; using Microsoft.Extensions.Localization;
using SJZY.Expand.ABP.Core.Localization;
using SJZY.Expand.ABP.Core.PublicMethords;
using SJZY.Track.Application.Dtos.TrackPull;
using SJZY.Track.Application.Dtos.TrackTemplates;
using SJZY.Track.Application.Localization; using SJZY.Track.Application.Localization;
using SJZY.Track.Domain.Aggregates.TrackPullAggregate; using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
using SJZY.Track.Domain.Dtos.Common; using SJZY.Track.Domain.Dtos.Common;
using SJZY.Track.Domain.Dtos.TrackPull; using SJZY.Track.Domain.Dtos.TrackPull;
using System.Linq.Expressions;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
namespace SJZY.Track.Application.Services.TrackPull; namespace SJZY.Track.Application.Services.TrackPull;
@ -16,13 +22,16 @@ public class TrackPullService : ApplicationService, ITransientDependency
{ {
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer; private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
private readonly ITrackPullConfigRepository _trackPullConfigRepository; private readonly ITrackPullConfigRepository _trackPullConfigRepository;
private readonly ITrackTemplateRepository _trackTemplateRepository;
public TrackPullService( public TrackPullService(
IStringLocalizer<TrackLocalizationResource> stringLocalizer, IStringLocalizer<TrackLocalizationResource> stringLocalizer,
ITrackPullConfigRepository trackPullConfigRepository) ITrackPullConfigRepository trackPullConfigRepository,
ITrackTemplateRepository trackTemplateRepository)
{ {
_stringLocalizer = stringLocalizer; _stringLocalizer = stringLocalizer;
_trackPullConfigRepository = trackPullConfigRepository; _trackPullConfigRepository = trackPullConfigRepository;
_trackTemplateRepository = trackTemplateRepository;
} }
/// <summary> /// <summary>
@ -68,4 +77,132 @@ public class TrackPullService : ApplicationService, ITransientDependency
{ {
return await _trackPullConfigRepository.GetContentDetailAsync(id); return await _trackPullConfigRepository.GetContentDetailAsync(id);
} }
/// <summary>
/// 轨迹拉取配置编辑
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("Edit")]
public async Task<bool> EditAsync([FromBody] EditTrackPullConfigInput input)
{
if (input.Options != OptionTypeNoNull.删除)
{
Expression<Func<TrackPullConfigEntity, bool>> isAnyExp = x =>
x.SubSystemId == input.SubSystemId && x.TrackTemplateId == input.TrackTemplateId && x.ServiceProviderId == input.ServiceProviderId;
if (input.Options == OptionTypeNoNull.修改) isAnyExp.And(x => x.Id != input.Id);
if (await _trackPullConfigRepository.IsAnyAsync(isAnyExp))
throw new BusinessException(message: _stringLocalizer["IsTrackPullConfigAny"]);
}
switch (input.Options)
{
case OptionTypeNoNull.新增:
{
var trackPullEntity = ObjectMapper.Map<EditTrackPullConfigInput, TrackPullConfigEntity>(input);
var trackPullParamsEntity = ObjectMapper.Map<EditTrackPullConfigInput, TrackPushPullParamsConfigEntity>(input);
var trackTemplateContentEntities = await _trackTemplateRepository.GetContentListAsync(x => x.TrackTemplateId == input.TrackTemplateId);
var trackPullContentEntities = new List<TrackPullContentConfigEntity>();
using (var ts = TransactionScopeHelper.Create())
{
int id = await _trackPullConfigRepository.InsertReturnIdentityAsync(trackPullEntity);
trackPullParamsEntity.PullOrPushConfigId = id;
await _trackPullConfigRepository.InsertParamsAsync(trackPullParamsEntity);
foreach (var item in trackTemplateContentEntities)
{
trackPullContentEntities.Add(new()
{
TrackPullConfigId = id,
TrackContentId = item.TrackContentId
});
}
await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities);
ts.Complete();
}
}
break;
case OptionTypeNoNull.修改:
{
var oldTrackPullEntity = await _trackPullConfigRepository.GetFirstAsync(x => x.Id == input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]);
var oldTrackPullParamsEntity = await _trackPullConfigRepository.GetParamsSingleAsync(x => x.PullOrPushConfigId == input.Id && !x.IsPush);
var trackPullContentEntities = new List<TrackPullContentConfigEntity>();
if (oldTrackPullEntity.TrackTemplateId != input.TrackTemplateId)
{
var trackTemplateContentEntities = await _trackTemplateRepository.GetContentListAsync(x => x.TrackTemplateId == input.TrackTemplateId);
foreach (var item in trackTemplateContentEntities)
{
trackPullContentEntities.Add(new()
{
TrackPullConfigId = oldTrackPullEntity.Id,
TrackContentId = item.TrackContentId
});
}
}
ObjectMapper.Map(input, oldTrackPullEntity);
ObjectMapper.Map(input, oldTrackPullParamsEntity);
using (var ts = TransactionScopeHelper.Create())
{
await _trackPullConfigRepository.UpdateAsync(oldTrackPullEntity);
await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPullParamsEntity);
if (oldTrackPullEntity.TrackTemplateId != input.TrackTemplateId)
{
await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id);
await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities);
}
ts.Complete();
}
}
break;
case OptionTypeNoNull.删除:
using (var ts = TransactionScopeHelper.Create())
{
await _trackPullConfigRepository.SoftDeleteAsync(x => x.Id == input.Id);
await _trackPullConfigRepository.SoftDeleteParamsAsync(x => x.PullOrPushConfigId == input.Id && !x.IsPush);
await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id);
ts.Complete();
}
break;
default:
throw new BusinessException(message: _stringLocalizer[SjzyBasicLocalization.Validation_IsInEnum,
nameof(EditTrackPullConfigInput.Options)]);
}
return true;
}
/// <summary>
/// 轨迹拉取配置内容修改
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("UpdateContent")]
public async Task<bool> UpdateContentAsync([FromBody] UpdateTrackPullContentInput input)
{
var oldTrackPullContentEntity = await _trackPullConfigRepository.GetContentByIdAsync(input.Id) ?? throw new BusinessException(message: _stringLocalizer["NotFindData"]);
ObjectMapper.Map(input, oldTrackPullContentEntity);
await _trackPullConfigRepository.UpdateContentAsync(oldTrackPullContentEntity);
return true;
}
} }

View File

@ -1,4 +1,5 @@
using Microsoft.Extensions.Localization; using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Localization;
using SJZY.Track.Application.Dtos.TrackStatus; using SJZY.Track.Application.Dtos.TrackStatus;
using SJZY.Track.Application.Localization; using SJZY.Track.Application.Localization;
using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;

View File

@ -1,4 +1,5 @@
using System.Linq.Expressions; using System.Linq.Expressions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Localization; using Microsoft.Extensions.Localization;
using SJZY.Expand.ABP.Core.Localization; using SJZY.Expand.ABP.Core.Localization;
using SJZY.Track.Application.Dtos.TrackTemplates; using SJZY.Track.Application.Dtos.TrackTemplates;

View File

@ -32,4 +32,20 @@ public interface ITrackPullConfigRepository : IBasicRepository<TrackPullConfigEn
/// <param name="id"></param> /// <param name="id"></param>
/// <returns></returns> /// <returns></returns>
Task<GetTrackPullContentDetailOutputVO> GetContentDetailAsync(int id); Task<GetTrackPullContentDetailOutputVO> GetContentDetailAsync(int id);
Task<bool> InsertParamsAsync(TrackPushPullParamsConfigEntity insertObj);
Task<bool> InsertContentRangeAsync(List<TrackPullContentConfigEntity> insertObjs);
Task<TrackPushPullParamsConfigEntity> GetParamsSingleAsync(Expression<Func<TrackPushPullParamsConfigEntity, bool>> whereExpression);
Task<bool> UpdateParamsAsync(TrackPushPullParamsConfigEntity updateObj);
Task<bool> SoftDeleteContentAsync(Expression<Func<TrackPullContentConfigEntity, bool>> whereExpression);
Task<bool> SoftDeleteParamsAsync(Expression<Func<TrackPushPullParamsConfigEntity, bool>> whereExpression);
Task<TrackPullContentConfigEntity> GetContentByIdAsync(int id);
Task<bool> UpdateContentAsync(TrackPullContentConfigEntity updateObj);
} }

View File

@ -34,4 +34,6 @@ public interface ITrackTemplateRepository : IBasicRepository<TrackTemplateEntity
Task<bool> UpdateContentAsync(TrackTemplateContentEntity updateObj); Task<bool> UpdateContentAsync(TrackTemplateContentEntity updateObj);
Task<bool> SoftDeleteContentAsync(int id); Task<bool> SoftDeleteContentAsync(int id);
Task<List<TrackTemplateContentEntity>> GetContentListAsync(Expression<Func<TrackTemplateContentEntity, bool>> whereExpression);
} }

View File

@ -6,9 +6,27 @@ using System.Threading.Tasks;
namespace SJZY.Track.Domain.Dtos.Order namespace SJZY.Track.Domain.Dtos.Order
{ {
public class GetPageTrackOrderInputVO public class GetPageTrackOrderInputVO : PageInfoInput
{ {
/// <summary>
/// 子系统id
/// </summary>
public int SubSystemId { get; set; }
/// <summary>
/// 单号
/// </summary>
public List<string> OrderNos { get; set; }
/// <summary>
/// 创建时间开始
/// </summary>
public DateTime? CreateTimeStart { get; set; }
/// <summary>
/// 创建时间截止
/// </summary>
public DateTime? createTimeEnd { get; set; }
} }
/// <summary> /// <summary>
@ -16,6 +34,22 @@ namespace SJZY.Track.Domain.Dtos.Order
/// </summary> /// </summary>
public class TrackOrderVO public class TrackOrderVO
{ {
/// <summary>
/// 轨迹订单id
/// </summary>
public int Id { get; set; }
/// <summary>
/// 订单类型
/// </summary>
public string OrderType { get; set; }
public string OrderNumber { get; set; }
/// <summary>
/// 轨迹模版
/// </summary>
public string TrackTemplateNames { get; set; }
} }
} }

View File

@ -9,6 +9,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="SJZY.Expand.ABP.Core" Version="7.7.1" /> <PackageReference Include="SJZY.Expand.ABP.Core" Version="7.7.1" />
<PackageReference Include="SJZY.Expand.ElasticSearch" Version="7.0.17" /> <PackageReference Include="SJZY.Expand.ElasticSearch" Version="7.0.17" />
<PackageReference Include="SJZY.UserCenter.HttpApi" Version="3.0.3-alpha8" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,4 +1,6 @@
#pragma warning disable 1591 #pragma warning disable 1591
using SJZY.UserCenter.HttpApi.Services;
namespace SJZY.Track.Repository namespace SJZY.Track.Repository
{ {
/// <summary> /// <summary>
@ -22,6 +24,17 @@ namespace SJZY.Track.Repository
entityInfo.SetValue(DateTime.Now); entityInfo.SetValue(DateTime.Now);
if (entityInfo.PropertyName == nameof(ICreateBaicEntity.CreateUserId)) if (entityInfo.PropertyName == nameof(ICreateBaicEntity.CreateUserId))
{ {
if (oldValue == null || (int)oldValue == 0)
{
try
{
entityInfo.SetValue(CurrentUserRequest.CurrentUser?.UserId);
}
catch
{
}
}
//entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId); //entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId);
} }
} }
@ -32,6 +45,17 @@ namespace SJZY.Track.Repository
entityInfo.SetValue(DateTime.Now); entityInfo.SetValue(DateTime.Now);
else if (entityInfo.PropertyName == nameof(IUpdateBasicEntity.UpdateUserId)) else if (entityInfo.PropertyName == nameof(IUpdateBasicEntity.UpdateUserId))
{ {
if (oldValue == null || (int)oldValue == 1)
{
try
{
entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId);
}
catch
{
}
}
//entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId); //entityInfo.SetValue(CurrentUserRequest.CurrentUser.UserId);
} }
//删除 //删除

View File

@ -81,6 +81,16 @@ public class OrderRepository : BasicRepository<OrderEntity>, IOrderRepository, I
public async Task<UnifyPageResultDto<TrackOrderVO>> GetPageTrackOrder(GetPageTrackOrderInputVO input) public async Task<UnifyPageResultDto<TrackOrderVO>> GetPageTrackOrder(GetPageTrackOrderInputVO input)
{ {
//await Context.Queryable<OrderEntity, OrderTemplateEntity>((a,b)= ); //await Context.Queryable<OrderEntity, OrderTemplateEntity>((a,b)= );
await Context.Queryable<OrderEntity, OrderTemplateEntity>((a, b) => new JoinQueryInfos(JoinType.Left, a.Id==b.OrderId))
.GroupBy((a, b) => new { a.Id })
.Select((a, b) => new TrackOrderVO
{
Id=a.Id,
OrderNumber=a.OrderNo,
}).ToPageListAsync(input.PageIndex, input.PageSize);
return null; return null;
} }

View File

@ -43,6 +43,10 @@ public class SJZYTrackRepositoryModule : AbpModule
}); });
} }
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)
{ {
context.Services.AddTransient(typeof(IBasicQuery<>), typeof(BasicQuery<>)); context.Services.AddTransient(typeof(IBasicQuery<>), typeof(BasicQuery<>));

View File

@ -4,6 +4,7 @@ using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
using SJZY.Track.Domain.Dtos.Common; using SJZY.Track.Domain.Dtos.Common;
using SJZY.Track.Domain.Dtos.TrackPull; using SJZY.Track.Domain.Dtos.TrackPull;
using SJZY.Track.Domain.VEntities; using SJZY.Track.Domain.VEntities;
using System.Linq.Expressions;
namespace SJZY.Track.Repository; namespace SJZY.Track.Repository;
@ -83,4 +84,50 @@ public class TrackPullConfigRepository : BasicRepository<TrackPullConfigEntity>,
}, true) }, true)
.SingleAsync(); .SingleAsync();
} }
public async Task<bool> InsertParamsAsync(TrackPushPullParamsConfigEntity insertObj)
{
return await Context.Insertable(insertObj).ExecuteCommandAsync() > 0;
}
public async Task<bool> InsertContentRangeAsync(List<TrackPullContentConfigEntity> insertObjs)
{
return await Context.Insertable(insertObjs).ExecuteCommandAsync() > 0;
}
public async Task<TrackPushPullParamsConfigEntity> GetParamsSingleAsync(Expression<Func<TrackPushPullParamsConfigEntity, bool>> whereExpression)
{
return await Context.Queryable<TrackPushPullParamsConfigEntity>().SingleAsync(whereExpression);
}
public async Task<bool> UpdateParamsAsync(TrackPushPullParamsConfigEntity updateObj)
{
return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync();
}
public async Task<bool> SoftDeleteContentAsync(Expression<Func<TrackPullContentConfigEntity, bool>> whereExpression)
{
return await Context.Updateable<TrackPullContentConfigEntity>()
.Where(whereExpression)
.SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), true)
.ExecuteCommandHasChangeAsync();
}
public async Task<bool> SoftDeleteParamsAsync(Expression<Func<TrackPushPullParamsConfigEntity, bool>> whereExpression)
{
return await Context.Updateable<TrackPushPullParamsConfigEntity>()
.Where(whereExpression)
.SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), true)
.ExecuteCommandHasChangeAsync();
}
public async Task<TrackPullContentConfigEntity> GetContentByIdAsync(int id)
{
return await Context.Queryable<TrackPullContentConfigEntity>().InSingleAsync(id);
}
public async Task<bool> UpdateContentAsync(TrackPullContentConfigEntity updateObj)
{
return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync();
}
} }

View File

@ -167,4 +167,9 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
.SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), true) .SetColumns(nameof(ISoftDeleteBasicEntity.IsDeleted), true)
.ExecuteCommandHasChangeAsync(); .ExecuteCommandHasChangeAsync();
} }
public async Task<List<TrackTemplateContentEntity>> GetContentListAsync(Expression<Func<TrackTemplateContentEntity, bool>> whereExpression)
{
return await Context.Queryable<TrackTemplateContentEntity>().Where(whereExpression).ToListAsync();
}
} }