Ver código fonte

添加绑定日志

S0025136190 8 meses atrás
pai
commit
afce74947c

+ 2 - 0
Backend/sample/src/main/java/com/dji/sample/manage/controller/DeviceController.java

@@ -75,6 +75,7 @@ public class DeviceController {
      */
     @PostMapping("/{device_sn}/binding")
     public HttpResultResponse bindDevice(@RequestBody DeviceDTO device, @PathVariable("device_sn") String deviceSn) {
+        log.info("=========进入设备绑定=======",device);
         device.setDeviceSn(deviceSn);
         boolean isUpd = deviceService.bindDevice(device);
         return isUpd ? HttpResultResponse.success() : HttpResultResponse.error();
@@ -118,6 +119,7 @@ public class DeviceController {
      */
     @DeleteMapping("/{device_sn}/unbinding")
     public HttpResultResponse unbindingDevice(@PathVariable("device_sn") String deviceSn) {
+        log.info("=========进入设备解绑=======",deviceSn);
         deviceService.unbindDevice(deviceSn);
         return HttpResultResponse.success();
     }

+ 6 - 2
Backend/sample/src/main/java/com/dji/sample/manage/service/impl/DeviceServiceImpl.java

@@ -493,11 +493,14 @@ public class DeviceServiceImpl implements IDeviceService {
 
         boolean isUpd = this.updateDevice(device);
         if (!isUpd) {
+            log.info("====更新设备绑定状态失败=========",device);
             return false;
         }
+        log.info("====更新设备绑定状态成功=========",device);
 
         Optional<DeviceDTO> deviceOpt = deviceRedisService.getDeviceOnline(device.getDeviceSn());
         if (deviceOpt.isEmpty()) {
+            log.info("====设备绑定,设备不在线=========",device.getDeviceSn());
             return false;
         }
 
@@ -518,13 +521,14 @@ public class DeviceServiceImpl implements IDeviceService {
             gatewaySn = redisDevice.getParentSn();
             deviceSn = device.getDeviceSn();
         }
-
+        log.info("====更新设备绑定状态,pushDeviceOnlineTopo=========gatewaySn:" + gatewaySn +",deviceSn:" + deviceSn);
         pushDeviceOnlineTopo(device.getWorkspaceId(), gatewaySn, deviceSn);
+        log.info("====更新设备绑定状态,subDeviceOnlineSubscribeTopic=========gatewaySn:" + gatewaySn +",deviceSn:" + deviceSn);
         subDeviceOnlineSubscribeTopic(SDKManager.getDeviceSDK(gatewaySn));
 
         //添加绑定日志
         deviceOprLogsService.addDeviceOprLogsDTO(redisDevice,LogOprTypeEnum.BIND);
-
+        log.info("====更新设备绑定状态,添加日志成功",redisDevice);
         return true;
     }