Przeglądaj źródła

磁盘接口代码提交

jingyuanchao 1 rok temu
rodzic
commit
7c6f4daad4

+ 10 - 3
soc-modules/soc-modules-mediator/src/main/java/com/xunmei/mediator/api/video/service/impl/IotDvrHardDiskDetectionServiceImpl.java

@@ -24,6 +24,7 @@ import com.xunmei.mediator.util.CheckDataUtil;
 import com.xunmei.mediator.websocket.constant.WebSocketConstants;
 import com.xunmei.mediator.websocket.dto.WebsocketExecuteReq;
 import com.xunmei.common.core.enums.iot.DeviceTypeEnum;
+import com.xunmei.mediator.websocket.dto.WebsocketResult;
 import com.xunmei.mediator.websocket.enums.ProductEnums;
 import com.xunmei.mediator.websocket.service.RouterService;
 import com.xunmei.system.api.RemoteOrgService;
@@ -69,6 +70,7 @@ public class IotDvrHardDiskDetectionServiceImpl extends ServiceImpl<IotDvrHardDi
     IotServerInfoService iotServerInfoService;
     @Resource
     IIotDeviceInfoService iotDeviceInfoService;
+
     @Override
     public ProductEnums product() {
         return ProductEnums.DVS;
@@ -91,6 +93,11 @@ public class IotDvrHardDiskDetectionServiceImpl extends ServiceImpl<IotDvrHardDi
             dto.setEquipmentCode(recorderHardDiskDetectionReq.getDvsCode());
             dto.setCheckStatus(recorderHardDiskDetectionReq.getCheckStatus());
             dto.setCheckTime(recorderHardDiskDetectionReq.getCheckTime());
+            List<Map<String, Object>> maps = new ArrayList<>();
+            /*for (JSONObject object : recorderHardDiskDetectionReq.getDetailInfo()) {
+                Map javaObject = object.toJavaObject(Map.class);
+                maps.add(javaObject);
+            }*/
             dto.setDetailInfo(recorderHardDiskDetectionReq.getDetailInfo());
 
             String token = req.getToken();
@@ -99,8 +106,8 @@ public class IotDvrHardDiskDetectionServiceImpl extends ServiceImpl<IotDvrHardDi
             dto.setToken(token);
             dto.setDeviceName(req.getDeviceName());
             dto.setProductName(req.getProductName());
-
-            return saveData(dto, req.getId());
+            WebsocketResult result = WebsocketResult.of(saveData(dto, req.getId()), req.getTopic(), req.getId());
+            return result;
         } catch (IllegalAccessException e) {
             throw new RuntimeException(e);
         }
@@ -246,7 +253,7 @@ public class IotDvrHardDiskDetectionServiceImpl extends ServiceImpl<IotDvrHardDi
             LogUtils.STATUS_INFO_DISKS.info("硬盘检测上报状态消息,开始处理对应盘符状态.....");
             iotDvrDiskService.updateStatusByDiskDetection(videoRecorderHardDiskDetection, videoRecorderHardDiskDetectionEditDto.getToken());
         } catch (Exception e) {
-            LogUtils.STATUS_INFO_DISKS.info("硬盘检测处理处理对应盘符状态时发生异常!内容:{}",e.getMessage());
+            LogUtils.STATUS_INFO_DISKS.info("硬盘检测处理处理对应盘符状态时发生异常!内容:{}", e.getMessage());
             throw new RuntimeException(e);
         }
 

+ 14 - 11
soc-modules/soc-modules-mediator/src/main/java/com/xunmei/mediator/domain/dto/disk/VideoRecorderHardDiskDetectionReq.java

@@ -6,6 +6,7 @@ import lombok.Data;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+
 @Data
 public class VideoRecorderHardDiskDetectionReq {
 
@@ -14,16 +15,18 @@ public class VideoRecorderHardDiskDetectionReq {
      *     "dvsCode":"ba8a6246-a0da-b238-9d83-935746d5d003",  //录像机编号
      *     "checkTime":"2024-07-02T14:18:32",  // 检测时间
      *     "checkStatus":0,   // 0:检测成功 | 1: 检测失败
-     *     "detailInfo":{
-     *       "state":0  //0:正常 | 1:异常
-     *       "diskSerialNum":"sdsd22232",//硬盘序列号
-     *       "name":"D",//widnows D E F信息    linux dev/hda0 dev/hda1
-     *       "diskFormat":"TFS",//磁盘格式
-     *       "totalBytes":1231312312312,//驱动器总空间		单位Bytes
-     *       "availableBytes":123132,//驱动器可用空间		单位Bytes
-     *       "freeBytes":123132,//剩余空间		单位Bytes
-     *       "originState":0,//0:正常 1:不存在 2:未格式化 3:休眠 4:正在维修 5:报警 6:错误 7:排除 9:未知
-     *     }
+     *     "detailInfo":[
+     *     {
+     *      "state":0  //0:正常 | 1:异常
+     *      "diskSerialNum":"sdsd22232",//硬盘序列号
+     *      "name":"D",//widnows D E F信息    linux dev/hda0 dev/hda1
+     *      "diskFormat":"TFS",//磁盘格式
+     *      "totalBytes":1231312312312,//驱动器总空间		单位Bytes
+     *      "availableBytes":123132,//驱动器可用空间		单位Bytes
+     *      "freeBytes":123132,//剩余空间		单位Bytes
+     *      "originState":0,//0:正常 1:不存在 2:未格式化 3:休眠 4:正在维修 5:报警 6:错误 7:排除 9:未知
+     *          }
+     *     ]
      *   }
      */
     @ApiModelProperty("录像机编号")
@@ -36,5 +39,5 @@ public class VideoRecorderHardDiskDetectionReq {
     private Date checkTime;
 
     @ApiModelProperty("硬盘当前状态信息")
-    private List<Map<String, Object>> detailInfo;
+    private List<Map<String,Object>> detailInfo;
 }

+ 1 - 0
soc-modules/soc-modules-mediator/src/main/java/com/xunmei/mediator/websocket/dto/WebsocketResult.java

@@ -69,6 +69,7 @@ public class WebsocketResult implements Serializable {
         Map<String, Object> map = new HashMap<>();
         map.put(WebSocketConstants.STATUS_CODE, dto.getSuccess() ? HttpStatus.SUCCESS : HttpStatus.ERROR);
         map.put(WebSocketConstants.STATUS_DESCRIPTION, dto.getErrorMsg());
+        map.put(WebSocketConstants.HEADER, new JSONObject());
         result.setPayload(map);
         return result;
     }