From 21a261a806347fab1886114db2401a3e7e6240fa Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Thu, 28 Apr 2022 15:46:29 +0800
Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E9=80=9A=E7=9F=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Management/DTO/SystemNoticeViewModel.cs | 6 +++++
.../Service/Management/SystemNoticeService.cs | 24 +++++++++++++++---
.../Service/Management/_MapConfig.cs | 25 ++++++++++---------
.../Management/Notice/SystemNotice.cs | 12 ++++-----
4 files changed, 46 insertions(+), 21 deletions(-)
diff --git a/IRaCIS.Core.Application/Service/Management/DTO/SystemNoticeViewModel.cs b/IRaCIS.Core.Application/Service/Management/DTO/SystemNoticeViewModel.cs
index c8aa3b9d..0c3fb3d0 100644
--- a/IRaCIS.Core.Application/Service/Management/DTO/SystemNoticeViewModel.cs
+++ b/IRaCIS.Core.Application/Service/Management/DTO/SystemNoticeViewModel.cs
@@ -14,6 +14,12 @@ namespace IRaCIS.Core.Application.ViewModel
/// SystemNoticeView 列表视图模型
public class SystemNoticeView : SystemNoticeBasicInfo
{
+ public Guid? PublishedUserId { get; set; }
+
+ public DateTime? PublishedTime { get; set; }
+
+ public string PublishUserName { get; set; }
+
public DateTime CreateTime { get; set; }
public Guid CreateUserId { get; set; }
diff --git a/IRaCIS.Core.Application/Service/Management/SystemNoticeService.cs b/IRaCIS.Core.Application/Service/Management/SystemNoticeService.cs
index ba694b75..2f1d0abe 100644
--- a/IRaCIS.Core.Application/Service/Management/SystemNoticeService.cs
+++ b/IRaCIS.Core.Application/Service/Management/SystemNoticeService.cs
@@ -48,8 +48,14 @@ namespace IRaCIS.Core.Application.Service
if (addOrEditSystemNotice.Id == null)
{
- var entity = await _systemNoticeRepository.InsertFromDTOAsync(addOrEditSystemNotice, true);
+ var entity = await _systemNoticeRepository.InsertFromDTOAsync(addOrEditSystemNotice);
+ if (entity.NoticeStateEnum == Domain.Share.Management.SystemNotice_NoticeStateEnum.HavePublished)
+ {
+ entity.PublishedUserId = _userInfo.Id;
+ entity.PublishedTime = DateTime.Now;
+ }
+ _systemNoticeRepository.SaveChangesAsync();
return ResponseOutput.Ok(entity.Id.ToString());
}
@@ -60,6 +66,18 @@ namespace IRaCIS.Core.Application.Service
_mapper.Map(addOrEditSystemNotice, systemNotice);
+ if (addOrEditSystemNotice.NoticeStateEnum == Domain.Share.Management.SystemNotice_NoticeStateEnum.HavePublished && systemNotice.NoticeStateEnum == Domain.Share.Management.SystemNotice_NoticeStateEnum.NotPublish)
+ {
+ systemNotice.PublishedUserId = _userInfo.Id;
+ systemNotice.PublishedTime = DateTime.Now;
+ }
+ else
+ {
+ systemNotice.PublishedUserId = null;
+ systemNotice.PublishedTime = null;
+ }
+
+
await _systemNoticeRepository.SaveChangesAsync();
return ResponseOutput.Ok();
@@ -97,7 +115,7 @@ namespace IRaCIS.Core.Application.Service
public async Task> GetUserSystemNoticeList(SystemNoticeQuery querySystemNotice)
{
var systemNoticeQueryable = _systemNoticeRepository
- .Where(t=>t.NoticeUserTypeList.Any(t=>t.UserTypeId==_userInfo.UserTypeId))
+ .Where(t => t.NoticeUserTypeList.Any(t => t.UserTypeId == _userInfo.UserTypeId))
.WhereIf(querySystemNotice.ApplicableProjectEnum != null, t => t.ApplicableProjectEnum == querySystemNotice.ApplicableProjectEnum)
.WhereIf(querySystemNotice.NoticeLevelEnum != null, t => t.NoticeLevelEnum == querySystemNotice.NoticeLevelEnum)
.WhereIf(querySystemNotice.NoticeModeEnum != null, t => t.NoticeModeEnum == querySystemNotice.NoticeModeEnum)
@@ -105,7 +123,7 @@ namespace IRaCIS.Core.Application.Service
.WhereIf(querySystemNotice.NoticeTypeEnum != null, t => t.NoticeTypeEnum == querySystemNotice.NoticeTypeEnum)
.WhereIf(!string.IsNullOrWhiteSpace(querySystemNotice.FileName), t => t.FileName.Contains(querySystemNotice.FileName))
.WhereIf(!string.IsNullOrWhiteSpace(querySystemNotice.NoticeContent), t => t.NoticeContent.Contains(querySystemNotice.NoticeContent))
- .ProjectTo(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken ,userId=_userInfo.Id});
+ .ProjectTo(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.Id });
return await systemNoticeQueryable.ToPagedListAsync(querySystemNotice.PageIndex, querySystemNotice.PageSize, querySystemNotice.SortField, querySystemNotice.Asc);
}
diff --git a/IRaCIS.Core.Application/Service/Management/_MapConfig.cs b/IRaCIS.Core.Application/Service/Management/_MapConfig.cs
index 891c9005..02a06a1a 100644
--- a/IRaCIS.Core.Application/Service/Management/_MapConfig.cs
+++ b/IRaCIS.Core.Application/Service/Management/_MapConfig.cs
@@ -11,8 +11,8 @@ namespace IRaCIS.Core.Application.Service
{
public ManagementConfig()
{
-
- CreateMap().IncludeMembers(t => t.Menu);
+
+ CreateMap().IncludeMembers(t => t.Menu);
@@ -27,13 +27,13 @@ namespace IRaCIS.Core.Application.Service
CreateMap().ForMember(t => t.DictionaryId, u => u.MapFrom(c => c))
.EqualityComparison((odto, o) => odto == o.DictionaryId);
- CreateMap().ForMember(t=>t.MenuId,u=>u.MapFrom(c=>c))
+ CreateMap().ForMember(t => t.MenuId, u => u.MapFrom(c => c))
.EqualityComparison((odto, o) => odto == o.MenuId);
CreateMap()
.ForMember(t => t.GroupName, u => u.MapFrom(c => c.Group.Value))
.ForMember(t => t.GroupNameCN, u => u.MapFrom(c => c.Group.ValueCN));
-
+
CreateMap().ForMember(d => d.Id, u => u.MapFrom(t => t.MenuId)).ReverseMap();
@@ -44,7 +44,7 @@ namespace IRaCIS.Core.Application.Service
CreateMap()
- .ForMember(t => t.MenuIds, u => u.MapFrom(c => c.UserTypeMenuList.Select(t=>t.MenuId)));
+ .ForMember(t => t.MenuIds, u => u.MapFrom(c => c.UserTypeMenuList.Select(t => t.MenuId)));
CreateMap();
CreateMap