93 lines
3.4 KiB
C#
93 lines
3.4 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
using MyCode.Project.Domain.Message.Request.LxmZHMDReport;
|
|||
|
|
using MyCode.Project.Domain.Message.Response.LxmZHMDReport;
|
|||
|
|
using MyCode.Project.Infrastructure;
|
|||
|
|
using MyCode.Project.Infrastructure.Cache;
|
|||
|
|
using MyCode.Project.Infrastructure.Common;
|
|||
|
|
using MyCode.Project.Infrastructure.Constant;
|
|||
|
|
using MyCode.Project.Infrastructure.Enumeration;
|
|||
|
|
using MyCode.Project.Services.IServices;
|
|||
|
|
|
|||
|
|
namespace MyCode.Project.Services.BLL.ReportExport
|
|||
|
|
{
|
|||
|
|
public class MemberAssetInquiryExport : BaseExport
|
|||
|
|
{
|
|||
|
|
#region 初始化
|
|||
|
|
private readonly ILxmReport2023Service _reportService;
|
|||
|
|
private IMyCodeCacheService _myCodeCacheService;
|
|||
|
|
public MemberAssetInquiryExport(ILxmReport2023Service reportService
|
|||
|
|
, IMyCodeCacheService myCodeCacheService)
|
|||
|
|
{
|
|||
|
|
_reportService = reportService;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region Execute(执行)
|
|||
|
|
public override string Execute()
|
|||
|
|
{
|
|||
|
|
var req = JsonHelper.ToObject<ShopDiagnosisReportReq>(Condition.ToString());
|
|||
|
|
|
|||
|
|
var resultData = new ReportCalRateResp()
|
|||
|
|
{
|
|||
|
|
Total = 0,
|
|||
|
|
Rate = 0.01m
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
var result = new Result()
|
|||
|
|
{
|
|||
|
|
Data = resultData,
|
|||
|
|
Code = ResultCode.Success
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
if (base.ExcelFileType == (int)ExportFileType.Zip)
|
|||
|
|
{
|
|||
|
|
//类型为0是报表专用,验证客户端是否在线
|
|||
|
|
WebSocketBLL.CheckOnline(ReportId, 0);
|
|||
|
|
//开始运算,先发送个进度0%,表明开始
|
|||
|
|
WebSocketBLL.SendSocketMsg(ReportId, JsonHelper.ToJson(result, false, true));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var pageSearch = base.GetPageSearch<MemberAssetInquiryReq>(Condition, 1);
|
|||
|
|
var list = _reportService.GetMemberAssetInquiry(pageSearch, this.CurrentUser);
|
|||
|
|
|
|||
|
|
resultData.Total = list.TotalCount;
|
|||
|
|
var fileName = $"会员统计--会员查询";
|
|||
|
|
|
|||
|
|
if (base.ExcelFileType == (int)ExportFileType.Zip)
|
|||
|
|
{
|
|||
|
|
resultData.Rate = 0.02m;
|
|||
|
|
result.Data = resultData;
|
|||
|
|
WebSocketBLL.SendSocketMsg(ReportId, JsonHelper.ToJson(result, false, true));
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
pageSearch.Page = 1;
|
|||
|
|
pageSearch.PageSize = 10000;
|
|||
|
|
int maxPage = (list.TotalCount+ pageSearch.PageSize-1) / pageSearch.PageSize;
|
|||
|
|
string zipFile = "";
|
|||
|
|
string hasDownloadZipCacheKey = CacheKey.HasDownloadZipCacheKey + $@":{ReportId}";
|
|||
|
|
while (pageSearch.Page <= maxPage)
|
|||
|
|
{
|
|||
|
|
list = _reportService.GetMemberAssetInquiry(pageSearch, this.CurrentUser);
|
|||
|
|
zipFile =base.PageListExecute<MemberAssetInquiryResp>(list, pageSearch.Page, pageSearch.PageSize, list.TotalCount, fileName, hasDownloadZipCacheKey);
|
|||
|
|
pageSearch.Page++;
|
|||
|
|
}
|
|||
|
|
if (zipFile == "")
|
|||
|
|
{
|
|||
|
|
resultData.CurQty = list.TotalCount;
|
|||
|
|
resultData.Rate = 1;
|
|||
|
|
|
|||
|
|
WebSocketBLL.SendSocketMsg(ReportId, JsonHelper.ToJson(result, false, true));
|
|||
|
|
//移除正在下载
|
|||
|
|
_myCodeCacheService.Delete($"{hasDownloadZipCacheKey}");
|
|||
|
|
}
|
|||
|
|
return zipFile;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|