Merge remote-tracking branch 'origin/S01-轨迹中台' into S01-轨迹中台

This commit is contained in:
李鹏军 2024-03-04 18:48:59 +08:00
commit e055bedaf1
13 changed files with 102 additions and 18 deletions

View File

@ -7,8 +7,8 @@
} }
}, },
"ConnectionStrings": { "ConnectionStrings": {
"DefaultConnection": "server=192.168.80.84;Database=sjzy_package_setting;Uid=sjzy_test_user;Pwd=848c1c31;AllowLoadLocalInfile=true;SslMode=None;Charset=utf8mb4;", "DefaultConnection": "server=mysql-test.default.svc.cluster.local;Database=sjzy_track;Uid=sjzy_test_user;Pwd=848c1c31;AllowLoadLocalInfile=true;SslMode=None;Charset=utf8mb4;",
"canalView": "server=192.168.80.84;Database=sjzy_data_center;Uid=sjzy_test_user;Pwd=848c1c31;AllowLoadLocalInfile=true;SslMode=None;Charset=utf8mb4;" "canalView": "server=mysql-test.default.svc.cluster.local;Database=sjzy_track;Uid=sjzy_test_user;Pwd=848c1c31;AllowLoadLocalInfile=true;SslMode=None;Charset=utf8mb4;"
}, },
"Redis": { "Redis": {
"ConnectionString": "192.168.80.58:6379,abortConnect=false", "ConnectionString": "192.168.80.58:6379,abortConnect=false",

View File

@ -5,7 +5,7 @@
"Apollo": { "Apollo": {
"AppId": "SJZY.Track.Configuration", "AppId": "SJZY.Track.Configuration",
"Env": "DEV", "Env": "DEV",
"Namespace": "Dev", "Namespace": "Test",
"MetaServer": "http://apollo-service-test-apollo-configservice.apollo.svc.cluster.local:8080", "MetaServer": "http://apollo-service-test-apollo-configservice.apollo.svc.cluster.local:8080",
"ConfigServer": [ "http://apollo-service-test-apollo-configservice.apollo.svc.cluster.local:8080" ] "ConfigServer": [ "http://apollo-service-test-apollo-configservice.apollo.svc.cluster.local:8080" ]
} }

View File

@ -56,6 +56,11 @@
/// </summary> /// </summary>
public string SubSystem { set; get; } public string SubSystem { set; get; }
/// <summary>
/// 子系统id
/// </summary>
public int SubSystemId { set; get; }
/// <summary> /// <summary>
/// 创建时间 /// 创建时间
/// </summary> /// </summary>

View File

@ -94,7 +94,6 @@ public class OrderService : ApplicationService
#endregion #endregion
#region 轨迹订单列表 #region 轨迹订单列表
/// <summary> /// <summary>
/// 获取分页的轨迹订单 /// 获取分页的轨迹订单
/// </summary> /// </summary>
@ -109,7 +108,6 @@ public class OrderService : ApplicationService
ObjectMapper.Map<UnifyPageResultDto<TrackOrderVO>, UnifyPageResultDto<TrackOrderDto>>(pageList); ObjectMapper.Map<UnifyPageResultDto<TrackOrderVO>, UnifyPageResultDto<TrackOrderDto>>(pageList);
return pageResultDto; return pageResultDto;
} }
#endregion #endregion
private async Task UpdateOrderAsync(UpdateOrderInput input, OrderEntity order) private async Task UpdateOrderAsync(UpdateOrderInput input, OrderEntity order)

View File

