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

Loading…
Cancel
Save