Commit bd7ac948 by guanzhenshan

处理亚马逊流水的问题

parent 93aaf08e
......@@ -8,6 +8,7 @@ using System.Threading.Tasks;
using Bailun.ServiceFabric.Authorize;
using Bailun.ServiceFabric.Core.Extension.HttpContext;
using Bailun.ServiceFabric.Core.Extension;
using Microsoft.AspNetCore.Http;
namespace Bailun.DC.Web.Areas.DataWareHouse.Controllers
{
......@@ -282,6 +283,7 @@ namespace Bailun.DC.Web.Areas.DataWareHouse.Controllers
/// <param name="website">站点</param>
/// <returns></returns>
//[BailunAuthentication(LoginMode.Enforce)]
[DisableRequestSizeLimit]
public JsonResult UploadOrderBilling(string platform, string website)
{
......@@ -336,6 +338,71 @@ namespace Bailun.DC.Web.Areas.DataWareHouse.Controllers
});
}
/// <summary>
/// 平台站点合并单个文件上传
/// </summary>
/// <param name="platform"></param>
/// <param name="website"></param>
/// <returns></returns>
public JsonResult UploadOrderBillingMerge(string platform)
{
if (Request.Form.Files.Count == 0)
{
return Json(new
{
success = false,
msg = "请上传文件!"
});
}
//var user = HttpContextHelper.Current?.User;
var file = Request.Form.Files[0];
Dictionary<string, DataTable> dic = Base.NpolHelper.ExcelToDataTable(file.OpenReadStream(), file.FileName, true);
if (dic.Count > 0)
{
var tb = dic.FirstOrDefault();
var list = Dtb2Json(tb.Value);
var listOrders = new List<Models.DataWareHouse.flowing_sales>();
foreach (var item in list)
{
//保存数据
var m = new Models.DataWareHouse.flowing_sales
{
accountname = "",
createtime = DateTime.Now,
jsondata = Newtonsoft.Json.JsonConvert.SerializeObject(item),
month = "",
platform = platform,
//website = website ?? "",
orderno = "",
platformsku = "",
createuser = "页面上传"
};
listOrders.Add(m);
}
var result = new Services.DataWareHouse.PlatformOrderServices().InsertOrderBilling(listOrders);
return Json(new
{
success = string.IsNullOrEmpty(result),
msg = result
});
}
return Json(new
{
success = false,
msg = "无法识别表格的数据,请下载模版重新导入,或者检查下表格数据是否正确。",
});
}
private System.Collections.ArrayList Dtb2Json(DataTable dtb)
{
......
......@@ -54,6 +54,7 @@
<button id="btnexport" style="" type="button" class="btn btn-success" onclick="ExportCSV()">导出</button>
<button type="button" style="margin-left:10px" class="btn btn-warning" onclick="downloadTemplate()">模版下载</button>
<button id="btn_Upload" type="button" style="" class="btn btn-warning">导入流水</button>
@*<button id="btn_Upload_Merge" type="button" style="" class="btn btn-warning">导入站点合并流水</button>*@
</div>
</div>
</form>
......@@ -230,6 +231,20 @@
initUpload();
//btn_Upload_Merge
@*uploadfile('btn_Upload_Merge',
'@Url.Content("~/DataWareHouse/PlatformOrder/UploadOrderBillingMerge")' + '?platform=' + platform,
function(result){
if(result.success)
{
alert('上传成功!');
}
else
{
alert(result.msg);
}
});*@
})
function list() {
......@@ -445,6 +460,7 @@
// 不压缩image, 默认如果是jpeg,文件上传前会压缩一把再上传!
resize: false,
auto: true,
timeout: 0,
accept: {
extensions: "xls,xlsx",
mimeTypes: ".xls,.xlsx"
......
......@@ -19,6 +19,15 @@ namespace Bailun.DC.Web
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
.UseKestrel(options =>
{
options.Limits.MaxRequestBodySize = 200*1024*1024; // 200M
})
//.UseHttpSys(options =>
//{
// options.MaxRequestBodySize = 100_000_000;
//})
.UseStartup<Startup>()
;
}
}
......@@ -41,9 +41,13 @@ namespace Bailun.DC.Web
{
options.ValueLengthLimit = 1024 * 1024 * 100;
options.ValueCountLimit = int.MaxValue;
options.MultipartBodyLengthLimit = 200*1024*1024;//最大200M 解决文件上传Request body too large
options.MultipartHeadersCountLimit = 10;
options.MemoryBufferThreshold = int.MaxValue;
});
//注入session服务
//services.AddSession();
......@@ -97,6 +101,8 @@ namespace Bailun.DC.Web
ConfigManagerConf.SetConfiguration(Configuration);
app.UseStaticHttpContext();
}
}
}
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