mahao
1 year ago
6 changed files with 260 additions and 5 deletions
@ -0,0 +1,131 @@ |
|||
using System; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using Magicodes.ExporterAndImporter.Core; |
|||
using Volo.Abp.Application.Dtos; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos |
|||
{ |
|||
/// <summary>
|
|||
/// 发票同步Qad
|
|||
/// </summary>
|
|||
public class InvoiceSyncQadDto : AuditedEntityDto<Guid> |
|||
{ |
|||
/// <summary>
|
|||
/// 状态
|
|||
/// </summary>
|
|||
[Display(Name = "状态")] |
|||
public int TaskState { get; set; } |
|||
/// <summary>
|
|||
/// 任务ID
|
|||
/// </summary>
|
|||
[Display(Name = "任务ID")] |
|||
public Guid TaskID { get; set; } |
|||
/// <summary>
|
|||
/// 表名
|
|||
/// </summary>
|
|||
[Display(Name = "表名")] |
|||
public string TaskName { get; set; } |
|||
/// <summary>
|
|||
/// 信息
|
|||
/// </summary>
|
|||
[Display(Name = "信息")] |
|||
public string Failedinfo { get; set; } |
|||
/// <summary>
|
|||
/// 域
|
|||
/// </summary>
|
|||
[Display(Name = "域")] |
|||
public string Domain { get; set; } |
|||
/// <summary>
|
|||
/// 地点
|
|||
/// </summary>
|
|||
[Display(Name = "地点")] |
|||
public string Site { get; set; } |
|||
/// <summary>
|
|||
/// 金税发票号
|
|||
/// </summary>
|
|||
[Display(Name = "金税发票号")] |
|||
public string InvoiceNumber { get; set; } |
|||
/// <summary>
|
|||
/// 结算发票号
|
|||
/// </summary>
|
|||
[Display(Name = "结算发票号")] |
|||
public string SaslnvoiceNumber { get; set; } |
|||
/// <summary>
|
|||
/// 客户
|
|||
/// </summary>
|
|||
[Display(Name = "客户")] |
|||
public string Customer { get; set; } |
|||
/// <summary>
|
|||
/// 凭证号
|
|||
/// </summary>
|
|||
[Display(Name = "凭证号")] |
|||
public string Voucher { get; set; } |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 导出
|
|||
/// </summary>
|
|||
public class InvoiceSyncQadExportDto |
|||
{ |
|||
/// <summary>
|
|||
/// 状态
|
|||
/// </summary>
|
|||
[Display(Name = "状态")] |
|||
[ExporterHeader(DisplayName = "状态")] |
|||
public int TaskState { get; set; } |
|||
/// <summary>
|
|||
/// 任务ID
|
|||
/// </summary>
|
|||
[Display(Name = "任务ID")] |
|||
[ExporterHeader(DisplayName = "任务ID")] |
|||
public Guid TaskID { get; set; } |
|||
/// <summary>
|
|||
/// 表名
|
|||
/// </summary>
|
|||
[Display(Name = "表名")] |
|||
[ExporterHeader(DisplayName = "表名")] |
|||
public string TaskName { get; set; } |
|||
/// <summary>
|
|||
/// 信息
|
|||
/// </summary>
|
|||
[Display(Name = "信息")] |
|||
[ExporterHeader(DisplayName = "信息")] |
|||
public string Failedinfo { get; set; } |
|||
/// <summary>
|
|||
/// 域
|
|||
/// </summary>
|
|||
[Display(Name = "域")] |
|||
[ExporterHeader(DisplayName = "域")] |
|||
public string Domain { get; set; } |
|||
/// <summary>
|
|||
/// 地点
|
|||
/// </summary>
|
|||
[Display(Name = "地点")] |
|||
[ExporterHeader(DisplayName = "地点")] |
|||
public string Site { get; set; } |
|||
/// <summary>
|
|||
/// 金税发票号
|
|||
/// </summary>
|
|||
[Display(Name = "金税发票号")] |
|||
[ExporterHeader(DisplayName = "金税发票号")] |
|||
public string InvoiceNumber { get; set; } |
|||
/// <summary>
|
|||
/// 结算发票号
|
|||
/// </summary>
|
|||
[Display(Name = "结算发票号")] |
|||
[ExporterHeader(DisplayName = "结算发票号")] |
|||
public string SaslnvoiceNumber { get; set; } |
|||
/// <summary>
|
|||
/// 客户
|
|||
/// </summary>
|
|||
[Display(Name = "客户")] |
|||
[ExporterHeader(DisplayName = "客户")] |
|||
public string Customer { get; set; } |
|||
/// <summary>
|
|||
/// 凭证号
|
|||
/// </summary>
|
|||
[Display(Name = "凭证号")] |
|||
[ExporterHeader(DisplayName = "凭证号")] |
|||
public string Voucher { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,77 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.Extensions.Logging; |
|||
using SettleAccount.Domain.BQ; |
|||
using Shouldly; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.Caching; |
|||
using Win.Abp.Snowflakes; |
|||
using Win.Sfs.BaseData.ImportExcelCommon; |
|||
using Win.Sfs.SettleAccount.CommonManagers; |
|||
using Win.Sfs.SettleAccount.Entities.BQ.Dtos; |
|||
using Win.Sfs.SettleAccount.ExcelImporter; |
|||
using Win.Sfs.Shared.RepositoryBase; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ |
|||
{ |
|||
/// <summary>
|
|||
/// 发票同步Qad
|
|||
/// </summary>
|
|||
[AllowAnonymous] |
|||
[Route("api/settleaccount/[controller]/[action]")]
|
|||
public class InvoiceSyncQadService : SettleAccountApplicationBase<InvoiceSyncQad> |
|||
{ |
|||
private readonly ILogger<InvoiceSyncQadService> _logger; |
|||
private readonly INormalEfCoreRepository<InvoiceSyncQad, Guid> _repository; |
|||
|
|||
public InvoiceSyncQadService( |
|||
ILogger<InvoiceSyncQadService> logger, |
|||
INormalEfCoreRepository<InvoiceSyncQad, Guid> repository, |
|||
IDistributedCache<InvoiceSyncQad> cache, |
|||
IExcelImportAppService excelImportService, |
|||
ISnowflakeIdGenerator snowflakeIdGenerator, |
|||
ICommonManager commonManager |
|||
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) |
|||
{ |
|||
_logger = logger; |
|||
_repository = repository; |
|||
} |
|||
|
|||
#region 导入、导出
|
|||
/// <summary>
|
|||
/// 导出
|
|||
/// </summary>
|
|||
[HttpPost] |
|||
public async Task<string> ExportAsync(RequestDto input) |
|||
{ |
|||
var fileName = $"Qad发票同步状态_{Guid.NewGuid()}.xlsx"; |
|||
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true).ConfigureAwait(false); |
|||
var dtos = ObjectMapper.Map<List<InvoiceSyncQad>, List<InvoiceSyncQadExportDto>>(entities); |
|||
|
|||
var exportImporter = new ExportImporter(); |
|||
var result = await exportImporter.ExcelExporter(dtos).ConfigureAwait(false); |
|||
result.ShouldNotBeNull(); |
|||
|
|||
await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result }).ConfigureAwait(false); |
|||
return fileName; |
|||
} |
|||
#endregion
|
|||
|
|||
#region CURD
|
|||
/// <summary>
|
|||
/// 获取列表
|
|||
/// </summary>
|
|||
[HttpPost] |
|||
public async Task<PagedResultDto<InvoiceSyncQadDto>> GetListAsync(RequestDto input) |
|||
{ |
|||
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false); |
|||
var totalCount = await _repository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false); |
|||
var dtos = ObjectMapper.Map<List<InvoiceSyncQad>, List<InvoiceSyncQadDto>>(entities); |
|||
return new PagedResultDto<InvoiceSyncQadDto>(totalCount, dtos); |
|||
} |
|||
#endregion
|
|||
} |
|||
} |
Loading…
Reference in new issue