From 92f61e1a1bea4a4e3f49dc3a8f4a155a774f2d89 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com>
Date: Sat, 2 Mar 2024 10:00:08 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?=
=?UTF-8?q?=E6=8E=A8=E9=80=81=E9=85=8D=E7=BD=AE=E5=86=85=E5=AE=B9=E6=8E=92?=
=?UTF-8?q?=E5=BA=8F=20=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Dtos/TrackPush/SortTrackPushContentInput.cs | 6 ++++--
.../Services/TrackPush/TrackPushService.cs | 12 +++++++++++-
.../TrackPushAggregate/ITrackPushConfigRepository.cs | 4 ++++
.../Repositories/TrackPushConfigRepository.cs | 10 ++++++++++
4 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackPush/SortTrackPushContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/SortTrackPushContentInput.cs
index 9d68df98..ed095f3e 100644
--- a/src/SJZY.Track.Application.Contract/Dtos/TrackPush/SortTrackPushContentInput.cs
+++ b/src/SJZY.Track.Application.Contract/Dtos/TrackPush/SortTrackPushContentInput.cs
@@ -1,9 +1,11 @@
-namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
+using SJZY.Expand.ABP.Core.PublicMethords;
+
+namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
public class SortTrackPushContentInput
{
///
/// 排序信息
///
- public List> SortInfo { get; set; }
+ public List SortInfo { get; set; }
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs
index cbb9a835..85ef0633 100644
--- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs
+++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushService.cs
@@ -4,7 +4,6 @@ using SJZY.Expand.ABP.Core.Localization;
using SJZY.Expand.ABP.Core.PublicMethords;
using SJZY.Track.Application.Contract.Dtos.TrackPush;
using SJZY.Track.Application.Localization;
-using SJZY.Track.Domain.Aggregates.DemoAggregate;
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
@@ -246,6 +245,17 @@ public class TrackPushService : ApplicationService, ITransientDependency
[HttpPost("SortContent")]
public async Task SortContentAsync([FromBody] SortTrackPushContentInput input)
{
+ List ids = input.SortInfo.Select(x => int.Parse(x.Key)).ToList();
+
+ var trackPushContentEntities = await _trackPushConfigRepository.GetContentListAsync(x => ids.Contains(x.Id));
+
+ trackPushContentEntities.ForEach(item =>
+ {
+ item.Sort = input.SortInfo.Single(x => x.Key == item.Id.ToString()).Value;
+ });
+
+ await _trackPushConfigRepository.UpdateContentRangeAsync(trackPushContentEntities);
+
return true;
}
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs
index 808cc3ac..3d33a4ee 100644
--- a/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs
+++ b/src/SJZY.Track.Domain/Aggregates/TrackPushAggregate/ITrackPushConfigRepository.cs
@@ -22,4 +22,8 @@ public interface ITrackPushConfigRepository : IBasicRepository GetContentByIdAsync(int id);
Task UpdateContentAsync(TrackPushContentConfigEntity updateObj);
+
+ Task> GetContentListAsync(Expression> whereExpression);
+
+ Task UpdateContentRangeAsync(List updateObjs);
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs
index 472a8908..29300b59 100644
--- a/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs
+++ b/src/SJZY.Track.Repository/Repositories/TrackPushConfigRepository.cs
@@ -114,4 +114,14 @@ public class TrackPushConfigRepository : BasicRepository,
{
return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync();
}
+
+ public async Task> GetContentListAsync(Expression> whereExpression)
+ {
+ return await Context.Queryable().Where(whereExpression).ToListAsync();
+ }
+
+ public async Task UpdateContentRangeAsync(List updateObjs)
+ {
+ return await Context.Updateable(updateObjs).ExecuteCommandHasChangeAsync();
+ }
}
\ No newline at end of file
From 6c10a6e21c5bee22f368cadf12cb9090cb495b99 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com>
Date: Sat, 2 Mar 2024 10:07:59 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?=
=?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=86=85=E5=AE=B9=E6=8E=92=E5=BA=8F=20?=
=?UTF-8?q?=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../SortTrackTemplateContentInput.cs | 11 +++++++
.../TrackTemplates/TrackTemplateService.cs | 29 +++++++++++++++++--
.../ITrackTemplateRepository.cs | 2 ++
.../Repositories/TrackTemplateRepository.cs | 5 ++++
4 files changed, 44 insertions(+), 3 deletions(-)
create mode 100644 src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/SortTrackTemplateContentInput.cs
diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/SortTrackTemplateContentInput.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/SortTrackTemplateContentInput.cs
new file mode 100644
index 00000000..0dbd5155
--- /dev/null
+++ b/src/SJZY.Track.Application.Contract/Dtos/TrackTemplates/SortTrackTemplateContentInput.cs
@@ -0,0 +1,11 @@
+using SJZY.Expand.ABP.Core.PublicMethords;
+
+namespace SJZY.Track.Application.Contract.Dtos.TrackTemplates;
+
+public class SortTrackTemplateContentInput
+{
+ ///
+ /// 排序信息
+ ///
+ public List SortInfo { get; set; }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs
index f084dc2c..a250f22b 100644
--- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs
+++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs
@@ -1,6 +1,7 @@
using System.Linq.Expressions;
using Microsoft.Extensions.Localization;
using SJZY.Expand.ABP.Core.Localization;
+using SJZY.Track.Application.Contract.Dtos.TrackPush;
using SJZY.Track.Application.Contract.Dtos.TrackTemplates;
using SJZY.Track.Application.Localization;
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
@@ -34,7 +35,7 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
_stringLocalizer = stringLocalizer;
_trackTemplateRepository = trackTemplateRepository;
_trackPullConfigRepository = trackPullConfigRepository;
- _trackPushConfigRepository=trackPushConfigRepository;
+ _trackPushConfigRepository = trackPushConfigRepository;
}
///
@@ -119,7 +120,7 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
var isExist = await _trackTemplateRepository.GetFirstAsync(a =>
a.Id != input.Id && a.SubSystemId == input.SubSystemId && a.Code == input.Code);
if (isExist != null)
- {
+ {
throw new BusinessException(message: "模板代码已存在于当前选择的子系统下");
}
@@ -140,7 +141,7 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
var isExisistTrackPullConfigs = await _trackPullConfigRepository.GetListAsync(a => a.TrackTemplateId == input.Id);
if (isExisistTrackPullConfigs.Any())
{
- //throw new BusinessException(message: _stringLocalizer["IsExistTrackPullConfig"]);
+ //throw new BusinessException(message: _stringLocalizer["IsExistTrackPullConfig"]);
throw new BusinessException(message: "轨迹拉取配置里已经绑定模版,请检查");
}
//轨迹推送里看看是否被占用
@@ -234,4 +235,26 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
return true;
}
+
+ ///
+ /// 轨迹模板内容排序
+ ///
+ ///
+ ///
+ [HttpPost("SortContent")]
+ public async Task SortContentAsync([FromBody] SortTrackTemplateContentInput input)
+ {
+ List ids = input.SortInfo.Select(x => int.Parse(x.Key)).ToList();
+
+ var trackTemplateContentEntities = await _trackTemplateRepository.GetContentListAsync(x => ids.Contains(x.Id));
+
+ trackTemplateContentEntities.ForEach(item =>
+ {
+ item.Sort = input.SortInfo.Single(x => x.Key == item.Id.ToString()).Value;
+ });
+
+ await _trackTemplateRepository.UpdateContentRangeAsync(trackTemplateContentEntities);
+
+ return true;
+ }
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs
index 13d2ff0a..3654043b 100644
--- a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs
+++ b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs
@@ -35,4 +35,6 @@ public interface ITrackTemplateRepository : IBasicRepository> GetContentListAsync(
Expression> whereExpression);
+
+ Task UpdateContentRangeAsync(List updateObjs);
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs
index af67ce40..21eef31e 100644
--- a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs
+++ b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs
@@ -158,4 +158,9 @@ public class TrackTemplateRepository : BasicRepository, ITr
{
return await Context.Queryable().Where(whereExpression).ToListAsync();
}
+
+ public async Task UpdateContentRangeAsync(List updateObjs)
+ {
+ return await Context.Updateable(updateObjs).ExecuteCommandHasChangeAsync();
+ }
}
\ No newline at end of file