@ -1,5 +1,7 @@
using SJZY.Track.Application.Contract.Dtos.ProvideServices; using SJZY.Track.Application.Contract.Dtos.ProvideServices;
using SJZY.Track.Domain.Aggregates.OrderAggregate;
using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate;
using SJZY.Track.Domain.Dtos.Order;
using SJZY.Track.Domain.Queries; using SJZY.Track.Domain.Queries;
namespace SJZY.Track.Application.Services.ProvideServices; namespace SJZY.Track.Application.Services.ProvideServices;
@ -11,12 +13,15 @@ namespace SJZY.Track.Application.Services.ProvideServices;
public class TrackQueryService : ApplicationService public class TrackQueryService : ApplicationService
{ {
private readonly ITrackDetailsRepository _trackDetailsRepository; private readonly ITrackDetailsRepository _trackDetailsRepository;
private readonly IOrderRepository _orderRepository;
private readonly IProvideQueries _provideQueries; private readonly IProvideQueries _provideQueries;
public TrackQueryService(ITrackDetailsRepository trackDetailsRepository, public TrackQueryService(ITrackDetailsRepository trackDetailsRepository,
IOrderRepository orderRepository,
IProvideQueries provideQueries) IProvideQueries provideQueries)
{ {
_trackDetailsRepository = trackDetailsRepository; _trackDetailsRepository = trackDetailsRepository;
_orderRepository=orderRepository;
_provideQueries = provideQueries; _provideQueries = provideQueries;
} }
@ -63,6 +68,43 @@ public class TrackQueryService : ApplicationService
return res; return res;
} }
#region 轨迹订单明细列表
/// <summary>
/// 根据轨迹订单id获取轨迹订单明细列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/Track/GetDetails")]
public async Task<List<TrackOrderDetailDto>> GetOrderDetails(GetOrderDetailsInput input)
{
var trackDetails = await _trackDetailsRepository.GetListAsync(input.OrderId);
if (!trackDetails.IsNullOrEmpty())
{
var list = ObjectMapper.Map<List<TrackDetailsIndex>, List<TrackOrderDetailDto>>(trackDetails);
return list;
}
return new List<TrackOrderDetailDto>();
}
#endregion
#region 轨迹订单分页
/// <summary>
/// 获取分页的轨迹订单
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/Track/GetTrackOrderList")]
public async Task<UnifyPageResultDto<TrackOrderDto>> GetPageTrackOrder(GetPageTrackOrderInput input)
{
var vo = ObjectMapper.Map<GetPageTrackOrderInput, GetPageTrackOrderInputVO>(input);
var pageList = await _orderRepository.GetPageTrackOrder(vo);
var pageResultDto =
ObjectMapper.Map<UnifyPageResultDto<TrackOrderVO>, UnifyPageResultDto<TrackOrderDto>>(pageList);
return pageResultDto;
}
#endregion
private async Task TrackDetailSort(List<GetTrackOutput> list, GetTrackInput input) private async Task TrackDetailSort(List<GetTrackOutput> list, GetTrackInput input)
{ {
switch (input.SortMethod) switch (input.SortMethod)

View File

@ -193,21 +193,24 @@ namespace SJZY.Track.Application.Services.TrackContents
private async Task<UnifyResultDto> DeleteAsync(EditTrackContentInput input) private async Task<UnifyResultDto> DeleteAsync(EditTrackContentInput input)
{ {
#region 业务校验 #region 业务校验
//查询是否关联了轨迹模版内容 //查询是否关联了轨迹模版内容
var trackTemplateContents = await _trackTemplateContentBasicQuery.GetListAsync(a => a.TrackContentId == input.Id); var isExistTemplate = await _trackContentRepository.GetTemplateIsExist(input.Id);
if (trackTemplateContents.Any()) if (isExistTemplate)
{ {
throw new BusinessException(message: "该轨迹内容关联轨迹模板,禁止删除"); throw new BusinessException(message: "该轨迹内容关联轨迹模板,禁止删除");
} }
//var trackTemplateContents = await _trackTemplateContentBasicQuery.GetListAsync(a => a.TrackContentId == input.Id);
//if (trackTemplateContents.Any())
//{
// throw new BusinessException(message: "该轨迹内容关联轨迹模板,禁止删除");
//}
//需要加个判断,存在内容映射,则出提示 //需要加个判断,存在内容映射,则出提示
var trackContentMapEntities = await _trackContentMapBasicQuery.GetListAsync(a => a.TrackContentId == input.Id || a.MapTrackContentId == input.Id); //var trackContentMapEntities = await _trackContentMapBasicQuery.GetListAsync(a => a.TrackContentId == input.Id || a.MapTrackContentId == input.Id);
if (trackContentMapEntities.Any()) //if (trackContentMapEntities.Any())
{ //{
throw new BusinessException(message: "无法删除该内容,该轨迹内容已在轨迹内容映射中使用了,请检查"); // throw new BusinessException(message: "无法删除该内容,该轨迹内容已在轨迹内容映射中使用了,请检查");
} //}
#endregion 业务校验 #endregion 业务校验
var isTrue = await _trackContentRepository.SoftDeleteAsync(x => x.Id == input.Id); var isTrue = await _trackContentRepository.SoftDeleteAsync(x => x.Id == input.Id);

View File

@ -163,7 +163,7 @@ public class TrackStatusService : ApplicationService, ITransientDependency
if (isExistStatus!=null) if (isExistStatus!=null)
{ {
//throw new BusinessException(message: _stringLocalizer["IsExistTrackStatus"]); //throw new BusinessException(message: _stringLocalizer["IsExistTrackStatus"]);
throw new BusinessException(message: "轨迹内容已经绑定了该轨迹状态,请先删除轨迹内容后再删除该轨迹状态"); throw new BusinessException(message: "该状态关联轨迹内容,禁止删除");
} }
#endregion #endregion
var isTrue = await _trackStatusRepository.SoftDeleteAsync(x => x.Id == input.Id); var isTrue = await _trackStatusRepository.SoftDeleteAsync(x => x.Id == input.Id);

View File

@ -163,13 +163,13 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
if (isExisistTrackPullConfigs.Any()) if (isExisistTrackPullConfigs.Any())
{ {
//throw new BusinessException(message: _stringLocalizer["IsExistTrackPullConfig"]); //throw new BusinessException(message: _stringLocalizer["IsExistTrackPullConfig"]);
throw new BusinessException(message: "轨迹拉取配置里已经绑定模版,请检查"); throw new BusinessException(message: "该模板存在映射,禁止删除");
} }
//轨迹推送里看看是否被占用 //轨迹推送里看看是否被占用
var isExisistTrackPushConfigs = await _trackPushConfigRepository.GetListAsync(a => a.TrackTemplateId.Contains(input.Id.ToString())); var isExisistTrackPushConfigs = await _trackPushConfigRepository.GetListAsync(a => a.TrackTemplateId.Contains(input.Id.ToString()));
if (isExisistTrackPushConfigs.Any()) if (isExisistTrackPushConfigs.Any())
{ {
throw new BusinessException(message: "轨迹推送配置里已经绑定模版,请检查"); throw new BusinessException(message: "该模板存在映射,禁止删除");
} }
#endregion 业务校验 #endregion 业务校验

View File

@ -48,11 +48,13 @@ namespace SJZY.Track.Application
}); });
//添加多语言 //添加多语言
var languageConfig = configuration.GetSection("Language");
Configure<AbpLocalizationOptions>(options => Configure<AbpLocalizationOptions>(options =>
{ {
options.Resources options.Resources
.Add<TrackLocalizationResource>("zh") .Add<TrackLocalizationResource>("zh")
.AddBaseTypes(typeof(SjzyBasicLocalization)) .AddBaseTypes(typeof(SjzyBasicLocalization))
.AddRedisResource(languageConfig)
.AddVirtualJson("/Localization/Resources"); .AddVirtualJson("/Localization/Resources");
}); });
//授权拦截提示 //授权拦截提示

