Browse Source

导入设备信息的时候从定义中获取模型标识填充

zhongwei
tanghaihao 1 year ago
parent
commit
fec50a9202
  1. 14
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java

14
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java

@ -91,6 +91,8 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
@Autowired @Autowired
private IEmTreeInspectService emTreeInspectService; private IEmTreeInspectService emTreeInspectService;
@Autowired @Autowired
private IEmDefinitionService emDefinitionService;
@Autowired
private IStationClient stationClient; private IStationClient stationClient;
@Autowired @Autowired
private IAnalyseDataSearchClient searchClient; private IAnalyseDataSearchClient searchClient;
@ -493,7 +495,8 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
if (Func.isEmpty(station)) { if (Func.isEmpty(station)) {
throw new ServiceException("站点不存在"); throw new ServiceException("站点不存在");
} }
copyDeviceTree(station, 0L,deviceTreeDTO.getDefinitionId() , deviceTreeDTO.getTreeIds()); EmDefinitionEntity emDefinition = emDefinitionService.getById(deviceTreeDTO.getDefinitionId());
copyDeviceTree(station, 0L, deviceTreeDTO.getDefinitionId(), emDefinition.getModelSignage(), deviceTreeDTO.getTreeIds());
return true; return true;
} }
@ -508,8 +511,8 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
throw new ServiceException("设备负责部门未绑定站点"); throw new ServiceException("设备负责部门未绑定站点");
} }
EmTreeEntity emTree = emTreeService.getById(emInfo.getTreeId()); EmTreeEntity emTree = emTreeService.getById(emInfo.getTreeId());
EmDefinitionEntity emDefinition = emDefinitionService.getById(deviceTreeDTO.getDefinitionId());
copyDeviceTree(station, deviceTreeDTO.getInfoId(), emTree.getDefinitionId(), deviceTreeDTO.getTreeIds()); copyDeviceTree(station, deviceTreeDTO.getInfoId(), emTree.getDefinitionId(), emDefinition.getModelSignage(), deviceTreeDTO.getTreeIds());
return true; return true;
} }
@ -781,7 +784,7 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
return resultList; return resultList;
} }
private void copyDeviceTree(StationEntity station, Long pid, Long definitionId, List<EmTreeIdsDTO> treeIds) { private void copyDeviceTree(StationEntity station, Long pid, Long definitionId, String modelSignage, List<EmTreeIdsDTO> treeIds) {
List<ProjectDTO> projectDTOList = new ArrayList<>(); List<ProjectDTO> projectDTOList = new ArrayList<>();
LambdaQueryWrapper<EmTreeEntity> wrapper = new LambdaQueryWrapper(); LambdaQueryWrapper<EmTreeEntity> wrapper = new LambdaQueryWrapper();
wrapper.eq(EmTreeEntity::getDefinitionId, definitionId); wrapper.eq(EmTreeEntity::getDefinitionId, definitionId);
@ -814,6 +817,7 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
emInfo.setRunStatus("1"); emInfo.setRunStatus("1");
emInfo.setStatus(1); emInfo.setStatus(1);
emInfo.setHomePageDisplay("1"); emInfo.setHomePageDisplay("1");
emInfo.setModelSignage(modelSignage);
emInfo.setRunDate(new Date()); emInfo.setRunDate(new Date());
emInfo.setCreateDept(station.getRefDept()); emInfo.setCreateDept(station.getRefDept());
emInfo.setCreateTime(new Date()); emInfo.setCreateTime(new Date());
@ -883,7 +887,7 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
projectDTOList.add(projectDTO); projectDTOList.add(projectDTO);
if (Func.isNotEmpty(emTreeIdsDTO.getChildren())) { if (Func.isNotEmpty(emTreeIdsDTO.getChildren())) {
copyDeviceTree(station, infoId, definitionId, emTreeIdsDTO.getChildren()); copyDeviceTree(station, infoId, definitionId, modelSignage, emTreeIdsDTO.getChildren());
} }
} }
if (Func.isNotEmpty(projectDTOList)) { if (Func.isNotEmpty(projectDTOList)) {

Loading…
Cancel
Save