Browse Source

POST 报表

bjmzak
vaining01 2 years ago
parent
commit
5d5790cde7
  1. 1
      src/Shentun.Peis.Application.Contracts/ReportFormatTemplates/UpdateReportFormatTemplateDto.cs
  2. 38
      src/Shentun.Peis.Application/ReportFormatTemplates/ReportFormatTemplateAppService.cs
  3. 6
      src/Shentun.Peis.Application/ReportFormats/ReportFormatAppService.cs

1
src/Shentun.Peis.Application.Contracts/ReportFormatTemplates/UpdateReportFormatTemplateDto.cs

@ -7,6 +7,7 @@ namespace Shentun.Peis.ReportFormatTemplates
public class UpdateReportFormatTemplateDto
{
public string Id { get; set; }
public string ReportFormatId { get; set; }
public string DisplayName { get; set; }

38
src/Shentun.Peis.Application/ReportFormatTemplates/ReportFormatTemplateAppService.cs

@ -24,7 +24,7 @@ namespace Shentun.Peis.ReportFormatTemplates
private readonly IRepository<IdentityUser, Guid> _userRepository;
private readonly IRepository<Report, string> _reportRepository;
private readonly IRepository<ReportFormat, string> _reportFormatRepository;
private readonly IRepository<ReportFormatTemplate, string> _reportFormatTemplateRepository;
private readonly IRepository<ReportFormatTemplate, string> _repository;
private readonly ReportFormatTemplateManager _manager;
public ReportFormatTemplateAppService(
IRepository<ReportFormatTemplate, string> repository,
@ -33,19 +33,19 @@ namespace Shentun.Peis.ReportFormatTemplates
IRepository<ReportFormat, string> reportFormatRepository,
ReportFormatTemplateManager manager)
{
_repository = repository;
_userRepository = userRepository;
_manager = manager;
_reportFormatTemplateRepository = repository;
_reportFormatRepository = reportFormatRepository;
_reportRepository = reportRepository;
}
[HttpPost("api/app/ReportFormatTemplate/GetReportTemplate")]
public async Task<List<ReportFormatTemplateDto>> GetReportTemplateAsync()
[HttpPost("api/app/ReportFormatTemplate/GetDefalutReportTemplates")]
public async Task<List<ReportFormatTemplateDto>> GetDefalutReportTemplateAsync()
{
var query = from a in await _reportFormatRepository.GetQueryableAsync()
join b in await _reportRepository.GetQueryableAsync() on a.ReportId equals b.Id into bb
from ab in bb.DefaultIfEmpty()
join c in await _reportFormatTemplateRepository.GetQueryableAsync() on a.Id equals c.ReportFormatId into cc
join c in await _repository.GetQueryableAsync() on a.Id equals c.ReportFormatId into cc
from ac in cc.DefaultIfEmpty()
where (a.IsDefault=='Y' &&ab.IsActive=='Y'&&ac.IsDefault== 'Y')
select new
@ -75,12 +75,12 @@ namespace Shentun.Peis.ReportFormatTemplates
/// <summary>
/// 获取通过主键
/// </summary>
/// <param name="id"></param>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("api/app/ReportFormatTemplate/GetById")]
public async Task<ReportFormatTemplateDto> GetByIdAsync(ReportFormatTemplateIdDto input)
{
var entity= await _reportFormatTemplateRepository.GetAsync(input.Id);
var entity= await _repository.GetAsync(input.Id);
var aEntity = ObjectMapper.Map<ReportFormatTemplate, ReportFormatTemplateDto>(entity);
var userList = await _userRepository.GetListAsync();
aEntity.IsDefaulted = entity.IsDefault.Equals('Y');
@ -92,7 +92,7 @@ namespace Shentun.Peis.ReportFormatTemplates
[HttpPost("api/app/ReportFormatTemplate/GetMaxId")]
public async Task<ReportFormatTemplateDto> GetMaxIdAsync()
{
var ent = (await _reportFormatTemplateRepository.GetListAsync()).Max(x => x.Id);
var ent = (await _repository.GetListAsync()).Max(x => x.Id);
var entdto = new ReportFormatTemplateDto
{
Id = !string.IsNullOrEmpty(ent)?ent:"0001"
@ -100,9 +100,9 @@ namespace Shentun.Peis.ReportFormatTemplates
return entdto;
}
[HttpPost("api/app/ReportFormatTemplate/GetDefault")]
public async Task<ReportFormatTemplateDto> GetDefaultAsync(string formatId)
public async Task<ReportFormatTemplateDto> GetDefaultAsync(ReportFormatIdInputDto input)
{
var ent = await _manager.GetDefaultAsync(formatId);
var ent = await _manager.GetDefaultAsync(input.Id);
if (ent != null)
{
@ -143,7 +143,7 @@ namespace Shentun.Peis.ReportFormatTemplates
[HttpPost("api/app/ReportFormatTemplate/GetList")]
public async Task<List<ReportFormatTemplateDto>> GetListAsync(PagedAndSortedResultRequestDto input)
{
var reportList = await _reportFormatTemplateRepository.GetListAsync();
var reportList = await _repository.GetListAsync();
List<ReportFormatTemplateDto> templates = new List<ReportFormatTemplateDto>();
@ -170,7 +170,7 @@ namespace Shentun.Peis.ReportFormatTemplates
public async Task<PagedResultDto<ReportFormatTemplateDto>> GetListByReportFormatIdAsync(ReportFormatIdInputDto input)
{
int totalCount = 0;
var entlist = (await _reportFormatTemplateRepository.GetListAsync()).Where(m => m.ReportFormatId == input.Id);
var entlist = (await _repository.GetListAsync()).Where(m => m.ReportFormatId == input.Id);
totalCount = entlist.Count();
var userList = await _userRepository.GetListAsync();
@ -208,7 +208,7 @@ namespace Shentun.Peis.ReportFormatTemplates
{
var createEntity = ObjectMapper.Map<CreateReportFormatTemplateDto, ReportFormatTemplate>(input);
var entity = await _manager.CreateAsync(createEntity);
entity = await _reportFormatTemplateRepository.InsertAsync(entity);
entity = await _repository.InsertAsync(entity);
var dto = ObjectMapper.Map<ReportFormatTemplate, ReportFormatTemplateDto>(entity);
return dto;
}
@ -216,7 +216,7 @@ namespace Shentun.Peis.ReportFormatTemplates
public async Task<ReportFormatTemplateDto> CopyCreateAsync(CopyCreateReportFormatTemplateDto input)
{
var entity = await _manager.CopyCreateAsync(input.Id, input.NewId);
entity = await _reportFormatTemplateRepository.InsertAsync(entity);
entity = await _repository.InsertAsync(entity);
var dto = ObjectMapper.Map<ReportFormatTemplate, ReportFormatTemplateDto>(entity);
return dto;
}
@ -228,13 +228,13 @@ namespace Shentun.Peis.ReportFormatTemplates
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("api/app/ReportFormatTemplate/Update")]
public async Task<ReportFormatTemplateDto> UpdateAsync(string id, UpdateReportFormatTemplateDto input)
public async Task<ReportFormatTemplateDto> UpdateAsync(UpdateReportFormatTemplateDto input)
{
var entity = await _reportFormatTemplateRepository.GetAsync(id);
var entity = await _repository.GetAsync(input.Id);
var userList = await _userRepository.GetListAsync();
var sourceEntity = ObjectMapper.Map<UpdateReportFormatTemplateDto, ReportFormatTemplate>(input);
await _manager.UpdateAsync(sourceEntity, entity);
entity = await _reportFormatTemplateRepository.UpdateAsync(entity);
entity = await _repository.UpdateAsync(entity);
var dto= ObjectMapper.Map<ReportFormatTemplate, ReportFormatTemplateDto>(entity);
dto.IsDefaulted = entity.IsDefault.Equals('Y');
dto.IsSystemed= entity.IsSystem.Equals('Y');
@ -250,10 +250,10 @@ namespace Shentun.Peis.ReportFormatTemplates
[HttpPost("api/app/ReportFormatTemplate/Delete")]
public Task DeleteAsync(ReportFormatIdInputDto input)
{
return _reportFormatTemplateRepository.DeleteAsync(input.Id);
return _repository.DeleteAsync(input.Id);
}
[HttpPut("api/app/reportfomattemplate/updatedefault")]
[HttpPost("api/app/reportfomattemplate/UpdateDefault")]
public async Task UpdateDefaultAsync(ReportFormatIdInputDto input)
{
await _manager.UpdateDefaultAsync(input.Id);

6
src/Shentun.Peis.Application/ReportFormats/ReportFormatAppService.cs

@ -61,9 +61,9 @@ namespace Shentun.Peis.ReportFormats
return entdto;
}
[HttpPost("api/app/ReportFormat/GetDefault")]
public async Task<ReportFormatDto> GetDefaultAsync(string reportId)
public async Task<ReportFormatDto> GetDefaultAsync(ReportIdInputDto input)
{
var ent = await _manager.GetDefaultAsync(reportId);
var ent = await _manager.GetDefaultAsync(input.Id);
if (ent!=null)
{
@ -196,7 +196,7 @@ namespace Shentun.Peis.ReportFormats
return _repository.DeleteAsync(input.Id);
}
[HttpPut("api/app/ReportFormat/UpdateDefault")]
[HttpPost("api/app/ReportFormat/UpdateDefault")]
public async Task UpdateDefaultAsync(ReportFormatIdInputDto input)
{
await _manager.UpdateDefaultAsync(input.Id);

Loading…
Cancel
Save