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
d8ad4f63
Commit
d8ad4f63
authored
Mar 29, 2022
by
jianshuqin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化:平台利润导入费用
parent
fce365ba
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
13 deletions
+37
-13
flowing_sales_fee_detail.cs
Bailun.DC.Models/DataWareHouse/flowing_sales_fee_detail.cs
+5
-0
PlatformOrderFeeServices.cs
Bailun.DC.Services/DataWareHouse/PlatformOrderFeeServices.cs
+32
-13
No files found.
Bailun.DC.Models/DataWareHouse/flowing_sales_fee_detail.cs
View file @
d8ad4f63
...
@@ -18,6 +18,11 @@ namespace Bailun.DC.Models.DataWareHouse
...
@@ -18,6 +18,11 @@ namespace Bailun.DC.Models.DataWareHouse
public
int
fee_id
{
get
;
set
;
}
public
int
fee_id
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 账单流水ID
/// </summary>
public
int
flowing_sales_id
{
get
;
set
;
}
/// <summary>
/// 平台
/// 平台
/// </summary>
/// </summary>
public
string
platform
{
get
;
set
;
}
public
string
platform
{
get
;
set
;
}
...
...
Bailun.DC.Services/DataWareHouse/PlatformOrderFeeServices.cs
View file @
d8ad4f63
...
@@ -855,7 +855,7 @@ namespace Bailun.DC.Services.DataWareHouse
...
@@ -855,7 +855,7 @@ namespace Bailun.DC.Services.DataWareHouse
if
(
listRate
?.
Count
>
0
)
if
(
listRate
?.
Count
>
0
)
{
{
sql
=
$@"SELECT
sql
=
$@"SELECT
id AS f
ee
_id
id AS f
lowing_sales
_id
,'
{
platform
}
' AS platform
,'
{
platform
}
' AS platform
,'
{((
new
string
[]
{
"佣金及平台费-亚马逊非FBA"
,
"佣金及平台费-其他平台"
}).
Contains
(
datacenterCol
)
?
"平台费"
:
"FBA费"
)}
' AS fee_type
,'
{((
new
string
[]
{
"佣金及平台费-亚马逊非FBA"
,
"佣金及平台费-其他平台"
}).
Contains
(
datacenterCol
)
?
"平台费"
:
"FBA费"
)}
' AS fee_type
,datatime AS date
,datatime AS date
...
@@ -883,45 +883,64 @@ namespace Bailun.DC.Services.DataWareHouse
...
@@ -883,45 +883,64 @@ namespace Bailun.DC.Services.DataWareHouse
IList
<
flowing_sales_fee_detail
>
list
=
db
.
Query
<
flowing_sales_fee_detail
>(
sql
,
new
{
platform
=
platform
.
Equals
(
"Walmart"
,
StringComparison
.
OrdinalIgnoreCase
)
?
"Walmart"
:
"亚马逊"
,
month
=
month
,
datacenterCol
=
datacenterCol
}).
ToList
();
IList
<
flowing_sales_fee_detail
>
list
=
db
.
Query
<
flowing_sales_fee_detail
>(
sql
,
new
{
platform
=
platform
.
Equals
(
"Walmart"
,
StringComparison
.
OrdinalIgnoreCase
)
?
"Walmart"
:
"亚马逊"
,
month
=
month
,
datacenterCol
=
datacenterCol
}).
ToList
();
if
(
list
?.
Count
>
0
)
if
(
list
?.
Count
>
0
)
{
{
int
count
=
0
;
//开启事务
//开启事务
using
(
MySqlTransaction
transaction
=
db
.
BeginTransaction
())
using
(
MySqlTransaction
transaction
=
db
.
BeginTransaction
())
{
{
try
try
{
{
f
oreach
(
flowing_sales_fee_detail
entity
in
list
)
f
lowing_sales_fee
entity
=
new
flowing_sales_fee
(
)
{
{
if
(
entity
.
amount_cny
==
0
)
platform
=
platform
,
fee_type
=
(
new
string
[]
{
"佣金及平台费-亚马逊非FBA"
,
"佣金及平台费-其他平台"
}).
Contains
(
datacenterCol
)
?
"平台费"
:
"FBA费"
,
month
=
month
,
amount
=
list
.
Sum
(
l
=>
l
.
amount_cny
),
currency
=
"CNY"
,
create_time
=
DateTime
.
Now
,
update_time
=
DateTime
.
Now
,
remark
=
datacenterCol
==
"仓储费-平台"
?
"仓储费"
:
string
.
Empty
};
sql
=
$"update flowing_sales_fee set amount = @amount, currency = @currency,update_time = @update_time,remark = @remark where platform = @platform and fee_type = @fee_type and month = @month"
;
count
=
db
.
Execute
(
sql
,
entity
);
if
(
count
==
0
)
{
{
if
(
entity
.
currency
.
Equals
(
"CNY"
,
StringComparison
.
OrdinalIgnoreCase
))
entity
.
id
=
db
.
Insert
(
entity
)
??
0
;
}
foreach
(
flowing_sales_fee_detail
detailEntity
in
list
)
{
{
entity
.
amount_cny
=
entity
.
amount
;
detailEntity
.
fee_id
=
entity
.
id
;
if
(
detailEntity
.
amount_cny
==
0
)
{
if
(
detailEntity
.
currency
.
Equals
(
"CNY"
,
StringComparison
.
OrdinalIgnoreCase
))
{
detailEntity
.
amount_cny
=
detailEntity
.
amount
;
}
}
else
else
{
{
exchange_rate_finance
rate_cny
=
listRate
.
FirstOrDefault
(
l
=>
l
.
code
.
Equals
(
e
ntity
.
currency
,
StringComparison
.
OrdinalIgnoreCase
));
exchange_rate_finance
rate_cny
=
listRate
.
FirstOrDefault
(
l
=>
l
.
code
.
Equals
(
detailE
ntity
.
currency
,
StringComparison
.
OrdinalIgnoreCase
));
if
(
rate_cny
!=
null
)
if
(
rate_cny
!=
null
)
{
{
entity
.
amount_cny
=
Math
.
Round
(
e
ntity
.
amount
/
rate_cny
.
exchange_rate
,
2
);
detailEntity
.
amount_cny
=
Math
.
Round
(
detailE
ntity
.
amount
/
rate_cny
.
exchange_rate
,
2
);
}
}
}
}
}
}
if
(
e
ntity
.
currency
.
Equals
(
"USD"
,
StringComparison
.
OrdinalIgnoreCase
))
if
(
detailE
ntity
.
currency
.
Equals
(
"USD"
,
StringComparison
.
OrdinalIgnoreCase
))
{
{
entity
.
amount_usd
=
e
ntity
.
amount
;
detailEntity
.
amount_usd
=
detailE
ntity
.
amount
;
}
}
else
else
{
{
exchange_rate_finance
rate_usd
=
listRate
.
FirstOrDefault
(
l
=>
l
.
code
.
Equals
(
"USD"
,
StringComparison
.
OrdinalIgnoreCase
));
exchange_rate_finance
rate_usd
=
listRate
.
FirstOrDefault
(
l
=>
l
.
code
.
Equals
(
"USD"
,
StringComparison
.
OrdinalIgnoreCase
));
if
(
rate_usd
!=
null
)
if
(
rate_usd
!=
null
)
{
{
entity
.
amount_usd
=
Math
.
Round
(
e
ntity
.
amount_cny
*
rate_usd
.
exchange_rate
,
2
);
detailEntity
.
amount_usd
=
Math
.
Round
(
detailE
ntity
.
amount_cny
*
rate_usd
.
exchange_rate
,
2
);
}
}
}
}
sql
=
$"update flowing_sales_fee_detail set platform = @platform, date = @date,amount = @amount,currency = @currency,amount_cny = @amount_cny,amount_usd = @amount_usd,update_time = @update_time where f
ee_id = @fee
_id and data_type = @data_type"
;
sql
=
$"update flowing_sales_fee_detail set platform = @platform, date = @date,amount = @amount,currency = @currency,amount_cny = @amount_cny,amount_usd = @amount_usd,update_time = @update_time where f
lowing_sales_id = @flowing_sales
_id and data_type = @data_type"
;
int
count
=
db
.
Execute
(
sql
,
e
ntity
);
count
=
db
.
Execute
(
sql
,
detailE
ntity
);
if
(
count
==
0
)
if
(
count
==
0
)
{
{
entity
.
id
=
db
.
Insert
(
e
ntity
)
??
0
;
detailEntity
.
id
=
db
.
Insert
(
detailE
ntity
)
??
0
;
}
}
}
}
transaction
.
Commit
();
transaction
.
Commit
();
...
...
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