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
b05ec69a
Commit
b05ec69a
authored
Apr 21, 2021
by
linboxuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lin add order/need statistics
parent
d6ebca55
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
256 additions
and
211 deletions
+256
-211
center-manage/app/base/controller/impl/qifutong/statisticsCtl.js
+18
-0
center-manage/app/base/service/impl/qifutong/statisticsSve.js
+222
-211
center-manage/app/base/utils/qifutong/baseClient.js
+16
-0
No files found.
center-manage/app/base/controller/impl/qifutong/statisticsCtl.js
View file @
b05ec69a
...
@@ -146,6 +146,24 @@ class StatisticsCtl extends CtlBase {
...
@@ -146,6 +146,24 @@ class StatisticsCtl extends CtlBase {
}
}
}
}
// 渠道订单统计
async
getChannelOrderStatistics
(
pobj
,
qobj
,
req
)
{
try
{
const
rs
=
await
this
.
service
.
getChannelOrderStatistics
(
pobj
);
return
system
.
getResult
(
rs
);
}
catch
(
err
)
{
return
system
.
getResult
(
null
,
err
.
message
)
}
}
async
getChannelNeedStatistics
(
pobj
,
qobj
,
req
)
{
try
{
const
rs
=
await
this
.
service
.
getChannelNeedStatistics
(
pobj
);
return
system
.
getResult
(
rs
);
}
catch
(
err
)
{
return
system
.
getResult
(
null
,
err
.
message
)
}
}
}
}
module
.
exports
=
StatisticsCtl
;
module
.
exports
=
StatisticsCtl
;
center-manage/app/base/service/impl/qifutong/statisticsSve.js
View file @
b05ec69a
const
ToQiFuTong
=
require
(
'../../../utils/qifutong/baseClient'
).
getInstance
();
const
ToQiFuTong
=
require
(
'../../../utils/qifutong/baseClient'
).
getInstance
();
const
_
=
require
(
"lodash"
);
const
_
=
require
(
"lodash"
);
class
StatisticsService
{
class
StatisticsService
{
async
getAllChannels
(
pobj
)
{
async
getAllChannels
(
pobj
)
{
return
ToQiFuTong
.
getAllChannels
();
return
ToQiFuTong
.
getAllChannels
();
}
async
getAllService
(
pobj
)
{
return
ToQiFuTong
.
getAllService
();
}
async
getAllProducts
(
pobj
)
{
return
ToQiFuTong
.
getAllProducts
();
}
async
getPathName
(
pobj
)
{
return
ToQiFuTong
.
getPathName
();
}
async
getStatisticsByUappId
(
pobj
)
{
const
data
=
await
ToQiFuTong
.
getStatisticsByUappId
({
start
:
pobj
.
start
,
end
:
pobj
.
end
,
type_name
:
pobj
.
type_code
,
status
:
pobj
.
status
});
const
dates
=
ToQiFuTong
.
getAllDate
(
pobj
.
start
,
pobj
.
end
);
return
{
x
:
dates
,
data
};
}
async
getOrderStatisticsByUappId
(
pobj
)
{
const
data
=
await
ToQiFuTong
.
getOrderStatisticsByUappId
({
start
:
pobj
.
start
,
end
:
pobj
.
end
,
pathName
:
pobj
.
type_code
,
status
:
pobj
.
status
});
const
dates
=
ToQiFuTong
.
getAllDate
(
pobj
.
start
,
pobj
.
end
);
return
{
x
:
dates
,
data
};
}
async
getStatisticsByProduct
(
pobj
)
{
const
data
=
await
ToQiFuTong
.
getStatisticsByProduct
({
start
:
pobj
.
start
,
end
:
pobj
.
end
,
// status: pobj.status,
});
let
result
=
[];
// 基础数据
let
channels
=
new
Set
();
//渠道
let
productList
=
[];
//产品
for
(
let
val
of
data
)
{
let
productCount
=
0
;
for
(
let
info
of
val
.
data
)
{
productCount
+=
info
.
count
;
channels
.
add
(
info
.
uapp_id
?
info
.
uapp_id
.
toString
()
:
""
);
result
.
push
({
uapp_id
:
info
.
uapp_id
?
info
.
uapp_id
.
toString
()
:
""
,
count
:
info
.
count
,
type_code
:
val
.
type_code
})
}
productList
.
push
({
count
:
productCount
,
type_code
:
val
.
type_code
})
}
}
async
getAllService
(
pobj
)
{
productList
=
productList
.
sort
(
function
(
a
,
b
)
{
return
a
.
count
-
b
.
count
});
return
ToQiFuTong
.
getAllService
();
return
{
channelList
:
[...
channels
],
productList
:
productList
.
map
((
item
)
=>
{
return
item
.
type_code
}),
data
:
result
};
}
async
getOrderStatisticsByProduct
(
pobj
)
{
const
data
=
await
ToQiFuTong
.
getOrderStatisticsByProduct
({
start
:
pobj
.
start
,
end
:
pobj
.
end
,
// status: pobj.status,
});
let
result
=
[];
// 基础数据
let
channels
=
new
Set
();
//渠道
let
productList
=
[];
//产品
for
(
let
val
of
data
)
{
let
productCount
=
0
;
for
(
let
info
of
val
.
data
)
{
productCount
+=
info
.
count
;
channels
.
add
(
info
.
uapp_id
?
info
.
uapp_id
.
toString
()
:
""
);
result
.
push
({
uapp_id
:
info
.
uapp_id
?
info
.
uapp_id
.
toString
()
:
""
,
count
:
info
.
count
,
type_code
:
val
.
pathName
.
split
(
"/"
)[
1
]
+
" - "
+
val
.
pathName
.
split
(
"/"
)[
2
]
})
}
productList
.
push
({
count
:
productCount
,
type_code
:
val
.
pathName
.
split
(
"/"
)[
1
]
+
" - "
+
val
.
pathName
.
split
(
"/"
)[
2
]
})
}
}
async
getAllProducts
(
pobj
)
{
productList
=
productList
.
sort
(
function
(
a
,
b
)
{
return
a
.
count
-
b
.
count
});
return
ToQiFuTong
.
getAllProducts
();
return
{
}
channelList
:
[...
channels
],
async
getPathName
(
pobj
)
{
productList
:
productList
.
map
((
item
)
=>
{
return
item
.
type_code
}),
return
ToQiFuTong
.
getPathName
();
data
:
result
}
};
async
getStatisticsByUappId
(
pobj
)
{
}
const
data
=
await
ToQiFuTong
.
getStatisticsByUappId
({
start
:
pobj
.
start
,
async
getNeedFunnelStatistics
(
pobj
)
{
end
:
pobj
.
end
,
return
ToQiFuTong
.
getNeedFunnelStatistics
({
type_name
:
pobj
.
type_code
,
start
:
pobj
.
start
,
status
:
pobj
.
status
end
:
pobj
.
end
,
});
type_name
:
pobj
.
type_code
,
const
dates
=
ToQiFuTong
.
getAllDate
(
pobj
.
start
,
pobj
.
end
);
uapp_id
:
pobj
.
uapp_id
return
{
});
x
:
dates
,
}
data
};
async
getStatisticsByArea
(
pobj
)
{
}
const
data
=
await
ToQiFuTong
.
getStatisticsByArea
({
async
getOrderStatisticsByUappId
(
pobj
)
{
start
:
pobj
.
start
,
const
data
=
await
ToQiFuTong
.
getOrderStatisticsByUappId
({
end
:
pobj
.
end
,
start
:
pobj
.
start
,
type_name
:
pobj
.
type_code
,
end
:
pobj
.
end
,
uapp_id
:
pobj
.
uapp_id
pathName
:
pobj
.
type_code
,
});
status
:
pobj
.
status
let
result
=
{};
});
for
(
let
val
of
data
)
{
const
dates
=
ToQiFuTong
.
getAllDate
(
pobj
.
start
,
pobj
.
end
);
const
region
=
val
.
province
.
replace
(
/
(
.*
)(
市|省
)
$/
,
'$1'
);
return
{
let
sum
=
0
x
:
dates
,
for
(
let
info
of
val
.
data
)
{
data
sum
+=
info
.
count
;
};
}
}
if
(
result
[
region
])
{
async
getStatisticsByProduct
(
pobj
)
{
let
productInfo
=
_
.
groupBy
([...
val
.
data
,
...
result
[
region
].
data
],
"type_code"
);
const
data
=
await
ToQiFuTong
.
getStatisticsByProduct
({
let
productInfoList
=
[];
start
:
pobj
.
start
,
for
(
let
key
in
productInfo
)
{
end
:
pobj
.
end
,
let
count
=
0
;
// status: pobj.status,
for
(
let
info
of
productInfo
[
key
])
{
});
count
+=
info
.
count
;
let
result
=
[];
// 基础数据
}
let
channels
=
new
Set
();
//渠道
productInfoList
.
push
({
let
productList
=
[];
//产品
count
,
for
(
let
val
of
data
)
{
type_code
:
key
let
productCount
=
0
;
});
for
(
let
info
of
val
.
data
)
{
productCount
+=
info
.
count
;
channels
.
add
(
info
.
uapp_id
?
info
.
uapp_id
.
toString
()
:
""
);
result
.
push
({
uapp_id
:
info
.
uapp_id
?
info
.
uapp_id
.
toString
()
:
""
,
count
:
info
.
count
,
type_code
:
val
.
type_code
})
}
productList
.
push
({
count
:
productCount
,
type_code
:
val
.
type_code
})
}
}
productList
=
productList
.
sort
(
function
(
a
,
b
)
{
return
a
.
count
-
b
.
count
});
result
[
region
]
=
{
return
{
sum
:
result
[
region
].
sum
+
sum
,
channelList
:
[...
channels
],
data
:
productInfoList
productList
:
productList
.
map
((
item
)
=>
{
return
item
.
type_code
}),
}
data
:
result
}
else
{
};
result
[
region
]
=
{
}
sum
:
sum
,
async
getOrderStatisticsByProduct
(
pobj
)
{
data
:
val
.
data
const
data
=
await
ToQiFuTong
.
getOrderStatisticsByProduct
({
start
:
pobj
.
start
,
end
:
pobj
.
end
,
// status: pobj.status,
});
let
result
=
[];
// 基础数据
let
channels
=
new
Set
();
//渠道
let
productList
=
[];
//产品
for
(
let
val
of
data
)
{
let
productCount
=
0
;
for
(
let
info
of
val
.
data
)
{
productCount
+=
info
.
count
;
channels
.
add
(
info
.
uapp_id
?
info
.
uapp_id
.
toString
()
:
""
);
result
.
push
({
uapp_id
:
info
.
uapp_id
?
info
.
uapp_id
.
toString
()
:
""
,
count
:
info
.
count
,
type_code
:
val
.
pathName
.
split
(
"/"
)[
1
]
+
" - "
+
val
.
pathName
.
split
(
"/"
)[
2
]
})
}
productList
.
push
({
count
:
productCount
,
type_code
:
val
.
pathName
.
split
(
"/"
)[
1
]
+
" - "
+
val
.
pathName
.
split
(
"/"
)[
2
]
})
}
}
productList
=
productList
.
sort
(
function
(
a
,
b
)
{
return
a
.
count
-
b
.
count
});
}
return
{
channelList
:
[...
channels
],
productList
:
productList
.
map
((
item
)
=>
{
return
item
.
type_code
}),
data
:
result
};
}
}
return
result
;
}
async
getNeedFunnelStatistics
(
pobj
)
{
async
getNeedComparison
(
pobj
)
{
return
ToQiFuTong
.
getNeedFunnelStatistics
({
const
data
=
await
ToQiFuTong
.
getNeedComparison
({
start
:
pobj
.
start
,
startNow
:
pobj
.
startNow
,
end
:
pobj
.
end
,
endNow
:
pobj
.
endNow
,
type_name
:
pobj
.
type_code
,
startLast
:
pobj
.
startLast
,
uapp_id
:
pobj
.
uapp_id
endLast
:
pobj
.
endLast
,
});
type_name
:
pobj
.
type_code
,
}
uapp_id
:
pobj
.
uapp_id
});
return
{
businessStatistics
:
{
sum
:
data
.
now
.
total
,
lastSum
:
data
.
last
.
total
,
type
:
ToQiFuTong
.
judgeSize
(
data
.
now
.
total
,
data
.
last
.
total
),
contrast
:
(
data
.
last
.
total
===
0
?
(
data
.
now
.
total
===
0
?
0
:
100
)
:
((
data
.
now
.
total
-
data
.
last
.
total
)
/
data
.
last
.
total
*
100
)).
toFixed
(
2
)
async
getStatisticsByArea
(
pobj
)
{
},
const
data
=
await
ToQiFuTong
.
getStatisticsByArea
({
businessToOrderStatistics
:
{
start
:
pobj
.
start
,
sum
:
data
.
now
.
order
,
end
:
pobj
.
end
,
lastSum
:
data
.
last
.
order
,
type_name
:
pobj
.
type_code
,
type
:
ToQiFuTong
.
judgeSize
(
data
.
now
.
order
,
data
.
last
.
order
),
uapp_id
:
pobj
.
uapp_id
contrast
:
(
data
.
last
.
order
===
0
?
(
data
.
now
.
order
===
0
?
0
:
100
)
:
((
data
.
now
.
order
-
data
.
last
.
order
)
/
data
.
last
.
order
*
100
)).
toFixed
(
2
)
});
let
result
=
{};
for
(
let
val
of
data
)
{
const
region
=
val
.
province
.
replace
(
/
(
.*
)(
市|省
)
$/
,
'$1'
);
let
sum
=
0
for
(
let
info
of
val
.
data
)
{
sum
+=
info
.
count
;
}
if
(
result
[
region
])
{
let
productInfo
=
_
.
groupBy
([...
val
.
data
,
...
result
[
region
].
data
],
"type_code"
);
let
productInfoList
=
[];
for
(
let
key
in
productInfo
)
{
let
count
=
0
;
for
(
let
info
of
productInfo
[
key
])
{
count
+=
info
.
count
;
}
productInfoList
.
push
({
count
,
type_code
:
key
});
}
result
[
region
]
=
{
sum
:
result
[
region
].
sum
+
sum
,
data
:
productInfoList
}
}
else
{
result
[
region
]
=
{
sum
:
sum
,
data
:
val
.
data
}
}
}
return
result
;
}
async
getNeedComparison
(
pobj
)
{
}
const
data
=
await
ToQiFuTong
.
getNeedComparison
({
};
startNow
:
pobj
.
startNow
,
}
endNow
:
pobj
.
endNow
,
async
getOrdersComparison
(
pobj
)
{
startLast
:
pobj
.
startLast
,
const
data
=
await
ToQiFuTong
.
getOrdersComparison
({
endLast
:
pobj
.
endLast
,
startNow
:
pobj
.
startNow
,
type_name
:
pobj
.
type_code
,
endNow
:
pobj
.
endNow
,
uapp_id
:
pobj
.
uapp_id
startLast
:
pobj
.
startLast
,
});
endLast
:
pobj
.
endLast
,
return
{
pathName
:
pobj
.
type_code
,
businessStatistics
:
{
uapp_id
:
pobj
.
uapp_id
sum
:
data
.
now
.
total
,
});
lastSum
:
data
.
last
.
total
,
return
{
type
:
ToQiFuTong
.
judgeSize
(
data
.
now
.
total
,
data
.
last
.
total
),
orderStatistics
:
{
contrast
:
(
data
.
last
.
total
===
0
?
(
data
.
now
.
total
===
0
?
0
:
100
)
:
((
data
.
now
.
total
-
data
.
last
.
total
)
/
data
.
last
.
total
*
100
)).
toFixed
(
2
)
sum
:
data
.
now
.
total
,
lastSum
:
data
.
last
.
total
,
type
:
ToQiFuTong
.
judgeSize
(
data
.
now
.
total
,
data
.
last
.
total
),
contrast
:
(
data
.
last
.
total
===
0
?
(
data
.
now
.
total
===
0
?
0
:
100
)
:
((
data
.
now
.
total
-
data
.
last
.
total
)
/
data
.
last
.
total
*
100
)).
toFixed
(
2
)
},
}
businessToOrderStatistics
:
{
};
sum
:
data
.
now
.
order
,
}
lastSum
:
data
.
last
.
order
,
type
:
ToQiFuTong
.
judgeSize
(
data
.
now
.
order
,
data
.
last
.
order
),
contrast
:
(
data
.
last
.
order
===
0
?
(
data
.
now
.
order
===
0
?
0
:
100
)
:
((
data
.
now
.
order
-
data
.
last
.
order
)
/
data
.
last
.
order
*
100
)).
toFixed
(
2
)
}
async
getStatisticsList
(
pobj
)
{
};
const
data
=
await
ToQiFuTong
.
getStatisticsList
({
}
start
:
pobj
.
start
,
async
getOrdersComparison
(
pobj
)
{
end
:
pobj
.
end
,
const
data
=
await
ToQiFuTong
.
getOrdersComparison
({
uapp_id
:
pobj
.
uapp_id
,
startNow
:
pobj
.
startNow
,
type_code
:
pobj
.
type_code
,
endNow
:
pobj
.
endNow
,
type_name
:
pobj
.
type_code
,
startLast
:
pobj
.
startLast
,
pathName
:
pobj
.
type_code
,
endLast
:
pobj
.
endLast
,
pageIndex
:
pobj
.
pageNum
||
1
,
pathName
:
pobj
.
type_code
,
pageSize
:
pobj
.
pageSize
||
10
,
uapp_id
:
pobj
.
uapp_id
listType
:
pobj
.
listType
,
});
fuzzy_code
:
pobj
.
fuzzy_code
,
return
{
status
:
pobj
.
status
orderStatistics
:
{
});
sum
:
data
.
now
.
total
,
return
data
;
lastSum
:
data
.
last
.
total
,
}
type
:
ToQiFuTong
.
judgeSize
(
data
.
now
.
total
,
data
.
last
.
total
),
contrast
:
(
data
.
last
.
total
===
0
?
(
data
.
now
.
total
===
0
?
0
:
100
)
:
((
data
.
now
.
total
-
data
.
last
.
total
)
/
data
.
last
.
total
*
100
)).
toFixed
(
2
)
}
async
importTxNeeds
(
pobj
)
{
};
const
data
=
await
ToQiFuTong
.
importTxNeeds
(
pobj
);
}
return
data
;
}
async
getNeedProductType
(
pobj
)
{
const
data
=
await
ToQiFuTong
.
getNeedProductType
(
pobj
);
return
data
;
}
async
getStatisticsList
(
pobj
)
{
async
getChannelOrderStatistics
(
pobj
)
{
const
data
=
await
ToQiFuTong
.
getStatisticsList
({
const
data
=
await
ToQiFuTong
.
getChannelOrderStatistics
(
pobj
);
start
:
pobj
.
start
,
return
data
;
end
:
pobj
.
end
,
}
uapp_id
:
pobj
.
uapp_id
,
type_code
:
pobj
.
type_code
,
type_name
:
pobj
.
type_code
,
pathName
:
pobj
.
type_code
,
pageIndex
:
pobj
.
pageNum
||
1
,
pageSize
:
pobj
.
pageSize
||
10
,
listType
:
pobj
.
listType
,
fuzzy_code
:
pobj
.
fuzzy_code
,
status
:
pobj
.
status
});
return
data
;
}
async
importTxNeeds
(
pobj
)
{
async
getChannelNeedStatistics
(
pobj
)
{
const
data
=
await
ToQiFuTong
.
importTxNeeds
(
pobj
);
const
data
=
await
ToQiFuTong
.
getChannelNeedStatistics
(
pobj
);
return
data
;
return
data
;
}
}
async
getNeedProductType
(
pobj
)
{
const
data
=
await
ToQiFuTong
.
getNeedProductType
(
pobj
);
return
data
;
}
}
}
module
.
exports
=
StatisticsService
;
module
.
exports
=
StatisticsService
;
\ No newline at end of file
center-manage/app/base/utils/qifutong/baseClient.js
View file @
b05ec69a
...
@@ -219,6 +219,22 @@ class BaseClient {
...
@@ -219,6 +219,22 @@ class BaseClient {
return
data
;
return
data
;
}
}
async
getChannelOrderStatistics
(
pobj
)
{
const
data
=
await
this
.
pushQiFuTong
(
'/web/opaction/order/springBoard'
,
{
"actionType"
:
"getOrderStatisticsByChannel"
,
"actionBody"
:
pobj
});
return
data
;
}
async
getChannelNeedStatistics
(
pobj
)
{
const
data
=
await
this
.
pushQiFuTong
(
'/web/action/opNeed/springBoard'
,
{
"actionType"
:
"getStatisticsByChannel"
,
"actionBody"
:
pobj
});
return
data
;
}
async
importTxNeeds
(
pobj
)
{
async
importTxNeeds
(
pobj
)
{
let
url
;
let
url
;
let
query
;
let
query
;
...
...
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