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
e36e1e54
Commit
e36e1e54
authored
Aug 11, 2021
by
zhouminghui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
月利润明细
parent
93e7cb62
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
458 additions
and
3 deletions
+458
-3
FinanceDetailsDto.cs
Bailun.DC.Models/Dtos/Finance/FinanceDetailsDto.cs
+11
-2
GetMonthProfitPlatformDetailInput.cs
....Models/WebApiModels/GetMonthProfitPlatformDetailInput.cs
+14
-0
MonthPlatformProfitDto.cs
Bailun.DC.Models/WebApiModels/MonthPlatformProfitDto.cs
+26
-0
MonthReFundDto.cs
Bailun.DC.Models/WebApiModels/MonthReFundDto.cs
+24
-0
FinanceService.cs
Bailun.DC.Services/WebApiService/FinanceService.cs
+281
-0
FinanceController.cs
Bailun.DC.WebApi/Controllers/FinanceController.cs
+102
-1
No files found.
Bailun.DC.Models/Dtos/Finance/FinanceDetailsDto.cs
View file @
e36e1e54
...
...
@@ -9,11 +9,11 @@ namespace Bailun.DC.Models.Dtos.Finance
/// <summary>
/// 金额
/// </summary>
public
decimal
Amount
{
get
;
set
;
}
public
decimal
?
Amount
{
get
;
set
;
}
/// <summary>
/// 人民币
/// </summary>
public
decimal
AmountRmb
{
get
;
set
;
}
public
decimal
?
AmountRmb
{
get
;
set
;
}
/// <summary>
/// 公司
/// </summary>
...
...
@@ -42,6 +42,7 @@ namespace Bailun.DC.Models.Dtos.Finance
/// 付款时间
/// </summary>
public
string
PayTime
{
get
;
set
;
}
public
DateTime
?
pay_time
{
get
;
set
;
}
/// <summary>
/// 费用类型
/// </summary>
...
...
@@ -51,5 +52,13 @@ namespace Bailun.DC.Models.Dtos.Finance
/// </summary>
public
string
Accounting
{
get
;
set
;
}
public
string
CostReason
{
get
;
set
;
}
public
string
CostRemark
{
get
;
set
;
}
public
int
cost_form
{
get
;
set
;
}
public
int
?
is_lend
{
get
;
set
;
}
public
int
?
lend_balance
{
get
;
set
;
}
}
}
Bailun.DC.Models/WebApiModels/GetMonthProfitPlatformDetailInput.cs
0 → 100644
View file @
e36e1e54
using
Bailun.DC.Models.Common.Page
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Bailun.DC.Models.WebApiModels
{
public
class
GetMonthProfitPlatformDetailInput
:
PageRequest
{
public
string
Month
{
get
;
set
;
}
public
string
FeeName
{
get
;
set
;
}
public
string
PlatformType
{
get
;
set
;
}
}
}
Bailun.DC.Models/WebApiModels/MonthPlatformProfitDto.cs
0 → 100644
View file @
e36e1e54
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Bailun.DC.Models.WebApiModels
{
public
class
MonthPlatformProfitDto
{
public
string
PlatForm
{
get
;
set
;
}
public
string
WebSite
{
get
;
set
;
}
public
string
Orderno
{
get
;
set
;
}
public
string
DataTime
{
get
;
set
;
}
public
string
AmountVal
{
get
;
set
;
}
public
string
FeeType
{
get
;
set
;
}
public
string
Subjectcode
{
get
;
set
;
}
public
string
ProjectCode
{
get
;
set
;
}
public
string
FinanceCategory
{
get
;
set
;
}
public
string
DatacenterCol
{
get
;
set
;
}
public
string
Currency
{
get
;
set
;
}
public
string
ExchangeRate
{
get
;
set
;
}
public
string
AmountValRmb
{
get
;
set
;
}
public
string
Month
{
get
;
set
;
}
}
}
Bailun.DC.Models/WebApiModels/MonthReFundDto.cs
0 → 100644
View file @
e36e1e54
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Bailun.DC.Models.WebApiModels
{
public
class
MonthReFundDto
{
public
string
PlatformType
{
get
;
set
;
}
public
string
BailunAccount
{
get
;
set
;
}
public
string
WebSite
{
get
;
set
;
}
public
string
OriginOrderId
{
get
;
set
;
}
public
string
RefundRmb
{
get
;
set
;
}
public
string
RefundUsd
{
get
;
set
;
}
public
string
RefundTime
{
get
;
set
;
}
}
public
class
MonthReFundSummary
{
public
string
Platform
{
get
;
set
;
}
public
decimal
?
RefundRmb
{
get
;
set
;
}
public
decimal
?
RefundUsd
{
get
;
set
;
}
public
int
?
Totals
{
get
;
set
;
}
}
}
Bailun.DC.Services/WebApiService/FinanceService.cs
View file @
e36e1e54
...
...
@@ -457,6 +457,7 @@ and s1.management_cost_name = @managementcostname";
return
data
;
}
#
region
月利润销售表
/// <summary>
/// 查询月销售平台统计数据
...
...
@@ -483,6 +484,8 @@ and s1.management_cost_name = @managementcostname";
return
data
;
}
/// <summary>
/// 分页查询月销售明细
/// </summary>
...
...
@@ -508,6 +511,7 @@ and s1.management_cost_name = @managementcostname";
return
result
;
}
private
string
BuildMonthSalesProfitOrderdetailPageQuerySqlWhere
(
MonthProfitOrderDetailPageInputDto
input
,
out
DynamicParameters
parameters
)
{
parameters
=
new
DynamicParameters
();
...
...
@@ -540,6 +544,7 @@ and s1.management_cost_name = @managementcostname";
sqlText
.
Append
(
" ORDER BY t1.createtime DESC "
);
return
sqlText
.
ToString
();
}
public
bool
UpdateMonthSalseProfit
(
UpdateMonthSalseProfitInput
input
,
int
userId
,
string
userName
)
{
using
(
var
cn
=
new
MySqlConnection
(
Common
.
GlobalConfig
.
ConnectionString
))
...
...
@@ -669,6 +674,282 @@ and s1.management_cost_name = @managementcostname";
}
}
}
/// <summary>
/// 月销售利润管理成本明细
/// </summary>
/// <param name="month"></param>
/// <param name="feeName"></param>
/// <returns></returns>
public
CommonApiResponseDto
<
List
<
FinanceDetailsDto
>>
GetMonthProfitFeeManagementCostDetail
(
string
month
,
string
feeName
)
{
month
=
month
.
Replace
(
"月份"
,
""
);
var
start
=
Convert
.
ToDateTime
(
month
).
Date
;
var
end
=
start
.
AddMonths
(
1
).
Date
;
var
sql
=
BuildMonthProfitFeeManagementCostDetailSql
(
start
,
end
,
feeName
);
var
data
=
SimpleCRUD
.
Query
<
FinanceDetailsDto
>(
sql
,
null
,
GlobalConfig
.
ConnectionString
).
ToList
();
foreach
(
var
item
in
data
)
{
if
(
item
.
cost_form
==
2
)
{
item
.
Amount
=
-(
item
.
Amount
);
item
.
AmountRmb
=
-(
item
.
AmountRmb
);
}
//借支单待还余额
if
(
item
.
cost_form
==
3
)
{
if
(
item
.
is_lend
.
HasValue
&&
item
.
is_lend
.
Value
==
2
&&
((
item
.
lend_balance
??
0
)
>
0
))
//归还金额
{
item
.
Amount
=
-(
item
.
Amount
);
item
.
AmountRmb
=
-(
item
.
AmountRmb
);
}
}
}
data
.
Select
(
x
=>
{
x
.
Reason
=
string
.
IsNullOrEmpty
(
x
.
CostReason
)
?
x
.
CostRemark
:
x
.
CostReason
;
x
.
PayTime
=
x
.
pay_time
.
HasValue
?
x
.
pay_time
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
;
return
x
;
}).
ToList
();
data
.
Add
(
new
FinanceDetailsDto
{
FeeId
=
"合计"
,
AmountRmb
=
data
.
Sum
(
x
=>
x
.
AmountRmb
),
Amount
=
data
.
Sum
(
x
=>
x
.
Amount
)
});
return
new
CommonApiResponseDto
<
List
<
FinanceDetailsDto
>>
{
Data
=
data
};
}
public
string
BuildMonthProfitFeeManagementCostDetailSql
(
DateTime
start
,
DateTime
end
,
string
feeName
)
{
StringBuilder
sql
=
new
StringBuilder
();
sql
.
Append
(
$@"select amount as Amount,amount_rmb as AmountRmb,company_name as CompanyName,
dic as Currency,department_name as DepartmentName,type_name as TypeName,
cost_no as FeeId,accounting_subject_name as Accounting,bank_company as ReceiveUnit,
cost_reason as CostReason,cost_remark as CostRemark,pay_time
from dc_base_finance_fee where cost_status=4 and (is_lend is null or is_lend=1 or (is_lend=2 and lend_balance>0)
or (is_lend=2 and cost_form=1)) and pay_time>='
{
start
}
' and pay_time<'
{
end
}
' "
);
if
(
feeName
==
"广州歌戈儿生活科技有限公司"
)
{
sql
.
Append
(
$" and (company_name like '%
{
feeName
}
%' and (type_name!='销售收入' and type_name!='出口退税款')) "
);
}
else
if
(
feeName
.
Contains
(
"广州电子服装仓&阳山"
))
{
sql
.
Append
(
" and (company_name in ('广州电子服装仓','阳山仓') and type_name!='出口退税款') "
);
}
else
{
sql
.
Append
(
$" and (company_name ='
{
feeName
}
' and type_name!='出口退税款') "
);
}
return
sql
.
ToString
();
}
public
CommonApiResponseDto
<
PageResult
<
List
<
MonthPlatformProfitDto
>>>
GetMonthProfitFeePlatformFeeDetail
(
GetMonthProfitPlatformDetailInput
input
)
{
var
sql
=
BuildMonthProfitFeePlatformFeeDetailSql
(
input
);
var
result
=
new
PageResult
<
List
<
MonthPlatformProfitDto
>>();
using
(
var
cn
=
new
MySqlConnection
(
Common
.
GlobalConfig
.
ConnectionString_DW
))
{
if
(
cn
.
State
==
System
.
Data
.
ConnectionState
.
Closed
)
{
cn
.
Open
();
}
int
total
=
0
;
var
obj
=
cn
.
Page
<
MonthPlatformProfitDto
>(
input
.
PageIndex
,
input
.
PageNumber
,
sql
,
ref
total
);
var
data
=
obj
.
ToList
();
if
(
data
.
Count
>
0
)
{
var
sumSql
=
BuildMonthProfitFeePlatformFeeDetailSql
(
input
,
false
,
true
);
var
count
=
cn
.
Query
<(
decimal
,
decimal
)>(
sumSql
).
FirstOrDefault
();
data
.
Add
(
new
MonthPlatformProfitDto
{
Currency
=
"合计"
,
AmountVal
=
Math
.
Round
(
count
.
Item1
,
2
).
ToString
(),
AmountValRmb
=
Math
.
Round
(
count
.
Item2
,
2
).
ToString
(),
});
}
result
=
result
.
ToPageResult
(
input
.
PageIndex
,
total
,
data
);
}
//var data = SimpleCRUD.Query<MonthPlatformProfitDto>(sql, null, GlobalConfig.ConnectionString_DW).ToList();
return
new
CommonApiResponseDto
<
PageResult
<
List
<
MonthPlatformProfitDto
>>>
{
Data
=
result
};
}
public
string
BuildMonthProfitFeePlatformFeeDetailSql
(
GetMonthProfitPlatformDetailInput
input
,
bool
isPage
=
false
,
bool
isSum
=
false
)
{
input
.
Month
=
input
.
Month
.
Replace
(
"月份"
,
""
);
StringBuilder
sql
=
new
StringBuilder
();
if
(
isSum
)
{
sql
.
Append
(
$@"SELECT sum(s1.amountval) as amountval, sum(s1.amountval_rmb) amountval_rmb
from order_fee_value_amazon s1
JOIN order_fee_config s2
ON s2.id = s1.order_fee_config_id WHERE s1.amountval != 0 AND s1.month = '
{
input
.
Month
}
'"
);
}
else
{
sql
.
Append
(
$@"SELECT s1.platform AS PlatForm,s1.website AS WebSite,s1.orderno AS Orderno,
s1.datatime AS DataTime,s1.amountval AS AmountVal,
s2.feetype AS FeeType,s2.subjectcode AS Subjectcode,s2.projectcode AS ProjectCode,
s2.financecategory AS FinanceCategory,s2.datacenter_col AS DatacenterCol,s2.currency AS Currency,
s1.exchange_rate AS ExchangeRate,s1.amountval_rmb AS AmountValRmb,s1.month AS Month
from order_fee_value_amazon s1
JOIN order_fee_config s2
ON s2.id = s1.order_fee_config_id WHERE s1.amountval != 0 AND s1.month = '
{
input
.
Month
}
'"
);
}
if
(
input
.
FeeName
==
"FBA费"
)
{
sql
.
Append
(
"AND s2.datacenter_col LIKE '%佣金及平台费-亚马逊FBA%'"
);
}
else
{
sql
.
Append
(
$"AND s2.datacenter_col LIKE '%
{
input
.
FeeName
}
%'"
);
}
if
(
isPage
)
{
sql
.
Append
(
$" LIMIT
{
input
.
PageNumber
}
OFFSET
{(
input
.
PageIndex
-
1
)
*
input
.
PageNumber
}
"
);
}
return
sql
.
ToString
();
}
public
List
<
MonthPlatformProfitDto
>
ExportMonthProfitFeePlatformFeeDetail
(
GetMonthProfitPlatformDetailInput
input
)
{
var
sql
=
BuildMonthProfitFeePlatformFeeDetailSql
(
input
,
false
,
false
);
var
data
=
SimpleCRUD
.
Query
<
MonthPlatformProfitDto
>(
sql
,
null
,
GlobalConfig
.
ConnectionString_DW
).
ToList
();
return
data
;
}
/// <summary>
/// 退款分页明细
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public
CommonApiResponseDto
<
PageResult
<
List
<
MonthReFundDto
>>>
GetMonthProfitFeeReFundDetail
(
GetMonthProfitPlatformDetailInput
input
)
{
var
sql
=
BuildMonthProfitFeeReFundDetailSql
(
input
,
false
,
false
);
var
result
=
new
PageResult
<
List
<
MonthReFundDto
>>();
using
(
var
cn
=
new
MySqlConnection
(
Common
.
GlobalConfig
.
ConnectionString_read
))
{
if
(
cn
.
State
==
System
.
Data
.
ConnectionState
.
Closed
)
{
cn
.
Open
();
}
int
total
=
0
;
var
obj
=
cn
.
Page
<
MonthReFundDto
>(
input
.
PageIndex
,
input
.
PageNumber
,
sql
,
ref
total
);
var
data
=
obj
.
ToList
();
if
(
data
.
Count
>
0
)
{
var
sumSql
=
BuildMonthProfitFeeReFundDetailSql
(
input
,
false
,
true
);
var
count
=
cn
.
Query
<(
decimal
,
decimal
)>(
sumSql
).
FirstOrDefault
();
data
.
Add
(
new
MonthReFundDto
{
BailunAccount
=
"合计"
,
RefundRmb
=
Math
.
Round
(
count
.
Item1
,
2
).
ToString
(),
RefundUsd
=
Math
.
Round
(
count
.
Item2
,
2
).
ToString
(),
});
}
result
=
result
.
ToPageResult
(
input
.
PageIndex
,
total
,
data
);
}
return
new
CommonApiResponseDto
<
PageResult
<
List
<
MonthReFundDto
>>>
{
Data
=
result
};
}
/// <summary>
/// 根据平台汇总
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public
CommonApiResponseDto
<
List
<
MonthReFundSummary
>>
GetMonthProfitPlatformPlatformSummary
(
GetMonthProfitPlatformDetailInput
input
)
{
var
sql
=
BuildMonthProfitFeeReFundDetailSql
(
input
,
false
,
false
,
true
);
var
data
=
SimpleCRUD
.
Query
<
MonthReFundSummary
>(
sql
,
null
,
GlobalConfig
.
ConnectionString_read
).
ToList
();
return
new
CommonApiResponseDto
<
List
<
MonthReFundSummary
>>
{
Data
=
data
.
Select
(
x
=>
new
MonthReFundSummary
{
Platform
=
x
.
Platform
,
RefundRmb
=
Math
.
Round
((
decimal
)
x
.
RefundRmb
,
2
),
RefundUsd
=
Math
.
Round
((
decimal
)
x
.
RefundUsd
,
2
),
Totals
=
x
.
Totals
,
}).
ToList
()
};
}
public
string
BuildMonthProfitFeeReFundDetailSql
(
GetMonthProfitPlatformDetailInput
input
,
bool
isPage
=
false
,
bool
isSum
=
false
,
bool
isSummary
=
false
)
{
StringBuilder
sql
=
new
StringBuilder
();
input
.
Month
=
input
.
Month
.
Replace
(
"月份"
,
""
);
var
start
=
Convert
.
ToDateTime
(
input
.
Month
).
Date
;
var
end
=
start
.
AddMonths
(
1
).
Date
;
if
(
isSummary
)
//根据平台分组明细汇总
{
return
$@"select platform_type AS Platform,SUM(amount_refund_rmb) AS RefundRmb,
SUM(amount_refund_usd) AS RefundUsd,Count(*) AS Totals
from dc_base_crm_refund
where refund_time >= '
{
start
}
' and refund_time < '
{
end
}
'
group by platform_type "
;
}
var
coulms
=
@"t1.platform_type AS PlatformType, t1.bailun_account AS BailunAccount, t1.website AS WebSite,
t1.origin_order_id AS OriginOrderId, t1.amount_refund_rmb AS RefundRmb, t1.amount_refund_usd AS RefundUsd, t1.refund_time AS RefundTime"
;
if
(
isSum
)
{
coulms
=
"sum(t1.amount_refund_rmb) AS RefundRmb,sum(t1.amount_refund_usd) AS RefundUsd"
;
}
sql
.
Append
(
$@"
select
{
coulms
}
from dc_base_crm_refund t1
where t1.refund_time >= '
{
start
}
' and t1.refund_time < '
{
end
}
' "
);
if
(!
string
.
IsNullOrWhiteSpace
(
input
.
PlatformType
))
{
sql
.
Append
(
$" AND t1.platform_type = '
{
input
.
PlatformType
}
'"
);
}
if
(
isPage
)
{
sql
.
Append
(
$" LIMIT
{
input
.
PageNumber
}
OFFSET
{(
input
.
PageIndex
-
1
)
*
input
.
PageNumber
}
"
);
}
return
sql
.
ToString
();
}
public
CommonApiResponseDto
<
PageResult
<
List
<
dc_month_sales_profit_orderdetail
>>>
GetMonthSalesProfitDetail
(
MonthProfitOrderDetailPageInputDto
input
,
bool
isPage
=
true
)
{
var
data
=
new
List
<
dc_month_sales_profit_orderdetail
>();
var
result
=
new
PageResult
<
List
<
dc_month_sales_profit_orderdetail
>>();
int
total
=
0
;
var
sql
=
$@"SELECT t1.*, t2.origin_order_id, t2.bailun_order_id
FROM dc_month_sales_profit_orderdetail t1
JOIN dc_base_oms_sku t2 ON t1.orderskuid = t2.id
WHERE t1. MONTH = '
{
input
.
Month
}
'
ORDER BY t1.createtime DESC "
;
//LIMIT {input.PageNumber}
//OFFSET { (input.PageIndex - 1) * input.PageNumber} ";
if
(
isPage
)
{
using
(
var
cn
=
new
MySqlConnection
(
GlobalConfig
.
ConnectionString
))
{
data
=
cn
.
Page
<
dc_month_sales_profit_orderdetail
>(
input
.
PageIndex
,
input
.
PageNumber
,
sql
,
ref
total
,
null
).
ToList
();
}
}
else
{
data
=
SimpleCRUD
.
Query
<
dc_month_sales_profit_orderdetail
>(
sql
,
null
,
GlobalConfig
.
ConnectionString
).
ToList
();
}
data
=
data
.
Select
(
a
=>
{
a
.
amount_sales
=
a
.
amount_sales
*
a
.
quantity_shipped
*
a
.
seller_order_exchange_rate
;
a
.
cost_fba_fee
=
a
.
cost_fba_fee
*
a
.
quantity_shipped
*
a
.
seller_order_exchange_rate
;
a
.
cost_first
=
a
.
cost_first
*
a
.
quantity_shipped
;
a
.
cost_handle_platform
=
a
.
cost_handle_platform
*
a
.
quantity_shipped
;
a
.
cost_logistics
=
a
.
cost_logistics
*
a
.
quantity_shipped
;
a
.
cost_paypal_fee
=
a
.
cost_paypal_fee
*
a
.
quantity_shipped
*
a
.
seller_order_exchange_rate
;
a
.
cost_platform_fee
=
a
.
cost_platform_fee
*
(
a
.
platform_type
.
ToLower
()
==
"ebay"
?
a
.
seller_other_exchange_rate
:
a
.
seller_order_exchange_rate
)
*
a
.
quantity_shipped
;
a
.
cost_product
=
a
.
cost_product
*
a
.
quantity_shipped
;
a
.
total_fee
=
(
a
.
total_fee
-
a
.
shipping
)
*
a
.
wms_to_cny_exchange_rate
*
a
.
quantity_shipped
;
//仓储费
a
.
sale_profit
=
a
.
amount_sales
-
a
.
cost_fba_fee
-
a
.
cost_first
-
a
.
cost_handle_platform
-
a
.
cost_logistics
-
a
.
cost_paypal_fee
-
a
.
cost_platform_fee
-
a
.
cost_product
-
a
.
total_fee
;
return
a
;
}).
ToList
();
result
=
result
.
ToPageResult
(
input
.
PageIndex
,
total
,
data
);
return
new
CommonApiResponseDto
<
PageResult
<
List
<
dc_month_sales_profit_orderdetail
>>>
{
Data
=
result
};
}
#
endregion
}
}
Bailun.DC.WebApi/Controllers/FinanceController.cs
View file @
e36e1e54
using
Bailun.DC.Models.Common
;
using
Bailun.DC.Models
;
using
Bailun.DC.Models.Common
;
using
Bailun.DC.Models.Common.Page
;
using
Bailun.DC.Models.Dtos.Finance
;
using
Bailun.DC.Models.WebApiModels
;
using
Bailun.DC.Services.WebApiService
;
...
...
@@ -392,6 +394,105 @@ namespace Bailun.DC.WebApi.Controllers
return
new
CommonApiResponseDto
<
string
>()
{
IsSuccess
=
false
,
Data
=
e
.
Message
};
}
}
/// <summary>
/// 月销售利润表获取管理成本明细
/// </summary>
/// <param name="month"></param>
/// <param name="feeName"></param>
/// <returns></returns>
[
HttpGet
(
"getMonthProfitFeeManagementCostDetail"
)]
public
CommonApiResponseDto
<
List
<
FinanceDetailsDto
>>
GetMonthProfitFeeManagementCostDetail
(
string
month
,
string
feeName
)
=>
new
FinanceService
().
GetMonthProfitFeeManagementCostDetail
(
month
,
feeName
);
/// <summary>
/// 月销售利润平台费用明细
/// </summary>
/// <param name="month"></param>
/// <param name="feeName"></param>
/// <returns></returns>
[
HttpPost
(
"getMonthProfitFeePlatformFeeDetail"
)]
public
CommonApiResponseDto
<
PageResult
<
List
<
MonthPlatformProfitDto
>>>
GetMonthProfitFeePlatformFeeDetail
(
GetMonthProfitPlatformDetailInput
input
)
=>
new
FinanceService
().
GetMonthProfitFeePlatformFeeDetail
(
input
);
/// <summary>
/// 导出月销售利润平台费用明细
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[
HttpPost
(
"exportMonthProfitFeePlatformFeeDetail"
)]
public
ActionResult
ExportMonthProfitFeePlatformFeeDetail
(
GetMonthProfitPlatformDetailInput
input
)
{
var
dataList
=
new
FinanceService
().
ExportMonthProfitFeePlatformFeeDetail
(
input
);
var
colNames
=
new
List
<
string
>
{
"平台"
,
"站点"
,
"账单时间"
,
"单号"
,
"币种"
,
"原币金额"
,
"汇率"
,
"RMB金额"
,
"费用字段说明"
,
"财务分类归集说明"
,
"数据中心费用类型"
,
"会计科目编码"
,
"项目编码"
};
var
list
=
new
List
<
string
>();
foreach
(
var
item
in
dataList
)
{
list
.
Add
(
$@"
{
item
.
PlatForm
}
|
{
item
.
WebSite
}
|
{
item
.
DataTime
}
|
{
item
.
Orderno
}
|
{
item
.
Currency
}
|
{
item
.
AmountVal
}
|
{
item
.
ExchangeRate
}
|
{
item
.
AmountValRmb
}{
item
.
FeeType
}
|
{
item
.
FinanceCategory
}
|
{
item
.
DatacenterCol
}
|
{
item
.
Subjectcode
}
|
{
item
.
ProjectCode
}
"
);
}
var
guid
=
Guid
.
NewGuid
().
ToString
();
var
filepath
=
_hostingEnvironment
.
WebRootPath
+
"\\Files\\Report\\"
+
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)
+
"\\"
;
ToCSV
(
list
,
colNames
,
guid
,
filepath
);
var
ms
=
new
System
.
IO
.
MemoryStream
();
using
(
var
f
=
new
System
.
IO
.
FileStream
(
filepath
+
guid
+
".csv"
,
System
.
IO
.
FileMode
.
Open
))
{
f
.
CopyTo
(
ms
);
}
ms
.
Position
=
0
;
return
File
(
ms
,
"text/csv"
,
$"
{
input
.
Month
}
_
{
input
.
FeeName
}
月销售利润表明细.csv"
);
}
/// <summary>
/// 退款明细
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[
HttpPost
(
"getMonthProfitFeeReFundDetail"
)]
public
CommonApiResponseDto
<
PageResult
<
List
<
MonthReFundDto
>>>
GetMonthProfitFeeReFundDetail
(
GetMonthProfitPlatformDetailInput
input
)
=>
new
FinanceService
().
GetMonthProfitFeeReFundDetail
(
input
);
/// <summary>
/// 按平台汇总退款信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[
HttpPost
(
"getMonthProfitPlatformPlatformSummary"
)]
public
CommonApiResponseDto
<
List
<
MonthReFundSummary
>>
GetMonthProfitPlatformPlatformSummary
(
GetMonthProfitPlatformDetailInput
input
)
=>
new
FinanceService
().
GetMonthProfitPlatformPlatformSummary
(
input
);
/// <summary>
/// 销售费用合计》销售利润
/// </summary>
/// <param name="month"></param>
/// <returns></returns>
[
HttpPost
(
"getMonthSalesProfitDetail"
)]
public
object
GetMonthSalesProfitDetail
(
MonthProfitOrderDetailPageInputDto
input
)
=>
new
FinanceService
().
GetMonthSalesProfitDetail
(
input
);
/// <summary>
/// 导出销售费用合计》销售利润
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[
HttpPost
(
"exportMonthSalesProfitDetail"
)]
public
ActionResult
ExportMonthSalesProfitDetail
(
MonthProfitOrderDetailPageInputDto
input
)
{
var
dataList
=
new
FinanceService
().
GetMonthSalesProfitDetail
(
input
,
false
);
var
colNames
=
new
List
<
string
>
{
"财务分类"
,
"平台类型"
,
"订单号"
,
"SKU"
,
"销售利润"
,
"发货量"
,
"发货时间"
,
"创建时间"
};
var
list
=
new
List
<
string
>();
foreach
(
var
item
in
dataList
.
Data
.
Data
)
{
list
.
Add
(
$@"
{
item
.
financecategoryname
}
|
{
item
.
platform_type
}
|
{
item
.
origin_order_id
}
|
{
item
.
bailun_sku
}
|
{
item
.
sale_profit
}
|
{
item
.
quantity_shipped
}
|
{
item
.
shipping_time
}
|
{
item
.
createtime
}
"
);
}
var
guid
=
Guid
.
NewGuid
().
ToString
();
var
filepath
=
_hostingEnvironment
.
WebRootPath
+
"\\Files\\Report\\"
+
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)
+
"\\"
;
ToCSV
(
list
,
colNames
,
guid
,
filepath
);
var
ms
=
new
System
.
IO
.
MemoryStream
();
using
(
var
f
=
new
System
.
IO
.
FileStream
(
filepath
+
guid
+
".csv"
,
System
.
IO
.
FileMode
.
Open
))
{
f
.
CopyTo
(
ms
);
}
ms
.
Position
=
0
;
return
File
(
ms
,
"text/csv"
,
$"
{
input
.
Month
}
_月销售费用合计》费用利润表明细.csv"
);
}
#
endregion
}
}
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