Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-serivce
/
glsx-config-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 886f5a0a
authored
Jun 19, 2020
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
出货统计
1 parent
fced1a7f
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
92 additions
and
8 deletions
app/controller/biz/delivery.js
app/router/biz/index.js
app/service/biz/delivery.js
app/service/biz/opportunity.js
app/controller/biz/delivery.js
View file @
886f5a0
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: chenwq
* @Author: chenwq
* @Date: 2020-06-17 11:12:15
* @Date: 2020-06-17 11:12:15
* @Last Modified by: chenwq
* @Last Modified by: chenwq
* @Last Modified time: 2020-06-1
8 10:18:15
* @Last Modified time: 2020-06-1
9 13:51:10
*/
*/
"use strict"
;
"use strict"
;
...
@@ -29,16 +29,28 @@
...
@@ -29,16 +29,28 @@
* @summary 查询所有出货信息
* @summary 查询所有出货信息
* @Router POST /biz/delivery/findAll
* @Router POST /biz/delivery/findAll
* @Description 查询所有出货信息
* @Description 查询所有出货信息
* @Request pager
* @Request searcher
* @Request searcher
* @Response 200 response ok
* @Response 200 response ok
*/
*/
async
findAll
({
request
:
{
body
:
{
pager
,
searcher
}}})
{
async
findAll
({
request
:
{
body
:
{
searcher
}}})
{
// get请求获取参数
// get请求获取参数
// searcher = this.ctx.query
// searcher = this.ctx.query
const
result
=
await
this
.
deliveryServices
.
findAll
({
pager
,
searcher
});
const
result
=
await
this
.
deliveryServices
.
findAll
({
searcher
});
// const result = await this.deliveryServices.findAll({ pager, searcher });
// const result = await this.deliveryServices.findAll({ pager, searcher });
this
.
ctx
.
body
=
this
.
ServerResponse
.
Success
(
result
);
this
.
ctx
.
body
=
this
.
ServerResponse
.
Success
(
result
);
}
}
/**
* @summary 查询所有出货统计
* @Router POST /biz/delivery/findCount
* @Description 查询所有出货统计
* @Request pager
* @Request searcher
* @Response 200 response ok
*/
async
findCount
({
request
:
{
body
:
{
searcher
}}})
{
const
result
=
await
this
.
deliveryServices
.
findCount
({
searcher
});
this
.
ctx
.
body
=
this
.
ServerResponse
.
Success
(
result
[
0
]);
}
}
}
module
.
exports
=
deliveryController
;
module
.
exports
=
deliveryController
;
\ No newline at end of file
\ No newline at end of file
app/router/biz/index.js
View file @
886f5a0
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: limin
* @Author: limin
* @Date: 2019-11-21 11:19:15
* @Date: 2019-11-21 11:19:15
* @Last Modified by: chenwq
* @Last Modified by: chenwq
* @Last Modified time: 2020-06-19 1
0:45:07
* @Last Modified time: 2020-06-19 1
1:45:09
*/
*/
module
.
exports
=
(
app
)
=>
{
module
.
exports
=
(
app
)
=>
{
...
@@ -13,6 +13,7 @@ module.exports = (app) => {
...
@@ -13,6 +13,7 @@ module.exports = (app) => {
app
.
router
.
get
(
"/biz/merchant/findAll"
,
app
.
controller
.
biz
.
merchant
.
findAll
);
app
.
router
.
get
(
"/biz/merchant/findAll"
,
app
.
controller
.
biz
.
merchant
.
findAll
);
app
.
router
.
get
(
"/biz/devices/findAll"
,
app
.
controller
.
biz
.
devices
.
findAll
);
app
.
router
.
get
(
"/biz/devices/findAll"
,
app
.
controller
.
biz
.
devices
.
findAll
);
app
.
router
.
get
(
"/biz/delivery/findAll"
,
app
.
controller
.
biz
.
delivery
.
findAll
);
app
.
router
.
get
(
"/biz/delivery/findAll"
,
app
.
controller
.
biz
.
delivery
.
findAll
);
app
.
router
.
get
(
"/biz/delivery/findCount"
,
app
.
controller
.
biz
.
delivery
.
findCount
);
app
.
router
.
get
(
"/biz/clues/findAll"
,
app
.
controller
.
biz
.
clues
.
findAll
);
app
.
router
.
get
(
"/biz/clues/findAll"
,
app
.
controller
.
biz
.
clues
.
findAll
);
app
.
router
.
get
(
"/biz/opportunity/findAll"
,
app
.
controller
.
biz
.
opportunity
.
findAll
);
app
.
router
.
get
(
"/biz/opportunity/findAll"
,
app
.
controller
.
biz
.
opportunity
.
findAll
);
app
.
router
.
get
(
"/biz/opportunity/findCount"
,
app
.
controller
.
biz
.
opportunity
.
findCount
);
app
.
router
.
get
(
"/biz/opportunity/findCount"
,
app
.
controller
.
biz
.
opportunity
.
findCount
);
...
...
app/service/biz/delivery.js
View file @
886f5a0
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: chenwq
* @Author: chenwq
* @Date: 2020-06-16 10:02:28
* @Date: 2020-06-16 10:02:28
* @Last Modified by: chenwq
* @Last Modified by: chenwq
* @Last Modified time: 2020-06-1
8 17:54:00
* @Last Modified time: 2020-06-1
9 13:51:21
* 出货统计
* 出货统计
*/
*/
const
Service
=
require
(
"egg"
).
Service
;
const
Service
=
require
(
"egg"
).
Service
;
...
@@ -107,5 +107,76 @@ class deliveryServices extends Service {
...
@@ -107,5 +107,76 @@ class deliveryServices extends Service {
});
});
return
date
;
return
date
;
}
}
// 计算总数
async
findCount
({
searcher
=
{}
})
{
const
{
month
,
merchantId
,
shopMerchantId
,
bizType
,
deviceType
}
=
searcher
;
const
{
Op
,
col
,
fn
}
=
this
.
app
.
Sequelize
let
where
=
{};
let
andDateArr
=
[{
name
:
'month'
,
sqlName
:
'month'
}]
let
likeArr
=
[{
name
:
'merchantName'
,
sqlName
:
'merchant_name'
},
{
name
:
'shopMerchantName'
,
sqlName
:
'merchant_name'
}]
let
equalArr
=
[{
name
:
'deviceType'
,
sqlName
:
'device_type'
},
{
name
:
'bizType'
,
sqlName
:
'biz_type'
}]
andDateArr
.
map
(
item
=>
{
if
(
searcher
[
item
.
name
])
{
let
nextDate
=
new
Date
(
searcher
[
item
.
name
])
new
Date
(
nextDate
.
setMonth
(
nextDate
.
getMonth
()
+
1
))
let
nextMonth
=
nextDate
.
getMonth
()
>
8
?
(
nextDate
.
getMonth
()
+
1
)
:
(
'0'
+
(
nextDate
.
getMonth
()
+
1
))
where
[
item
.
sqlName
]
=
{
[
Op
.
and
]:
[{
[
Op
.
gte
]:
searcher
[
item
.
name
]
},
{
[
Op
.
lt
]:
nextDate
.
getFullYear
()
+
'-'
+
nextMonth
}]
}
}
})
likeArr
.
map
(
item
=>
{
if
(
searcher
[
item
.
name
])
{
where
[
item
.
sqlName
]
=
{
[
Op
.
like
]:
`%
${
searcher
[
item
.
name
]}
%`
}
}
})
equalArr
.
map
(
item
=>
{
if
(
searcher
[
item
.
name
])
{
where
[
item
.
sqlName
]
=
searcher
[
item
.
name
]
}
})
return
await
this
.
GBDL
.
findAll
({
attributes
:
[
[
fn
(
'SUM'
,
col
(
'delivery_total'
)),
'deliveryTotal'
],
[
fn
(
'SUM'
,
col
(
'active_total'
)),
'activeTotal'
]
],
where
,
raw
:
true
})
}
}
}
module
.
exports
=
deliveryServices
;
module
.
exports
=
deliveryServices
;
\ No newline at end of file
\ No newline at end of file
app/service/biz/opportunity.js
View file @
886f5a0
/*
/*
* @Author: huyue
* @Author: huyue
* @Date: 2020-06-16 15:36:11
* @Date: 2020-06-16 15:36:11
* @Last Modified by:
huyue
* @Last Modified by:
chenwq
* @Last Modified time: 2020-06-1
8 16:17:19
* @Last Modified time: 2020-06-1
9 11:40:03
*/
*/
const
Service
=
require
(
"egg"
).
Service
;
const
Service
=
require
(
"egg"
).
Service
;
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment