明树Git Lab
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
L
letian_backend
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
zengfanpei
letian_backend
Commits
3bbabff9
Commit
3bbabff9
authored
Sep 09, 2024
by
zengfanpei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: 获取设备可选地块
parent
d46bc0ae
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
3 deletions
+40
-3
agrController.js
controller/agrController.js
+7
-1
collectSMCController.js
controller/collectSMCController.js
+7
-0
collectWSController.js
controller/collectWSController.js
+7
-0
deviceController.js
controller/deviceController.js
+17
-2
deviceRouter.js
router/deviceRouter.js
+2
-0
No files found.
controller/agrController.js
View file @
3bbabff9
...
@@ -8,7 +8,13 @@
...
@@ -8,7 +8,13 @@
async
function
list
(
req
,
res
,
next
)
{
async
function
list
(
req
,
res
,
next
)
{
try
{
try
{
//
let
search
=
{
del
:
0
};
let
page
=
req
.
body
.
page
||
1
;
let
pageSize
=
req
.
body
.
pageSize
||
10
;
let
skip
=
(
page
-
1
)
*
pageSize
;
let
count
=
await
DB
.
AgrInRecord
.
countDoucments
(
search
)
let
list
=
await
DB
.
AgrInRecord
.
find
(
search
).
skip
(
skip
).
limit
(
pageSize
).
lean
().
exec
();
res
.
sendData
({
count
,
list
});
}
catch
(
error
)
{
}
catch
(
error
)
{
next
(
error
)
next
(
error
)
}
}
...
...
controller/collectSMCController.js
View file @
3bbabff9
...
@@ -32,6 +32,13 @@ async function list(req, res, next) {
...
@@ -32,6 +32,13 @@ async function list(req, res, next) {
$gte
:
req
.
body
.
time
[
0
]
$gte
:
req
.
body
.
time
[
0
]
}
}
}
}
if
(
req
.
body
.
land
)
{
let
devs
=
await
DB
.
Device
.
find
({
land
:
req
.
body
.
land
}).
lean
().
exec
();
if
(
devs
&&
devs
.
length
)
{
let
devNums
=
devs
.
map
(
o
=>
{
return
o
.
deviceNumber
});
search
.
deviceNumber
=
{
$in
:
devNums
}
}
}
let
page
=
req
.
body
.
page
||
1
;
let
page
=
req
.
body
.
page
||
1
;
let
pageSize
=
req
.
body
.
pageSize
||
10
;
let
pageSize
=
req
.
body
.
pageSize
||
10
;
let
skip
=
(
page
-
1
)
*
pageSize
;
let
skip
=
(
page
-
1
)
*
pageSize
;
...
...
controller/collectWSController.js
View file @
3bbabff9
...
@@ -32,6 +32,13 @@ async function list(req, res, next) {
...
@@ -32,6 +32,13 @@ async function list(req, res, next) {
$gte
:
req
.
body
.
time
[
0
]
$gte
:
req
.
body
.
time
[
0
]
}
}
}
}
if
(
req
.
body
.
land
)
{
let
devs
=
await
DB
.
Device
.
find
({
land
:
req
.
body
.
land
}).
lean
().
exec
();
if
(
devs
&&
devs
.
length
)
{
let
devNums
=
devs
.
map
(
o
=>
{
return
o
.
deviceNumber
});
search
.
deviceNumber
=
{
$in
:
devNums
}
}
}
let
page
=
req
.
body
.
page
||
1
;
let
page
=
req
.
body
.
page
||
1
;
let
pageSize
=
req
.
body
.
pageSize
||
10
;
let
pageSize
=
req
.
body
.
pageSize
||
10
;
let
skip
=
(
page
-
1
)
*
pageSize
;
let
skip
=
(
page
-
1
)
*
pageSize
;
...
...
controller/deviceController.js
View file @
3bbabff9
...
@@ -167,7 +167,22 @@ async function listThreshold(req, res, next) {
...
@@ -167,7 +167,22 @@ async function listThreshold(req, res, next) {
async
function
getDeviceLand
(
req
,
res
,
next
)
{
try
{
let
search
=
{
del
:
0
};
search
.
deviceDPType
=
req
.
body
.
deviceDPType
;
let
list
=
await
DB
.
Device
.
find
(
search
).
select
(
'land'
).
lean
().
exec
();
let
landIds
=
[];
for
(
let
index
=
0
;
index
<
list
.
length
;
index
++
)
{
const
element
=
list
[
index
];
landIds
.
push
(
element
.
land
);
}
let
lands
=
await
DB
.
Land
.
find
({
_id
:
{
$in
:
landIds
},
del
:
0
});
res
.
sendData
(
lands
);
}
catch
(
error
)
{
next
(
error
);
}
}
...
@@ -184,5 +199,5 @@ module.exports = {
...
@@ -184,5 +199,5 @@ module.exports = {
listAttribute
,
listAttribute
,
setThreshold
,
setThreshold
,
listThreshold
,
listThreshold
,
getDeviceLand
,
}
}
\ No newline at end of file
router/deviceRouter.js
View file @
3bbabff9
...
@@ -18,5 +18,7 @@ router.post('/threshold/list', deviceController.listThreshold); //获取设备
...
@@ -18,5 +18,7 @@ router.post('/threshold/list', deviceController.listThreshold); //获取设备
router
.
post
(
'/attribute/list'
,
deviceController
.
listAttribute
);
//获取可设置属性列表
router
.
post
(
'/attribute/list'
,
deviceController
.
listAttribute
);
//获取可设置属性列表
router
.
post
(
'/getDeviceLand'
,
deviceController
.
getDeviceLand
);
module
.
exports
=
router
;
module
.
exports
=
router
;
\ No newline at end of file
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