From 1f9d29e005b5ce001d0dfec7bfdbb704d2ad9fde Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Mon, 24 Jun 2024 10:13:03 +0800
Subject: [PATCH] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8E=86=E5=8F=B2=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD=E5=A2=9E=E5=8A=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Service/Common/DTO/PublishLogViewModel.cs | 19 ++++++++-
.../Service/Common/PublishLogService.cs | 29 ++++++++++++--
.../Service/Common/_MapConfig.cs | 3 ++
IRaCIS.Core.Domain/Common/PublishLog.cs | 40 ++++++++-----------
4 files changed, 62 insertions(+), 29 deletions(-)
diff --git a/IRaCIS.Core.Application/Service/Common/DTO/PublishLogViewModel.cs b/IRaCIS.Core.Application/Service/Common/DTO/PublishLogViewModel.cs
index b76607051..5cd098251 100644
--- a/IRaCIS.Core.Application/Service/Common/DTO/PublishLogViewModel.cs
+++ b/IRaCIS.Core.Application/Service/Common/DTO/PublishLogViewModel.cs
@@ -26,6 +26,8 @@ namespace IRaCIS.Core.Application.ViewModel
public string? UpdateContent { get; set; }
+ public int? State { get; set; }
+
}
/// PublishLogAddOrEdit 列表查询参数模型
@@ -33,9 +35,24 @@ namespace IRaCIS.Core.Application.ViewModel
{
public Guid? Id { get; set; }
public string Version { get; set; }
- public DateTime PublishTime { get; set; }
+ public DateTime? PublishTime { get; set; }
public string UpdateContent { get; set; }
+ //0 开发中 ,已发布
+ public int State { get; set; }
+
+ public bool IsCurrentVersion { get; set; }
+
+ }
+
+
+ public class PublishVersionSelect
+ {
+ public Guid Id { get; set; }
+ public string Version { get; set; }
+ public int State { get; set; }
+ public DateTime? PublishTime { get; set; }
+ public bool IsCurrentVersion { get; set; }
}
diff --git a/IRaCIS.Core.Application/Service/Common/PublishLogService.cs b/IRaCIS.Core.Application/Service/Common/PublishLogService.cs
index 5afb3aaf8..213c0b90a 100644
--- a/IRaCIS.Core.Application/Service/Common/PublishLogService.cs
+++ b/IRaCIS.Core.Application/Service/Common/PublishLogService.cs
@@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Application.Contracts;
+using Microsoft.AspNetCore.Authorization;
namespace IRaCIS.Core.Application.Service
{
@@ -31,8 +32,9 @@ namespace IRaCIS.Core.Application.Service
{
var publishLogQueryable = _publishLogRepository
- .WhereIf(!string.IsNullOrEmpty(inQuery.Version) , t => t.Version.Contains(inQuery.Version))
+ .WhereIf(!string.IsNullOrEmpty(inQuery.Version), t => t.Version.Contains(inQuery.Version))
.WhereIf(!string.IsNullOrEmpty(inQuery.UpdateContent), t => t.UpdateContent.Contains(inQuery.UpdateContent))
+ .WhereIf(inQuery.State != null, t => t.State == inQuery.State)
.ProjectTo(_mapper.ConfigurationProvider);
var pageList = await publishLogQueryable
@@ -50,11 +52,11 @@ namespace IRaCIS.Core.Application.Service
{
return ResponseOutput.NotOk("版本号不符合要求");
}
-
+
var verifyExp1 = new EntityVerifyExp()
{
- VerifyExp = u => u.Version == addOrEditPublishLog.Version ,
-
+ VerifyExp = u => u.Version == addOrEditPublishLog.Version,
+
VerifyMsg = "发布编号不能重复"
};
@@ -74,6 +76,25 @@ namespace IRaCIS.Core.Application.Service
return ResponseOutput.Ok();
}
+ [AllowAnonymous]
+ public async Task GetCurrentPublishInfo()
+ {
+ var result = await _publishLogRepository.Where(t => t.IsCurrentVersion == true).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync();
+
+ if (result == null)
+ {
+ //系统当前版本未标记,请联系维护人员
+ throw new QueryBusinessObjectNotExistException("系统当前版本未标记,请联系维护人员");
+ }
+
+ return result;
+ }
+
+
+ public async Task> GetPublishVersionSelect()
+ {
+ return await _publishLogRepository.ProjectTo(_mapper.ConfigurationProvider).OrderByDescending(t => t.State).ToListAsync();
+ }
}
}
diff --git a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs
index 18058ee40..743955f1a 100644
--- a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs
+++ b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs
@@ -78,6 +78,9 @@ namespace IRaCIS.Core.Application.Service
CreateMap();
CreateMap().ReverseMap();
+ CreateMap();
+
+
}
}
diff --git a/IRaCIS.Core.Domain/Common/PublishLog.cs b/IRaCIS.Core.Domain/Common/PublishLog.cs
index 082edaef3..0a58ed3a3 100644
--- a/IRaCIS.Core.Domain/Common/PublishLog.cs
+++ b/IRaCIS.Core.Domain/Common/PublishLog.cs
@@ -17,48 +17,40 @@ namespace IRaCIS.Core.Domain.Models
{
- ///
- /// Version
- ///
+
[Required]
public string Version { get; set; }
- ///
- /// PublishTime
- ///
+
[Required]
- public DateTime PublishTime { get; set; }
+ public DateTime? PublishTime { get; set; }
- ///
- /// UpdateContent
- ///
+
[Required]
public string UpdateContent { get; set; }
- ///
- /// CreateTime
- ///
+
[Required]
public DateTime CreateTime { get; set; }
- ///
- /// CreateUserId
- ///
+
[Required]
public Guid CreateUserId { get; set; }
- ///
- /// UpdateUserId
- ///
+
[Required]
public Guid UpdateUserId { get; set; }
- ///
- /// UpdateTime
- ///
+
[Required]
public DateTime UpdateTime { get; set; }
-
- }
+
+ //0 开发中 ,已发布
+ public int State { get; set; }
+
+ public bool IsCurrentVersion { get; set; }
+
+
+ }
}