Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
DataCenter_Core2.1_20190520
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bltdc
DataCenter_Core2.1_20190520
Commits
14c7e74d
Commit
14c7e74d
authored
Jul 31, 2021
by
guanzhenshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加物流账单流水模块和解析数据
parent
73276365
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
486 additions
and
55 deletions
+486
-55
flowing_logistic.cs
Bailun.DC.Models/DataWareHouse/flowing_logistic.cs
+7
-0
flowing_logistic_config.cs
Bailun.DC.Models/DataWareHouse/flowing_logistic_config.cs
+1
-0
order_fee_col.cs
Bailun.DC.Models/DataWareHouse/order_fee_col.cs
+4
-1
order_fee_config.cs
Bailun.DC.Models/DataWareHouse/order_fee_config.cs
+5
-0
LogisticServices.cs
Bailun.DC.Services/DataWareHouse/LogisticServices.cs
+55
-2
PlatformOrderFeeServices.cs
Bailun.DC.Services/DataWareHouse/PlatformOrderFeeServices.cs
+19
-0
LogisticsController.cs
...eb/Areas/DataWareHouse/Controllers/LogisticsController.cs
+87
-5
PlatformOrderController.cs
...reas/DataWareHouse/Controllers/PlatformOrderController.cs
+0
-32
List.cshtml
...un.DC.Web/Areas/DataWareHouse/Views/Logistics/List.cshtml
+129
-13
BaseController.cs
Bailun.DC.Web/Base/BaseController.cs
+28
-0
HomeController.cs
Bailun.DC.Web/Controllers/HomeController.cs
+139
-1
DemoFile.cshtml
Bailun.DC.Web/Views/Home/DemoFile.cshtml
+12
-1
No files found.
Bailun.DC.Models/DataWareHouse/flowing_logistic.cs
View file @
14c7e74d
...
@@ -65,6 +65,13 @@ namespace Bailun.DC.Models.DataWareHouse
...
@@ -65,6 +65,13 @@ namespace Bailun.DC.Models.DataWareHouse
/// </summary>
/// </summary>
public
DateTime
createtime
{
get
;
set
;
}
public
DateTime
createtime
{
get
;
set
;
}
public
string
website
{
get
;
set
;
}
public
string
col_orderno
{
get
;
set
;
}
public
string
col_orderno
{
get
;
set
;
}
public
string
month
{
get
;
set
;
}
public
string
createuser
{
get
;
set
;
}
}
}
}
}
Bailun.DC.Models/DataWareHouse/flowing_logistic_config.cs
View file @
14c7e74d
...
@@ -18,6 +18,7 @@ namespace Bailun.DC.Models.DataWareHouse
...
@@ -18,6 +18,7 @@ namespace Bailun.DC.Models.DataWareHouse
/// </summary>
/// </summary>
public
string
platform
{
get
;
set
;
}
public
string
platform
{
get
;
set
;
}
public
string
website
{
get
;
set
;
}
/// <summary>
/// <summary>
///
///
...
...
Bailun.DC.Models/DataWareHouse/order_fee_col.cs
View file @
14c7e74d
...
@@ -29,7 +29,10 @@ namespace Bailun.DC.Models.DataWareHouse
...
@@ -29,7 +29,10 @@ namespace Bailun.DC.Models.DataWareHouse
/// </summary>
/// </summary>
public
string
cols
{
get
;
set
;
}
public
string
cols
{
get
;
set
;
}
/// <summary>
/// 数据类型,1:销售平台的,2:物流费用
/// </summary>
public
int
datatype
{
get
;
set
;
}
}
}
}
}
Bailun.DC.Models/DataWareHouse/order_fee_config.cs
View file @
14c7e74d
...
@@ -85,5 +85,10 @@ namespace Bailun.DC.Models.DataWareHouse
...
@@ -85,5 +85,10 @@ namespace Bailun.DC.Models.DataWareHouse
/// </summary>
/// </summary>
public
string
versionno
{
get
;
set
;
}
public
string
versionno
{
get
;
set
;
}
/// <summary>
/// 数据类型,1:销售平台的,2:物流费用
/// </summary>
public
int
datatype
{
get
;
set
;
}
}
}
}
}
Bailun.DC.Services/DataWareHouse/LogisticServices.cs
View file @
14c7e74d
...
@@ -38,7 +38,7 @@ namespace Bailun.DC.Services.DataWareHouse
...
@@ -38,7 +38,7 @@ namespace Bailun.DC.Services.DataWareHouse
/// <param name="end"></param>
/// <param name="end"></param>
/// <param name="total"></param>
/// <param name="total"></param>
/// <returns></returns>
/// <returns></returns>
public
List
<
flowing_logistic
>
ListFlowingLogistic
(
int
page
,
int
pagesize
,
string
platform
,
DateTime
?
start
,
DateTime
?
end
,
string
orderno
,
ref
int
total
)
public
List
<
flowing_logistic
>
ListFlowingLogistic
(
int
page
,
int
pagesize
,
string
platform
,
string
website
,
DateTime
?
start
,
DateTime
?
end
,
string
orderno
,
ref
int
total
)
{
{
var
sql
=
"select * from flowing_logistic where 1=1"
;
var
sql
=
"select * from flowing_logistic where 1=1"
;
var
sqlparam
=
new
DynamicParameters
();
var
sqlparam
=
new
DynamicParameters
();
...
@@ -49,7 +49,13 @@ namespace Bailun.DC.Services.DataWareHouse
...
@@ -49,7 +49,13 @@ namespace Bailun.DC.Services.DataWareHouse
sqlparam
.
Add
(
"platform"
,
platform
);
sqlparam
.
Add
(
"platform"
,
platform
);
}
}
if
(
start
.
HasValue
)
if
(!
string
.
IsNullOrEmpty
(
website
))
{
sql
+=
" and website=@website"
;
sqlparam
.
Add
(
"website"
,
website
);
}
if
(
start
.
HasValue
)
{
{
sql
+=
$" and datatime>='
{
start
.
Value
.
ToString
(
"yyyy-MM-dd"
)}
'"
;
sql
+=
$" and datatime>='
{
start
.
Value
.
ToString
(
"yyyy-MM-dd"
)}
'"
;
}
}
...
@@ -88,5 +94,52 @@ namespace Bailun.DC.Services.DataWareHouse
...
@@ -88,5 +94,52 @@ namespace Bailun.DC.Services.DataWareHouse
}
}
/// <summary>
/// 保存流水信息
/// </summary>
/// <param name="list"></param>
/// <returns></returns>
public
string
InsertOrderBilling
(
List
<
Models
.
DataWareHouse
.
flowing_logistic
>
list
)
{
try
{
using
(
var
cn
=
new
MySqlConnection
(
Common
.
GlobalConfig
.
ConnectionString_DW
))
{
if
(
cn
.
State
==
System
.
Data
.
ConnectionState
.
Closed
)
{
cn
.
Open
();
}
foreach
(
var
item
in
list
)
{
SaveOrderBill
(
cn
,
item
);
}
}
return
""
;
}
catch
(
Exception
ex
)
{
return
ex
.
Message
;
}
}
public
void
SaveOrderBill
(
MySqlConnection
cn
,
flowing_logistic
m
)
{
try
{
if
(
cn
.
State
==
System
.
Data
.
ConnectionState
.
Closed
)
{
cn
.
Open
();
}
cn
.
Insert
(
m
);
}
catch
(
Exception
ex
)
{
SaveOrderBill
(
cn
,
m
);
}
}
}
}
}
}
Bailun.DC.Services/DataWareHouse/PlatformOrderFeeServices.cs
View file @
14c7e74d
...
@@ -86,6 +86,25 @@ namespace Bailun.DC.Services.DataWareHouse
...
@@ -86,6 +86,25 @@ namespace Bailun.DC.Services.DataWareHouse
return
""
;
return
""
;
}
}
/// <summary>
/// 获取费用解析财务流水配置
/// </summary>
/// <param name="datatype"></param>
/// <returns></returns>
public
List
<
order_fee_config
>
ListOrderFeeConfig
(
int
datatype
)
{
using
(
var
cn
=
new
MySqlConnection
(
Common
.
GlobalConfig
.
ConnectionString_DW
))
{
if
(
cn
.
State
==
System
.
Data
.
ConnectionState
.
Closed
)
{
cn
.
Open
();
}
return
cn
.
Query
<
order_fee_config
>(
"select * from order_fee_config where datatype="
+
datatype
).
ToList
();
}
}
#
endregion
#
endregion
public
List
<
order_fee_col
>
ListOrderFeeCol
()
public
List
<
order_fee_col
>
ListOrderFeeCol
()
...
...
Bailun.DC.Web/Areas/DataWareHouse/Controllers/LogisticsController.cs
View file @
14c7e74d
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.AspNetCore.Mvc
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Data
;
using
System.Linq
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
namespace
Bailun.DC.Web.Areas.DataWareHouse.Controllers
namespace
Bailun.DC.Web.Areas.DataWareHouse.Controllers
{
{
[
Area
(
"DataWareHouse"
)]
[
Area
(
"DataWareHouse"
)]
public
class
LogisticsController
:
Controller
public
class
LogisticsController
:
Base
.
Base
Controller
{
{
public
IActionResult
List
(
string
platform
)
public
IActionResult
List
(
string
platform
)
{
{
var
listconfig
=
new
Services
.
DataWareHouse
.
LogisticServices
().
ListLogisticConfig
(
);
var
listconfig
=
new
Services
.
DataWareHouse
.
PlatformOrderFeeServices
().
ListOrderFeeConfig
(
2
);
ViewBag
.
listconfig
=
listconfig
;
ViewBag
.
listconfig
=
listconfig
.
Select
(
a
=>
a
.
platform
).
Distinct
().
ToList
()
;
ViewBag
.
platform
=
platform
;
ViewBag
.
platform
=
platform
;
ViewBag
.
sites
=
listconfig
.
Where
(
a
=>
a
.
platform
==
platform
).
Select
(
b
=>
b
.
website
).
Distinct
().
Where
(
c
=>!
string
.
IsNullOrEmpty
(
c
)).
ToList
();
return
View
();
return
View
();
}
}
...
@@ -30,7 +32,7 @@ namespace Bailun.DC.Web.Areas.DataWareHouse.Controllers
...
@@ -30,7 +32,7 @@ namespace Bailun.DC.Web.Areas.DataWareHouse.Controllers
/// <param name="pagesize"></param>
/// <param name="pagesize"></param>
/// <returns></returns>
/// <returns></returns>
[
HttpPost
]
[
HttpPost
]
public
JsonResult
ListFlowingJson
(
int
page
,
string
platform
,
DateTime
?
start
,
DateTime
?
end
,
string
orderno
,
int
pagesize
=
25
)
public
JsonResult
ListFlowingJson
(
int
page
,
string
platform
,
string
website
,
DateTime
?
start
,
DateTime
?
end
,
string
orderno
,
int
pagesize
=
25
)
{
{
var
total
=
0
;
var
total
=
0
;
if
(
page
<=
0
)
if
(
page
<=
0
)
...
@@ -38,7 +40,7 @@ namespace Bailun.DC.Web.Areas.DataWareHouse.Controllers
...
@@ -38,7 +40,7 @@ namespace Bailun.DC.Web.Areas.DataWareHouse.Controllers
page
=
1
;
page
=
1
;
}
}
var
obj
=
new
Services
.
DataWareHouse
.
LogisticServices
().
ListFlowingLogistic
(
page
,
pagesize
,
platform
,
start
,
end
,
orderno
,
ref
total
);
var
obj
=
new
Services
.
DataWareHouse
.
LogisticServices
().
ListFlowingLogistic
(
page
,
pagesize
,
platform
,
website
,
start
,
end
,
orderno
,
ref
total
);
;
;
var
list
=
obj
.
Select
(
a
=>
new
{
var
list
=
obj
.
Select
(
a
=>
new
{
a
.
createtime
,
a
.
createtime
,
...
@@ -58,7 +60,87 @@ namespace Bailun.DC.Web.Areas.DataWareHouse.Controllers
...
@@ -58,7 +60,87 @@ namespace Bailun.DC.Web.Areas.DataWareHouse.Controllers
}
}
/// <summary>
/// 上传物流流水数据
/// </summary>
/// <param name="platform"></param>
/// <returns></returns>
[
RequestSizeLimit
(
100
_000_000
)]
public
JsonResult
UploadFlowing
(
string
platform
,
string
website
,
string
month
)
{
if
(
string
.
IsNullOrEmpty
(
platform
))
{
return
Json
(
new
{
success
=
false
,
msg
=
"请选择平台"
});
}
if
(
string
.
IsNullOrEmpty
(
month
))
{
return
Json
(
new
{
success
=
false
,
msg
=
"请选择月份后再导入"
});
}
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_logistic
>();
foreach
(
var
item
in
list
)
{
//保存数据
var
m
=
new
Models
.
DataWareHouse
.
flowing_logistic
{
createtime
=
DateTime
.
Now
,
jsondata
=
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
item
),
month
=
month
,
platformtype
=
platform
,
website
=
website
,
createuser
=
"页面上传"
,
datatype
=
1
,
datatypename
=
"物流账单"
,
account
=
""
,
};
listOrders
.
Add
(
m
);
}
var
result
=
new
Services
.
DataWareHouse
.
LogisticServices
().
InsertOrderBilling
(
listOrders
);
return
Json
(
new
{
success
=
string
.
IsNullOrEmpty
(
result
),
msg
=
result
});
}
return
Json
(
new
{
success
=
false
,
msg
=
"无法识别表格的数据,请下载模版重新导入,或者检查下表格数据是否正确。"
,
});
}
}
}
}
}
Bailun.DC.Web/Areas/DataWareHouse/Controllers/PlatformOrderController.cs
View file @
14c7e74d
...
@@ -559,37 +559,5 @@ namespace Bailun.DC.Web.Areas.DataWareHouse.Controllers
...
@@ -559,37 +559,5 @@ namespace Bailun.DC.Web.Areas.DataWareHouse.Controllers
#
endregion
#
endregion
#
region
私有方法
private
System
.
Collections
.
ArrayList
Dtb2Json
(
DataTable
dtb
)
{
System
.
Collections
.
ArrayList
dic
=
new
System
.
Collections
.
ArrayList
();
foreach
(
DataRow
dr
in
dtb
.
Rows
)
{
System
.
Collections
.
Generic
.
Dictionary
<
string
,
object
>
drow
=
new
System
.
Collections
.
Generic
.
Dictionary
<
string
,
object
>();
foreach
(
DataColumn
dc
in
dtb
.
Columns
)
{
drow
.
Add
(
dc
.
ColumnName
,
dr
[
dc
.
ColumnName
]);
}
//判断是否空行,如果null值
if
(
drow
.
ToList
().
Where
(
a
=>
a
.
Value
==
null
).
Count
()
==
drow
.
Count
||
drow
.
FirstOrDefault
().
Value
==
null
)
{
continue
;
}
else
{
dic
.
Add
(
drow
);
}
}
return
dic
;
}
#
endregion
}
}
}
}
Bailun.DC.Web/Areas/DataWareHouse/Views/Logistics/List.cshtml
View file @
14c7e74d
...
@@ -16,16 +16,29 @@
...
@@ -16,16 +16,29 @@
<div id="sel_platform_contain" class="form-group" style="display:none;">
<div id="sel_platform_contain" class="form-group" style="display:none;">
<label>平台:</label>
<label>平台:</label>
<select id="platform" name="platform" class="form-control" style="width:120px">
<select id="platform" name="platform" class="form-control" style="width:120px">
@if (ViewBag.listconfig.Count > 0)
@if (ViewBag.listconfig.Count > 0)
{
{
foreach (var item in ViewBag.listconfig)
foreach (var item in ViewBag.listconfig)
{
{
<option value="@item">@item</option>
<option value="@item">@item</option>
}
}
}
}
</select>
</select>
</div>
</div>
<div class="form-group">
站点:
<div data-toggle="buttons-checkbox" class="btn-group">
@foreach (var item in ViewBag.sites)
{
//<option value="@item">@item</option>
<button class="btn btn-info wsites" type="button" aria-pressed="false" onclick="selWebsite('@item',this)">@item</button>
}
</div>
</div>
<div class="form-group" style="margin-left:10px">
<label>账单月份</label>
<input id="month" name="month" class="form-control" style="width:135px" placeholder="账单归属月份" />
</div>
<div class="form-group" style="margin-left:10px">
<div class="form-group" style="margin-left:10px">
<label>时间</label>
<label>时间</label>
@*<input id="month" name="month" class="form-control" style="width:100px" value="@(DateTime.Now.AddMonths(-1).ToString("yyyy-MM"))" />*@
@*<input id="month" name="month" class="form-control" style="width:100px" value="@(DateTime.Now.AddMonths(-1).ToString("yyyy-MM"))" />*@
...
@@ -194,8 +207,14 @@
...
@@ -194,8 +207,14 @@
var tb;
var tb;
var current_page = 1;
var current_page = 1;
var platform = '@(ViewBag.platform)';
var platform = '@(ViewBag.platform)';
var website = '';
var websitecount = '@(ViewBag.sites.Count)';
var BASE_URL = '@(Url.Content("~/js/webuploader-0.1.5/"))';
var BASE_URL = '@(Url.Content("~/js/webuploader-0.1.5/"))';
var month = '';
var uploader;
$(document).ready(function () {
$(document).ready(function () {
...
@@ -207,6 +226,9 @@
...
@@ -207,6 +226,9 @@
$('#platform').change(function () {
$('#platform').change(function () {
platform = $('#platform').val();
platform = $('#platform').val();
initUpload();
initUpload();
//获取平台站点
getWebsite();
})
})
}
}
...
@@ -215,6 +237,17 @@
...
@@ -215,6 +237,17 @@
laydate.render({ elem: '#start' });
laydate.render({ elem: '#start' });
laydate.render({ elem: '#end' });
laydate.render({ elem: '#end' });
laydate.render({
elem: '#month', type: 'month', done: function (value, date, endDate) {
console.log(value); //得到日期生成的值,如:2017-08-18
console.log(date); //得到日期时间对象:{year: 2017, month: 8, date: 18, hours: 0, minutes: 0, seconds: 0}
console.log(endDate); //得结束的日期时间对象,开启范围选择(range: true)才会返回。对象成员同上。
month = value;
initUpload();
}
});
initUpload();
initUpload();
...
@@ -232,7 +265,6 @@
...
@@ -232,7 +265,6 @@
}
}
});*@
});*@
})
})
function list() {
function list() {
...
@@ -263,7 +295,7 @@
...
@@ -263,7 +295,7 @@
$.submit({
$.submit({
url: '@Url.Content("~/DataWareHouse/Logistics/ListFlowingJson")',
url: '@Url.Content("~/DataWareHouse/Logistics/ListFlowingJson")',
type:'POST',
type:'POST',
paramData: 'page=' + current_page + '&platform=' + platform
+ '&start=' + start + '&end=' + end + '&orderno=' + orderno
,
paramData: 'page=' + current_page + '&platform=' + platform
+ '&start=' + start + '&end=' + end + '&orderno=' + orderno + '&website=' + website
,
func: function (result) {
func: function (result) {
layer.close(load_index)
layer.close(load_index)
$('#tb_head').html('');
$('#tb_head').html('');
...
@@ -336,7 +368,7 @@
...
@@ -336,7 +368,7 @@
//}
//}
uploadfile('btn_Upload',
uploadfile('btn_Upload',
'@Url.Content("~/DataWareHouse/
PlatformOrder/UploadOrderBilling")' + '?platform=' + platform
,
'@Url.Content("~/DataWareHouse/
Logistics/UploadFlowing")' + '?platform=' + platform + '&month=' + month + '&website=' + website
,
function(result){
function(result){
if(result.success)
if(result.success)
{
{
...
@@ -380,11 +412,27 @@
...
@@ -380,11 +412,27 @@
}
}
function isJson (obj) {
function isJson (obj) {
var isjson = typeof (obj) == "object" && Object.prototype.toString.call(obj).toLowerCase() == "[object object]" && !obj.length;
var isjson = typeof (obj) == "object" && Object.prototype.toString.call(obj).toLowerCase() == "[object object]" && !obj.length;
return isjson;
return isjson;
}
}
function selWebsite(site, data) {
website = site;
$('.wsites').each(function () {
$(this).attr('aria-pressed', 'false');
$(this).removeClass('active');
})
$(data).prop('aria-pressed', 'true');
list();
initUpload();
}
function ExportCSV() {
function ExportCSV() {
//var website = $('#website').val();
//var website = $('#website').val();
//var month = $('#month').val();
//var month = $('#month').val();
...
@@ -402,7 +450,7 @@
...
@@ -402,7 +450,7 @@
return false;
return false;
}
}
window.open('@Url.Content("~/DataWareHouse/PlatformOrder/ExportOrderBillings")' + '?platform=' + platform + '&start=' + start + '&end=' + end + '&orderno=' + orderno);
//
window.open('@Url.Content("~/DataWareHouse/PlatformOrder/ExportOrderBillings")' + '?platform=' + platform + '&start=' + start + '&end=' + end + '&orderno=' + orderno);
}
}
function downloadTemplate() {
function downloadTemplate() {
...
@@ -415,13 +463,13 @@
...
@@ -415,13 +463,13 @@
var end = $('#end').val();
var end = $('#end').val();
var orderno = $('#orderno').val();
var orderno = $('#orderno').val();
window.open('@Url.Content("~/DataWareHouse/PlatformOrder/DownLoadOrderBillingTemplate?platform=")' + platform + '&start=' + start + '&end=' + end ,'_blank');
//
window.open('@Url.Content("~/DataWareHouse/PlatformOrder/DownLoadOrderBillingTemplate?platform=")' + platform + '&start=' + start + '&end=' + end ,'_blank');
}
}
function uploadfile(id,url,callback)
function uploadfile(id,url,callback)
{
{
var
uploader = new WebUploader.Uploader({
uploader = new WebUploader.Uploader({
// swf文件路径
// swf文件路径
swf: BASE_URL + 'Uploader.swf',
swf: BASE_URL + 'Uploader.swf',
// 文件接收服务端。
// 文件接收服务端。
...
@@ -449,6 +497,74 @@
...
@@ -449,6 +497,74 @@
uploader.on('uploadError', function (file) {
uploader.on('uploadError', function (file) {
layer.msg("上传出错");
layer.msg("上传出错");
});
});
uploader.register({
"before-send-file": "beforeSendFile",
"before-send": "beforeSend",
"after-send-file": "afterSendFile",
}, {
//时间点1:所有分块进行上传之前调用此函数
beforeSendFile: function (file) {
var deferred = WebUploader.Deferred();
//1、计算文件的唯一标记,用于断点续传
(new WebUploader.Uploader()).md5File(file, 0, 2 * 1024 * 1024)
.progress(function (percentage) {
})
.then(function (val) {
fileMd5 = val;
//获取文件信息后进入下一步
deferred.resolve();
});
return deferred.promise();
},
//时间点2:如果有分块上传,则每个分块上传之前调用此函数
beforeSend: function (block) {
var deferred = WebUploader.Deferred();
if (videoAdd[block.file.id] > block.start) {
// 分块存在,跳过
deferred.reject();
} else {
// 分块不存在或不完整,重新发送该分块内容
this.owner.options.formData = {
start: block.start,//设置视频上传的start点
fileMd5: videoMd5[block.file.id]//设置视频上传的唯一标识MD5
}
deferred.resolve();
}
return deferred.promise();
},
//时间点3:所有分块上传成功后调用此函数
afterSendFile: function (file, response) {
//分块上传成功,执行成功回调
successHandler(file, response, fileArr);
}
});
}
function getWebsite() {
$.submit({
url: '@Url.Content("~/DataWareHouse/PlatformOrder/ListWebsite?platform=")' + $('#platform').val(),
paramData: '',
type:'POST',
func: function (result) {
$('#website').html('<option value="">请选择站点</option>');
if (result.success) {
if (result.data.length > 0) {
for (var i in result.data) {
$('#website').append('<option value="' + result.data[i] + '">' + result.data[i] + '</option>');
}
}
}
else {
alert(result.msg);
}
}
})
}
}
...
...
Bailun.DC.Web/Base/BaseController.cs
View file @
14c7e74d
...
@@ -158,5 +158,33 @@ namespace Bailun.DC.Web.Base
...
@@ -158,5 +158,33 @@ namespace Bailun.DC.Web.Base
#
endregion
#
endregion
public
System
.
Collections
.
ArrayList
Dtb2Json
(
DataTable
dtb
)
{
System
.
Collections
.
ArrayList
dic
=
new
System
.
Collections
.
ArrayList
();
foreach
(
DataRow
dr
in
dtb
.
Rows
)
{
System
.
Collections
.
Generic
.
Dictionary
<
string
,
object
>
drow
=
new
System
.
Collections
.
Generic
.
Dictionary
<
string
,
object
>();
foreach
(
DataColumn
dc
in
dtb
.
Columns
)
{
drow
.
Add
(
dc
.
ColumnName
,
dr
[
dc
.
ColumnName
]);
}
//判断是否空行,如果null值
if
(
drow
.
ToList
().
Where
(
a
=>
a
.
Value
==
null
).
Count
()
==
drow
.
Count
||
drow
.
FirstOrDefault
().
Value
==
null
)
{
continue
;
}
else
{
dic
.
Add
(
drow
);
}
}
return
dic
;
}
}
}
}
}
Bailun.DC.Web/Controllers/HomeController.cs
View file @
14c7e74d
...
@@ -387,7 +387,8 @@ namespace Bailun.DC.Web.Controllers
...
@@ -387,7 +387,8 @@ namespace Bailun.DC.Web.Controllers
platform
=
platform
,
platform
=
platform
,
website
=
website
,
website
=
website
,
currency
=
currency
,
currency
=
currency
,
delstatus
=
0
delstatus
=
0
,
datatype
=
1
,
};
};
list
.
Add
(
m
);
list
.
Add
(
m
);
...
@@ -400,6 +401,7 @@ namespace Bailun.DC.Web.Controllers
...
@@ -400,6 +401,7 @@ namespace Bailun.DC.Web.Controllers
cols
=
string
.
Join
(
"||"
,
cols
.
Distinct
().
ToList
()),
cols
=
string
.
Join
(
"||"
,
cols
.
Distinct
().
ToList
()),
platform
=
platform
,
platform
=
platform
,
website
=
website
,
website
=
website
,
datatype
=
1
,
}});
}});
if
(!
string
.
IsNullOrEmpty
(
result
))
if
(!
string
.
IsNullOrEmpty
(
result
))
...
@@ -419,6 +421,141 @@ namespace Bailun.DC.Web.Controllers
...
@@ -419,6 +421,141 @@ namespace Bailun.DC.Web.Controllers
return
Content
(
"OK"
);
return
Content
(
"OK"
);
}
}
/// <summary>
/// 保存物流商费用取数配置
/// </summary>
/// <returns></returns>
public
ActionResult
UploadLogisticFeeConfig
()
{
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
=
new
List
<
Bailun
.
DC
.
Models
.
DataWareHouse
.
order_fee_config
>();
var
columns
=
tb
.
Value
.
Columns
;
var
_service
=
new
Services
.
DataWareHouse
.
PlatformOrderFeeServices
();
//cols.Add(columns[3].ColumnName.Split('-')[1]);
for
(
var
i
=
0
;
i
<
tb
.
Value
.
Rows
.
Count
;
i
++)
{
//解析行
var
row
=
tb
.
Value
.
Rows
[
i
];
if
(
row
==
null
||
string
.
IsNullOrEmpty
(
row
[
0
].
ToString
()))
{
continue
;
}
var
cols
=
new
List
<
string
>();
cols
.
Add
(
row
[
"判断字段1"
].
ToString
().
Trim
());
cols
.
Add
(
row
[
"判断字段2"
].
ToString
().
Trim
());
var
type
=
row
[
"具体字段1"
].
ToString
();
var
description
=
row
[
"具体字段2"
].
ToString
();
var
fulfillment
=
""
;
var
valcol
=
row
[
"取数列"
].
ToString
();
var
feetype
=
""
;
var
category
=
row
[
"科目名称"
].
ToString
();
var
subjectcode
=
row
[
"科目编码"
].
ToString
();
var
projectcode
=
""
;
var
datacentercol
=
row
[
"数据中心字段归集"
].
ToString
();
var
note
=
""
;
var
currency
=
row
[
"币别"
].
ToString
();
var
platform
=
row
[
"物流商"
].
ToString
();
var
website
=
row
[
"分表"
].
ToString
();
//格式化组合条件
var
_condition
=
"{"
;
if
(!
string
.
IsNullOrEmpty
(
type
)
&&
type
!=
"/"
)
{
_condition
+=
"\""
+
row
[
"判断字段1"
].
ToString
()
+
"\":\""
+
type
.
Trim
()
+
"\","
;
}
if
(!
string
.
IsNullOrEmpty
(
description
)
&&
description
!=
"/"
)
{
_condition
+=
"\""
+
row
[
"判断字段2"
].
ToString
()
+
"\":\""
+
description
.
Trim
()
+
"\","
;
}
if
(!
string
.
IsNullOrEmpty
(
fulfillment
))
{
_condition
+=
"\""
+
columns
[
3
].
ColumnName
.
Split
(
'-'
)[
1
]
+
"\":\""
+
fulfillment
.
Trim
()
+
"\","
;
}
if
(
_condition
.
Length
>
1
)
{
_condition
=
_condition
.
Substring
(
0
,
_condition
.
Length
-
1
);
}
_condition
+=
"}"
;
//需要解析的字段
cols
.
Add
(
valcol
);
//保存需要解析的字段
var
_col_result
=
_service
.
SaveOrderFeeCol
(
new
List
<
Models
.
DataWareHouse
.
order_fee_col
>
{
new
Models
.
DataWareHouse
.
order_fee_col
{
cols
=
string
.
Join
(
"||"
,
cols
.
Distinct
().
Where
(
b
=>
b
!=
"/"
&&
!
string
.
IsNullOrEmpty
(
b
)).
ToList
()),
platform
=
platform
,
website
=
website
,
datatype
=
2
,
}});
if
(!
string
.
IsNullOrEmpty
(
_col_result
))
{
return
Content
(
"保存字段解析配置异常,请确认字段格式是否正确。"
);
}
var
m
=
new
Models
.
DataWareHouse
.
order_fee_config
{
subjectcode
=
subjectcode
,
colname_fee
=
valcol
,
condition_forfee
=
_condition
,
datacenter_col
=
datacentercol
,
feetype
=
feetype
,
financecategory
=
category
,
note
=
note
,
projectcode
=
projectcode
,
platform
=
platform
,
website
=
website
,
currency
=
currency
,
delstatus
=
0
,
datatype
=
2
};
list
.
Add
(
m
);
}
//保存取数逻辑条件
var
result
=
_service
.
SaveOrderFeeConfig
(
list
);
if
(!
string
.
IsNullOrEmpty
(
result
))
{
return
Content
(
"保存平台费用取数逻辑配置异常:"
+
result
);
}
}
return
Content
(
"OK"
);
}
}
}
}
}
\ No newline at end of file
Bailun.DC.Web/Views/Home/DemoFile.cshtml
View file @
14c7e74d
...
@@ -4,8 +4,9 @@
...
@@ -4,8 +4,9 @@
ViewBag.Nav = new string[] { "销售平台流水", (ViewBag.platform == "" ? "其他" : ViewBag.platform) + "账单流水" };
ViewBag.Nav = new string[] { "销售平台流水", (ViewBag.platform == "" ? "其他" : ViewBag.platform) + "账单流水" };
}
}
<button id="btn_Upload" type="button" style="" class="btn btn-warning">导入
配置文件
</button>
<button id="btn_Upload" type="button" style="" class="btn btn-warning">导入
销售订单费用配置
</button>
<button id="btn_LogisticFee" type="button" style="" class="btn btn-success">导入物流费配置</button>
@section css{
@section css{
<link href="~/js/webuploader-0.1.5/webuploader.css" rel="stylesheet" />
<link href="~/js/webuploader-0.1.5/webuploader.css" rel="stylesheet" />
...
@@ -47,6 +48,16 @@
...
@@ -47,6 +48,16 @@
function (result) {
function (result) {
alert('上传成功!');
alert('上传成功!');
});
});
//物流商配置 UploadLogisticFeeConfig
uploadfile('btn_LogisticFee',
'@Url.Content("~/Home/UploadLogisticFeeConfig")',
function (result) {
alert('上传成功!');
});
})
})
function uploadfile(id,url,callback)
function uploadfile(id,url,callback)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment