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