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
cb59d780
Commit
cb59d780
authored
Aug 21, 2021
by
zhouminghui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
e1a7d1d0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
7 deletions
+31
-7
FinanceService.cs
Bailun.DC.Services/WebApiService/FinanceService.cs
+30
-6
FinanceController.cs
Bailun.DC.WebApi/Controllers/FinanceController.cs
+1
-1
No files found.
Bailun.DC.Services/WebApiService/FinanceService.cs
View file @
cb59d780
...
@@ -1109,22 +1109,32 @@ AND financecategoryname LIKE '{financecategory.Replace("产品", "")}%' ";
...
@@ -1109,22 +1109,32 @@ AND financecategoryname LIKE '{financecategory.Replace("产品", "")}%' ";
/// <summary>
/// <summary>
/// 拉取旧的dc_month_sales_profit表数据到新表,生成新的汇总数据
/// 拉取旧的dc_month_sales_profit表数据到新表,生成新的汇总数据
/// </summary>
/// </summary>
public
bool
SyncMonthSalesProfit
(
DateTime
?
date
)
public
bool
SyncMonthSalesProfit
(
string
date
)
{
{
try
try
{
{
//拉取旧表数据
//拉取旧表数据
var
time
=
string
.
Empty
;
var
time
=
string
.
Empty
;
if
(
date
.
HasValue
)
if
(
!
string
.
IsNullOrWhiteSpace
(
date
)
)
{
{
time
=
date
.
Value
.
ToString
(
"yyyy-MM"
);
time
=
Convert
.
ToDateTime
(
date
)
.
ToString
(
"yyyy-MM"
);
}
}
else
else
{
{
time
=
DateTime
.
Now
.
AddMonths
(-
1
).
ToString
(
"yyyy-MM"
);
time
=
DateTime
.
Now
.
AddMonths
(-
1
).
ToString
(
"yyyy-MM"
);
}
}
var
falg
=
false
;
Console
.
WriteLine
(
$"
{
DateTime
.
Now
}
开始生成利润报表汇总数据"
);
var
sql
=
$"select * from dc_month_sales_profit_v2 where isedit != 1 and month = '
{
time
}
'"
;
var
sql
=
$"select * from dc_month_sales_profit_v2 where isedit != 1 and month = '
{
time
}
'"
;
var
oldData
=
SimpleCRUD
.
Query
<
dc_month_sales_profit_v2
>(
sql
,
null
,
GlobalConfig
.
ConnectionString
).
FirstOrDefault
()
??
new
dc_month_sales_profit_v2
();
var
oldData
=
SimpleCRUD
.
Query
<
dc_month_sales_profit_v2
>(
sql
,
null
,
GlobalConfig
.
ConnectionString
).
FirstOrDefault
();
if
(
oldData
==
null
)
{
falg
=
true
;
sql
=
$"select * from dc_month_sales_profit where isedit != 1 and month = '
{
time
}
'"
;
oldData
=
SimpleCRUD
.
Query
<
dc_month_sales_profit_v2
>(
sql
,
null
,
GlobalConfig
.
ConnectionString
).
FirstOrDefault
();
}
if
(
oldData
!=
null
)
{
//对旧表数据进行赋值新数据
//对旧表数据进行赋值新数据
//var field = new MonthSalesProfitDto();
//var field = new MonthSalesProfitDto();
//var name = field.amount_sales_jingyou.GetType().GetCustomAttribute<System.ComponentModel.DisplayNameAttribute>().DisplayName;
//var name = field.amount_sales_jingyou.GetType().GetCustomAttribute<System.ComponentModel.DisplayNameAttribute>().DisplayName;
...
@@ -1140,7 +1150,7 @@ AND financecategoryname LIKE '{financecategory.Replace("产品", "")}%' ";
...
@@ -1140,7 +1150,7 @@ AND financecategoryname LIKE '{financecategory.Replace("产品", "")}%' ";
oldData
.
amount_sales
=
Math
.
Round
(
oldData
.
amount_sales_dianzi
+
oldData
.
amount_sales_fuzhuang
+
oldData
.
amount_sales_jiaju
oldData
.
amount_sales
=
Math
.
Round
(
oldData
.
amount_sales_dianzi
+
oldData
.
amount_sales_fuzhuang
+
oldData
.
amount_sales_jiaju
+
oldData
.
amount_sales_jingyou
+
oldData
.
amount_sales_meirongmj
+
oldData
.
amount_sales_other
+
oldData
.
fee_refund
,
2
);
+
oldData
.
amount_sales_jingyou
+
oldData
.
amount_sales_meirongmj
+
oldData
.
amount_sales_other
+
oldData
.
fee_refund
,
2
);
//成本
//成本
oldData
.
cost_jingyou
=
Math
.
Abs
(
Math
.
Round
(
GetMonthSalesProfiOrderSummary
(
time
,
"精油产品"
,
"成本"
).
Sum
(
x
=>
x
.
total_amount_sales
),
2
))
*
(-
1
);
oldData
.
cost_jingyou
=
Math
.
Abs
(
Math
.
Round
(
GetMonthSalesProfiOrderSummary
(
time
,
"精油产品"
,
"成本"
).
Sum
(
x
=>
x
.
total_amount_sales
),
2
))
*
(-
1
);
oldData
.
cost_dianzi
=
Math
.
Abs
(
Math
.
Round
(
GetMonthSalesProfiOrderSummary
(
time
,
"电子产品"
,
"成本"
).
Sum
(
x
=>
x
.
total_amount_sales
),
2
))
*
(-
1
);
oldData
.
cost_dianzi
=
Math
.
Abs
(
Math
.
Round
(
GetMonthSalesProfiOrderSummary
(
time
,
"电子产品"
,
"成本"
).
Sum
(
x
=>
x
.
total_amount_sales
),
2
))
*
(-
1
);
oldData
.
cost_jiaju
=
Math
.
Abs
(
Math
.
Round
(
GetMonthSalesProfiOrderSummary
(
time
,
"家居产品"
,
"成本"
).
Sum
(
x
=>
x
.
total_amount_sales
),
2
))
*
(-
1
);
oldData
.
cost_jiaju
=
Math
.
Abs
(
Math
.
Round
(
GetMonthSalesProfiOrderSummary
(
time
,
"家居产品"
,
"成本"
).
Sum
(
x
=>
x
.
total_amount_sales
),
2
))
*
(-
1
);
oldData
.
cost_meirongmj
=
Math
.
Abs
(
Math
.
Round
(
GetMonthSalesProfiOrderSummary
(
time
,
"美容美甲产品"
,
"成本"
).
Sum
(
x
=>
x
.
total_amount_sales
),
2
))
*
(-
1
);
oldData
.
cost_meirongmj
=
Math
.
Abs
(
Math
.
Round
(
GetMonthSalesProfiOrderSummary
(
time
,
"美容美甲产品"
,
"成本"
).
Sum
(
x
=>
x
.
total_amount_sales
),
2
))
*
(-
1
);
...
@@ -1183,7 +1193,7 @@ AND financecategoryname LIKE '{financecategory.Replace("产品", "")}%' ";
...
@@ -1183,7 +1193,7 @@ AND financecategoryname LIKE '{financecategory.Replace("产品", "")}%' ";
.
Where
(
m
=>
m
.
AmountValRmb
!=
null
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
.
Where
(
m
=>
m
.
AmountValRmb
!=
null
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
oldData
.
fee_nologistics_tail
=
Math
.
Abs
(
Math
.
Round
(
ExportMonthProfitFeePlatformFeeDetail
(
oldData
.
fee_nologistics_tail
=
Math
.
Abs
(
Math
.
Round
(
ExportMonthProfitFeePlatformFeeDetail
(
new
GetMonthProfitPlatformDetailInput
{
Month
=
time
,
FeeName
=
"尾程物流费-非平台"
})
new
GetMonthProfitPlatformDetailInput
{
Month
=
time
,
FeeName
=
"尾程物流费-非平台"
})
.
Where
(
m
=>
m
.
AmountValRmb
!=
null
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
.
Where
(
m
=>
m
.
AmountValRmb
!=
null
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
oldData
.
fee_logistics_direct
=
Math
.
Abs
(
Math
.
Round
(
ExportMonthProfitFeePlatformFeeDetail
(
oldData
.
fee_logistics_direct
=
Math
.
Abs
(
Math
.
Round
(
ExportMonthProfitFeePlatformFeeDetail
(
new
GetMonthProfitPlatformDetailInput
{
Month
=
time
,
FeeName
=
"直邮物流费-平台"
})
new
GetMonthProfitPlatformDetailInput
{
Month
=
time
,
FeeName
=
"直邮物流费-平台"
})
.
Where
(
m
=>
m
.
AmountValRmb
!=
null
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
.
Where
(
m
=>
m
.
AmountValRmb
!=
null
).
Sum
(
x
=>
x
.
AmountValRmb
.
Value
),
2
))
*
(-
1
);
...
@@ -1270,17 +1280,31 @@ AND financecategoryname LIKE '{financecategory.Replace("产品", "")}%' ";
...
@@ -1270,17 +1280,31 @@ AND financecategoryname LIKE '{financecategory.Replace("产品", "")}%' ";
{
{
cn
.
Open
();
cn
.
Open
();
}
}
if
(
falg
)
{
oldData
.
createtime
=
DateTime
.
Now
;
oldData
.
lastupdatetime
=
DateTime
.
Now
;
cn
.
Insert
(
oldData
);
Console
.
WriteLine
(
$"
{
DateTime
.
Now
}
触发了新增操作"
);
}
else
{
if
(
oldData
.
id
>
0
)
if
(
oldData
.
id
>
0
)
{
{
oldData
.
lastupdatetime
=
DateTime
.
Now
;
oldData
.
lastupdatetime
=
DateTime
.
Now
;
cn
.
Update
(
oldData
);
cn
.
Update
(
oldData
);
Console
.
WriteLine
(
$"
{
DateTime
.
Now
}
触发了更新操作"
);
}
}
else
else
{
{
oldData
.
createtime
=
DateTime
.
Now
;
oldData
.
createtime
=
DateTime
.
Now
;
oldData
.
lastupdatetime
=
DateTime
.
Now
;
oldData
.
lastupdatetime
=
DateTime
.
Now
;
cn
.
Insert
(
oldData
);
cn
.
Insert
(
oldData
);
Console
.
WriteLine
(
$"
{
DateTime
.
Now
}
触发了新增操作"
);
}
}
}
}
Console
.
WriteLine
(
$"
{
DateTime
.
Now
}
开始生成利润报表汇总数据"
);
}
}
return
true
;
return
true
;
}
}
...
...
Bailun.DC.WebApi/Controllers/FinanceController.cs
View file @
cb59d780
...
@@ -547,7 +547,7 @@ namespace Bailun.DC.WebApi.Controllers
...
@@ -547,7 +547,7 @@ namespace Bailun.DC.WebApi.Controllers
/// <param name="time"></param>
/// <param name="time"></param>
/// <returns></returns>
/// <returns></returns>
[
HttpGet
(
"syncMonthSalesProfit"
)]
[
HttpGet
(
"syncMonthSalesProfit"
)]
public
bool
SyncMonthSalesProfit
(
DateTime
?
time
)
public
bool
SyncMonthSalesProfit
(
string
time
)
{
{
return
new
FinanceService
().
SyncMonthSalesProfit
(
time
);
return
new
FinanceService
().
SyncMonthSalesProfit
(
time
);
//var sql = "select * from dc_month_sales_profit_orderdetail limit 1";
//var sql = "select * from dc_month_sales_profit_orderdetail limit 1";
...
...
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