View File

@ -23,4 +23,5 @@ public interface ITrackContentRepository : IBasicRepository<TrackContentEntity>
Task<bool> SoftDeleteMapAsync(Expression<Func<TrackContentMapEntity, bool>> whereExpression); Task<bool> SoftDeleteMapAsync(Expression<Func<TrackContentMapEntity, bool>> whereExpression);
Task<bool> UpdateMapAsync(Expression<Func<TrackContentMapEntity, TrackContentMapEntity>> columns, Expression<Func<TrackContentMapEntity, bool>> whereExpression); Task<bool> UpdateMapAsync(Expression<Func<TrackContentMapEntity, TrackContentMapEntity>> columns, Expression<Func<TrackContentMapEntity, bool>> whereExpression);
Task<bool> GetTemplateIsExist(int trackContentId);
} }

View File

@ -56,6 +56,11 @@ public class GetTrackTemplateListVO
/// </summary> /// </summary>
public string SubSystem { set; get; } public string SubSystem { set; get; }
/// <summary>
/// 子系统id
/// </summary>
public int SubSystemId { set; get; }
/// <summary> /// <summary>
/// 创建时间 /// 创建时间
/// </summary> /// </summary>

View File

@ -1,6 +1,7 @@
using SJZY.Track.Domain.Aggregates.TrackContentAggregate; using SJZY.Track.Domain.Aggregates.TrackContentAggregate;
using SJZY.Track.Domain.Aggregates.TrackFlagAggregate; using SJZY.Track.Domain.Aggregates.TrackFlagAggregate;
using SJZY.Track.Domain.Aggregates.TrackStatusAggregate; using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
using SJZY.Track.Domain.Dtos.TrackContents; using SJZY.Track.Domain.Dtos.TrackContents;
using SJZY.Track.Domain.VEntities; using SJZY.Track.Domain.VEntities;
using System.Linq; using System.Linq;
@ -88,6 +89,32 @@ public class TrackContentRepository : BasicRepository<TrackContentEntity>, ITrac
return pagedList; return pagedList;
} }
/// <summary>
/// 获取轨迹模版是否存在
/// </summary>
/// <param name="trackContentId"></param>
/// <returns></returns>
public async Task<bool> GetTemplateIsExist(int trackContentId)
{
//var trackTemplateContents = await _trackTemplateContentBasicQuery.GetListAsync(a => a.TrackContentId == input.Id);
var trackContentEntities = await Context.Queryable<TrackContentEntity>().LeftJoin<TrackTemplateContentEntity>((a, b) => a.Id==b.TrackContentId && b.IsDeleted==false)
.LeftJoin<TrackTemplateEntity>((a, b, c) => b.TrackTemplateId==c.Id&& c.IsDeleted==false)
.Where((a, b, c) => a.Id==trackContentId)
.Select((a, b, c) => new
{
TrackContentId = a.Id,
TemplateId = c.Id
})
.ToListAsync();
if (trackContentEntities.Any(a => a.TemplateId>0))
{
return true;
}
return false;
}
public async Task<UnifyPageResultDto<GetTrackContentMapPageOutputVO>> GetMapPageAsync(GetTrackContentMapPageInputVO input) public async Task<UnifyPageResultDto<GetTrackContentMapPageOutputVO>> GetMapPageAsync(GetTrackContentMapPageInputVO input)
{ {
return await Context.Queryable<TrackContentMapEntity>() return await Context.Queryable<TrackContentMapEntity>()

View File

@ -55,7 +55,8 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
Code = a.Code, Code = a.Code,
CreateTime = a.CreateTime, CreateTime = a.CreateTime,
Name = a.Name, Name = a.Name,
SubSystem = b.CnName SubSystem = b.CnName,
SubSystemId = b.Id
}) })
.ToPagedListAsync(input.PageIndex, input.PageSize); .ToPagedListAsync(input.PageIndex, input.PageSize);
//.OrderByIF(input.TrackTemplateId > 0, //.OrderByIF(input.TrackTemplateId > 0,