|
|
@@ -1,11 +1,12 @@
|
|
|
package com.zhongshu.iot.server.core.controller.free;
|
|
|
|
|
|
+import com.github.microservice.net.ResultContent;
|
|
|
import com.zhongshu.iot.client.model.mqtt.GateWayBindDeviceParam;
|
|
|
import com.zhongshu.iot.client.model.mqtt.GateWayInfoAddParam;
|
|
|
import com.zhongshu.iot.client.model.mqtt.MqttInfoReturnModel;
|
|
|
+import com.zhongshu.iot.server.core.service.base.AkSignService;
|
|
|
import com.zhongshu.iot.server.core.service.mqtt.DeviceInfoService;
|
|
|
import com.zhongshu.iot.server.core.service.mqtt.GateWayInfoService;
|
|
|
-import com.github.microservice.net.ResultContent;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -36,10 +37,17 @@ public class GateWayFreeController {
|
|
|
@Autowired
|
|
|
DeviceInfoService deviceInfoService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private AkSignService akSignService;
|
|
|
+
|
|
|
@Operation(summary = "注册网关")
|
|
|
@RequestMapping(value = "registerGateWay", method = {RequestMethod.POST})
|
|
|
public ResultContent<MqttInfoReturnModel> registerGateWay(@RequestBody GateWayInfoAddParam param) {
|
|
|
Assert.hasText(param.getGateWayId(), "网关ID不能为空");
|
|
|
+ ResultContent resultContent = akSignService.verifyAk(param.getAk(), param.getTime(), param.getSign());
|
|
|
+ if (resultContent.isFailed()) {
|
|
|
+ return resultContent;
|
|
|
+ }
|
|
|
log.info("-----------------------注册网关---------------------- {}", param);
|
|
|
return gateWayInfoService.registerGateWay(param);
|
|
|
}
|
|
|
@@ -48,6 +56,10 @@ public class GateWayFreeController {
|
|
|
@RequestMapping(value = "gateWayBindDevice", method = {RequestMethod.POST})
|
|
|
public ResultContent gateWayBindDevice(@RequestBody GateWayBindDeviceParam param) {
|
|
|
Assert.hasText(param.getGateWayId(), "网关ID不能为空");
|
|
|
+ ResultContent resultContent = akSignService.verifyAk(param.getAk(), param.getTime(), param.getSign());
|
|
|
+ if (resultContent.isFailed()) {
|
|
|
+ return resultContent;
|
|
|
+ }
|
|
|
log.info("-------------------------网关绑定设备------------------------: {}", param);
|
|
|
return gateWayInfoService.gateWayBindDevice(param);
|
|
|
}
|