明树Git Lab

Commit fbfd257f authored by zfp1's avatar zfp1

update

parent a572a039
...@@ -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
...@@ -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
...@@ -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" });
} }
......
...@@ -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: 'plantiCycle'}).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 || [];
......
...@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment