提交 4a5f5d4e authored 作者: 林业通's avatar 林业通

Merge remote-tracking branch 'origin/master'

...@@ -2,18 +2,14 @@ package tech.glinfo.enbao.modules.mq; ...@@ -2,18 +2,14 @@ package tech.glinfo.enbao.modules.mq;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.json.JSONObject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import tech.glinfo.enbao.common.contants.Constants;
import tech.glinfo.enbao.common.utils.ByteUtils; import tech.glinfo.enbao.common.utils.ByteUtils;
import tech.glinfo.enbao.common.utils.DateUtils; import tech.glinfo.enbao.common.utils.DateUtils;
import tech.glinfo.enbao.common.utils.RedisUtils; import tech.glinfo.enbao.common.utils.RedisUtils;
import tech.glinfo.enbao.common.utils.StringUtils; import tech.glinfo.enbao.common.utils.StringUtils;
import tech.glinfo.enbao.modules.sh.entity.ShDeviceDataEntity;
import tech.glinfo.enbao.modules.sh.entity.ShDeviceEntity; import tech.glinfo.enbao.modules.sh.entity.ShDeviceEntity;
import tech.glinfo.enbao.modules.sh.entity.ShInstructionParsingEntity; import tech.glinfo.enbao.modules.sh.entity.ShInstructionParsingEntity;
import tech.glinfo.enbao.modules.sh.form.ProtocolContent; import tech.glinfo.enbao.modules.sh.form.ProtocolContent;
...@@ -37,9 +33,6 @@ public class FilterParse implements IParse { ...@@ -37,9 +33,6 @@ public class FilterParse implements IParse {
@Autowired @Autowired
private MqProducer mqProducer; private MqProducer mqProducer;
@Autowired
private ShDeviceDataService shDeviceDataService;
@Override @Override
public Map<String, String> run(Object o, Map<String, String> datas) { public Map<String, String> run(Object o, Map<String, String> datas) {
ShDeviceEntity device = (ShDeviceEntity) o; ShDeviceEntity device = (ShDeviceEntity) o;
...@@ -76,22 +69,11 @@ public class FilterParse implements IParse { ...@@ -76,22 +69,11 @@ public class FilterParse implements IParse {
ws.put(cmd.getName(), hex1); ws.put(cmd.getName(), hex1);
length += cmd.getLength(); length += cmd.getLength();
} }
//@TODO 由于当前设备没有上报灯光状态用updateFilterDeviceData,上报之后请切换到updateDeviceData //@TODO 目前设备没有上传灯光状态
otherShDeviceService.updateFilterDeviceData(map, device.getId()); otherShDeviceService.updateFilterDeviceData(map, device.getId());
} else { } else {
ws = datas; ws = datas;
} }
} else if ("84".equals(cmd1)) {//设备使用期限
redisUtils.set(Constants.FILTER_UES_TIME + device.getNumbering(), datas.get("content"), 300);
} else if ("93".equals(cmd1) || "95".equals(cmd1)) {
if ("95".equals(cmd1)) {//灯光控制有问题
ShDeviceDataEntity entity = shDeviceDataService.getOne(new QueryWrapper<ShDeviceDataEntity>().eq("device_id", device.getId()));
JSONObject jsonObj = new JSONObject(entity.getValue());
String light = jsonObj.has("light")?jsonObj.getString("light"):"0";
jsonObj.put("light", light.equals("0")?"1":"0");
entity.setValue(jsonObj.toString());
shDeviceDataService.updateById(entity);
}
} else { } else {
ws = datas; ws = datas;
} }
......
...@@ -87,7 +87,7 @@ public class MqConsumer { ...@@ -87,7 +87,7 @@ public class MqConsumer {
*/ */
@JmsListener(destination = AppContants.SOCKETIO_TOPIC, containerFactory = "jmsListenerContainerTopic") @JmsListener(destination = AppContants.SOCKETIO_TOPIC, containerFactory = "jmsListenerContainerTopic")
public void socketioTopic(String message) { public void socketioTopic(String message) {
logger.info("报文为:{},主题:{}", message, AppContants.SOCKETIO_TOPIC); logger.info("socketio报文为:{},主题:{}", message, AppContants.SOCKETIO_TOPIC);
try { try {
Map<String, String> datas = (Map<String, String>) JSON.parse(message); Map<String, String> datas = (Map<String, String>) JSON.parse(message);
socketIOService.pushMessageToDevice(datas.get("deviceId"), message); socketIOService.pushMessageToDevice(datas.get("deviceId"), message);
......
...@@ -139,13 +139,10 @@ public class OtherShDeviceServiceImpl extends ServiceImpl<OtherShDeviceDao, ShDe ...@@ -139,13 +139,10 @@ public class OtherShDeviceServiceImpl extends ServiceImpl<OtherShDeviceDao, ShDe
ShDeviceDataEntity dataEntity = new ShDeviceDataEntity(); ShDeviceDataEntity dataEntity = new ShDeviceDataEntity();
dataEntity.setDeviceId(deviceId); dataEntity.setDeviceId(deviceId);
if (entity == null) { if (entity == null) {
map.put("light", "0");
dataEntity.setValue(JSON.toJSONString(map)); dataEntity.setValue(JSON.toJSONString(map));
shDeviceDataService.save(dataEntity); shDeviceDataService.save(dataEntity);
}else { }else {
dataEntity.setId(entity.getId()); dataEntity.setId(entity.getId());
JSONObject jsonObj = new JSONObject(entity.getValue());
map.put("light", jsonObj.has("light")?jsonObj.getString("light"):"0");
dataEntity.setValue(JSON.toJSONString(map)); dataEntity.setValue(JSON.toJSONString(map));
shDeviceDataService.updateById(dataEntity); shDeviceDataService.updateById(dataEntity);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论