refactor(device): 更新设备监测点信息接口调用方式

- 引入 LineInfoParam 参数对象统一接口参数传递
- 移除 DictData 依赖减少不必要的导入
- 修改 getLineInfo 方法调用适配新的参数结构
- 在多个服务类中实现统一的参数封装逻辑
- 优化 Redis 缓存中监测点信息的处理流程
- 提升代码可读性和维护性
This commit is contained in:
xy
2026-05-26 10:53:14 +08:00
parent 71107fe36d
commit 200004913e
4 changed files with 37 additions and 25 deletions

View File

@@ -56,7 +56,6 @@ import org.springframework.transaction.annotation.Transactional;
import javax.validation.ConstraintViolation;
import javax.validation.Validator;
import java.nio.charset.StandardCharsets;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
@@ -487,7 +486,10 @@ public class MqttMessageHandler {
heartbeatService.receiveHeartbeat(nDid);
//有心跳,则将装置改成在线
//csEquipmentDeliveryService.updateRunStatusBynDid(nDid,AccessEnum.ONLINE.getCode());
//处理心跳
//处理心跳 判断设备是否接入,如果设备已经接入则响应,不然忽略
CsEquipmentDeliveryPO po = equipmentFeignClient.findDevByNDid(nDid).getData();
if (Objects.nonNull(po)) {
if (po.getUsageStatus() == 1 && po.getRunStatus() == 2 && po.getStatus() == 3) {
ReqAndResDto.Res reqAndResParam = new ReqAndResDto.Res();
reqAndResParam.setMid(res.getMid());
reqAndResParam.setDid(0);
@@ -511,6 +513,8 @@ public class MqttMessageHandler {
System.out.println("异常设备ID"+item);
});
}
}
}
break;
case 4866:
AutoDataDto dataDto = gson.fromJson(new String(message.getPayload(), StandardCharsets.UTF_8), AutoDataDto.class);

View File

@@ -28,5 +28,5 @@ public interface ICsTopicService extends IService<CsTopic> {
*/
String getVersion(String nDid);
void deleteByNDid(String nDid);
}

View File

@@ -388,6 +388,8 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
appLineTopologyDiagramPOQueryWrapper.in("line_id",collect);
appLineTopologyDiagramService.remove(appLineTopologyDiagramPOQueryWrapper);
}
//删除topic表
csTopicService.deleteByNDid(nDid);
//清空缓存
redisUtil.deleteKeysByString(AppRedisKey.LINE_POSITION+nDid);
}

View File

@@ -7,7 +7,6 @@ import com.njcn.access.mapper.CsTopicMapper;
import com.njcn.access.pojo.po.CsTopic;
import com.njcn.access.service.ICsTopicService;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
@@ -42,4 +41,11 @@ public class CsTopicServiceImpl extends ServiceImpl<CsTopicMapper, CsTopic> impl
}
return version;
}
@Override
public void deleteByNDid(String nDid) {
LambdaQueryWrapper<CsTopic> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(CsTopic::getNDid,nDid);
this.remove(lambdaQueryWrapper);
}
}