Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
Project
Project
Details
Activity
Releases
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
黄奎
mall.oytour.com
Commits
3f2e3f5c
Commit
3f2e3f5c
authored
Aug 18, 2020
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
主播佣金 创建财务单据
parent
28b4a61f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
107 additions
and
5 deletions
+107
-5
OrderModule.cs
Mall.Module.Product/OrderModule.cs
+99
-2
OrderController.cs
Mall.WebApi/Controllers/Product/OrderController.cs
+8
-3
No files found.
Mall.Module.Product/OrderModule.cs
View file @
3f2e3f5c
...
...
@@ -5930,12 +5930,109 @@ namespace Mall.Module.Product
/// <param name="orderdetailIdList"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <param name="e
RP
EmpId"></param>
/// <param name="e
rp
EmpId"></param>
/// <returns></returns>
public
string
SetLiveGoodsOrderFinance
(
int
isPublic
,
List
<
int
>
accountIdList
,
List
<
int
>
orderdetailIdList
,
int
tenantId
,
int
mallBaseId
,
int
e
RP
EmpId
)
public
string
SetLiveGoodsOrderFinance
(
int
isPublic
,
List
<
int
>
accountIdList
,
List
<
int
>
orderdetailIdList
,
int
tenantId
,
int
mallBaseId
,
int
e
rp
EmpId
)
{
int
accountNum
=
accountIdList
.
Count
();
string
orderdetailIds
=
string
.
Join
(
","
,
orderdetailIdList
);
var
list
=
goods_OrderDetailRepository
.
GetOrderDetailList
(
new
RB_Goods_OrderDetail_Extend
()
{
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
,
OrderDetailIds
=
orderdetailIds
});
foreach
(
var
item
in
list
)
{
if
(
item
.
LivePeopleNum
!=
accountNum
)
{
return
"订单:"
+
item
.
OrderId
+
"主播数量不正确"
;
}
if
(!
string
.
IsNullOrEmpty
(
item
.
LiveFinanceIds
))
{
return
"订单:"
+
item
.
OrderId
+
" 已生成单据,无法再次生成"
;
}
}
List
<
RB_Goods_Order_Extend
>
OrderList
=
new
List
<
RB_Goods_Order_Extend
>();
if
(
list
.
Any
())
{
string
orderIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
OrderId
).
Distinct
());
OrderList
=
goods_OrderRepository
.
GetOrderList
(
new
RB_Goods_Order_Extend
()
{
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
,
OrderIds
=
orderIds
});
}
try
{
decimal
Money
=
list
.
Sum
(
x
=>
x
.
LiveCommission
??
0
)
/
accountNum
;
//每个账户的总金额
//先查询规则
var
financeConfigurineList
=
financeConfigurineRepository
.
GetList
(
new
Model
.
Extend
.
Finance
.
RB_Finance_Configurine_Extend
{
Type
=
4
});
//根据规则中的小程序,查询订单详情信息
if
(
financeConfigurineList
!=
null
&&
financeConfigurineList
.
Any
())
{
var
item
=
financeConfigurineList
.
FirstOrDefault
();
item
.
IsPublic
=
isPublic
;
List
<
int
>
FinanceIds
=
new
List
<
int
>();
//返回的财务单号
var
detailList
=
new
List
<
object
>();
foreach
(
var
qitem
in
list
)
{
var
orderModel
=
OrderList
.
Where
(
x
=>
x
.
OrderId
==
qitem
.
OrderId
).
FirstOrDefault
();
decimal
dMoney
=
(
qitem
.
LiveCommission
??
0
)
/
accountNum
;
detailList
.
Add
(
new
{
CostTypeId
=
item
.
RemitCostTypeId
,
Number
=
1
,
OriginalMoney
=
dMoney
,
UnitPrice
=
dMoney
,
Remark
=
qitem
.
GoodsName
+
" "
+
qitem
.
Specification
+
" "
+
(
orderModel
?.
OrderNo
??
""
)
});
}
foreach
(
var
aitem
in
accountIdList
)
{
var
financeObj
=
new
{
CreateBy
=
erpEmpId
>
0
?
erpEmpId
.
ToString
()
:
Config
.
ExpendDirector
,
item
.
IsPublic
,
ClientType
=
10
,
ClientID
=
aitem
,
item
.
CurrencyId
,
WBMoney
=
Money
,
PayDate
=
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
),
RB_Branch_Id
=
Config
.
ExpendBranchId
,
TemplateId
=
item
.
WorkFlowId
,
OrderSource
=
16
,
OtherType
=
20
,
ReFinanceId
=
0
,
Remark
=
DateTime
.
Now
.
ToString
(
"yyyy年MM月dd日"
)
+
"自动生成财务单据(主播订单佣金)"
,
detailList
,
RB_Depart_Id
=
Config
.
ExpendDepartment
};
string
sign
=
EncryptionHelper
.
AesEncrypt
(
JsonHelper
.
Serialize
(
financeObj
),
Config
.
FinanceKey
);
var
resultInfo
=
new
{
msg
=
sign
};
string
apiResult
=
Mall
.
Common
.
Plugin
.
HttpHelper
.
HttpPost
(
Config
.
PaymentFinanceApi
,
JsonHelper
.
Serialize
(
resultInfo
),
""
);
var
apir
=
JsonConvert
.
DeserializeObject
<
ApiResult
>(
apiResult
);
if
(
apir
.
resultCode
==
1
)
{
FinanceIds
.
Add
(
Convert
.
ToInt32
(
apir
.
data
.
ToString
()));
}
}
if
(
FinanceIds
.
Any
())
{
string
financeIds2
=
string
.
Join
(
","
,
FinanceIds
);
foreach
(
var
qitem
in
list
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods_OrderDetail
.
LiveFinanceIds
),
financeIds2
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_OrderDetail
.
Id
),
FiledValue
=
qitem
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
goods_OrderDetailRepository
.
Update
(
keyValues
,
wheres
);
}
}
}
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"SetLiveGoodsOrderFinance"
);
return
"出错了,请联系管理员"
;
}
return
""
;
}
...
...
Mall.WebApi/Controllers/Product/OrderController.cs
View file @
3f2e3f5c
...
...
@@ -1085,6 +1085,10 @@ namespace Mall.WebApi.Controllers.MallBase
var
req
=
RequestParm
;
JObject
parms
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
int
IsPublic
=
parms
.
GetInt
(
"IsPublic"
,
0
);
//账户类型
int
ErpEmpId
=
parms
.
GetInt
(
"ErpEmpId"
,
0
);
if
(
ErpEmpId
<=
0
)
{
ErpEmpId
=
req
.
ERPEmpId
;
}
string
AccountIds
=
parms
.
GetStringValue
(
"AccountIds"
);
//账户ids
string
OrderDetailIds
=
parms
.
GetStringValue
(
"OrderDetailIds"
);
//订单明细ids
if
(
string
.
IsNullOrEmpty
(
AccountIds
))
{
...
...
@@ -1093,8 +1097,7 @@ namespace Mall.WebApi.Controllers.MallBase
if
(
string
.
IsNullOrEmpty
(
OrderDetailIds
))
{
return
ApiResult
.
ParamIsNull
(
"订单明细不存在"
);
}
List
<
int
>
AccountIdList
=
new
List
<
int
>();
List
<
int
>
OrderdetailIdList
=
new
List
<
int
>();
List
<
int
>
AccountIdList
;
try
{
AccountIdList
=
JsonConvert
.
DeserializeObject
<
List
<
int
>>(
AccountIds
);
...
...
@@ -1103,6 +1106,8 @@ namespace Mall.WebApi.Controllers.MallBase
{
return
ApiResult
.
ParamIsNull
(
"账户格式有误"
);
}
List
<
int
>
OrderdetailIdList
;
try
{
OrderdetailIdList
=
JsonConvert
.
DeserializeObject
<
List
<
int
>>(
OrderDetailIds
);
...
...
@@ -1118,7 +1123,7 @@ namespace Mall.WebApi.Controllers.MallBase
return
ApiResult
.
ParamIsNull
(
"请选择订单列表"
);
}
string
msg
=
orderModule
.
SetLiveGoodsOrderFinance
(
IsPublic
,
AccountIdList
,
OrderdetailIdList
,
req
.
TenantId
,
req
.
MallBaseId
,
req
.
ERP
EmpId
);
string
msg
=
orderModule
.
SetLiveGoodsOrderFinance
(
IsPublic
,
AccountIdList
,
OrderdetailIdList
,
req
.
TenantId
,
req
.
MallBaseId
,
Erp
EmpId
);
if
(
msg
==
""
)
{
return
ApiResult
.
Success
();
...
...
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