明树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
2efffc91
Commit
2efffc91
authored
Sep 13, 2024
by
zengfanpei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
cc00ac3b
Changes
40
Hide whitespace changes
Inline
Side-by-side
Showing
40 changed files
with
145 additions
and
78 deletions
+145
-78
README.md
README.md
+3
-3
fileController.js
controller/fileController.js
+1
-1
userController.js
controller/userController.js
+3
-3
deviceCron.js
cron/deviceCron.js
+6
-6
index.js
cron/index.js
+1
-1
index.js
db/index.js
+5
-5
collectAttribute.js
db/models/collectAttribute.js
+5
-5
collectIPS.js
db/models/collectIPS.js
+2
-2
collectIPSPlan.js
db/models/collectIPSPlan.js
+1
-1
collectIPSResult.js
db/models/collectIPSResult.js
+2
-2
collectIPSType.js
db/models/collectIPSType.js
+1
-1
collectSMC.js
db/models/collectSMC.js
+2
-2
collectThreshold.js
db/models/collectThreshold.js
+2
-2
collectWS.js
db/models/collectWS.js
+1
-1
letianAgrInputRecord.js
db/models/letianAgrInputRecord.js
+1
-1
letianAgrTask.js
db/models/letianAgrTask.js
+11
-2
letianAgrTaskAudit.js
db/models/letianAgrTaskAudit.js
+53
-0
letianAgrTaskRecord.js
db/models/letianAgrTaskRecord.js
+7
-2
letianAreaRecord.js
db/models/letianAreaRecord.js
+2
-2
letianLand.js
db/models/letianLand.js
+3
-3
letianPlantCycle.js
db/models/letianPlantCycle.js
+1
-1
letianPlantPlan.js
db/models/letianPlantPlan.js
+1
-1
letianPlantVariety.js
db/models/letianPlantVariety.js
+1
-1
letianZone.js
db/models/letianZone.js
+2
-2
systemButton.js
db/models/systemButton.js
+2
-2
systemDepart.js
db/models/systemDepart.js
+1
-1
systemFile.js
db/models/systemFile.js
+1
-1
systemMenu.js
db/models/systemMenu.js
+3
-3
systemNotice.js
db/models/systemNotice.js
+2
-2
systemRequestLog.js
db/models/systemRequestLog.js
+1
-1
systemRole.js
db/models/systemRole.js
+2
-2
systemUser.js
db/models/systemUser.js
+4
-4
request.js
middleware/request.js
+1
-1
response.js
middleware/response.js
+1
-1
collectIPSModule.js
module/collectIPSModule.js
+2
-2
deviceModule.js
module/deviceModule.js
+3
-3
userModule.js
module/userModule.js
+1
-1
collectRouter.js
router/collectRouter.js
+1
-1
fileRouter.js
router/fileRouter.js
+1
-1
index.js
utils/index.js
+2
-2
No files found.
README.md
View file @
2efffc91
...
...
@@ -23,11 +23,11 @@
# 记录
```
1. 待完成excel导出 -- 这个要看前端做管理端菜单管理
,
需要知道在那个菜单 对应哪个表
1. 待完成excel导出 -- 这个要看前端做管理端菜单管理
,
需要知道在那个菜单 对应哪个表
2. 农业投入品表的增删改查 已完成
硬件入场
:
1. 需要确认每一个设备的设备信息
:
名称、设备编号、设备类型
硬件入场
:
1. 需要确认每一个设备的设备信息
:
名称、设备编号、设备类型
2. 需要确认每一个设备 对应的 每一个地块的位置信息
3. 需要确认每一个种类设备 上传的信息 接口调试
4.
...
...
controller/fileController.js
View file @
2efffc91
...
...
@@ -52,7 +52,7 @@ async function importExcel(req, res, next) {
await
workbook
.
xlsx
.
readFile
(
req
.
file
.
path
);
let
worksheet
=
workbook
.
getWorksheet
(
4
);
console
.
log
(
workbook
.
_worksheets
.
length
);
let
values
=
worksheet
.
getRow
(
1
).
values
;
// 示例
:
读取第一行
let
values
=
worksheet
.
getRow
(
1
).
values
;
// 示例
:
读取第一行
for
(
let
index
=
1
;
index
<
worksheet
.
actualRowCount
;
index
++
)
{
let
values
=
worksheet
.
getRow
(
index
+
1
).
values
;
await
DB
.
AgrInRecord
.
create
({
...
...
controller/userController.js
View file @
2efffc91
...
...
@@ -256,10 +256,10 @@ async function createRole(req, res, next) {
menus
:
[],
buttons
:
[]
}
// // 1. 创建角色时同步设置角色权限
,
这里让前端直接将有选中状态的菜单tree传递到后端
// // 1. 创建角色时同步设置角色权限
,
这里让前端直接将有选中状态的菜单tree传递到后端
// let menus = req.body.menus || [];
// let menusNodes = utils.disTree(menus);
// //选中状态 permission
:
true 将menus buttons平行存入role中.
// //选中状态 permission
:
true 将menus buttons平行存入role中.
// for (let i = 0; i < menusNodes.length; i++) {
// const element = menusNodes[i];
// if (element.permission) {
...
...
@@ -299,7 +299,7 @@ async function updateRole(req, res, next) {
};
// let menus = req.body.menus || [];
// let menusNodes = utils.disTree(menus);
// //选中状态 permission
:
true 将menus buttons平行存入role中.
// //选中状态 permission
:
true 将menus buttons平行存入role中.
// for (let i = 0; i < menusNodes.length; i++) {
// const element = menusNodes[i];
// if (element.permission) {
...
...
cron/deviceCron.js
View file @
2efffc91
...
...
@@ -11,9 +11,9 @@ const collectWSModule = require('../module/collectWSModule');
const
_
=
require
(
'lodash'
);
/**
* 获取协议
:
* 1 土壤温湿度、土壤氮磷钾
,
* 2 土壤ph、土壤电导率
,
* 获取协议
:
* 1 土壤温湿度、土壤氮磷钾
,
* 2 土壤ph、土壤电导率
,
* 3 气象站三大类设备
*/
async
function
getDeviceList
()
{
...
...
@@ -52,7 +52,7 @@ async function getAllDevice() {
}
}
/* -------------------------------------------有诸多不确定因素
,暂时分开,
后续 请求日志需要分别按照不同设备种类区分类型------------------------------------------------------------------ */
/* -------------------------------------------有诸多不确定因素
,暂时分开,
后续 请求日志需要分别按照不同设备种类区分类型------------------------------------------------------------------ */
/**
* 采集上述设备 1 的信息
*/
...
...
@@ -270,11 +270,11 @@ async function handleDeviceThreshold(obj) {
if
(
_
.
isNumber
(
element
.
max
)
&&
_
.
gt
(
obj
[
element
.
dbKey
],
element
.
max
))
{
// 采集值 > 最大设置值
// exceeds.push({...element, collectValue: obj[element.dbKey], deviceNumber: obj.deviceNumber});
exceeds
.
push
(
`设备
${
obj
.
deviceNumber
}
, 采集值:
${
obj
[
element
.
dbKey
]}
, 最大阈值
:
${
element
.
max
}
`
);
exceeds
.
push
(
`设备
${
obj
.
deviceNumber
}
, 采集值:
${
obj
[
element
.
dbKey
]}
, 最大阈值
:
${
element
.
max
}
`
);
}
if
(
_
.
isNumber
(
element
.
min
)
&&
_
.
lt
(
obj
[
element
.
dbKey
],
element
.
min
))
{
// exceeds.push({...element, collectValue: obj[element.dbKey], deviceNumber: obj.deviceNumber});
exceeds
.
push
(
`设备
${
obj
.
deviceNumber
}
, 采集值:
${
obj
[
element
.
dbKey
]}
, 最小阈值
:
${
element
.
min
}
`
);
exceeds
.
push
(
`设备
${
obj
.
deviceNumber
}
, 采集值:
${
obj
[
element
.
dbKey
]}
, 最小阈值
:
${
element
.
min
}
`
);
}
}
}
...
...
cron/index.js
View file @
2efffc91
...
...
@@ -16,7 +16,7 @@ const deviceCron = require('./deviceCron');
# * * * * * *
*/
const
cron
=
()
=>
{
// 1 土壤温湿度、土壤氮磷钾
, 2 土壤ph、土壤电导率,
3 气象站
// 1 土壤温湿度、土壤氮磷钾
, 2 土壤ph、土壤电导率,
3 气象站
if
(
sysConfig
&&
sysConfig
.
cron
&&
sysConfig
.
cron
.
getDeviceList
)
{
console
.
log
(
"getDeviceList:"
,
new
Date
());
// 每天10点30分 处理 1 30 10 * * *
...
...
db/index.js
View file @
2efffc91
const
mongoose
=
require
(
'mongoose'
);
// 连接字符串
,
格式为 mongodb://用户名:密码@地址:端口/数据库名
// 连接字符串
,
格式为 mongodb://用户名:密码@地址:端口/数据库名
const
dbURI
=
sysConfig
.
dbURI
||
'mongodb://localhost:27017/letian'
;
// 连接数据库
...
...
@@ -19,12 +19,12 @@ mongoose.connection.on('disconnected', () => {
/**
1. 由于硬件提供的API返回参数皆为驼峰命名
,为了对接方便,
本系统数据库字段设计按照驼峰命名
1. 由于硬件提供的API返回参数皆为驼峰命名
,为了对接方便,
本系统数据库字段设计按照驼峰命名
如 templateId deviceNumber
2. 特殊情况下 允许字段使用数字作为区分
,
数字直接与字母相连
2. 特殊情况下 允许字段使用数字作为区分
,
数字直接与字母相连
如 智壤仪温度1 soilTemperature1 智壤仪温度2 soilTemperature2
3. 数据库表名按照第一条规则
,
也采用驼峰命名
4. 单词尽量使用翻译器翻译之后考虑使用
,
要求简洁、见名知义
3. 数据库表名按照第一条规则
,
也采用驼峰命名
4. 单词尽量使用翻译器翻译之后考虑使用
,
要求简洁、见名知义
*/
const
User
=
require
(
'./models/systemUser'
);
...
...
db/models/collectAttribute.js
View file @
2efffc91
...
...
@@ -10,22 +10,22 @@ const moment = require('moment');
const
collectAttributeSchema
=
new
Schema
({
deviceKey
:
{
type
:
String
,
comment
:
"在硬件上设置的key 如
:
土壤湿度"
comment
:
"在硬件上设置的key 如
:
土壤湿度"
},
dbKey
:
{
type
:
String
,
comment
:
"数据库里面的key 如
:
windSpeed"
comment
:
"数据库里面的key 如
:
windSpeed"
},
name
:
{
type
:
String
,
comment
:
"名称 如
:
湿度"
comment
:
"名称 如
:
湿度"
},
enable
:
{
type
:
Boolean
,
default
:
true
,
comment
:
"true: 启用
,
false: 不启用"
comment
:
"true: 启用
,
false: 不启用"
},
createdAt
:
{
type
:
Date
,
...
...
@@ -40,7 +40,7 @@ const collectAttributeSchema = new Schema({
del
:
{
type
:
Number
,
default
:
0
,
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
}
},
{
id
:
false
,
...
...
db/models/collectIPS.js
View file @
2efffc91
...
...
@@ -91,7 +91,7 @@ const collectInsectPestSituationSchema = new Schema({
comment
:
"上一次标注后的图片(压缩后)"
,
},
/* 识别结果 不管哪一种形式
,只要结果确认有效则写入,为空则表示此条数据无效,
后续需要根据业务定期处理这类数据 */
/* 识别结果 不管哪一种形式
,只要结果确认有效则写入,为空则表示此条数据无效,
后续需要根据业务定期处理这类数据 */
cameraRecognition
:
{
type
:
String
,
default
:
null
,
...
...
@@ -112,7 +112,7 @@ const collectInsectPestSituationSchema = new Schema({
del
:
{
type
:
Number
,
default
:
0
,
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
}
},
{
toJSON
:
{
...
...
db/models/collectIPSPlan.js
View file @
2efffc91
...
...
@@ -38,7 +38,7 @@ const collectIPSPlanSchema = new Schema({
del
:
{
type
:
Number
,
default
:
0
,
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
}
},
{
toJSON
:
{
...
...
db/models/collectIPSResult.js
View file @
2efffc91
...
...
@@ -3,7 +3,7 @@ const Schema = mongoose.Schema;
const
moment
=
require
(
'moment'
);
/**
* 虫情 一条采集数据 1
: 图片识别结果 1:
一张图片会有多个虫子结果 n
* 虫情 一条采集数据 1
: 图片识别结果 1:
一张图片会有多个虫子结果 n
* 虫子结果--虫子类型--虫子解决方案
*
*/
...
...
@@ -73,7 +73,7 @@ const collectIPSResultSchema = new Schema({
del
:
{
type
:
Number
,
default
:
0
,
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
}
},
{
toJSON
:
{
...
...
db/models/collectIPSType.js
View file @
2efffc91
...
...
@@ -26,7 +26,7 @@ const collectIPSTypeSchema = new Schema({
del
:
{
type
:
Number
,
default
:
0
,
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
}
},
{
toJSON
:
{
...
...
db/models/collectSMC.js
View file @
2efffc91
...
...
@@ -122,7 +122,7 @@ const soilMoistureContentSchema = new Schema({
},
onLineState
:
{
type
:
String
,
comment
:
"在线状态
,该字段不记录到db,
后期采集数据时将状态更新到redis里面即可"
comment
:
"在线状态
,该字段不记录到db,
后期采集数据时将状态更新到redis里面即可"
},
...
...
@@ -140,7 +140,7 @@ const soilMoistureContentSchema = new Schema({
del
:
{
type
:
Number
,
default
:
0
,
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
}
},
{
toJSON
:
{
...
...
db/models/collectThreshold.js
View file @
2efffc91
...
...
@@ -37,7 +37,7 @@ const collectThresholdSchema = new Schema({
enable
:
{
type
:
Boolean
,
default
:
true
,
comment
:
"true: 启用
,
false: 不启用"
comment
:
"true: 启用
,
false: 不启用"
},
createdAt
:
{
type
:
Date
,
...
...
@@ -52,7 +52,7 @@ const collectThresholdSchema = new Schema({
del
:
{
type
:
Number
,
default
:
0
,
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
}
},
{
id
:
false
,
...
...
db/models/collectWS.js
View file @
2efffc91
...
...
@@ -101,7 +101,7 @@ const collectWeatherStationSchema = new Schema({
del
:
{
type
:
Number
,
default
:
0
,
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
}
},
{
toJSON
:
{
...
...
db/models/letianAgrInputRecord.js
View file @
2efffc91
...
...
@@ -50,7 +50,7 @@ const letianAgrInputRecordSchema = new Schema({
del
:
{
type
:
Number
,
default
:
0
,
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
}
},
{
id
:
false
,
...
...
db/models/letianAgrTask.js
View file @
2efffc91
...
...
@@ -26,7 +26,16 @@ const AgrTaskSchema = new Schema({
leader
:
{
type
:
mongoose
.
Types
.
ObjectId
,
ref
:
'User'
,
comment
:
"负责人--从分配负责人开始,任务就开启"
comment
:
"负责人--从分配负责人开始, 任务就开启"
},
status
:
{
type
:
Number
,
comment
:
"1. 待分配(没有leader), 3. 进行中, 5 已完成"
},
auditStatus
:
{
type
:
Number
,
comment
:
"1. 待审核, 2, 审核通过, 3.审核不通过, 记录最新的审核记录"
},
creator
:
{
...
...
@@ -49,7 +58,7 @@ const AgrTaskSchema = new Schema({
del
:
{
type
:
Number
,
default
:
0
,
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
}
},
{
toJSON
:
{
...
...
db/models/letianAgrTaskAudit.js
0 → 100644
View file @
2efffc91
const
mongoose
=
require
(
'mongoose'
);
const
Schema
=
mongoose
.
Schema
;
const
moment
=
require
(
'moment'
);
/**
* 农事任务审核记录
*/
const
AgrTaskAuditSchema
=
new
Schema
({
creator
:
{
type
:
mongoose
.
Types
.
ObjectId
,
ref
:
'User'
,
comment
:
"创建人"
},
audit
:
{
type
:
mongoose
.
Types
.
ObjectId
,
ref
:
'User'
,
comment
:
"审核人"
},
auditStatus
:
{
type
:
Number
,
comment
:
"1. 待审核, 2, 审核通过, 3.审核不通过, 记录任务上"
},
createdAt
:
{
type
:
Date
,
default
:
Date
.
now
,
get
:
v
=>
moment
(
v
).
format
(
"YYYY-MM-DD HH:mm:ss"
),
},
updatedAt
:
{
type
:
Date
,
default
:
Date
.
now
,
get
:
v
=>
moment
(
v
).
format
(
"YYYY-MM-DD HH:mm:ss"
),
},
del
:
{
type
:
Number
,
default
:
0
,
comment
:
'默认0 , 1:表示删除,若有其他隐藏业务 不要混用此字段。'
}
},
{
toJSON
:
{
getters
:
true
}
});
const
AgrTaskAudit
=
mongoose
.
model
(
'AgrTaskAudit'
,
AgrTaskAuditSchema
,
'letianAgrTaskAudit'
);
module
.
exports
=
AgrTaskAudit
;
\ No newline at end of file
db/models/letianAgrTaskRecord.js
View file @
2efffc91
...
...
@@ -3,9 +3,14 @@ const Schema = mongoose.Schema;
const
moment
=
require
(
'moment'
);
/**
* 农事
任务---农事记录,一个
任务 对应多条农事记录
* 农事
记录,一个农事
任务 对应多条农事记录
*/
const
AgrTaskSchema
=
new
Schema
({
content
:
{
type
:
String
,
comment
:
"内容"
},
task
:
{
type
:
mongoose
.
Types
.
ObjectId
,
...
...
@@ -39,7 +44,7 @@ const AgrTaskSchema = new Schema({
del
:
{
type
:
Number
,
default
:
0
,
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
}
},
{
toJSON
:
{
...
...
db/models/letianAreaRecord.js
View file @
2efffc91
...
...
@@ -4,7 +4,7 @@ const moment = require('moment');
/**
* 园区
* 结构设想是
:
省-市-县-乡镇-园区
* 结构设想是
:
省-市-县-乡镇-园区
*/
const
letianAreaRecord
=
new
Schema
({
province
:
{
...
...
@@ -70,7 +70,7 @@ const letianAreaRecord = new Schema({
del
:
{
type
:
Number
,
default
:
0
,
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
}
},
{
toJSON
:
{
...
...
db/models/letianLand.js
View file @
2efffc91
...
...
@@ -31,11 +31,11 @@ const landSchema = new Schema({
latestYield
:
{
type
:
Number
,
comment
:
"最近一期的产量
,
通过产量表录入"
,
comment
:
"最近一期的产量
,
通过产量表录入"
,
},
latestYieldValue
:
{
type
:
Number
,
comment
:
"最近一期的产值
,
通过产值表录入"
,
comment
:
"最近一期的产值
,
通过产值表录入"
,
},
zone
:
{
type
:
mongoose
.
Types
.
ObjectId
,
...
...
@@ -58,7 +58,7 @@ const landSchema = new Schema({
del
:
{
type
:
Number
,
default
:
0
,
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
}
},
{
toJSON
:
{
...
...
db/models/letianPlantCycle.js
View file @
2efffc91
...
...
@@ -33,7 +33,7 @@ const PlantCycleSchema = new Schema({
del
:
{
type
:
Number
,
default
:
0
,
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
}
},
{
toJSON
:
{
...
...
db/models/letianPlantPlan.js
View file @
2efffc91
...
...
@@ -56,7 +56,7 @@ const PlantPlanSchema = new Schema({
del
:
{
type
:
Number
,
default
:
0
,
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
}
},
{
toJSON
:
{
...
...
db/models/letianPlantVariety.js
View file @
2efffc91
...
...
@@ -36,7 +36,7 @@ const PlantVarietySchema = new Schema({
del
:
{
type
:
Number
,
default
:
0
,
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
}
},
{
toJSON
:
{
...
...
db/models/letianZone.js
View file @
2efffc91
...
...
@@ -4,7 +4,7 @@ const moment = require('moment');
/**
* 园区
* 结构设想是
:
省-市-县-乡镇-园区
* 结构设想是
:
省-市-县-乡镇-园区
*/
const
ZoneSchema
=
new
Schema
({
name
:
{
...
...
@@ -40,7 +40,7 @@ const ZoneSchema = new Schema({
del
:
{
type
:
Number
,
default
:
0
,
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
}
},
{
toJSON
:
{
...
...
db/models/systemButton.js
View file @
2efffc91
...
...
@@ -35,7 +35,7 @@
// del: {
// type: Number,
// default: 0,
// comment: '默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
// comment: '默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
// }
// }, {
// id: false,
...
...
@@ -48,4 +48,4 @@
// const Button = mongoose.model('Button', buttonSchema, 'systemButton');
// module.exports = Button;
// 合并到menus里面,方便前端处理。
\ No newline at end of file
// 合并到menus里面,方便前端处理。
\ No newline at end of file
db/models/systemDepart.js
View file @
2efffc91
...
...
@@ -41,7 +41,7 @@ const departSchema = new Schema({
del
:
{
type
:
Number
,
default
:
0
,
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
}
},
{
id
:
false
,
...
...
db/models/systemFile.js
View file @
2efffc91
...
...
@@ -42,7 +42,7 @@ const fileSchema = new Schema({
del
:
{
type
:
Number
,
default
:
0
,
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
}
},
{
id
:
false
,
...
...
db/models/systemMenu.js
View file @
2efffc91
...
...
@@ -50,14 +50,14 @@ const menuSchema = new Schema({
type
:
{
type
:
Number
,
comment
:
"类型
: 1. 菜单,
2. 按钮"
,
comment
:
"类型
: 1. 菜单,
2. 按钮"
,
default
:
1
},
enable
:
{
type
:
Boolean
,
default
:
true
,
comment
:
"true
: 启用,
false: 不启用"
comment
:
"true
: 启用,
false: 不启用"
},
createdAt
:
{
...
...
@@ -73,7 +73,7 @@ const menuSchema = new Schema({
del
:
{
type
:
Number
,
default
:
0
,
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
}
},
{
id
:
false
,
...
...
db/models/systemNotice.js
View file @
2efffc91
...
...
@@ -23,7 +23,7 @@ const Noticechema = new Schema({
read
:
{
type
:
Boolean
,
default
:
false
,
comment
:
"true 已读
,
false 未读"
comment
:
"true 已读
,
false 未读"
},
...
...
@@ -41,7 +41,7 @@ const Noticechema = new Schema({
del
:
{
type
:
Number
,
default
:
0
,
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
}
},
{
id
:
false
,
...
...
db/models/systemRequestLog.js
View file @
2efffc91
...
...
@@ -42,7 +42,7 @@ const requestLogSchema = new Schema({
},
type
:
{
type
:
String
,
comment
:
"日志类型 调用外部硬件接口日志
:device, 系统内部请求日志:
system"
,
comment
:
"日志类型 调用外部硬件接口日志
:device, 系统内部请求日志:
system"
,
default
:
"system"
},
createdAt
:
{
...
...
db/models/systemRole.js
View file @
2efffc91
...
...
@@ -21,7 +21,7 @@ const roleSchema = new Schema({
menus
:
{
type
:
[
mongoose
.
Types
.
ObjectId
],
ref
:
"Menu"
,
comment
:
"记录的是包含菜单和按钮的集合
,
方便展示树结构"
comment
:
"记录的是包含菜单和按钮的集合
,
方便展示树结构"
},
buttons
:
{
type
:
[
mongoose
.
Types
.
ObjectId
],
...
...
@@ -43,7 +43,7 @@ const roleSchema = new Schema({
del
:
{
type
:
Number
,
default
:
0
,
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
}
},
{
id
:
false
,
...
...
db/models/systemUser.js
View file @
2efffc91
...
...
@@ -40,17 +40,17 @@ const userSchema = new Schema({
depart
:
{
type
:
mongoose
.
Types
.
ObjectId
,
ref
:
"Depart"
,
comment
:
"一个人只有一个部门
,若存在一个人多个部门的情况,
需要重新设计"
comment
:
"一个人只有一个部门
,若存在一个人多个部门的情况,
需要重新设计"
},
enable
:
{
type
:
Boolean
,
default
:
true
,
comment
:
"true
: 启用,
false: 不启用"
comment
:
"true
: 启用,
false: 不启用"
},
status
:
{
type
:
Number
,
comment
:
"状态 1
:正常, 2:
....."
,
comment
:
"状态 1
:正常, 2:
....."
,
default
:
1
},
...
...
@@ -76,7 +76,7 @@ const userSchema = new Schema({
del
:
{
type
:
Number
,
default
:
0
,
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
comment
:
'默认0
, 1:表示删除,
若有其他隐藏业务 不要混用此字段。'
}
},
{
id
:
false
,
...
...
middleware/request.js
View file @
2efffc91
...
...
@@ -28,7 +28,7 @@ module.exports = async (req, res, next) => {
}
}
/* --------------3. 记录所有进来的日志
,
是否记录响应的值有待 */
/* --------------3. 记录所有进来的日志
,
是否记录响应的值有待 */
requestLogModule
.
createRequestLog
({
url
:
req
.
baseUrl
+
req
.
path
,
params
:
JSON
.
stringify
({
...
...
middleware/response.js
View file @
2efffc91
...
...
@@ -17,7 +17,7 @@ module.exports = (req, res, next) => {
});
};
res
[
'sendError'
]
=
(
error
)
=>
{
// 除404 500以外 其他均归类为业务错误 以http 200返回
,
具体错误在返回内容里面根据code来区分。
// 除404 500以外 其他均归类为业务错误 以http 200返回
,
具体错误在返回内容里面根据code来区分。
res
.
status
(
200
).
send
({
code
:
error
.
code
,
message
:
error
.
message
,
...
...
module/collectIPSModule.js
View file @
2efffc91
...
...
@@ -76,7 +76,7 @@ async function insertHQData(data) {
// let name = String(eleArr[0]).trim();
// // 记录虫子类型
// let bugType = await DB.CollectIPSType.findOneAndUpdate({ name }, { name }, { upsert: true });
// //获取防止建议---此处建议不从远端取
,
在本系统根据虫子种类维护建议即可
// //获取防止建议---此处建议不从远端取
,
在本系统根据虫子种类维护建议即可
// let preInRet = await httpRequest({
// url: sysConfig.device.getPreventionToInsectName,
// method: "GET",
...
...
@@ -130,7 +130,7 @@ async function handleIPSResult(data) {
let
name
=
String
(
eleArr
[
0
]).
trim
();
// 记录虫子类型
let
bugType
=
await
DB
.
CollectIPSType
.
findOneAndUpdate
({
name
},
{
name
},
{
upsert
:
true
});
//获取防止建议---此处建议不从远端取
,
在本系统根据虫子种类维护建议即可
//获取防止建议---此处建议不从远端取
,
在本系统根据虫子种类维护建议即可
let
preInRet
=
await
httpRequest
({
url
:
sysConfig
.
device
.
getPreventionToInsectName
,
method
:
"GET"
,
...
...
module/deviceModule.js
View file @
2efffc91
...
...
@@ -20,10 +20,10 @@ async function findAll(search, fields = [], ) {
/**
* 用来插入通过 "HTTP数据获取-设备接口" 获取的设备插入
* 1. 检查是否存在
,存在则更新设备信息,
不存在则插入系统
* 2. 如果之前出现
,
后续没有出现的需要去掉
* 1. 检查是否存在
,存在则更新设备信息,
不存在则插入系统
* 2. 如果之前出现
,
后续没有出现的需要去掉
* ----
* 按照最新沟通的结果
,设备可能是固定的,
或许不需要实时更新设备列表
* 按照最新沟通的结果
,设备可能是固定的,
或许不需要实时更新设备列表
*/
async
function
insertHQDevice
(
datas
,
deviceHQType
)
{
let
devNumArr
=
[];
...
...
module/userModule.js
View file @
2efffc91
...
...
@@ -43,7 +43,7 @@ async function getRoleMenus(roles) {
}
console
.
log
(
menuIds
)
let
buts
=
await
DB
.
Menu
.
find
({
del
:
0
,
_id
:
{
$in
:
buttonIds
}
}).
lean
().
exec
();
// 把按钮的最近一级的父节点
,作为map的key,
按钮在下面放到对应的菜单中
// 把按钮的最近一级的父节点
,作为map的key,
按钮在下面放到对应的菜单中
let
bMap
=
{};
for
(
let
i
=
0
;
i
<
buts
.
length
;
i
++
)
{
const
o
=
buts
[
i
];
...
...
router/collectRouter.js
View file @
2efffc91
...
...
@@ -7,7 +7,7 @@ const collectSMCController = require('../controller/collectSMCController');
const
collectWSController
=
require
(
'../controller/collectWSController'
);
/* -----数据采集相关接口
,
可以用类简化 暂时---- */
/* -----数据采集相关接口
,
可以用类简化 暂时---- */
/**
...
...
router/fileRouter.js
View file @
2efffc91
...
...
@@ -34,7 +34,7 @@ router.post('/upload', upload.single('file'), fileController.upload);
router
.
post
(
'/batch/upload'
,
upload
.
array
(
'files'
),
fileController
.
batchUpload
);
// 文件访问
:
起nginx用以处理文件服务器。
// 文件访问
:
起nginx用以处理文件服务器。
/**
...
...
utils/index.js
View file @
2efffc91
...
...
@@ -29,10 +29,10 @@ function checkUserPassword({ reqPw, salt, userPw }) {
}
function
buildTree
(
nodes
)
{
// 创建一个映射
,
将节点ID映射到节点对象
// 创建一个映射
,
将节点ID映射到节点对象
const
nodeMap
=
new
Map
(
nodes
.
map
(
node
=>
[
String
(
node
.
_id
),
{
...
node
,
children
:
[]
}]));
// 遍历所有节点
,
并将它们添加到对应父节点的children数组中
// 遍历所有节点
,
并将它们添加到对应父节点的children数组中
nodes
.
forEach
(
node
=>
{
const
parentId
=
String
(
node
.
parentId
);
if
(
parentId
!==
null
)
{
...
...
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