20260328:数据推送:红绿黄值都不填写默认绿色;模板加上设备地址

This commit is contained in:
George 2026-03-28 19:32:06 +08:00
parent 518107ac04
commit c25f288b6c
5 changed files with 14 additions and 7 deletions

View File

@ -77,7 +77,7 @@ public enum DataLevelEnum {
private static boolean inNumericRange(double v, String min, String max) {
if (min == null && max == null) {
return false;
return true; // 区间值都不填就是绿色通知
}
boolean lowerOk = StringUtils.isBlank(min) || v >= Double.parseDouble(min);
boolean upperOk = StringUtils.isBlank(max) || v <= Double.parseDouble(max);

View File

@ -204,16 +204,20 @@ public class ThingsModelPushHandler {
List<String> varNames = extractVarNames(msgParams.getContent());
Map<String, String> map = new LinkedHashMap<>();
String deviceDisplay = StringUtils.isNotEmpty(config.getDeviceName())
? config.getDeviceName() : serialNumber;
for (int i = 0; i < varNames.size(); i++) {
String varName = varNames.get(i);
if (i == 0) {
map.put(varName, serialNumber);
map.put(varName, deviceDisplay);
} else if (i == 1) {
map.put(varName, level.getLabel());
} else if (i == 2) {
map.put(varName, dataText);
} else {
} else if (i == 3) {
map.put(varName, simpleDateFormat.format(new Date()));
} else {
map.put(varName, config.getDeviceAddress());
}
}

View File

@ -40,6 +40,9 @@ public class ThingsModelPushConfig extends BaseEntity {
@ApiModelProperty("设备名称(非持久化,JOIN查询)")
private String deviceName;
@ApiModelProperty("设备地址(非持久化,JOIN查询)")
private String deviceAddress;
@ApiModelProperty("设备类型:1=直连 2=网关(非持久化,JOIN查询)")
private Integer deviceType;

View File

@ -53,9 +53,9 @@
<sql id="baseColumns">
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.tenant_id, c.tenant_name,
c.create_by, c.create_time, c.update_by, c.update_time,
p.product_name, p.device_type, d.device_name, nt.name AS template_name
c.tenant_id, c.tenant_name, c.create_by, c.create_time,
c.update_by, c.update_time,p.product_name, p.device_type,
d.device_name,d.network_address AS device_address, nt.name AS template_name
</sql>
<sql id="baseJoins">

View File

@ -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)
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)
VALUES (3431, '推送配置查询', 3430, 1, '#', '', NULL, 1, 0, 'F', '0', '0', 'iot:push:query', '#', 'admin', now(), 'admin', now(), '');