系统通知
parent
13b4c25b58
commit
21a261a806
|
@ -14,6 +14,12 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
/// <summary> SystemNoticeView 列表视图模型 </summary>
|
||||
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; }
|
||||
|
|
|
@ -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<PageOutput<SystemNoticeReadDTO>> 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<SystemNoticeReadDTO>(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken ,userId=_userInfo.Id});
|
||||
.ProjectTo<SystemNoticeReadDTO>(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.Id });
|
||||
|
||||
return await systemNoticeQueryable.ToPagedListAsync(querySystemNotice.PageIndex, querySystemNotice.PageSize, querySystemNotice.SortField, querySystemNotice.Asc);
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
public ManagementConfig()
|
||||
{
|
||||
|
||||
CreateMap<UserTypeMenu, MenuTreeNode>().IncludeMembers(t => t.Menu);
|
||||
|
||||
CreateMap<UserTypeMenu, MenuTreeNode>().IncludeMembers(t => t.Menu);
|
||||
|
||||
|
||||
|
||||
|
@ -27,13 +27,13 @@ namespace IRaCIS.Core.Application.Service
|
|||
CreateMap<Guid, UserTypeGroup>().ForMember(t => t.DictionaryId, u => u.MapFrom(c => c))
|
||||
.EqualityComparison((odto, o) => odto == o.DictionaryId);
|
||||
|
||||
CreateMap<Guid, UserTypeMenu>().ForMember(t=>t.MenuId,u=>u.MapFrom(c=>c))
|
||||
CreateMap<Guid, UserTypeMenu>().ForMember(t => t.MenuId, u => u.MapFrom(c => c))
|
||||
.EqualityComparison((odto, o) => odto == o.MenuId);
|
||||
|
||||
CreateMap<UserTypeGroup, UserTypeGroupInfo>()
|
||||
.ForMember(t => t.GroupName, u => u.MapFrom(c => c.Group.Value))
|
||||
.ForMember(t => t.GroupNameCN, u => u.MapFrom(c => c.Group.ValueCN));
|
||||
|
||||
|
||||
|
||||
CreateMap<MenuCommand, Menu>().ForMember(d => d.Id, u => u.MapFrom(t => t.MenuId)).ReverseMap();
|
||||
|
||||
|
@ -44,7 +44,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
CreateMap<UserType, UserTypeRoleView>()
|
||||
.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<Role, RoleDTO>();
|
||||
CreateMap<Menu, MenuFunctionDTO>();
|
||||
|
@ -93,23 +93,24 @@ namespace IRaCIS.Core.Application.Service
|
|||
var token = string.Empty;
|
||||
var userId = Guid.Empty;
|
||||
CreateMap<SystemNotice, SystemNoticeView>()
|
||||
.ForMember(t=>t.CreateUserName,d=>d.MapFrom(t=>t.CreateUser.FullName))
|
||||
.ForMember(t => t.PublishUserName, d => d.MapFrom(t => t.PublishUser.FullName))
|
||||
.ForMember(t => t.CreateUserName, d => d.MapFrom(t => t.CreateUser.FullName))
|
||||
.ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path + "?access_token=" + token));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
CreateMap<SystemNotice, SystemNoticeReadDTO>()
|
||||
.ForMember(t => t.CreateUserName, d => d.MapFrom(t => t.CreateUser.FullName))
|
||||
.ForMember(t => t.IsRead, d => d.MapFrom(t => t.NoticeUserReadList.Any(t=>t.CreateUserId== userId)))
|
||||
.ForMember(t => t.IsRead, d => d.MapFrom(t => t.NoticeUserReadList.Any(t => t.CreateUserId == userId)))
|
||||
.ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path + "?access_token=" + token));
|
||||
|
||||
CreateMap<SystemNotice, SystemNoticeAddOrEdit>().ReverseMap()
|
||||
.ForMember(t=>t.NoticeUserTypeList,u=>u.MapFrom(t=>t.NoticeUserTypeIdList));
|
||||
.ForMember(t => t.NoticeUserTypeList, u => u.MapFrom(t => t.NoticeUserTypeIdList));
|
||||
|
||||
|
||||
CreateMap<SystemNoticeUserType, UserTypeSimpleDTO>().IncludeMembers(t=>t.NoticeUserType)
|
||||
.ForMember(t=>t.Id,u=>u.MapFrom(u=>u.NoticeUserType.Id));
|
||||
CreateMap<SystemNoticeUserType, UserTypeSimpleDTO>().IncludeMembers(t => t.NoticeUserType)
|
||||
.ForMember(t => t.Id, u => u.MapFrom(u => u.NoticeUserType.Id));
|
||||
|
||||
CreateMap<UserType, UserTypeSimpleDTO>();
|
||||
|
||||
|
@ -120,5 +121,5 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -73,18 +73,18 @@ namespace IRaCIS.Core.Domain.Models
|
|||
|
||||
public DateTime? EndDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// FileName
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string FileName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Path
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string Path { get; set; }
|
||||
|
||||
public Guid? PublishedUserId { get; set; }
|
||||
|
||||
public User PublishUser { get; set; }
|
||||
|
||||
public DateTime? PublishedTime { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue