Răsfoiți Sursa

feat(device): 初始化设备功能调整

- 修改解绑接口为设备初始化接口
- 增加设备下房间、跌倒事件、告警事件的逻辑删除处理- 注释掉向算法发送家具和子区域参数的相关代码
- 在dev_info重置SQL中增加多个字段清空操作- 调整dev_room查询条件顺序
- 更新操作日志类型描述从"解绑设备"改为"初始化设备"
hxd 1 săptămână în urmă
părinte
comite
aed2345591

+ 1 - 1
portal-service-application/src/main/java/com/hfln/portal/application/controller/web/WebAdminDealController.java

@@ -28,7 +28,7 @@ public class WebAdminDealController {
     private WebAdminDealGateway webAdminDealGateway;
 
     @PostMapping("/unbind")
-    @Operation(summary = "解绑用户")
+    @Operation(summary = "初始化设备")
     public ApiResult<Void> unbind(@Valid @RequestBody AdminDealUnbindParam param) {
 
         webAdminDealGateway.unbind(param);

+ 3 - 1
portal-service-common/src/main/java/com/hfln/portal/common/constant/mqtt/topic/TopicConstants.java

@@ -23,11 +23,13 @@ public interface TopicConstants {
     //向雷达发送设备信息
     String TOPIC_MPS_SET_DEVICE_PARAM = "/mps/set_device_param";
 
+    // 算法运维客户端暂时停止维护了 这俩个topic暂时不用
+/*
     //向算法发送子区域参数
     String TOPIC_DAS_SET_SUB_REGION_PARAM = "/opc/update_sub_regions";
-
     //向算法发送家具参数
     String TOPIC_DAS_SET_FURNITURE_PARAM = "/opc/update_furnitures";
+*/
 
 
     /**

+ 1 - 1
portal-service-domain/src/main/java/com/hfln/portal/domain/customer/OprLogType.java

@@ -44,7 +44,7 @@ public enum OprLogType {
     /**
      * 超管特权操作
      */
-    ADMIN_DEAL_UNBIND("ADMIN_DEAL_UNBIND", "超管解绑设备"),
+    ADMIN_DEAL_UNBIND("ADMIN_DEAL_UNBIND", "超管初始化设备"),
     ;
 
     String code;

+ 3 - 0
portal-service-infrastructure/src/main/java/com/hfln/portal/infrastructure/gateway/impl/DeviceGatewayImpl.java

@@ -646,6 +646,7 @@ public class DeviceGatewayImpl implements DeviceGateway {
         // 更新dev_room表
         devRoomService.saveOrUpdate(param);
 
+/*
         // 发送家具信息到算法
         if (param.getFurnitures() != null && !param.getFurnitures().isEmpty()) {
             mqttSend.sendMqttMessage(TopicConstants.TOPIC_DAS_SET_FURNITURE_PARAM, devInfo.getClientId());
@@ -656,6 +657,8 @@ public class DeviceGatewayImpl implements DeviceGateway {
             mqttSend.sendMqttMessage(TopicConstants.TOPIC_DAS_SET_SUB_REGION_PARAM, devInfo.getClientId());
         }
 
+*/
+
         // 发送子区域信息到设备
         if (subRegions != null && !subRegions.isEmpty()) {
             mqttSend.sendSubRegionToDevice(devInfo.getClientId(), subRegions);

+ 39 - 2
portal-service-infrastructure/src/main/java/com/hfln/portal/infrastructure/gateway/impl/WebAdminDealGatewayImpl.java

@@ -41,6 +41,13 @@ public class WebAdminDealGatewayImpl implements WebAdminDealGateway {
     private AlarmGateway alarmGateway;
     @Autowired
     private AlarmPlanService alarmPlanService;
+    @Autowired
+    private DevRoomService devRoomService;
+    @Autowired
+    private EventsService eventsService;
+    @Autowired
+    private EventListService eventListService;
+
 
     @Override
     @Transactional
@@ -52,7 +59,10 @@ public class WebAdminDealGatewayImpl implements WebAdminDealGateway {
         // 2 设备被分享者 逻辑删除
         // 4 群组分享表 逻辑删除
         // 5 设备下告警计划 物理删除
-        log.info("超管对设备devId:{}, 进行解绑", param.getDevId());
+        // 6 设备下房间 逻辑删除
+        // 7 设备下跌倒事件 逻辑删除
+        // 8 设备下告警事件 逻辑删除
+        log.info("超管对设备devId:{}, 进行设备初始化", param.getDevId());
 
         DevInfo devInfo = devInfoService.getById(param.getDevId());
         if (devInfo == null) {
@@ -95,10 +105,37 @@ public class WebAdminDealGatewayImpl implements WebAdminDealGateway {
                 }
             }
         }
+        // 设备下房间 逻辑删除
+        DevRoom devRoom = devRoomService.queryByDevId(devInfo.getDevId());
+        log.info("设备下房间:{}", JSON.toJSONString(devRoom));
+        devRoomService.update(
+                Wrappers.<DevRoom>lambdaUpdate()
+                        .eq(DevRoom::getDevId, devInfo.getDevId())
+                        .eq(DevRoom::getIsDeleted, 0)
+                        .set(DevRoom::getIsDeleted, 1)
+        );
+        // 设备下跌倒事件 逻辑删除
+        List<Events> events = eventsService.list(new  LambdaQueryWrapper<Events>().eq(Events::getClientId, devInfo.getClientId()));
+        log.info("设备下跌倒事件:{}", JSON.toJSONString(events));
+        eventsService.update(
+                Wrappers.<Events>lambdaUpdate()
+                        .eq(Events::getClientId, devInfo.getClientId())
+                        .eq(Events::getIsDeleted, 0)
+                        .set(Events::getIsDeleted, 1)
+        );
+        // 设备下告警事件 逻辑删除
+        List<EventList> eventLists = eventListService.list(new LambdaQueryWrapper<EventList>().eq(EventList::getDevId, devInfo.getDevId()));
+        log.info("设备下告警事件:{}", JSON.toJSONString(eventLists));
+        eventListService.update(
+                Wrappers.<EventList>lambdaUpdate()
+                        .eq(EventList::getDevId, devInfo.getDevId())
+                        .eq(EventList::getIsDeleted, 0)
+                        .set(EventList::getIsDeleted, 1)
+        );
 
         // 对设备 绑定信息置空信息
         devInfoService.resetDevInfo(devInfo.getDevId());
-        log.info("超管设备解绑完成");
+        log.info("超管设备初始化完成");
     }
 
     @Override

+ 13 - 1
portal-service-infrastructure/src/main/java/com/hfln/portal/infrastructure/mapper/DevInfoMapper.java

@@ -44,7 +44,19 @@ public interface DevInfoMapper extends BaseMapper<DevInfo> {
             "exist_flag = null , " +
             "presence_change_time = null , " +
             "age = null , "  +
-            "guardianship_type = null " +
+            "guardianship_type = null ," +
+            "onoff_time = null , " +
+            "fall_setting_enabled = null , " +
+            "low_high_snr_ratio = null , " +
+            "low_mid_snr_ratio = null , " +
+            "low_snr_thr = null , " +
+            "low_z_max  = null ," +
+            "human_pred_threshold = null , " +
+            "min_events_for_detection = null , " +
+            "min_human_events_for_detection = null ," +
+            "create_id = null ," +
+            "update_id = null ," +
+            "remark = null " +
 
             "WHERE dev_id = #{devId}")
     void reset(Long devId);

+ 1 - 1
portal-service-infrastructure/src/main/java/com/hfln/portal/infrastructure/service/impl/DevRoomServiceImpl.java

@@ -20,8 +20,8 @@ public class DevRoomServiceImpl extends ServiceImpl<DevRoomMapper, DevRoom> impl
         return this.baseMapper.selectOne(
                 new LambdaQueryWrapper<DevRoom>()
                         .select()
-                        .eq(DevRoom::getIsDeleted, BasePO.DeleteFlag.NOT_DELETED)
                         .eq(DevRoom::getDevId, devId)
+                        .eq(DevRoom::getIsDeleted, BasePO.DeleteFlag.NOT_DELETED)
         );
     }