2025-07-04 10:47:18 +08:00
|
|
|
|
using MyCode.Project.Domain.Message.Act.Common;
|
2025-07-04 09:50:02 +08:00
|
|
|
|
using MyCode.Project.Domain.Repositories;
|
|
|
|
|
|
using MyCode.Project.Infrastructure.Common;
|
|
|
|
|
|
using MyCode.Project.OutSideService;
|
|
|
|
|
|
using MyCode.Project.Services.BLL.ReportExport;
|
|
|
|
|
|
|
|
|
|
|
|
namespace MyCode.Project.Services.Implementation
|
|
|
|
|
|
{
|
|
|
|
|
|
public class ReportService : ServiceBase, IReportService
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
#region 初始化
|
|
|
|
|
|
private readonly IRepository _repository;
|
|
|
|
|
|
|
|
|
|
|
|
private readonly IBfyService _bfyService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ReportService(IRepository repository,
|
|
|
|
|
|
IBfyService bfyService
|
|
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
{
|
|
|
|
|
|
_repository = repository;
|
|
|
|
|
|
_bfyService = bfyService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region ReportExportAnsy(异步执行导出)
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 异步执行导出,有带websocket异步推送
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="obj"></param>
|
|
|
|
|
|
public string ReportExportAnsy(object obj)
|
|
|
|
|
|
{
|
|
|
|
|
|
var act = JsonHelper.ToObject<AnsyReportExportAct>(obj.ToString());
|
|
|
|
|
|
|
|
|
|
|
|
return ReportExport(act);
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region ReportExportAnsy(异步执行导出)
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 异步执行导出,有带websocket异步推送
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="obj"></param>
|
|
|
|
|
|
public string ReportExport(AnsyReportExportAct act)
|
|
|
|
|
|
{
|
|
|
|
|
|
var export = ExportReportFactory.Create(act.ReportType);
|
|
|
|
|
|
export.Condition = act.Condition;
|
|
|
|
|
|
export.CurrentUser = act.CurrentUser;
|
|
|
|
|
|
export.ReportId = act.ReportId;
|
|
|
|
|
|
export.ExcelFileType = act.ExportFileType;
|
|
|
|
|
|
return export.Execute();
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region HtmLToXls(测试html转成xls)
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 测试html转成xls
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public void HtmLToXls()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
MiniExcelLibs.MiniExcel.SaveAsByTemplate(@"E:\Git\Lxm_Report_Api\MyCode.Project.WebApi\App_File\test2.xls", @"E:\Git\Lxm_Report_Api\MyCode.Project.WebApi\App_File\test.xls", new { });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|