|
|
@@ -1,11 +1,16 @@
|
|
|
package com.zhongshu.iot.server.core.service.iotPlatform.impl;
|
|
|
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
+import com.github.microservice.models.onLine.DeviceOnLineParam;
|
|
|
+import com.github.microservice.models.onLine.DeviceOnLineResult;
|
|
|
import com.github.microservice.net.ResultContent;
|
|
|
import com.zhongshu.iot.server.core.domain.ExecuteAnnotationService;
|
|
|
import com.zhongshu.iot.server.core.domain.ExecuteAnnotationServiceMethod;
|
|
|
-import com.zhongshu.iot.server.core.service.base.SuperService;
|
|
|
import com.zhongshu.iot.server.core.service.iotPlatform.PlatformTopic;
|
|
|
+import com.zhongshu.iot.server.core.util.DateUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.ObjectUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
/**
|
|
|
@@ -25,7 +30,21 @@ public class OnLineTopic implements PlatformTopic {
|
|
|
@ExecuteAnnotationServiceMethod(value = "online", remark = "上线")
|
|
|
@Override
|
|
|
public ResultContent<Object> action(String topic, String message) {
|
|
|
-
|
|
|
- return ResultContent.buildSuccess();
|
|
|
+ log.info("online");
|
|
|
+ DeviceOnLineParam param = null;
|
|
|
+ if (StringUtils.isNotEmpty(message)) {
|
|
|
+ param = JSONUtil.toBean(message, DeviceOnLineParam.class);
|
|
|
+ }
|
|
|
+ DeviceOnLineResult result = new DeviceOnLineResult();
|
|
|
+ if (ObjectUtils.isNotEmpty(param)) {
|
|
|
+ result.setOperator(param.getOperator());
|
|
|
+ result.setSuccess();
|
|
|
+ result.setDeviceId(param.getDeviceId());
|
|
|
+ result.setMqttDataId(param.getMqttDataId());
|
|
|
+ result.setGateWayId(param.getGateWayId());
|
|
|
+ result.setTime(DateUtils.paresTime(System.currentTimeMillis(), DateUtils.FORMAT_LONG));
|
|
|
+ result.setInfo(param.getInfo());
|
|
|
+ }
|
|
|
+ return ResultContent.buildSuccess(result);
|
|
|
}
|
|
|
}
|