明树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
fbfd257f
Commit
fbfd257f
authored
Dec 12, 2024
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
a572a039
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
5 deletions
+31
-5
local.json
config/local.json
+2
-1
plantContoller.js
controller/plantContoller.js
+24
-1
index.js
cron/index.js
+1
-2
plantWarnCron.js
cron/plantWarnCron.js
+2
-1
plantRouter.js
router/plantRouter.js
+2
-0
No files found.
config/local.json
View file @
fbfd257f
...
@@ -38,6 +38,7 @@
...
@@ -38,6 +38,7 @@
"getAllDevice"
:
false
,
"getAllDevice"
:
false
,
"collectDeviceInfo"
:
false
,
"collectDeviceInfo"
:
false
,
"collectDeviceInfo4"
:
true
,
"collectDeviceInfo4"
:
true
,
"excel"
:
false
"excel"
:
false
,
"plantearlywarning"
:
true
}
}
}
}
\ No newline at end of file
controller/plantContoller.js
View file @
fbfd257f
...
@@ -7,6 +7,17 @@ const errorMessage = require("../utils/errorMessage");
...
@@ -7,6 +7,17 @@ const errorMessage = require("../utils/errorMessage");
async
function
getPlantCycle
(
req
,
res
,
next
)
{
try
{
// let userId = req.user._id;
let
search
=
{
del
:
0
};
search
.
_id
=
req
.
body
.
_id
;
let
ret
=
await
DB
.
PlantCycle
.
findOne
(
search
).
populate
({
path
:
"img"
});
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
)
}
}
async
function
listPlantCycle
(
req
,
res
,
next
)
{
async
function
listPlantCycle
(
req
,
res
,
next
)
{
try
{
try
{
// let userId = req.user._id;
// let userId = req.user._id;
...
@@ -83,6 +94,16 @@ async function createPlan(req, res, next) {
...
@@ -83,6 +94,16 @@ async function createPlan(req, res, next) {
next
(
error
);
next
(
error
);
}
}
}
}
async
function
getPlan
(
req
,
res
,
next
)
{
try
{
let
search
=
{
del
:
0
};
search
.
_id
=
req
.
body
.
_id
;
let
ret
=
await
DB
.
PlantPlan
.
findOne
(
search
).
populate
({
path
:
'plantCycle'
}).
populate
({
path
:
"land"
});
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
}
}
async
function
listPlan
(
req
,
res
,
next
)
{
async
function
listPlan
(
req
,
res
,
next
)
{
try
{
try
{
let
search
=
{
del
:
0
};
let
search
=
{
del
:
0
};
...
@@ -132,6 +153,7 @@ async function updatePlan(req, res, next) {
...
@@ -132,6 +153,7 @@ async function updatePlan(req, res, next) {
module
.
exports
=
{
module
.
exports
=
{
getPlantCycle
,
createPlantCycle
,
createPlantCycle
,
listPlantCycle
,
listPlantCycle
,
deletePlantCycle
,
deletePlantCycle
,
...
@@ -139,6 +161,7 @@ module.exports = {
...
@@ -139,6 +161,7 @@ module.exports = {
createPlan
,
createPlan
,
listPlan
,
listPlan
,
deletePlan
,
deletePlan
,
updatePlan
updatePlan
,
getPlan
,
}
}
\ No newline at end of file
cron/index.js
View file @
fbfd257f
...
@@ -101,8 +101,7 @@ const cron = () => {
...
@@ -101,8 +101,7 @@ const cron = () => {
if
(
sysConfig
&&
sysConfig
.
cron
&&
sysConfig
.
cron
.
plantearlywarning
)
{
if
(
sysConfig
&&
sysConfig
.
cron
&&
sysConfig
.
cron
.
plantearlywarning
)
{
console
.
log
(
"plant:"
,
new
Date
());
console
.
log
(
"plant:"
,
new
Date
());
new
nodeCron
.
schedule
(
'1 01 06 * * *'
,
async
()
=>
{
new
nodeCron
.
schedule
(
'1 */1 * * * *'
,
async
()
=>
{
console
.
log
(
new
Date
().
getTime
())
await
plantWarnCron
.
plantearlywarning
();
await
plantWarnCron
.
plantearlywarning
();
},
{
timezone
:
"Asia/Shanghai"
});
},
{
timezone
:
"Asia/Shanghai"
});
}
}
...
...
cron/plantWarnCron.js
View file @
fbfd257f
...
@@ -10,8 +10,9 @@ async function plantearlywarning(params) {
...
@@ -10,8 +10,9 @@ async function plantearlywarning(params) {
users
=
await
DB
.
User
.
find
({
roles
:
role
.
_id
}).
select
(
'_id'
);
users
=
await
DB
.
User
.
find
({
roles
:
role
.
_id
}).
select
(
'_id'
);
}
}
//这里暂时不确定 收获周期的格式
//这里暂时不确定 收获周期的格式
let
plants
=
await
DB
.
PlantPlan
.
find
({
del
:
0
}).
populate
({
path
:
'plant
i
Cycle'
}).
lean
().
exec
();
let
plants
=
await
DB
.
PlantPlan
.
find
({
del
:
0
}).
populate
({
path
:
'plantCycle'
}).
lean
().
exec
();
let
exceeds
=
[];
let
exceeds
=
[];
console
.
log
(
plants
,
"===="
)
for
(
let
index
=
0
;
index
<
plants
.
length
;
index
++
)
{
for
(
let
index
=
0
;
index
<
plants
.
length
;
index
++
)
{
const
element
=
plants
[
index
];
const
element
=
plants
[
index
];
let
cycles
=
element
.
plantCycle
||
[];
let
cycles
=
element
.
plantCycle
||
[];
...
...
router/plantRouter.js
View file @
fbfd257f
...
@@ -10,12 +10,14 @@ const productDeepController = require('../controller/productDeepController.js');
...
@@ -10,12 +10,14 @@ const productDeepController = require('../controller/productDeepController.js');
// 生长周期
// 生长周期
router
.
post
(
'/cycle/create'
,
plantContoller
.
createPlantCycle
);
router
.
post
(
'/cycle/create'
,
plantContoller
.
createPlantCycle
);
router
.
post
(
'/cycle/list'
,
plantContoller
.
listPlantCycle
);
router
.
post
(
'/cycle/list'
,
plantContoller
.
listPlantCycle
);
router
.
post
(
'/cycle/info'
,
plantContoller
.
getPlantCycle
);
router
.
post
(
'/cycle/delete'
,
plantContoller
.
deletePlantCycle
);
router
.
post
(
'/cycle/delete'
,
plantContoller
.
deletePlantCycle
);
router
.
post
(
'/cycle/update'
,
plantContoller
.
updatePlantCycle
);
router
.
post
(
'/cycle/update'
,
plantContoller
.
updatePlantCycle
);
// 种植规划
// 种植规划
router
.
post
(
'/plan/create'
,
plantContoller
.
createPlan
);
router
.
post
(
'/plan/create'
,
plantContoller
.
createPlan
);
router
.
post
(
'/plan/list'
,
plantContoller
.
listPlan
);
router
.
post
(
'/plan/list'
,
plantContoller
.
listPlan
);
router
.
post
(
'/plan/info'
,
plantContoller
.
getPlan
);
router
.
post
(
'/plan/delete'
,
plantContoller
.
deletePlan
);
router
.
post
(
'/plan/delete'
,
plantContoller
.
deletePlan
);
router
.
post
(
'/plan/update'
,
plantContoller
.
updatePlan
);
router
.
post
(
'/plan/update'
,
plantContoller
.
updatePlan
);
...
...
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