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
22c80d0c
Commit
22c80d0c
authored
Jan 06, 2021
by
任晓松
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
需求统计
parent
438a9472
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
0 deletions
+63
-0
center-order/app/base/api/impl/action/opNeed.js
+6
-0
center-order/app/base/service/impl/dbneed/opneedinfoSve.js
+57
-0
No files found.
center-order/app/base/api/impl/action/opNeed.js
View file @
22c80d0c
...
@@ -45,6 +45,12 @@ class IcAPI extends APIBase {
...
@@ -45,6 +45,12 @@ class IcAPI extends APIBase {
case
"getStatisticsByUappId"
:
case
"getStatisticsByUappId"
:
opResult
=
await
this
.
opNeedInfoSve
.
getStatisticsByUappId
(
pobj
);
opResult
=
await
this
.
opNeedInfoSve
.
getStatisticsByUappId
(
pobj
);
break
;
break
;
case
"getStatisticsByProduct"
:
opResult
=
await
this
.
opNeedInfoSve
.
getStatisticsByProduct
(
pobj
);
break
;
case
"getNeedFunnelStatistics"
:
opResult
=
await
this
.
opNeedInfoSve
.
getNeedFunnelStatistics
(
pobj
);
break
;
default
:
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
break
;
...
...
center-order/app/base/service/impl/dbneed/opneedinfoSve.js
View file @
22c80d0c
...
@@ -167,6 +167,63 @@ class NeedinfoService extends ServiceBase {
...
@@ -167,6 +167,63 @@ class NeedinfoService extends ServiceBase {
let
result
=
await
this
.
customQuery
(
sql
,
whereParam
);
let
result
=
await
this
.
customQuery
(
sql
,
whereParam
);
return
system
.
getResultSuccess
(
result
);
return
system
.
getResultSuccess
(
result
);
}
}
/**
* 需求统计漏斗图
* @param pobj
* @returns {Promise<void>}
*/
async
getNeedFunnelStatistics
(
pobj
){
let
ac
=
pobj
.
actionBody
;
let
sql
=
`select count(*) count from n_need_info where deleted_at is null `
;
let
sql2
=
`select count(DISTINCT(a.needNo)) count from n_need_solution a left join n_need_info b on a.needNo = b.needNo where a.deleted_at is null`
;
let
whereParams
=
{};
if
(
ac
.
start
&&
ac
.
end
){
sql
+=
` AND created_at >= :start and created_at <= :end`
;
sql2
+=
` AND b.created_at >= :start and b.created_at <= :end`
;
whereParams
.
start
=
ac
.
start
;
whereParams
.
end
=
ac
.
end
;
}
if
(
ac
.
uapp_id
){
sql
+=
` and uapp_id = :uapp_id`
;
sql2
+=
` and b.uapp_id = :uapp_id`
;
whereParams
.
uapp_id
=
ac
.
uapp_id
;
}
if
(
ac
.
type_code
){
sql
+=
` and typeCode = :type_code`
;
sql2
+=
` and b.typeCode = :type_code`
;
whereParams
.
type_code
=
ac
.
type_code
;
}
let
total
=
await
this
.
customQuery
(
sql
,
whereParams
);
let
middle
=
await
this
.
customQuery
(
sql2
,
whereParams
);
let
sql3
=
sql2
+
` and b.status = 'ycd'`
let
finish
=
await
this
.
customQuery
(
sql3
,
whereParams
);
let
result
=
{
total
:
total
[
0
].
count
,
middle
:
middle
[
0
].
count
,
finish
:
finish
[
0
].
count
}
return
system
.
getResult
(
result
);
}
/**
* 需求统计(产品维度)
* @param pobj
* @returns {Promise<void>}
*/
async
getStatisticsByProduct
(
pobj
){
let
ac
=
pobj
.
actionBody
;
let
sql
=
`select typeCode,status,count(*) count from n_need_info where typeCode is not null `
;
let
whereParams
=
{};
if
(
ac
.
start
&&
ac
.
end
){
sql
+=
` and created_at >= :start and created_at <= :end `
;
whereParams
.
start
=
ac
.
start
;
whereParams
.
end
=
ac
.
end
;
}
sql
+=
` GROUP BY typeCode,status`
;
let
result
=
await
this
.
customQuery
(
sql
,
whereParams
);
return
system
.
getResultSuccess
(
result
);
}
}
}
module
.
exports
=
NeedinfoService
;
module
.
exports
=
NeedinfoService
;
...
...
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