You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.4 KiB
87 lines
2.4 KiB
{
|
|
"properties" : { },
|
|
"id" : "b2c3d4e5f678901234567890abcdef01",
|
|
"script" : null,
|
|
"groupId" : "f8e3d2c1b0a94e5f8a7b6c5d4e3f2a1",
|
|
"name" : "市场环境监控",
|
|
"createTime" : 1781196000000,
|
|
"updateTime" : 1781374000000,
|
|
"lock" : null,
|
|
"createBy" : "admin",
|
|
"updateBy" : "admin",
|
|
"path" : "/market-environment",
|
|
"method" : "GET",
|
|
"parameters" : [ ],
|
|
"options" : [ ],
|
|
"requestBody" : "",
|
|
"headers" : [ ],
|
|
"paths" : [ ],
|
|
"responseBody" : null,
|
|
"description" : "市场环境监控:gov_count_real_info,group_item=env-monitor,source_system=yzt。温湿度/气象八项指标及 tag、unit。",
|
|
"requestBodyDefinition" : null,
|
|
"responseBodyDefinition" : null
|
|
}
|
|
================================
|
|
// gov_count_real_info(group_item=env-monitor, source_system=yzt)
|
|
// temperature 温度
|
|
// humidity 湿度
|
|
// aqi 空气质量
|
|
// pressure 大气压强
|
|
// uv 紫外线
|
|
// rainfall 降雨量
|
|
// wind_direction 风向(value=角度,tag=风向名)
|
|
// wind_power 风力(value=级数)
|
|
|
|
var sql = """
|
|
SELECT key, name, value, tag, unit
|
|
FROM gov_count_real_info
|
|
WHERE group_item = 'env-monitor'
|
|
AND source_system = 'yzt'
|
|
"""
|
|
|
|
var rows = db.select(sql)
|
|
|
|
var valueMap = {}
|
|
var tagMap = {}
|
|
var unitMap = {}
|
|
|
|
for (row in rows) {
|
|
valueMap[row.key] = row.value != null ? row.value : null
|
|
if (row.tag) {
|
|
tagMap[row.key] = row.tag
|
|
}
|
|
if (row.unit) {
|
|
unitMap[row.key] = row.unit
|
|
}
|
|
}
|
|
|
|
var pick = (key) => valueMap[key] != null ? valueMap[key] : null
|
|
var pickTag = (key) => tagMap[key]
|
|
var pickUnit = (key) => unitMap[key]
|
|
|
|
return {
|
|
temperature: pick('temperature'),
|
|
humidity: pick('humidity'),
|
|
aqi: pick('aqi'),
|
|
airPressure: pick('pressure'),
|
|
uvIndex: pick('uv'),
|
|
rainfall: pick('rainfall'),
|
|
windDirection: pick('wind_direction'),
|
|
windPower: pick('wind_power'),
|
|
temperatureTag: pickTag('temperature'),
|
|
humidityTag: pickTag('humidity'),
|
|
aqiTag: pickTag('aqi'),
|
|
airPressureTag: pickTag('pressure'),
|
|
uvIndexTag: pickTag('uv'),
|
|
rainfallTag: pickTag('rainfall'),
|
|
windDirectionTag: pickTag('wind_direction'),
|
|
windPowerTag: pickTag('wind_power'),
|
|
temperatureUnit: pickUnit('temperature'),
|
|
humidityUnit: pickUnit('humidity'),
|
|
aqiUnit: pickUnit('aqi'),
|
|
airPressureUnit: pickUnit('pressure'),
|
|
uvIndexUnit: pickUnit('uv'),
|
|
rainfallUnit: pickUnit('rainfall'),
|
|
windDirectionUnit: pickUnit('wind_direction'),
|
|
windPowerUnit: pickUnit('wind_power')
|
|
}
|
|
|