diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/MaterialRelationship/IMaterialRelationshipAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/MaterialRelationship/IMaterialRelationshipAppService.cs index 4eb83bf6..1e08ca1c 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/MaterialRelationship/IMaterialRelationshipAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/MaterialRelationship/IMaterialRelationshipAppService.cs @@ -1,22 +1,6 @@ -锘縰sing System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.Application.Services; -using Win.Sfs.SettleAccount.MaterialRelationships; -using Win.Sfs.Shared.ApplicationBase; - -namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships +锘縩amespace Win.Sfs.SettleAccount.Entities.MaterialRelationships { - public interface IMaterialRelationshipAppService : ICrudAppService, - IBranchBaseDataAppService - + public interface IMaterialRelationshipAppService { } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/MaterialRelationship/MaterialRelationshipDtoBase.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/MaterialRelationship/MaterialRelationshipDtoBase.cs index af306943..51f1625b 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/MaterialRelationship/MaterialRelationshipDtoBase.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/MaterialRelationship/MaterialRelationshipDtoBase.cs @@ -108,14 +108,6 @@ namespace Win.Sfs.SettleAccount.MaterialRelationships - } - - /// - /// FIS - /// - public class MaterialRelationshipRequestDto : RequestDtoBase - { - } /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PURCHASE_PRICE_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PURCHASE_PRICE_SERVICE.cs index b2f236ef..56bc276b 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PURCHASE_PRICE_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PURCHASE_PRICE_SERVICE.cs @@ -16,8 +16,6 @@ using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Entities.BQ.Dtos; using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.SettleAccount.ExportReports; -using Win.Sfs.SettleAccount.MaterialRelationships; -using Win.Sfs.Shared.DtoBase; using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.BQ diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Boms/BomAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Boms/BomAppService.cs index 1541afeb..d54a51e2 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Boms/BomAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Boms/BomAppService.cs @@ -1,48 +1,27 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Threading.Tasks; -using EFCore.BulkExtensions; -using Magicodes.ExporterAndImporter.Core; -using Magicodes.ExporterAndImporter.Csv; -using Magicodes.ExporterAndImporter.Excel; using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Caching.Distributed; using Shouldly; -using Volo.Abp; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; using Volo.Abp.Caching; -using Volo.Abp.Domain.Repositories; using Volo.Abp.Guids; using Volo.Abp.ObjectMapping; -using Volo.Abp.Uow; using Win.Abp.Snowflakes; using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.CommonManagers; -using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Entities.Boms; -using Win.Sfs.SettleAccount.Entities.Controls; using Win.Sfs.SettleAccount.Entities.ImportMap; using Win.Sfs.SettleAccount.Entities.Materials; using Win.Sfs.SettleAccount.ExcelImporter; -using Win.Sfs.SettleAccount.ExportReports; -using Win.Sfs.Shared.CacheBase; -using Win.Sfs.Shared.Filter; using Win.Sfs.Shared.RepositoryBase; -using Win.Utils; namespace Win.Sfs.SettleAccount.Boms { - /// /// BOM /// - //[Authorize(SettleAccountPermissions.Boms.Default)] [AllowAnonymous] [Route("api/settleaccount/BomAppService")] public class BomAppService : SettleAccountApplicationBase @@ -52,46 +31,21 @@ namespace Win.Sfs.SettleAccount.Boms /// private readonly INormalEfCoreRepository _repository; - private readonly IGuidGenerator _guidGenerator; - - private readonly IObjectMapper _objectMapper; - - private readonly IExcelImportAppService _excelImportService; - - private readonly ISettleAccountBranchEfCoreRepository _materialRepository; - - private readonly ISettleAccountBranchEfCoreRepository _importColumnMapRepository; - - private readonly ISettleAccountBranchEfCoreRepository _versionRepository; - /// - /// 构造方法 + /// 构造 /// public BomAppService( INormalEfCoreRepository repository, - IGuidGenerator guidGenerator, - IObjectMapper objectMapper, - IExcelImportAppService excelImportService, - ISnowflakeIdGenerator snowflakeIdGenerator, - ICommonManager commonManager, - ISettleAccountBranchEfCoreRepository versionRepository, - ISettleAccountBranchEfCoreRepository materialRepository, - ISettleAccountBranchEfCoreRepository importColumnMapRepository, - IDistributedCache cache - ) : base(cache,excelImportService,snowflakeIdGenerator,commonManager) + IDistributedCache cache, + IExcelImportAppService excelImportService, + ISnowflakeIdGenerator snowflakeIdGenerator, + ICommonManager commonManager + ) : base(cache,excelImportService,snowflakeIdGenerator,commonManager) { _repository = repository; - - _guidGenerator = guidGenerator; - _objectMapper = objectMapper; - - _excelImportService = excelImportService; - _versionRepository = versionRepository; - _materialRepository = materialRepository; - _importColumnMapRepository = importColumnMapRepository; } - #region 导入、导出 + #region 导出 /// /// 导出 /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Controls/CentralizedControlAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Controls/CentralizedControlAppService.cs index b5ae7bb8..974f55a4 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Controls/CentralizedControlAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Controls/CentralizedControlAppService.cs @@ -1,42 +1,22 @@ -锘縰sing System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using EFCore.BulkExtensions; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http; +锘縰sing Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Caching.Distributed; using Shouldly; -using Volo.Abp; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; using Volo.Abp.Caching; -using Volo.Abp.Domain.Repositories; -using Volo.Abp.Guids; -using Volo.Abp.ObjectMapping; -using Volo.Abp.Uow; using Win.Abp.Snowflakes; using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.CommonManagers; -using Win.Sfs.SettleAccount.Constant; -using Win.Sfs.SettleAccount.Entities.CodeSettings; -using Win.Sfs.SettleAccount.Entities.ImportMap; -using Win.Sfs.SettleAccount.Entities.Materials; using Win.Sfs.SettleAccount.ExcelImporter; -using Win.Sfs.SettleAccount.MaterialRelationships; -using Win.Sfs.Shared.CacheBase; using Win.Sfs.Shared.RepositoryBase; -using Win.Utils; namespace Win.Sfs.SettleAccount.Entities.Controls { /// /// 鏈熼棿璁剧疆 /// - //[Authorize(SettleAccountPermissions.CentralizedControls.Default)] [AllowAnonymous] [Route("api/settleaccount/CentralizedControl")] public class CentralizedControlAppService : SettleAccountApplicationBase @@ -46,16 +26,11 @@ namespace Win.Sfs.SettleAccount.Entities.Controls /// private readonly INormalEfCoreRepository _repository; - private readonly ISettleAccountBranchEfCoreRepository _mapRepository; - - private readonly IExcelImportAppService _excelImportService; /// - /// 鏋勫缓鏂规硶 + /// 鏋勯 /// public CentralizedControlAppService( INormalEfCoreRepository repository, - IGuidGenerator guidGenerator, - IObjectMapper objectMapper, IDistributedCache cache, IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, @@ -63,10 +38,9 @@ namespace Win.Sfs.SettleAccount.Entities.Controls ) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) { _repository = repository; - _excelImportService = excelImportService; } - #region 瀵煎叆銆佸鍑 + #region 瀵煎嚭 /// /// 瀵煎嚭 /// @@ -103,6 +77,9 @@ namespace Win.Sfs.SettleAccount.Entities.Controls #endregion #region 寮鍚佸叧闂 + /// + /// 寮鍚増鏈 + /// [HttpPost] [Route("open")] public async Task OpenVersion(List ids) @@ -115,11 +92,11 @@ namespace Win.Sfs.SettleAccount.Entities.Controls return true; } - [HttpPost] - [Route("close")] /// /// 鍏抽棴鐗堟湰 /// + [HttpPost] + [Route("close")] public async Task ClosedVersion(List ids) { var entitys = await _repository.GetListAsync(p => ids.Contains(p.Id)); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/MaterialRelationships/MaterialRelationshipAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/MaterialRelationships/MaterialRelationshipAppService.cs index a0df79bc..f5935648 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/MaterialRelationships/MaterialRelationshipAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/MaterialRelationships/MaterialRelationshipAppService.cs @@ -29,6 +29,7 @@ using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.SettleAccount.ExportReports; using Win.Sfs.SettleAccount.MaterialRelationships; using Win.Sfs.Shared.CacheBase; +using Win.Sfs.Shared.DtoBase; using Win.Sfs.Shared.RepositoryBase; using Win.Utils; @@ -37,7 +38,6 @@ namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships /// /// 瀹㈡埛闆朵欢鍏崇郴 /// - //[Authorize(SettleAccountPermissions.MaterialRelationships.Default)] [AllowAnonymous] [Route("api/settleaccount/MaterialRelationshipAppService")] public class MaterialRelationshipAppService : SettleAccountApplicationBase @@ -47,17 +47,11 @@ namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships /// private readonly INormalEfCoreRepository _repository; - private readonly ISettleAccountBranchEfCoreRepository _mapRepository; - private readonly IExcelImportAppService _excelImportService; - /// - /// 鏋勯犳柟娉 + /// 鏋勯 /// public MaterialRelationshipAppService( INormalEfCoreRepository repository, - IGuidGenerator guidGenerator, - IObjectMapper objectMapper, - ISettleAccountBranchEfCoreRepository mapRepository, IDistributedCache cache, IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, @@ -65,9 +59,6 @@ namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships ) : base(cache,excelImportService,snowflakeIdGenerator,commonManager) { _repository = repository; - - _mapRepository = mapRepository; - _excelImportService = excelImportService; } #region 瀵煎叆銆佸鍑 @@ -122,7 +113,7 @@ namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships /// [HttpPost] [Route("Export")] - public async Task ExportAsync(MaterialRelationshipRequestDto input) + public async Task ExportAsync(RequestDtoBase input) { string fileName = $"瀹㈡埛闆朵欢鍏崇郴_{Guid.NewGuid()}.xlsx"; var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true); @@ -143,7 +134,7 @@ namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships /// [HttpPost] [Route("list")] - public async Task> GetListAsync(MaterialRelationshipRequestDto input) + public async Task> GetListAsync(RequestDtoBase input) { var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true); var totalCount = await _repository.GetCountByFilterAsync(input.Filters); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Materials/MaterialAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Materials/MaterialAppService.cs index 779153fd..0d95ac09 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Materials/MaterialAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Materials/MaterialAppService.cs @@ -1,7 +1,5 @@ 锘縰sing Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; using Shouldly; using System; using System.Collections.Generic; @@ -10,16 +8,8 @@ using Volo.Abp.Application.Dtos; using Volo.Abp.Caching; using Win.Abp.Snowflakes; using Win.Sfs.BaseData.ImportExcelCommon; -using Win.Sfs.SettleAccount.Boms; using Win.Sfs.SettleAccount.CommonManagers; -using Win.Sfs.SettleAccount.Constant; -using Win.Sfs.SettleAccount.Entities.Boms; -using Win.Sfs.SettleAccount.Entities.ImportMap; -using Win.Sfs.SettleAccount.Entities.Prices; -using Win.Sfs.SettleAccount.Entities.TaskJobs; using Win.Sfs.SettleAccount.ExcelImporter; -using Win.Sfs.SettleAccount.ExportReports; -using Win.Sfs.SettleAccount.MaterialRelationships; using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.Materials @@ -27,50 +17,27 @@ namespace Win.Sfs.SettleAccount.Entities.Materials /// /// 鐗╂枡涓绘暟鎹 /// - //[Authorize(SettleAccountPermissions.Materials.Default)] [AllowAnonymous] [Route("api/settleaccount/MaterialAppService")] public class MaterialAppService : SettleAccountApplicationBase { - private readonly IExcelImportAppService _excelImportService; + /// + /// 鐗╂枡涓绘暟鎹粨鍌 + /// private readonly INormalEfCoreRepository _repository; - private readonly ISettleAccountBranchEfCoreRepository _bomRepository; - private readonly ISettleAccountBranchEfCoreRepository _bomversionRepository; - private readonly ISettleAccountBranchEfCoreRepository _priceRepository; - private readonly ISettleAccountBranchEfCoreRepository _priceversionRepository; - private readonly ISettleAccountBranchEfCoreRepository _mapRepository; - private readonly ISettleAccountBranchEfCoreRepository _relationshipRepository; - /// - /// 鏋勫缓鏂规硶 + /// 鏋勯 /// public MaterialAppService( INormalEfCoreRepository repository, - ISettleAccountBranchEfCoreRepository mapRepository, - ISettleAccountBranchEfCoreRepository bomRepository, - ISettleAccountBranchEfCoreRepository bomversionRepository, - TaskJobService service, - ISettleAccountBranchEfCoreRepository relationshipRepository, - ISettleAccountBranchEfCoreRepository priceRepository, - ISettleAccountBranchEfCoreRepository priceversionRepository, - - IDistributedCache cache, + IDistributedCache cache, IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager - - ) : base(cache,excelImportService,snowflakeIdGenerator,commonManager) + ) : base(cache,excelImportService,snowflakeIdGenerator,commonManager) { - _priceRepository = priceRepository; - _priceversionRepository = priceversionRepository; - _bomRepository = bomRepository; - _excelImportService = excelImportService; - _repository = repository; - _relationshipRepository = relationshipRepository; - _mapRepository = mapRepository; - _bomversionRepository = bomversionRepository; - + _repository = repository; } #region 瀵煎叆銆佸鍑 @@ -79,7 +46,6 @@ namespace Win.Sfs.SettleAccount.Entities.Materials /// [HttpPost] [Route("Export")] - //[Authorize(SettleAccountPermissions.Materials.Default)] public virtual async Task ExportAsync(MaterialRequestDto input) { string _fileName = string.Format("鐗╂枡涓绘暟鎹甠{0}.xlsx", DateTime.Now.ToString("yyyyMMdd")); @@ -112,7 +78,6 @@ namespace Win.Sfs.SettleAccount.Entities.Materials /// [HttpPost] [Route("list")] - //[Authorize(SettleAccountPermissions.Materials.Default)] virtual public async Task> GetListAsync(MaterialRequestDto input) { var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs index 9c48ef60..d15c82e2 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs @@ -4,35 +4,25 @@ using Magicodes.ExporterAndImporter.Excel; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using Microsoft.OpenApi.Extensions; -using NPOI.SS.UserModel; -using SettleAccount.Job.Services.Report; using Shouldly; using System; using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.IO; using System.Linq; -using System.Reflection; -using System.Text; using System.Threading.Tasks; -using TaskJob.EventArgs; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; -using Volo.Abp.Uow; using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.Constant; +using Win.Sfs.SettleAccount.Entities.BQ.Dtos; using Win.Sfs.SettleAccount.Entities.ImportMap; using Win.Sfs.SettleAccount.Entities.TaskJobs; using Win.Sfs.SettleAccount.ExcelImporter; -using Win.Sfs.Shared.Filter; namespace Win.Sfs.SettleAccount.Entities.Prices { /// - /// 鏍囧噯浠锋牸鍗-鐩稿叧搴旂敤鏈嶅姟 + /// 閿鍞环鏍煎崟 /// - //[Authorize(SettleAccountPermissions.PriceLists.Default)] [Route("api/SettleAccount/TB_PRICE_LIST_Service")] [AllowAnonymous] public class PriceListAppService : ApplicationService @@ -55,15 +45,15 @@ namespace Win.Sfs.SettleAccount.Entities.Prices } #region 瀵煎叆銆佸鍑 - /// - /// 鑾峰彇瀵煎叆妯℃澘 - /// - [HttpPost("import-template")] - public virtual async Task ImportTemplateAsync() - { - await Task.CompletedTask; - return new Microsoft.AspNetCore.Mvc.OkResult(); - } + ///// + ///// 鑾峰彇瀵煎叆妯℃澘 + ///// + //[HttpPost("import-template")] + //public virtual async Task ImportTemplateAsync() + //{ + // await Task.CompletedTask; + // return new Microsoft.AspNetCore.Mvc.OkResult(); + //} /// /// 瀵煎叆 @@ -100,7 +90,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices /// [HttpPost] [Route("Export")] - public virtual async Task ExportAsync(TB_PRICE_LIST_RequestDto input) + public virtual async Task ExportAsync(RequestDto input) { IExporter _csv = new CsvExporter(); @@ -115,18 +105,8 @@ namespace Win.Sfs.SettleAccount.Entities.Prices string _fileName = string.Empty; //澹版槑瀵煎嚭瀹瑰櫒 - byte[] result = null; - switch (input.FileType) - { - case 0: - _fileName = string.Format("閿鍞环鏍煎崟_{0}.xlsx", Guid.NewGuid().ToString()); - result = await _csv.ExportAsByteArray(dtoDetails); - break; - case 1: - _fileName = string.Format("閿鍞环鏍煎崟_{0}.xlsx", Guid.NewGuid().ToString()); - result = await _excel.ExportAsByteArray(dtoDetails); - break; - } + _fileName = string.Format("閿鍞环鏍煎崟_{0}.xlsx", Guid.NewGuid().ToString()); + byte[] result = await _excel.ExportAsByteArray(dtoDetails); result.ShouldNotBeNull(); //淇濆瓨瀵煎嚭鏂囦欢鍒版湇鍔″櫒瀛樻垚浜岃繘鍒 @@ -147,12 +127,8 @@ namespace Win.Sfs.SettleAccount.Entities.Prices /// [HttpPost] [Route("list")] - public virtual async Task> GetListAsync(TB_PRICE_LIST_RequestDto input) + public virtual async Task> GetListAsync(RequestDto input) { - if (!string.IsNullOrEmpty(input.Version)) - { - input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version }); - } var entitys = await _priceListManager.GetListAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount); var totalCount = await _priceListManager.GetCountAsync(input.Filters, GuidGenerator.Create()); var dtos = ObjectMapper.Map, List>(entitys); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs index 02808812..105d4f5b 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs @@ -1,14 +1,18 @@ 锘縰sing Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using Shouldly; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Caching; +using Win.Abp.Snowflakes; using Win.Sfs.BaseData.ImportExcelCommon; -using Win.Sfs.SettleAccount.Bases; +using Win.Sfs.SettleAccount.CommonManagers; using Win.Sfs.SettleAccount.Constant; -using Win.Sfs.SettleAccount.Entities.ImportMap; +using Win.Sfs.SettleAccount.Entities.BQ.Dtos; using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.Shared.RepositoryBase; @@ -17,29 +21,24 @@ namespace Win.Sfs.SettleAccount.Entities.Prices /// /// 澶囦欢浠锋牸 /// - //[Authorize(SettleAccountPermissions.PriceLists.Default)] [AllowAnonymous] [Route("api/SettleAccount/TB_PRICE_BJ_Service")] - public class PriceListAppServiceBJ : CurdBaseAppService + public class PriceListAppServiceBJ : SettleAccountApplicationBase { private readonly INormalEfCoreRepository _repository; private readonly PriceListManagerBJ _priceListManagerBJ; - private readonly IExcelImportAppService _excelImportService; - private readonly ISettleAccountBranchEfCoreRepository _mapRepository; public PriceListAppServiceBJ( INormalEfCoreRepository repository, PriceListManagerBJ priceListManagerBJ, + IDistributedCache cache, IExcelImportAppService excelImportService, - ISettleAccountBranchEfCoreRepository mapRepository - - ) :base(repository: repository, excelImportService: excelImportService) + ISnowflakeIdGenerator snowflakeIdGenerator, + ICommonManager commonManager + ) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) { _repository = repository; _priceListManagerBJ = priceListManagerBJ; - _excelImportService = excelImportService; - - _mapRepository = mapRepository; } #region 瀵煎叆銆佸鍑 @@ -48,7 +47,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices /// [HttpPost] [Route("Import")] - public override async Task ImportAsync([FromForm] IFormFileCollection files, string version) + public async Task ImportAsync([FromForm] IFormFileCollection files, string version) { ExportImporter _exportImporter = new ExportImporter(); var result = await _exportImporter.UploadExcelImport(files, _excelImportService); @@ -68,6 +67,40 @@ namespace Win.Sfs.SettleAccount.Entities.Prices await _priceListManagerBJ.ImportAsync(_ls.ToList(), version); return ApplicationConsts.SuccessStr; } + + /// + /// 瀵煎嚭 + /// + [HttpPost] + [Route("Export")] + public async Task ExportAsync(RequestDto input) + { + string fileName = $"澶囦欢浠锋牸_{Guid.NewGuid()}.xlsx"; + var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true); + var dtos = ObjectMapper.Map, List>(entities); + + ExportImporter _exportImporter = new ExportImporter(); + var result = await _exportImporter.ExcelExporter(dtos); + result.ShouldNotBeNull(); + + await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result }); + return fileName; + } + #endregion + + #region CURD + /// + /// 鑾峰彇鍒楄〃 + /// + [HttpPost] + [Route("list")] + public async Task> GetListAsync(RequestDto input) + { + var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true); + var totalCount = await _repository.GetCountByFilterAsync(input.Filters); + var dtos = ObjectMapper.Map, List>(entities); + return new PagedResultDto(totalCount, dtos); + } #endregion #region 鍘熸湁鐨勬柟娉曚箣鍚庡簾寮冨垹闄