学 赵
1 year ago
13 changed files with 395 additions and 86 deletions
@ -0,0 +1,126 @@ |
|||
using Magicodes.ExporterAndImporter.Core; |
|||
using Magicodes.ExporterAndImporter.Csv; |
|||
using Magicodes.ExporterAndImporter.Excel; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using SettleAccount.Bases; |
|||
using SettleAccount.Domain.BQ; |
|||
using Shouldly; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Linq; |
|||
using System.Reflection; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.Application.Services; |
|||
using Volo.Abp.Domain.Entities; |
|||
using Win.Sfs.BaseData.ImportExcelCommon; |
|||
using Win.Sfs.SettleAccount.Constant; |
|||
using Win.Sfs.SettleAccount.Entities.BQ.Dtos; |
|||
using Win.Sfs.Shared.RepositoryBase; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Bases |
|||
{ |
|||
public abstract class BA_SERVICE:ApplicationService |
|||
{ |
|||
|
|||
|
|||
private readonly INormalEfCoreRepository<INVOICE_GRP, Guid> _repository; |
|||
private readonly INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> _wRepository; |
|||
private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _sRepository; |
|||
private readonly INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> _mRepository; |
|||
//private readonly INormalEfCoreRepository<TEntityDetail, Guid> _detailRepository;
|
|||
private readonly IExcelImportAppService _excelImportService; |
|||
|
|||
protected BA_SERVICE( |
|||
INormalEfCoreRepository<INVOICE_GRP, Guid> repository, |
|||
INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> wRepository, |
|||
INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository, |
|||
INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository, |
|||
IExcelImportAppService excelImportService |
|||
//INormalEfCoreRepository<TEntityDetail, Guid> detailRepository
|
|||
|
|||
) |
|||
{ |
|||
_excelImportService = excelImportService; |
|||
_repository = repository; |
|||
_wRepository = wRepository; |
|||
_mRepository = mRepository; |
|||
_sRepository = sRepository; |
|||
} |
|||
public virtual async Task<string> GenerateInvoice(INVOICE_GRP_REQ_DTO input) |
|||
{ |
|||
return ApplicationConsts.SuccessStr; |
|||
|
|||
} |
|||
|
|||
[HttpPost] |
|||
//[Route("mainquery")]
|
|||
public virtual async Task<PagedResultDto<INVOICE_GRP_DTO>> MainQueryAsync(INVOICE_GRP_REQ_DTO input) |
|||
{ |
|||
var entitys = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount); |
|||
var totalCount = await _repository.GetCountByFilterAsync(input.Filters); |
|||
var dtos = ObjectMapper.Map<List<INVOICE_GRP>, List<INVOICE_GRP_DTO>>(entitys); |
|||
return new PagedResultDto<INVOICE_GRP_DTO>(totalCount, dtos); |
|||
} |
|||
[HttpPost] |
|||
public virtual async Task<INVOICE_GRP_DETAIL_DTO> DetailQueryAsync(INVOICE_GRP_REQ_DTO input) |
|||
{ |
|||
|
|||
INVOICE_GRP_DETAIL_DTO _entity=new INVOICE_GRP_DETAIL_DTO(); |
|||
var m= await _mRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount); |
|||
var mdtos = ObjectMapper.Map<List<INVOICE_MAP_GROUP>, List<INVOICE_MAP_GROUP_DTO>>(m); |
|||
var w=await _wRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount); |
|||
var wdtos = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(w); |
|||
var s=await _sRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount); |
|||
var sdtos = ObjectMapper.Map<List<INVOICE_NOT_SETTLE>, List<INVOICE_NOT_SETTLE_DTO>>(s); |
|||
_entity.INVOICE_NOT_SETTLE = sdtos; |
|||
_entity.INVOICE_WAIT_DETAIL = wdtos; |
|||
_entity.INVOICE_MAP_GROUP = mdtos; |
|||
return _entity; |
|||
|
|||
|
|||
} |
|||
[HttpPost] |
|||
public virtual async Task<string> ExportAsync(INVOICE_GRP_REQ_DTO input) |
|||
{ |
|||
IExporter _csv = new CsvExporter(); |
|||
IExporter _excel = new ExcelExporter(); |
|||
|
|||
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true); |
|||
var dtoDetails = ObjectMapper.Map<List<INVOICE_GRP>, List<INVOICE_GRP_EXPORT_DTO>>(entities); |
|||
|
|||
var classDisplayName = typeof(INVOICE_GRP_DTO).GetCustomAttribute<DisplayAttribute>()?.Name ?? typeof(INVOICE_GRP_DTO).Name; |
|||
string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx"; |
|||
byte[] result = null; |
|||
|
|||
switch (input.FileType) |
|||
{ |
|||
case 0: |
|||
result = await _csv.ExportAsByteArray(dtoDetails); |
|||
break; |
|||
case 1: |
|||
result = await _excel.ExportAsByteArray(dtoDetails); |
|||
break; |
|||
} |
|||
result.ShouldNotBeNull(); |
|||
|
|||
//保存导出文件到服务器存成二进制
|
|||
await _excelImportService.SaveBlobAsync( |
|||
new SaveExcelImportInputDto |
|||
{ |
|||
Name = _fileName, |
|||
Content = result |
|||
} |
|||
); |
|||
return _fileName; |
|||
} |
|||
[HttpPost] |
|||
public virtual async Task<string> RejectAsync(INVOICE_GRP_REQ_DTO input) |
|||
{ |
|||
return ApplicationConsts.SuccessStr; ; |
|||
|
|||
} |
|||
} |
|||
} |
@ -0,0 +1,12 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Bases |
|||
{ |
|||
internal class PD_SERVICE |
|||
{ |
|||
} |
|||
} |
@ -1,17 +1,24 @@ |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Components; |
|||
using SettleAccount.Domain.BQ; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Services; |
|||
using Win.Sfs.BaseData.ImportExcelCommon; |
|||
using Win.Sfs.SettleAccount.Bases; |
|||
using Win.Sfs.Shared.RepositoryBase; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ |
|||
{ |
|||
[AllowAnonymous] |
|||
[Route("api/settleaccount/hbpo_ba_service")] |
|||
public class HBPO_BA_SERVICE : ApplicationService |
|||
public class HBPO_BA_SERVICE : BA_SERVICE |
|||
{ |
|||
public HBPO_BA_SERVICE(INormalEfCoreRepository<INVOICE_GRP, Guid> repository, INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> wRepository, INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository, INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository, IExcelImportAppService excelImportService) : base(repository, wRepository, sRepository, mRepository, excelImportService) |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
|
@ -0,0 +1,134 @@ |
|||
using Magicodes.ExporterAndImporter.Core; |
|||
using Magicodes.ExporterAndImporter.Csv; |
|||
using Magicodes.ExporterAndImporter.Excel; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using SettleAccount.Domain.BQ; |
|||
using Shouldly; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Linq; |
|||
using System.Reflection; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.Application.Services; |
|||
using Win.Sfs.BaseData.ImportExcelCommon; |
|||
using Win.Sfs.SettleAccount.Entities.BQ.Dtos; |
|||
using Win.Sfs.Shared.RepositoryBase; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ |
|||
{ |
|||
public class INVOICE_SERVICE:ApplicationService |
|||
{ |
|||
private readonly INormalEfCoreRepository<INVOICE_GRP, Guid> _repository; |
|||
private readonly INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> _wRepository; |
|||
private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _sRepository; |
|||
private readonly INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> _mRepository; |
|||
//private readonly INormalEfCoreRepository<TEntityDetail, Guid> _detailRepository;
|
|||
private readonly IExcelImportAppService _excelImportService; |
|||
|
|||
protected INVOICE_SERVICE( |
|||
INormalEfCoreRepository<INVOICE_GRP, Guid> repository, |
|||
INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> wRepository, |
|||
INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository, |
|||
INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository, |
|||
IExcelImportAppService excelImportService |
|||
//INormalEfCoreRepository<TEntityDetail, Guid> detailRepository
|
|||
|
|||
) |
|||
{ |
|||
_excelImportService = excelImportService; |
|||
_repository = repository; |
|||
_wRepository = wRepository; |
|||
_mRepository = mRepository; |
|||
_sRepository = sRepository; |
|||
} |
|||
public virtual async Task<string> ApprovalPassed(INVOICE_GRP_REQ_DTO input) |
|||
{ |
|||
return string.Empty; |
|||
|
|||
} |
|||
|
|||
[HttpPost] |
|||
//[Route("mainquery")]
|
|||
public virtual async Task<PagedResultDto<INVOICE_GRP_DTO>> MainQueryAsync(INVOICE_GRP_REQ_DTO input) |
|||
{ |
|||
var entitys = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount); |
|||
var totalCount = await _repository.GetCountByFilterAsync(input.Filters); |
|||
var dtos = ObjectMapper.Map<List<INVOICE_GRP>, List<INVOICE_GRP_DTO>>(entitys); |
|||
return new PagedResultDto<INVOICE_GRP_DTO>(totalCount, dtos); |
|||
} |
|||
public virtual async Task<INVOICE_GRP_DETAIL_DTO> DetailQueryAsync(INVOICE_GRP_REQ_DTO input) |
|||
{ |
|||
|
|||
INVOICE_GRP_DETAIL_DTO _entity = new INVOICE_GRP_DETAIL_DTO(); |
|||
var m = await _mRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount); |
|||
var mdtos = ObjectMapper.Map<List<INVOICE_MAP_GROUP>, List<INVOICE_MAP_GROUP_DTO>>(m); |
|||
var w = await _wRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount); |
|||
var wdtos = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(w); |
|||
var s = await _sRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount); |
|||
var sdtos = ObjectMapper.Map<List<INVOICE_NOT_SETTLE>, List<INVOICE_NOT_SETTLE_DTO>>(s); |
|||
_entity.INVOICE_NOT_SETTLE = sdtos; |
|||
_entity.INVOICE_WAIT_DETAIL = wdtos; |
|||
_entity.INVOICE_MAP_GROUP = mdtos; |
|||
return _entity; |
|||
|
|||
|
|||
} |
|||
public virtual async Task<string> ExportAsync(INVOICE_GRP_REQ_DTO input) |
|||
{ |
|||
IExporter _csv = new CsvExporter(); |
|||
IExporter _excel = new ExcelExporter(); |
|||
|
|||
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true); |
|||
var dtoDetails = ObjectMapper.Map<List<INVOICE_GRP>, List<INVOICE_GRP_EXPORT_DTO>>(entities); |
|||
|
|||
var classDisplayName = typeof(INVOICE_GRP_DTO).GetCustomAttribute<DisplayAttribute>()?.Name ?? typeof(INVOICE_GRP_DTO).Name; |
|||
string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx"; |
|||
byte[] result = null; |
|||
|
|||
switch (input.FileType) |
|||
{ |
|||
case 0: |
|||
result = await _csv.ExportAsByteArray(dtoDetails); |
|||
break; |
|||
case 1: |
|||
result = await _excel.ExportAsByteArray(dtoDetails); |
|||
break; |
|||
} |
|||
result.ShouldNotBeNull(); |
|||
|
|||
//保存导出文件到服务器存成二进制
|
|||
await _excelImportService.SaveBlobAsync( |
|||
new SaveExcelImportInputDto |
|||
{ |
|||
Name = _fileName, |
|||
Content = result |
|||
} |
|||
); |
|||
return _fileName; |
|||
} |
|||
|
|||
public virtual async Task<string> RejectAsync(INVOICE_GRP_REQ_DTO input) |
|||
{ |
|||
return string.Empty; |
|||
|
|||
} |
|||
public virtual async Task<string> Sync_QAD(INVOICE_GRP_REQ_DTO input) |
|||
{ |
|||
return string.Empty; |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
} |
@ -1,17 +1,24 @@ |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Components; |
|||
using SettleAccount.Domain.BQ; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Services; |
|||
using Win.Sfs.BaseData.ImportExcelCommon; |
|||
using Win.Sfs.SettleAccount.Bases; |
|||
using Win.Sfs.Shared.RepositoryBase; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ |
|||
{ |
|||
[AllowAnonymous] |
|||
[Route("api/settleaccount/pub_ba_service")] |
|||
public class PUB_BA_SERVICE : ApplicationService |
|||
public class PUB_BA_SERVICE : BA_SERVICE |
|||
{ |
|||
public PUB_BA_SERVICE(INormalEfCoreRepository<INVOICE_GRP, Guid> repository, INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> wRepository, INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository, INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository, IExcelImportAppService excelImportService) : base(repository, wRepository, sRepository, mRepository, excelImportService) |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
|
Loading…
Reference in new issue