From af288e84549f2dc5e9958b8c8f2f6a5d2f48f6d3 Mon Sep 17 00:00:00 2001 From: lishuai Date: Fri, 23 Aug 2024 17:09:00 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=8F=B0=E8=B4=A6=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E7=89=A9=E5=85=B3=E7=B3=BB=E7=9A=84=E8=B0=83=E6=95=B4?= =?UTF-8?q?=202024=E5=B9=B48=E6=9C=8823=E6=97=A517:08:55?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/IotThingsServiceImpl.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/modules/equipment/src/main/java/com/thing/eq/eqmanager/service/impl/IotThingsServiceImpl.java b/modules/equipment/src/main/java/com/thing/eq/eqmanager/service/impl/IotThingsServiceImpl.java index 8aceb51..5edce9d 100644 --- a/modules/equipment/src/main/java/com/thing/eq/eqmanager/service/impl/IotThingsServiceImpl.java +++ b/modules/equipment/src/main/java/com/thing/eq/eqmanager/service/impl/IotThingsServiceImpl.java @@ -32,8 +32,8 @@ import com.thing.thing.entity.mapper.IotThingEntityMapper; import com.thing.thing.entity.service.IotThingEntityService; import com.thing.thing.relation.detail.dto.IotThingRelationDetailDTO; import com.thing.thing.relation.detail.dto.RelationDetailBatchSaveDTO; -import com.thing.thing.relation.detail.dto.ThingRelationDTO; import com.thing.thing.relation.detail.entity.IotThingRelationDetailEntity; +import com.thing.thing.relation.detail.param.IotThingRelationDetailParamDTO; import com.thing.thing.relation.detail.service.IotThingRelationDetailService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -192,21 +192,26 @@ public class IotThingsServiceImpl implements IotThingsService { baseInfoDTO.setScrapDisposal("0"); iotThingBaseInfoService.saveDto(baseInfoDTO); //保存设备的关系 - ThingRelationDTO relationDTO = new ThingRelationDTO(); + + List relationDetailDTOS = + iotThingRelationDetailService.findRootDetailChildNodeByRootIdAndFromIdAndRootThingId(dto.getRelationTypeId(), parentThing.getId(), dto.getRelationTopId()); + + IotThingRelationDetailParamDTO relationDTO = new IotThingRelationDetailParamDTO(); relationDTO.setRootId(dto.getRelationTypeId()); relationDTO.setRootThingId(dto.getRelationTopId()); relationDTO.setFromId(parentThing.getId()); relationDTO.setFromCode(parentThing.getCode()); relationDTO.setFromName(parentThing.getName()); - List relationList = new ArrayList<>(); - ThingRelationDTO.RelationEntity relation = new ThingRelationDTO.RelationEntity(); - + relationDTO.setId(relationDetailDTOS.get(0).getId()); + List relationList = new ArrayList<>(); + IotThingRelationDetailParamDTO relation = new IotThingRelationDetailParamDTO(); relation.setToId(thingEntity.getId()); relation.setToCode(code); relation.setToName(dto.getName()); relationList.add(relation); relationDTO.setRelationList(relationList); - iotThingRelationDetailService.saveRelationNodes(relationDTO); + + iotThingRelationDetailService.save(relationDTO); //保存附件 eqAttacmentService.saveBatch(ConvertUtils.sourceToTarget(attacmentDTOS, EqAttacmentEntity.class)); }