Commit d7963502 authored by 赵啸非's avatar 赵啸非

分组更新设备

parent 56e31553
...@@ -7,11 +7,12 @@ import com.mortals.framework.ap.GlobalSysInfo; ...@@ -7,11 +7,12 @@ import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.model.BizLogPdu; import com.mortals.framework.model.BizLogPdu;
import com.mortals.framework.service.ICacheService; import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.IMessageProduceService; import com.mortals.framework.service.IMessageProduceService;
import com.mortals.xhx.common.code.*; import com.mortals.xhx.common.code.DeviceMethodEnum;
import com.mortals.xhx.common.code.DeviceStatusEnum;
import com.mortals.xhx.common.code.LogTypeEnum;
import com.mortals.xhx.common.key.Constant; import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.key.RedisKey; import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.common.pdu.DefaultQueueMsg; import com.mortals.xhx.common.pdu.DefaultQueueMsg;
import com.mortals.xhx.common.utils.SendTask;
import com.mortals.xhx.common.utils.SendTaskThreadPool; import com.mortals.xhx.common.utils.SendTaskThreadPool;
import com.mortals.xhx.module.device.model.DeviceEntity; import com.mortals.xhx.module.device.model.DeviceEntity;
import com.mortals.xhx.module.device.model.DeviceLogEntity; import com.mortals.xhx.module.device.model.DeviceLogEntity;
...@@ -30,7 +31,6 @@ import org.springframework.util.ObjectUtils; ...@@ -30,7 +31,6 @@ import org.springframework.util.ObjectUtils;
import java.util.Date; import java.util.Date;
import static com.mortals.xhx.common.key.Constant.PARAM_SERVER_PHP_IN_HTTP_URL;
import static com.mortals.xhx.common.model.MessageHeader.DEVICECODE; import static com.mortals.xhx.common.model.MessageHeader.DEVICECODE;
import static com.mortals.xhx.common.model.MessageHeader.MESSAGETYPE; import static com.mortals.xhx.common.model.MessageHeader.MESSAGETYPE;
...@@ -78,7 +78,7 @@ public class DirectDynamicListener implements MessageListener { ...@@ -78,7 +78,7 @@ public class DirectDynamicListener implements MessageListener {
DeviceEntity deviceEntity = deviceService.getExtCache(deviceCode); DeviceEntity deviceEntity = deviceService.getExtCache(deviceCode);
if (!ObjectUtils.isEmpty(deviceEntity)) { if (!ObjectUtils.isEmpty(deviceEntity)) {
cacheService.set(RedisKey.KEY_DEVICE_ONLINE_CACHE + deviceEntity.getDeviceCode(), "", GlobalSysInfo.getParamIntValue(Constant.HEARTBEAT_TIMEOUT, 120)); cacheService.set(RedisKey.KEY_DEVICE_ONLINE_CACHE + deviceEntity.getDeviceCode(), "", GlobalSysInfo.getParamIntValue(Constant.HEARTBEAT_TIMEOUT, 180));
if (deviceEntity.getDeviceStatus() == DeviceStatusEnum.离线.getValue()) { if (deviceEntity.getDeviceStatus() == DeviceStatusEnum.离线.getValue()) {
deviceEntity.setOnlineTime(new Date()); deviceEntity.setOnlineTime(new Date());
deviceEntity.setDeviceStatus(DeviceStatusEnum.在线.getValue()); deviceEntity.setDeviceStatus(DeviceStatusEnum.在线.getValue());
...@@ -96,7 +96,6 @@ public class DirectDynamicListener implements MessageListener { ...@@ -96,7 +96,6 @@ public class DirectDynamicListener implements MessageListener {
PlatformEntity platformEntity = platformService.getCache(deviceEntity.getPlatformId().toString()); PlatformEntity platformEntity = platformService.getCache(deviceEntity.getPlatformId().toString());
ProductEntity productEntity = productService.get(deviceEntity.getProductId()); ProductEntity productEntity = productService.get(deviceEntity.getProductId());
if (!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(productEntity)) { if (!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(productEntity)) {
//新增设备通知第三方平台
deviceService.sendThirdParty(deviceEntity, productEntity, platformEntity, DeviceMethodEnum.ONLINE); deviceService.sendThirdParty(deviceEntity, productEntity, platformEntity, DeviceMethodEnum.ONLINE);
//保存业务消息为离线 //保存业务消息为离线
BizLogPdu bizLogPdu = new BizLogPdu(); BizLogPdu bizLogPdu = new BizLogPdu();
...@@ -130,7 +129,7 @@ public class DirectDynamicListener implements MessageListener { ...@@ -130,7 +129,7 @@ public class DirectDynamicListener implements MessageListener {
deviceLogEntity.setCreateTime(new Date()); deviceLogEntity.setCreateTime(new Date());
deviceLogService.save(deviceLogEntity); deviceLogService.save(deviceLogEntity);
} }
//获取exchange, /* //获取exchange,
PlatformEntity platformEntity = platformService.getCache(deviceEntity.getPlatformId().toString()); PlatformEntity platformEntity = platformService.getCache(deviceEntity.getPlatformId().toString());
String phpInUrl = GlobalSysInfo.getParamValue(PARAM_SERVER_PHP_IN_HTTP_URL, "http://172.15.28.116:8090"); String phpInUrl = GlobalSysInfo.getParamValue(PARAM_SERVER_PHP_IN_HTTP_URL, "http://172.15.28.116:8090");
...@@ -141,7 +140,7 @@ public class DirectDynamicListener implements MessageListener { ...@@ -141,7 +140,7 @@ public class DirectDynamicListener implements MessageListener {
SendTask sendTask = new SendTask(phpInUrl, queueMsg.getData()); SendTask sendTask = new SendTask(phpInUrl, queueMsg.getData());
sendTaskThreadPool.execute(sendTask); sendTaskThreadPool.execute(sendTask);
} }
} }*/
} }
} catch (Exception e) { } catch (Exception e) {
log.error("消费消息异常", e); log.error("消费消息异常", e);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment