Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
72212885
Commit
72212885
authored
Jul 16, 2020
by
linboxuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ucommune-back api add
parent
81798486
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
1 deletions
+52
-1
center-order/app/base/api/impl/action/ucommuneOrder.js
+19
-1
center-order/app/base/service/impl/dbcorder/ucommuneOrderSve.js
+33
-0
No files found.
center-order/app/base/api/impl/action/ucommuneOrder.js
View file @
72212885
...
@@ -26,9 +26,27 @@ class ucommuneOrder extends APIBase {
...
@@ -26,9 +26,27 @@ class ucommuneOrder extends APIBase {
async
opActionProcess
(
pobj
,
action_type
,
req
)
{
async
opActionProcess
(
pobj
,
action_type
,
req
)
{
var
opResult
=
null
;
var
opResult
=
null
;
switch
(
action_type
)
{
switch
(
action_type
)
{
case
"ucommuneGetOrderList"
:
case
"ucommuneGetOrderList"
:
// uk后端订单拉取功能
opResult
=
await
this
.
ucommuneOrderSve
.
getOrderInfo
(
pobj
,
pobj
.
actionBody
);
opResult
=
await
this
.
ucommuneOrderSve
.
getOrderInfo
(
pobj
,
pobj
.
actionBody
);
break
;
break
;
case
"getStatistics"
:
// 概览-业务统计
opResult
=
await
this
.
ucommuneOrderSve
.
getStatistics
(
pobj
,
pobj
.
actionBody
);
break
;
case
"getTrend"
:
// 概览-业务统计
opResult
=
await
this
.
ucommuneOrderSve
.
getTrend
(
pobj
,
pobj
.
actionBody
);
break
;
case
"getProductTypesales"
:
// 概览-产品销售分布
opResult
=
await
this
.
ucommuneOrderSve
.
getProductTypesales
(
pobj
,
pobj
.
actionBody
);
break
;
case
"getCustomerArea"
:
// 概览-客户地域分布
opResult
=
await
this
.
ucommuneOrderSve
.
getCustomerArea
(
pobj
,
pobj
.
actionBody
);
break
;
case
"getOrderInfo"
:
// 订单列表
opResult
=
await
this
.
ucommuneOrderSve
.
getOrderInfo
(
pobj
,
pobj
.
actionBody
);
break
;
case
"getOrderDelivery"
:
// 订单详情
opResult
=
await
this
.
ucommuneOrderSve
.
getOrderDelivery
(
pobj
,
pobj
.
actionBody
);
break
;
default
:
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
break
;
...
...
center-order/app/base/service/impl/dbcorder/ucommuneOrderSve.js
View file @
72212885
...
@@ -3,6 +3,8 @@ const ServiceBase = require("../../sve.base");
...
@@ -3,6 +3,8 @@ const ServiceBase = require("../../sve.base");
class
OrderInfoService
extends
ServiceBase
{
class
OrderInfoService
extends
ServiceBase
{
constructor
()
{
constructor
()
{
super
(
"dbcorder"
,
ServiceBase
.
getDaoName
(
OrderInfoService
));
super
(
"dbcorder"
,
ServiceBase
.
getDaoName
(
OrderInfoService
));
this
.
orderInfoDao
=
system
.
getObject
(
"db.dbcorder.orderinfoDao"
);
this
.
needInfoDao
=
system
.
getObject
(
"db.dbneed.needinfoDao"
);
}
}
async
getOrderInfo
(
pobj
,
actionBody
)
{
//获取订单列表信息
async
getOrderInfo
(
pobj
,
actionBody
)
{
//获取订单列表信息
...
@@ -50,5 +52,36 @@ class OrderInfoService extends ServiceBase {
...
@@ -50,5 +52,36 @@ class OrderInfoService extends ServiceBase {
return
result
;
return
result
;
}
}
async
getStatistics
(
pobj
,
actionBody
)
{
// uk运营后台 业务统计
var
needsCount
=
await
this
.
needInfoDao
.
findCount
({
where
:{
uapp_id
:
actionBody
.
uappId
}});
// 需求量
var
sql
=
"SELECT DISTINCT need.needNo,count(1) as count "
+
" FROM n_need_info AS need LEFT JOIN n_need_solution AS solution ON need.needNo = solution.needNo "
+
" where solution.orderNo is not null and need.uapp_id = "
+
actionBody
.
uappId
;
var
conversionRateList
=
await
this
.
needInfoDao
.
customQuery
(
sql
);
if
(
conversionRateList
.
length
!=
1
)
{
conversionRate
=
0
;
}
var
conversionRate
=
(
conversionRateList
[
0
][
"count"
]
/
needsCount
).
toFixed
(
2
);
// 需求订单转化为订单的数量 保留两位
var
sql
=
"select sum(totalSum) as totalSum,sum(pfProfitSum) as parentProfit,sum(channelProfitSum) as grossProfit, count(1) as count "
+
" from c_order_info where uapp_id="
+
actionBody
.
uappId
+
" and orderStatus=2"
;
var
payObj
=
await
this
.
customQuery
(
sql
);
// 订单量/交易总额/公司宝结算额/对方毛利
if
(
payObj
.
length
!=
1
)
{
}
let
resultObj
=
{
needsCount
:
needsCount
,
payCount
:
payObj
[
0
].
count
,
conversionRate
:
conversionRate
,
paySumCount
:
payObj
[
0
].
totalSum
,
parentProfit
:
payObj
[
0
].
parentProfit
,
grossProfit
:
payObj
[
0
].
grossProfit
}
var
result
=
system
.
getResultSuccess
(
resultObj
);
return
result
;
}
}
}
module
.
exports
=
OrderInfoService
;
module
.
exports
=
OrderInfoService
;
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