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

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

View File

@@ -22,6 +22,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.csdevice.api.*;
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
import com.njcn.csdevice.param.LineInfoParam;
import com.njcn.csdevice.pojo.param.*;
import com.njcn.csdevice.pojo.po.*;
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
@@ -30,7 +31,6 @@ import com.njcn.redis.utils.RedisUtil;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.api.DictTreeFeignClient;
import com.njcn.system.enums.DicDataEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.system.pojo.po.SysDicTreePO;
import com.njcn.user.api.UserFeignClient;
import com.njcn.user.enums.AppRoleEnum;
@@ -290,7 +290,10 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
csLineService.saveBatch(csLinePoList);
redisUtil.saveByKeyWithExpire("accessLineInfo:" + devAccessParam.getNDid(),csLinePoList,30L);
//缓存监测点信息
deviceMessageFeignClient.getLineInfo(devAccessParam.getNDid(),csLinePoList);
LineInfoParam param = new LineInfoParam();
param.setNDid(devAccessParam.getNDid());
param.setList(csLinePoList);
deviceMessageFeignClient.getLineInfo(param);
//4.监测点拓扑图表录入关系
appLineTopologyDiagramService.saveBatch(appLineTopologyDiagramPoList);
//5.绑定装置和人的关系
@@ -463,7 +466,10 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
csLineService.saveBatch(csLinePoList);
redisUtil.saveByKeyWithExpire("accessLineInfo:" + nDid,csLinePoList,30L);
//缓存监测点信息
deviceMessageFeignClient.getLineInfo(nDid,csLinePoList);
LineInfoParam param = new LineInfoParam();
param.setNDid(nDid);
param.setList(csLinePoList);
deviceMessageFeignClient.getLineInfo(param);
//4.生成装置和模板的关系表
CsDevModelRelationAddParm csDevModelRelationAddParm = new CsDevModelRelationAddParm();
csDevModelRelationAddParm.setDevId(vo.getId());
@@ -606,7 +612,10 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
csLineService.saveBatch(csLinePoList);
redisUtil.saveByKeyWithExpire("accessLineInfo:" + nDid,csLinePoList,30L);
//缓存监测点信息
deviceMessageFeignClient.getLineInfo(nDid,csLinePoList);
LineInfoParam param = new LineInfoParam();
param.setNDid(nDid);
param.setList(csLinePoList);
deviceMessageFeignClient.getLineInfo(param);
//4.生成装置和模板的关系表
CsDevModelRelationAddParm csDevModelRelationAddParm = new CsDevModelRelationAddParm();
csDevModelRelationAddParm.setDevId(vo.getId());
@@ -891,7 +900,9 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
}
Object object = redisUtil.getObjectByKey("accessLineInfo:" + nDid);
if (Objects.isNull(object)) {
deviceMessageFeignClient.getLineInfo(nDid,null);
LineInfoParam param = new LineInfoParam();
param.setNDid(nDid);
deviceMessageFeignClient.getLineInfo(param);
}
publisher.send("/Pfm/DevCmd/"+version+"/"+nDid, new Gson().toJson(getJson(mid,TypeEnum.TYPE_5.getCode())), 1, false);
result = true;

View File

@@ -14,6 +14,7 @@ import com.njcn.csdevice.api.CsCommunicateFeignClient;
import com.njcn.csdevice.api.CsLineFeignClient;
import com.njcn.csdevice.api.DataArrayFeignClient;
import com.njcn.csdevice.api.DeviceMessageFeignClient;
import com.njcn.csdevice.param.LineInfoParam;
import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
import com.njcn.csdevice.pojo.param.DataArrayParam;
import com.njcn.csdevice.pojo.po.CsDataArray;
@@ -84,7 +85,9 @@ public class StatServiceImpl implements IStatService {
String lineId = null;
Object object1 = redisUtil.getObjectByKey(AppRedisKey.LINE_POSITION+appAutoDataMessage.getId());
if (Objects.isNull(object1)){
deviceMessageFeignClient.getLineInfo(appAutoDataMessage.getId(),null);
LineInfoParam param = new LineInfoParam();
param.setNDid(appAutoDataMessage.getId());
deviceMessageFeignClient.getLineInfo(param);
}
//获取当前设备信息判断装置型号,来筛选监测点
List<CsEquipmentDeliveryPO> poList = channelObjectUtil.objectToList(redisUtil.getObjectByKey(AppRedisKey.DEVICE_LIST),CsEquipmentDeliveryPO.class);

View File

@@ -8,6 +8,7 @@ import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.csdevice.api.DeviceMessageFeignClient;
import com.njcn.csdevice.api.EquipmentFeignClient;
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
import com.njcn.csdevice.param.LineInfoParam;
import com.njcn.mq.message.AppEventMessage;
import com.njcn.redis.pojo.enums.AppRedisKey;
import com.njcn.redis.utils.RedisUtil;
@@ -51,7 +52,9 @@ public class CsWaveAnalysisServiceImpl implements ICsWaveAnalysisService {
List<WaveTimeDto> list = new ArrayList<>();
Object object1 = redisUtil.getObjectByKey(AppRedisKey.LINE_POSITION+appEventMessage.getId());
if (Objects.isNull(object1)){
deviceMessageFeignClient.getLineInfo(appEventMessage.getId(),null);
LineInfoParam param = new LineInfoParam();
param.setNDid(appEventMessage.getId());
deviceMessageFeignClient.getLineInfo(param);
}
//获取装置id
String deviceId = equipmentFeignClient.findDevByNDid(appEventMessage.getId()).getData().getId();

View File

@@ -11,6 +11,7 @@ import com.njcn.csdevice.api.CsLineFeignClient;
import com.njcn.csdevice.api.DeviceMessageFeignClient;
import com.njcn.csdevice.api.EquipmentFeignClient;
import com.njcn.csdevice.api.WlRecordFeignClient;
import com.njcn.csdevice.param.LineInfoParam;
import com.njcn.csdevice.pojo.param.WlRecordParam;
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
import com.njcn.csdevice.pojo.po.CsLinePO;
@@ -96,7 +97,9 @@ public class EventServiceImpl implements IEventService {
}
//判断监测点是否存在
if (Objects.isNull(object1)){
deviceMessageFeignClient.getLineInfo(appEventMessage.getId(),null);
LineInfoParam param = new LineInfoParam();
param.setNDid(appEventMessage.getId());
deviceMessageFeignClient.getLineInfo(param);
}
//获取装置id
CsEquipmentDeliveryPO po = equipmentFeignClient.findDevByNDid(appEventMessage.getId()).getData();