Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
data-center-auto
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
data-center-auto
Commits
3ef6386a
Commit
3ef6386a
authored
Nov 18, 2020
by
泽锋 李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增财报退款数据的抓取
parent
7f8e01b0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
111 additions
and
9 deletions
+111
-9
dc_report_finance_dao.cs
AutoTurnOver.DB/dc_report_finance_dao.cs
+82
-0
dc_report_finance.cs
AutoTurnOver.Models/Report/dc_report_finance.cs
+8
-0
Program.cs
ResetOutofstock/Program.cs
+1
-1
ReportFinanceBackgrounService.cs
ResetOutofstock/ReportFinanceBackgrounService.cs
+14
-8
ResetOutofstockBackgrounService.cs
ResetOutofstock/ResetOutofstockBackgrounService.cs
+6
-0
No files found.
AutoTurnOver.DB/dc_report_finance_dao.cs
View file @
3ef6386a
...
...
@@ -307,5 +307,87 @@ GROUP BY t1.platform_type ", new
thisTime
=
thisTime
.
AddDays
(-
1
);
}
}
/// <summary>
/// 计算订单 退款数据
/// </summary>
/// <param name="bTime"></param>
public
static
void
CalculationRefund
(
DateTime
bTime
)
{
// 查询分类
var
etime
=
DateTime
.
Now
;
var
thisTime
=
etime
;
while
(
thisTime
>=
bTime
)
{
var
b_this_time
=
thisTime
.
ToDayHome
();
var
e_this_time
=
thisTime
.
ToDayEnd
();
var
group_datas
=
_connection
.
Query
<
oms_order_refund_group_dto
>(
@"select
t2.product_type,t2.product_type_desc,
sum(t1.amount_refund_rmb) as 'amount_refund_rmb',
sum(t1.bailun_sku_quantity_refund) as 'bailun_sku_quantity_refund'
from dc_base_crm_refund as t1
left join dc_base_sku as t2 on t1.bailun_sku = t2.bailun_sku
where t1.refund_time>=@b_this_time and t1.refund_time<=@e_this_time
and t1.is_deleted =0
GROUP BY t2.product_type,t2.product_type_desc "
,
new
{
b_this_time
=
b_this_time
,
e_this_time
=
e_this_time
}).
ToList
();
if
(
group_datas
!=
null
)
{
List
<
dc_report_finance
>
datas
=
new
List
<
dc_report_finance
>();
foreach
(
var
item
in
group_datas
)
{
datas
.
Add
(
new
dc_report_finance
()
{
data_type
=
"退款数量"
,
item_name
=
item
.
product_type_desc
??
"未知"
,
item_id
=
item
.
product_type
.
ToString
(),
date
=
b_this_time
,
val
=
item
.
bailun_sku_quantity_refund
,
update_date
=
DateTime
.
Now
});
datas
.
Add
(
new
dc_report_finance
()
{
data_type
=
"退款金额"
,
item_name
=
item
.
product_type_desc
??
"未知"
,
item_id
=
item
.
product_type
.
ToString
(),
date
=
b_this_time
,
val
=
item
.
amount_refund_rmb
,
update_date
=
DateTime
.
Now
});
}
foreach
(
var
data
in
datas
)
{
data
.
id
=
_connection
.
QueryFirstOrDefault
<
int
>(
" select id from dc_report_finance where data_type=@data_type and item_id=@item_id and date=@date "
,
new
{
data_type
=
data
.
data_type
,
item_id
=
data
.
item_id
,
date
=
data
.
date
});
if
(
data
.
id
>
0
)
{
_connection
.
Update
(
data
);
}
else
{
_connection
.
Insert
(
data
);
}
}
}
thisTime
=
thisTime
.
AddDays
(-
1
);
}
}
}
}
AutoTurnOver.Models/Report/dc_report_finance.cs
View file @
3ef6386a
...
...
@@ -46,4 +46,12 @@ namespace AutoTurnOver.Models.Report
public
decimal
amount_sales
{
get
;
set
;
}
}
public
class
oms_order_refund_group_dto
{
public
int
product_type
{
get
;
set
;
}
public
string
product_type_desc
{
get
;
set
;
}
public
decimal
amount_refund_rmb
{
get
;
set
;
}
public
int
bailun_sku_quantity_refund
{
get
;
set
;
}
}
}
ResetOutofstock/Program.cs
View file @
3ef6386a
...
...
@@ -29,7 +29,7 @@ namespace ResetOutofstock
//dc_auto_pick_up_goods_order_dao.GenerateOrder(DateTime.Now.AddDays(-3), DateTime.Now);
//dc_auto_pick_up_goods_order_dao.GenerateOrder(DateTime.Now.AddDays(-1), DateTime.Now);
dc_report_finance_dao
.
CalculationOrderPlatfrom
(
DateTime
.
Now
.
AddYears
(-
1
));
//dc_report_finance_dao.CalculationRefund
(DateTime.Now.AddYears(-1));
}
catch
(
Exception
ex
)
{
...
...
ResetOutofstock/ReportFinanceBackgrounService.cs
View file @
3ef6386a
...
...
@@ -24,27 +24,33 @@ namespace ResetOutofstock
if
(
now
.
Hour
==
0
&&
now
.
Minute
==
01
)
{
Console
.
WriteLine
(
$"开始
刷新
财务付现数据 ,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
Console
.
WriteLine
(
$"开始
财报
财务付现数据 ,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
dc_report_finance_dao
.
CalculationCashPayment
(
DateTime
.
Now
.
AddDays
(-
90
));
Console
.
WriteLine
(
$"结束
刷新
财务付现数据,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
Console
.
WriteLine
(
$"结束
财报
财务付现数据,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
}
if
(
now
.
Hour
==
0
&&
now
.
Minute
==
02
)
{
Console
.
WriteLine
(
$"开始
刷新
出库退税数据 ,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
Console
.
WriteLine
(
$"开始
财报
出库退税数据 ,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
dc_report_finance_dao
.
CalculationTax
(
DateTime
.
Now
.
AddDays
(-
90
));
Console
.
WriteLine
(
$"结束
刷新
出库退税数据,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
Console
.
WriteLine
(
$"结束
财报
出库退税数据,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
}
if
(
now
.
Hour
==
0
&&
now
.
Minute
==
03
)
{
Console
.
WriteLine
(
$"开始
刷新订单财报
数据 ,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
Console
.
WriteLine
(
$"开始
财报订单
数据 ,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
dc_report_finance_dao
.
CalculationOrder
(
DateTime
.
Now
.
AddDays
(-
90
));
Console
.
WriteLine
(
$"结束
刷新订单财报
数据,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
Console
.
WriteLine
(
$"结束
财报订单
数据,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
}
if
(
now
.
Hour
==
0
&&
now
.
Minute
==
04
)
{
Console
.
WriteLine
(
$"开始
订单-平台财报
数据 ,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
Console
.
WriteLine
(
$"开始
财报订单-平台
数据 ,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
dc_report_finance_dao
.
CalculationOrderPlatfrom
(
DateTime
.
Now
.
AddDays
(-
90
));
Console
.
WriteLine
(
$"结束 订单-平台财报数据,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
Console
.
WriteLine
(
$"结束 财报订单-平台数据,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
}
if
(
now
.
Hour
==
0
&&
now
.
Minute
==
05
)
{
Console
.
WriteLine
(
$"开始 财报退款数据 ,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
dc_report_finance_dao
.
CalculationRefund
(
DateTime
.
Now
.
AddDays
(-
90
));
Console
.
WriteLine
(
$"结束 财报退款数据,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
}
...
...
ResetOutofstock/ResetOutofstockBackgrounService.cs
View file @
3ef6386a
...
...
@@ -39,6 +39,12 @@ namespace ResetOutofstock
dc_report_finance_dao
.
CalculationOrderPlatfrom
(
DateTime
.
Now
.
AddYears
(-
1
));
Console
.
WriteLine
(
$"结束 订单-平台财报数据,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
});
Task
.
Factory
.
StartNew
(()
=>
{
Console
.
WriteLine
(
$"开始 订单-财报退款数据 ,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
dc_report_finance_dao
.
CalculationRefund
(
DateTime
.
Now
.
AddYears
(-
1
));
Console
.
WriteLine
(
$"结束 订单-财报退款数据,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
});
Task
.
Factory
.
StartNew
(()
=>
...
...
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