refactor(device): 更新设备监测点信息接口调用方式
- 引入 LineInfoParam 参数对象统一接口参数传递 - 移除 DictData 依赖减少不必要的导入 - 修改 getLineInfo 方法调用适配新的参数结构 - 在多个服务类中实现统一的参数封装逻辑 - 优化 Redis 缓存中监测点信息的处理流程 - 提升代码可读性和维护性
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user