Commit d2d941ce authored by 黄奎's avatar 黄奎

商品导出修改

parent 8b5b52b9
...@@ -91,21 +91,6 @@ namespace Mall.Common.Plugin ...@@ -91,21 +91,6 @@ namespace Mall.Common.Plugin
//fCellStyle.FillPattern = FillPattern.SolidForeground; //fCellStyle.FillPattern = FillPattern.SolidForeground;
break; 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(); HSSFFont ffont = (HSSFFont)workbook.CreateFont();
if (subItem.FontHeight > 0) if (subItem.FontHeight > 0)
{ {
...@@ -302,22 +287,6 @@ namespace Mall.Common.Plugin ...@@ -302,22 +287,6 @@ namespace Mall.Common.Plugin
fCellStyle.FillPattern = FillPattern.SolidForeground; fCellStyle.FillPattern = FillPattern.SolidForeground;
break; 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) if (subItem.FontHeight > 0)
{ {
ffont.FontHeight = subItem.FontHeight * 20; ffont.FontHeight = subItem.FontHeight * 20;
......
...@@ -7,6 +7,7 @@ using System.Net.Http; ...@@ -7,6 +7,7 @@ using System.Net.Http;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.Threading.Tasks; using System.Threading.Tasks;
using Mall.Common.API; using Mall.Common.API;
using Mall.WebApi.Controllers.User;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace Mall.WebApi.Controllers.Export namespace Mall.WebApi.Controllers.Export
...@@ -19,41 +20,33 @@ namespace Mall.WebApi.Controllers.Export ...@@ -19,41 +20,33 @@ namespace Mall.WebApi.Controllers.Export
/// <summary> /// <summary>
/// 文件流下载 /// 文件流下载
/// </summary> /// </summary>
/// <param name="requestData"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public HttpResponseMessage DownLoad() public FileContentResult DownLoad()
{ {
string fileName = "Test.xls";
try try
{ {
HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); var downLoadRequest = RequestParm;//获取参数
switch (RequestParm.cmd) if (downLoadRequest.cmd != null && !string.IsNullOrEmpty(downLoadRequest.cmd))
{ {
//商品购买力TOP排行 //商品购买力TOP排行
case "getSalesGoodTop": if (downLoadRequest.cmd == "getSalesGoodTop")
var file_SalesGood = new Services.DMCService.BusService().DownLoadBusConfig(requestData); {
Stream stream_SalesGood = new MemoryStream(file_SalesGood); return File(new TenantController().DownLoadSalesGoods(downLoadRequest), "application/octet-stream", fileName);
response.Content = new StreamContent(stream);
break;
//用户购买力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;
} }
response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); //用户购买力TOP排行
response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment") if (downLoadRequest.cmd == "getSalesUserTop")
{ {
FileName = "Test.xls" return File(new TenantController().DownLoadSalesUser(downLoadRequest), "application/octet-stream", fileName);
}; }
return response; }
} }
catch (Exception ex) catch (Exception ex)
{ {
Common.Plugin.LogHelper.Write(ex, string.Format("DownLoad_requestData: {0}", Common.Plugin.JsonHelper.Serialize(requestData))); Common.Plugin.LogHelper.Write(ex, string.Format("DownLoad_requestData: {0}", Common.Plugin.JsonHelper.Serialize(this.RequestParm)));
return new HttpResponseMessage(HttpStatusCode.NoContent);
} }
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