若依微服务1.9.1

business:
1、在查询设备历史数据时查询关联设备报错的问题修复
2、下发控制指令在param中增加uid(子设备编号)
dataprocess:
下发控制指令在param中增加uid(子设备编号)
dev 1.9.1
xins 1 year ago
parent 08032a81eb
commit 7a540c1b08

@ -105,6 +105,8 @@ public class HwDictConstants {
public static final String CONTROL_COMMAND_TOPIC_KEY = "Topic";
public static final String CONTROL_COMMAND_PAYLOAD_KEY = "Payload";
public static final String CONTROL_COMMAND_PAYLOAD_MID_KEY = "mid";
public static final String CONTROL_COMMAND_PAYLOAD_UID_KEY = "uid";
public static final String CONTROL_COMMAND_PAYLOAD_TIMESTAMP_KEY = "timestamp";
public static final String CONTROL_COMMAND_PAYLOAD_TYPE_KEY = "type";
public static final String CONTROL_COMMAND_PAYLOAD_PARAM_KEY = "param";

@ -570,7 +570,9 @@ public class HwDeviceServiceImpl implements IHwDeviceService {
}
JSONObject payloadJson = new JSONObject();
JSONObject paramJson = new JSONObject();
payloadJson.put(HwDictConstants.CONTROL_COMMAND_PAYLOAD_MID_KEY, device.getDeviceCode());
paramJson.put(HwDictConstants.CONTROL_COMMAND_PAYLOAD_UID_KEY, device.getDeviceCode());//子设备或直连设备设备编号
payloadJson.put(HwDictConstants.CONTROL_COMMAND_PAYLOAD_MID_KEY, "");//请求ID,后续增加数据库表的主键ID
payloadJson.put(HwDictConstants.CONTROL_COMMAND_PAYLOAD_TIMESTAMP_KEY, System.currentTimeMillis() / 1000);//单位s
payloadJson.put(HwDictConstants.CONTROL_COMMAND_PAYLOAD_TYPE_KEY, deviceControlVo.getType());
payloadJson.put(HwDictConstants.CONTROL_COMMAND_PAYLOAD_PARAM_KEY, paramJson);

@ -249,8 +249,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectLinkedDevices" parameterType="Long" resultMap="HwDeviceResult">
<include refid="selectHwDeviceJoinVo"/>
where exists (select 1 from hw_alarm_rule har where har.link_device_id=hd.device_id
and har.device_id = #{deviceId})
where exists (select 1 from hw_alarm_rule_link harl where hd.device_id=harl.link_device_id
and hd.device_id = #{deviceId})
</select>

@ -1,5 +1,6 @@
package com.ruoyi.dataprocess.mqtt.client.listener;
import com.ruoyi.common.core.constant.HwDictConstants;
import com.ruoyi.dataprocess.mqtt.client.config.MqttConfiguration;
import com.ruoyi.dataprocess.service.IDataProcessService;
import com.ruoyi.dataprocess.service.IDeviceStatusService;
@ -23,10 +24,6 @@ import java.nio.charset.StandardCharsets;
public class MqttClientSubscribeListener {
private static final Logger logger = LoggerFactory.getLogger(MqttClientSubscribeListener.class);
public static final String TOPIC_TYPE_DATA_POSTFIX = "data";
public static final String TOPIC_TYPE_COMMAND_POSTFIX = "command";
public static final String TOPIC_TYPE_REPLY_POSTFIX = "reply";
@Autowired
private IDataProcessService dataProcessService;
@ -46,9 +43,9 @@ public class MqttClientSubscribeListener {
String imagePrefix = mqttConfiguration.getImagePrefix();
logger.info("topic:{},start:{}ms", topic, start);
try {
if (topic.endsWith(TOPIC_TYPE_DATA_POSTFIX)) {
if (topic.endsWith(HwDictConstants.TOPIC_TYPE_DATA_POSTFIX)) {
int processDataCount = dataProcessService.processBusinessData(payloadString,
imagePath, imagePatterns, imageDomain, imagePrefix);
imagePath, imagePatterns, imageDomain, imagePrefix, topic);
Long end = System.currentTimeMillis();
logger.info("Process Data start:{}ms,end:{}ms,Spend Time:{}ms,Data Count:{}", start, end, end - start, processDataCount);
}

@ -10,6 +10,7 @@ import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.enums.ResultEnums;
import com.ruoyi.common.core.utils.RegexUtils;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.utils.uuid.UUID;
import com.ruoyi.dataprocess.amap.LocationVo;
import com.ruoyi.dataprocess.amap.PositionUtils;
import com.ruoyi.dataprocess.amap.PositionVo;
@ -464,7 +465,9 @@ public class DataProcessServiceImpl implements IDataProcessService {
String controlCommandTopic = topic.replace(HwDictConstants.TOPIC_TYPE_DATA_POSTFIX, HwDictConstants.TOPIC_TYPE_COMMAND_POSTFIX);
JSONObject payloadJson = new JSONObject();
JSONObject paramJson = new JSONObject();
payloadJson.put(HwDictConstants.CONTROL_COMMAND_PAYLOAD_MID_KEY, subDeviceCode);
paramJson.put(HwDictConstants.CONTROL_COMMAND_PAYLOAD_UID_KEY, subDeviceCode);//子设备或直连设备设备编号
payloadJson.put(HwDictConstants.CONTROL_COMMAND_PAYLOAD_MID_KEY, "");
payloadJson.put(HwDictConstants.CONTROL_COMMAND_PAYLOAD_TIMESTAMP_KEY, System.currentTimeMillis() / 1000);//单位s
payloadJson.put(HwDictConstants.CONTROL_COMMAND_PAYLOAD_TYPE_KEY, serviceFunctionIdentifier);
payloadJson.put(HwDictConstants.CONTROL_COMMAND_PAYLOAD_PARAM_KEY, paramJson);

Loading…
Cancel
Save