wanggang
1 year ago
20 changed files with 4544 additions and 56 deletions
@ -0,0 +1,94 @@ |
|||
using Shouldly; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Services; |
|||
using Volo.Abp.Caching; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Domain.Entities; |
|||
using Win.Abp.Snowflakes; |
|||
using Win.Sfs.BaseData.ImportExcelCommon; |
|||
using Win.Sfs.SettleAccount.CommonManagers; |
|||
using Win.Sfs.SettleAccount.Constant; |
|||
using Win.Sfs.SettleAccount.ExcelImporter; |
|||
using Win.Sfs.SettleAccount.ExportReports; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Bases |
|||
{ |
|||
|
|||
|
|||
public abstract class BASE_SERVICE: ApplicationService, ITransientDependency |
|||
{ |
|||
|
|||
|
|||
protected readonly IExcelImportAppService _excelImportService; |
|||
|
|||
protected readonly ISnowflakeIdGenerator _snowflakeIdGenerator; |
|||
|
|||
protected readonly ICommonManager _commonManager; |
|||
|
|||
protected BASE_SERVICE() { } |
|||
|
|||
protected BASE_SERVICE( |
|||
|
|||
IExcelImportAppService excelImportService, |
|||
ISnowflakeIdGenerator snowflakeIdGenerator, |
|||
ICommonManager commonManager) |
|||
{ |
|||
_excelImportService = excelImportService; |
|||
_snowflakeIdGenerator = snowflakeIdGenerator; |
|||
_commonManager = commonManager; |
|||
|
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 输出报错信息
|
|||
/// </summary>
|
|||
/// <param name="errorList"></param>
|
|||
/// <param name="fileName"></param>
|
|||
/// <returns></returns>
|
|||
protected async Task<string> ExportErrorReportAsync(List<ErrorExportDto> errorList, string fileName = "") |
|||
{ |
|||
//没有信息返回成功
|
|||
if (errorList == null || errorList.Count == 0) |
|||
{ |
|||
return ApplicationConsts.SuccessStr; |
|||
} |
|||
|
|||
if (string.IsNullOrEmpty(fileName)) |
|||
{ |
|||
//导出文件名称
|
|||
fileName = CommonMethod.GetExcelFileNameByUserID(ApplicationConsts.CheckErroFileName, _snowflakeIdGenerator.Create().ToString(), ApplicationConsts.FileExtension); |
|||
} |
|||
|
|||
errorList = errorList.Distinct().OrderBy(p => p.Type).ThenBy(p => p.Model).ThenBy(p => p.ItemCode).ToList(); |
|||
|
|||
//声明导出容器
|
|||
ExportImporter _exportImporter = new ExportImporter(); |
|||
|
|||
var result = await _exportImporter.ExcelExporter(errorList); |
|||
|
|||
result.ShouldNotBeNull(); |
|||
|
|||
//保存导出文件到服务器存成二进制
|
|||
await _excelImportService.SaveBlobAsync( |
|||
new SaveExcelImportInputDto |
|||
{ |
|||
Name = fileName, |
|||
Content = result |
|||
} |
|||
); |
|||
return fileName; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
} |
File diff suppressed because it is too large
@ -0,0 +1,56 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Migrations |
|||
{ |
|||
public partial class _202307191 : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AddColumn<string>( |
|||
name: "ContractNo", |
|||
table: "Set_PriceListBJ", |
|||
type: "nvarchar(max)", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.AddColumn<DateTime>( |
|||
name: "Date", |
|||
table: "Set_PriceListBJ", |
|||
type: "datetime2", |
|||
nullable: false, |
|||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); |
|||
|
|||
migrationBuilder.AddColumn<string>( |
|||
name: "ContractNo", |
|||
table: "Set_PriceList", |
|||
type: "nvarchar(max)", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.AddColumn<DateTime>( |
|||
name: "Date", |
|||
table: "Set_PriceList", |
|||
type: "datetime2", |
|||
nullable: false, |
|||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropColumn( |
|||
name: "ContractNo", |
|||
table: "Set_PriceListBJ"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "Date", |
|||
table: "Set_PriceListBJ"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "ContractNo", |
|||
table: "Set_PriceList"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "Date", |
|||
table: "Set_PriceList"); |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue