Commit d2d941ce authored by 黄奎's avatar 黄奎

商品导出修改

parent 8b5b52b9
......@@ -91,21 +91,6 @@ namespace Mall.Common.Plugin
//fCellStyle.FillPattern = FillPattern.SolidForeground;
break;
}
//自定义背景颜色
if (subItem.SelfBgColorIndex > 0)
{
//var color = RGBToColor(subItem.SelfBgColor);
//short FIRST_COLOR_INDEX = (short)0x8;
//var defaultColor = palette.GetColor(FIRST_COLOR_INDEX);
//palette.SetColorAtIndex(FIRST_COLOR_INDEX, color.R, color.G, color.B);
//HSSFColor hSSFColor = palette.GetColor(FIRST_COLOR_INDEX);
//palette.SetColorAtIndex(FIRST_COLOR_INDEX, 0, 0, 0);
//HSSFColor hSSFColor = palette.FindSimilarColor(color.R, color.G, color.B);
//fCellStyle.FillForegroundColor = subItem.SelfBgColorIndex;
//fCellStyle.FillPattern = FillPattern.SolidForeground;
}
HSSFFont ffont = (HSSFFont)workbook.CreateFont();
if (subItem.FontHeight > 0)
{
......@@ -302,22 +287,6 @@ namespace Mall.Common.Plugin
fCellStyle.FillPattern = FillPattern.SolidForeground;
break;
}
//自定义背景颜色
if (subItem.SelfBgColorIndex > 0)
{
//var color = RGBToColor(subItem.SelfBgColor);
//short FIRST_COLOR_INDEX = (short)0x8;
//var defaultColor = palette.GetColor(FIRST_COLOR_INDEX);
//palette.SetColorAtIndex(FIRST_COLOR_INDEX, color.R, color.G, color.B);
//HSSFColor hSSFColor = palette.GetColor(FIRST_COLOR_INDEX);
//palette.SetColorAtIndex(FIRST_COLOR_INDEX, 0, 0, 0);
//HSSFColor hSSFColor = palette.FindSimilarColor(color.R, color.G, color.B);
//fCellStyle.FillForegroundColor = subItem.SelfBgColorIndex;
//fCellStyle.FillPattern = FillPattern.SolidForeground;
}
if (subItem.FontHeight > 0)
{
ffont.FontHeight = subItem.FontHeight * 20;
......
......@@ -7,6 +7,7 @@ using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Mall.Common.API;
using Mall.WebApi.Controllers.User;
using Microsoft.AspNetCore.Mvc;
namespace Mall.WebApi.Controllers.Export
......@@ -19,41 +20,33 @@ namespace Mall.WebApi.Controllers.Export
/// <summary>
/// 文件流下载
/// </summary>
/// <param name="requestData"></param>
/// <returns></returns>
[HttpPost]
public HttpResponseMessage DownLoad()
public FileContentResult DownLoad()
{
string fileName = "Test.xls";
try
{
HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);
switch (RequestParm.cmd)
var downLoadRequest = RequestParm;//获取参数
if (downLoadRequest.cmd != null && !string.IsNullOrEmpty(downLoadRequest.cmd))
{
//商品购买力TOP排行
case "getSalesGoodTop":
var file_SalesGood = new Services.DMCService.BusService().DownLoadBusConfig(requestData);
Stream stream_SalesGood = new MemoryStream(file_SalesGood);
response.Content = new StreamContent(stream);
break;
if (downLoadRequest.cmd == "getSalesGoodTop")
{
return File(new TenantController().DownLoadSalesGoods(downLoadRequest), "application/octet-stream", fileName);
}
//用户购买力TOP排行
case "getSalesUserTop":
var file_SalesUser = new Services.DMCService.BusService().DownLoadBusConfig(requestData);
Stream stream_SalesUser = new MemoryStream(file_SalesUser);
response.Content = new StreamContent(stream_SalesUser);
break;
if (downLoadRequest.cmd == "getSalesUserTop")
{
return File(new TenantController().DownLoadSalesUser(downLoadRequest), "application/octet-stream", fileName);
}
}
response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
{
FileName = "Test.xls"
};
return response;
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, string.Format("DownLoad_requestData: {0}", Common.Plugin.JsonHelper.Serialize(requestData)));
return new HttpResponseMessage(HttpStatusCode.NoContent);
Common.Plugin.LogHelper.Write(ex, string.Format("DownLoad_requestData: {0}", Common.Plugin.JsonHelper.Serialize(this.RequestParm)));
}
return File(new byte[0], "application/octet-stream", fileName);
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment