20260328:数据推送:红绿黄值都不填写默认绿色;模板加上设备地址
This commit is contained in:
parent
518107ac04
commit
c25f288b6c
@ -77,7 +77,7 @@ public enum DataLevelEnum {
|
|||||||
|
|
||||||
private static boolean inNumericRange(double v, String min, String max) {
|
private static boolean inNumericRange(double v, String min, String max) {
|
||||||
if (min == null && max == null) {
|
if (min == null && max == null) {
|
||||||
return false;
|
return true; // 区间值都不填就是绿色通知
|
||||||
}
|
}
|
||||||
boolean lowerOk = StringUtils.isBlank(min) || v >= Double.parseDouble(min);
|
boolean lowerOk = StringUtils.isBlank(min) || v >= Double.parseDouble(min);
|
||||||
boolean upperOk = StringUtils.isBlank(max) || v <= Double.parseDouble(max);
|
boolean upperOk = StringUtils.isBlank(max) || v <= Double.parseDouble(max);
|
||||||
|
|||||||
@ -204,16 +204,20 @@ public class ThingsModelPushHandler {
|
|||||||
List<String> varNames = extractVarNames(msgParams.getContent());
|
List<String> varNames = extractVarNames(msgParams.getContent());
|
||||||
|
|
||||||
Map<String, String> map = new LinkedHashMap<>();
|
Map<String, String> map = new LinkedHashMap<>();
|
||||||
|
String deviceDisplay = StringUtils.isNotEmpty(config.getDeviceName())
|
||||||
|
? config.getDeviceName() : serialNumber;
|
||||||
for (int i = 0; i < varNames.size(); i++) {
|
for (int i = 0; i < varNames.size(); i++) {
|
||||||
String varName = varNames.get(i);
|
String varName = varNames.get(i);
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
map.put(varName, serialNumber);
|
map.put(varName, deviceDisplay);
|
||||||
} else if (i == 1) {
|
} else if (i == 1) {
|
||||||
map.put(varName, level.getLabel());
|
map.put(varName, level.getLabel());
|
||||||
} else if (i == 2) {
|
} else if (i == 2) {
|
||||||
map.put(varName, dataText);
|
map.put(varName, dataText);
|
||||||
} else {
|
} else if (i == 3) {
|
||||||
map.put(varName, simpleDateFormat.format(new Date()));
|
map.put(varName, simpleDateFormat.format(new Date()));
|
||||||
|
} else {
|
||||||
|
map.put(varName, config.getDeviceAddress());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -40,6 +40,9 @@ public class ThingsModelPushConfig extends BaseEntity {
|
|||||||
@ApiModelProperty("设备名称(非持久化,JOIN查询)")
|
@ApiModelProperty("设备名称(非持久化,JOIN查询)")
|
||||||
private String deviceName;
|
private String deviceName;
|
||||||
|
|
||||||
|
@ApiModelProperty("设备地址(非持久化,JOIN查询)")
|
||||||
|
private String deviceAddress;
|
||||||
|
|
||||||
@ApiModelProperty("设备类型:1=直连 2=网关(非持久化,JOIN查询)")
|
@ApiModelProperty("设备类型:1=直连 2=网关(非持久化,JOIN查询)")
|
||||||
private Integer deviceType;
|
private Integer deviceType;
|
||||||
|
|
||||||
|
|||||||
@ -53,9 +53,9 @@
|
|||||||
<sql id="baseColumns">
|
<sql id="baseColumns">
|
||||||
c.id, c.config_name, c.product_id, c.device_id, c.serial_number,
|
c.id, c.config_name, c.product_id, c.device_id, c.serial_number,
|
||||||
c.template_id, c.push_interval, c.last_push_time, c.status,
|
c.template_id, c.push_interval, c.last_push_time, c.status,
|
||||||
c.tenant_id, c.tenant_name,
|
c.tenant_id, c.tenant_name, c.create_by, c.create_time,
|
||||||
c.create_by, c.create_time, c.update_by, c.update_time,
|
c.update_by, c.update_time,p.product_name, p.device_type,
|
||||||
p.product_name, p.device_type, d.device_name, nt.name AS template_name
|
d.device_name,d.network_address AS device_address, nt.name AS template_name
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="baseJoins">
|
<sql id="baseJoins">
|
||||||
|
|||||||
@ -58,7 +58,7 @@ CREATE TABLE IF NOT EXISTS `iot_push_user` (
|
|||||||
-- ============================================================
|
-- ============================================================
|
||||||
|
|
||||||
INSERT INTO `sys_menu` (menu_id, menu_name, parent_id, order_num, `path`, component, query, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
INSERT INTO `sys_menu` (menu_id, menu_name, parent_id, order_num, `path`, component, query, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||||
VALUES (3430, '数据推送配置', 3051, 9, 'pushConfig', 'iot/push/index', NULL, 1, 0, 'C', '0', '0', 'iot:push:list', 'notification', 'admin', now(), 'admin', now(), '微信服务号物模型数据推送');
|
VALUES (3430, '数据联动', 3343, 9, 'pushConfig', 'iot/push/index', NULL, 1, 0, 'C', '0', '0', 'iot:push:list', 'notification', 'admin', now(), 'admin', now(), '微信服务号物模型数据推送');
|
||||||
|
|
||||||
INSERT INTO `sys_menu` (menu_id, menu_name, parent_id, order_num, `path`, component, query, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
INSERT INTO `sys_menu` (menu_id, menu_name, parent_id, order_num, `path`, component, query, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||||
VALUES (3431, '推送配置查询', 3430, 1, '#', '', NULL, 1, 0, 'F', '0', '0', 'iot:push:query', '#', 'admin', now(), 'admin', now(), '');
|
VALUES (3431, '推送配置查询', 3430, 1, '#', '', NULL, 1, 0, 'F', '0', '0', 'iot:push:query', '#', 'admin', now(), 'admin', now(), '');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user