运维系统通知列表维护

This commit is contained in:
2022-04-25 11:54:56 +08:00
parent 6f09114bda
commit 7351415bbc
15 changed files with 328 additions and 173 deletions
@@ -325,6 +325,11 @@
<param name="datas"></param>
<returns></returns>
</member>
<member name="T:IRaCIS.Core.Application.Service.SystemNoticeService">
<summary>
SystemNoticeService
</summary>
</member>
<member name="T:IRaCIS.Core.Application.Service.TrialExternalUserService">
<summary>
项目外部人员 录入流程相关
@@ -515,15 +520,6 @@
<member name="T:IRaCIS.Core.Application.ViewModel.SystemNoticeQuery">
<summary>SystemNoticeQuery 列表查询参数模型</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.SystemNoticeQuery.NoticeContent">
<summary> NoticeContent</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.SystemNoticeQuery.FileName">
<summary> FileName</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.SystemNoticeQuery.Path">
<summary> Path</summary>
</member>
<member name="T:IRaCIS.Core.Application.ViewModel.SystemNoticeAddOrEdit">
<summary> SystemNoticeAddOrEdit 列表查询参数模型</summary>
</member>
@@ -6,60 +6,75 @@
using System;
using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Domain.Share.Management;
namespace IRaCIS.Core.Application.ViewModel
{
/// <summary> SystemNoticeView 列表视图模型 </summary>
public class SystemNoticeView
public class SystemNoticeView : SystemNoticeBasicInfo
{
public Guid Id { get; set; }
public int NoticeLevelEnum { get; set; }
public string NoticeContent { get; set; }
public DateTime CreateTime { get; set; }
public Guid CreateUserId { get; set; }
public DateTime UpdateTime { get; set; }
public Guid UpdateUserId { get; set; }
public int ApplicableProjectEnum { get; set; }
public int NoticeMode { get; set; }
public int NoticeStateEnum { get; set; }
public DateTime? StartDate { get; set; }
public DateTime? EndDate { get; set; }
public string FileName { get; set; }
public string Path { get; set; }
public string FullFilePath { get; set; }
public List<UserTypeSimpleDTO> NoticeUserTypeList { get; set; }
}
///<summary>SystemNoticeQuery 列表查询参数模型</summary>
public class SystemNoticeQuery
public class SystemNoticeQuery:PageInput
{
///<summary> NoticeContent</summary>
public string NoticeContent { get; set; }
public string NoticeContent { get; set; } = string.Empty;
///<summary> FileName</summary>
public string FileName { get; set; }
public string FileName { get; set; } = string.Empty;
public SystemNotice_NoticeTypeEnum? NoticeTypeEnum { get; set; }
public SystemNotice_NoticeLevelEnum? NoticeLevelEnum { get; set; }
public SystemNotice_ApplicableProjectEnum? ApplicableProjectEnum { get; set; }
public SystemNotice_NoticeModeEnum? NoticeModeEnum { get; set; }
public SystemNotice_NoticeStateEnum? NoticeStateEnum { get; set; }
///<summary> Path</summary>
public string Path { get; set; }
}
///<summary> SystemNoticeAddOrEdit 列表查询参数模型</summary>
public class SystemNoticeAddOrEdit
public class SystemNoticeBasicInfo
{
public Guid Id { get; set; }
public int NoticeLevelEnum { get; set; }
public Guid? Id { get; set; }
public string NoticeContent { get; set; }
public DateTime CreateTime { get; set; }
public Guid CreateUserId { get; set; }
public DateTime UpdateTime { get; set; }
public Guid UpdateUserId { get; set; }
public int ApplicableProjectEnum { get; set; }
public int NoticeMode { get; set; }
public int NoticeStateEnum { get; set; }
public SystemNotice_NoticeTypeEnum NoticeTypeEnum { get; set; }
public SystemNotice_NoticeLevelEnum NoticeLevelEnum { get; set; }
public SystemNotice_ApplicableProjectEnum ApplicableProjectEnum { get; set; }
public SystemNotice_NoticeModeEnum NoticeModeEnum { get; set; }
public SystemNotice_NoticeStateEnum NoticeStateEnum { get; set; }
public DateTime? StartDate { get; set; }
public DateTime? EndDate { get; set; }
public string FileName { get; set; }
public string Path { get; set; }
}
///<summary> SystemNoticeAddOrEdit 列表查询参数模型</summary>
public class SystemNoticeAddOrEdit: SystemNoticeBasicInfo
{
public Guid[] NoticeUserTypeIdList { get; set; }
}
public class SystemNoticeUserTypeView
{
public Guid Id { get; set; }
@@ -80,6 +80,15 @@ namespace IRaCIS.Core.Application.Contracts
}
public class UserTypeSimpleDTO
{
public Guid Id { get; set; }
public string UserTypeName { get; set; } = string.Empty;
public UserTypeEnum UserTypeEnum { get; set; }
public string UserTypeShortName { get; set; } = string.Empty;
public string PermissionStr { get; set; } = String.Empty;
}
}
@@ -14,7 +14,7 @@ namespace IRaCIS.Core.Application.Interfaces
{
Task<List<SystemNoticeView>> GetSystemNoticeList(SystemNoticeQuery querySystemNotice);
Task<PageOutput<SystemNoticeView>> GetSystemNoticeList(SystemNoticeQuery querySystemNotice);
Task<IResponseOutput> AddOrUpdateSystemNotice(SystemNoticeAddOrEdit addOrEditSystemNotice);
@@ -1,64 +1,82 @@
////--------------------------------------------------------------------
//// 此代码由T4模板自动生成 byzhouhang 20210918
//// 生成时间 2022-04-25 09:46:43
//// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
////--------------------------------------------------------------------
//--------------------------------------------------------------------
// 此代码由T4模板自动生成 byzhouhang 20210918
// 生成时间 2022-04-25 09:46:43
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//--------------------------------------------------------------------
//using IRaCIS.Core.Domain.Models;
//using Microsoft.AspNetCore.Mvc;
//using IRaCIS.Core.Application.Interfaces;
//using IRaCIS.Core.Application.ViewModel;
//namespace IRaCIS.Core.Application.Service
//{
// /// <summary>
// /// SystemNoticeService
// /// </summary>
// [ ApiExplorerSettings(GroupName = "Test")]
// public class SystemNoticeService: BaseService, ISystemNoticeService
// {
using IRaCIS.Core.Domain.Models;
using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel;
namespace IRaCIS.Core.Application.Service
{
/// <summary>
/// SystemNoticeService
/// </summary>
[ApiExplorerSettings(GroupName = "Management")]
public class SystemNoticeService : BaseService, ISystemNoticeService
{
// private readonly IRepository<SystemNotice> _systemNoticeRepository;
private readonly IRepository<SystemNotice> _systemNoticeRepository;
// public SystemNoticeService(IRepository<SystemNotice> systemNoticeRepository)
// {
// _systemNoticeRepository = systemNoticeRepository;
// }
public SystemNoticeService(IRepository<SystemNotice> systemNoticeRepository)
{
_systemNoticeRepository = systemNoticeRepository;
}
// public async Task<List<SystemNoticeView>> GetSystemNoticeList(SystemNoticeQuery querySystemNotice)
// {
// var systemNoticeQueryable = _repository.GetQueryable<SystemNotice>()
// .ProjectTo<SystemNoticeView>(_mapper.ConfigurationProvider);
// return await systemNoticeQueryable.ToListAsync();
// }
// public async Task<IResponseOutput> AddOrUpdateSystemNotice(SystemNoticeAddOrEdit addOrEditSystemNotice)
// {
// // 在此处拷贝automapper 映射
// //CreateMap<SystemNotice, SystemNoticeView>();
// // CreateMap< SystemNotice,SystemNoticeAddOrEdit>().ReverseMap();
[HttpPost]
public async Task<PageOutput<SystemNoticeView>> GetSystemNoticeList(SystemNoticeQuery querySystemNotice)
{
// var entity = await _repository.InsertOrUpdateAsync<SystemNotice, SystemNoticeAddOrEdit>(addOrEditSystemNotice, true);
var systemNoticeQueryable = _systemNoticeRepository
.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)
.WhereIf(querySystemNotice.NoticeStateEnum != null, t => t.NoticeStateEnum == querySystemNotice.NoticeStateEnum)
.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<SystemNoticeView>(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken});
// return ResponseOutput.Ok(entity.Id.ToString());
// }
return await systemNoticeQueryable.ToPagedListAsync(querySystemNotice.PageIndex, querySystemNotice.PageSize, querySystemNotice.SortField, querySystemNotice.Asc);
}
// [HttpDelete("{systemNoticeId:guid}")]
// public async Task<IResponseOutput> DeleteSystemNotice(Guid systemNoticeId)
// {
// var success = await _repository.BatchDeleteAsync<SystemNotice>()(t => t.Id == systemNoticeId);
// return ResponseOutput.Result(success);
// }
public async Task<IResponseOutput> AddOrUpdateSystemNotice(SystemNoticeAddOrEdit addOrEditSystemNotice)
{
// }
//}
if (addOrEditSystemNotice.Id == null)
{
var entity = await _systemNoticeRepository.InsertFromDTOAsync(addOrEditSystemNotice,true);
return ResponseOutput.Ok(entity.Id.ToString());
}
else
{
var systemNotice = await _systemNoticeRepository.Where(t => t.Id == addOrEditSystemNotice.Id, true, true).Include(t => t.NoticeUserTypeList).FirstOrDefaultAsync();
_mapper.Map(addOrEditSystemNotice, systemNotice);
await _systemNoticeRepository.SaveChangesAsync();
return ResponseOutput.Ok();
}
}
[HttpDelete("{systemNoticeId:guid}")]
public async Task<IResponseOutput> DeleteSystemNotice(Guid systemNoticeId)
{
var success = await _systemNoticeRepository.BatchDeleteAsync(t => t.Id == systemNoticeId);
return ResponseOutput.Result(success);
}
}
}
@@ -2,6 +2,7 @@
using AutoMapper.EquivalencyExpression;
using IRaCIS.Application.Contracts;
using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Models;
namespace IRaCIS.Core.Application.Service
@@ -89,6 +90,23 @@ namespace IRaCIS.Core.Application.Service
.ForMember(d => d.UserType, u => u.MapFrom(s => s.UserTypeRole.UserTypeShortName))
.ForMember(d => d.CanEditUserType, u => u.MapFrom(s => !s.UserTrials.Any()));
var token = string.Empty;
CreateMap<SystemNotice, SystemNoticeView>()
.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));
CreateMap<SystemNoticeUserType, UserTypeSimpleDTO>().IncludeMembers(t=>t.NoticeUserType);
CreateMap<UserType, UserTypeSimpleDTO>();
CreateMap<Guid, SystemNoticeUserType>().EqualityComparison((odto, o) => odto == o.UserTypeId)
.ForMember(d => d.UserTypeId, c => c.MapFrom(t => t));
}
}
@@ -25,7 +25,6 @@ namespace IRaCIS.Core.Application.Contracts
{
private readonly IRepository<NoneDicomStudy> _noneDicomStudyRepository;
private readonly IHttpContextAccessor _httpContext;
private readonly IWebHostEnvironment _hostEnvironment;
private readonly IDictionaryService _dictionaryService;
private readonly IInspectionService _inspectionService;
private readonly IRepository<NoneDicomStudyFile> _noneDicomStudyFileRepository;
@@ -36,7 +35,6 @@ namespace IRaCIS.Core.Application.Contracts
public NoneDicomStudyService(IRepository<NoneDicomStudy> noneDicomStudyRepository,
IHttpContextAccessor httpContext,
IWebHostEnvironment hostEnvironment,
IDictionaryService dictionaryService,
IInspectionService inspectionService,
IRepository<NoneDicomStudyFile> noneDicomStudyFileRepository)
@@ -44,7 +42,6 @@ namespace IRaCIS.Core.Application.Contracts
_noneDicomStudyRepository = noneDicomStudyRepository;
this._httpContext = httpContext;
this._hostEnvironment = hostEnvironment;
this._dictionaryService = dictionaryService;
this._inspectionService = inspectionService;
_noneDicomStudyFileRepository = noneDicomStudyFileRepository;