|
|
|
@ -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<IotThingRelationDetailDTO> 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<ThingRelationDTO.RelationEntity> relationList = new ArrayList<>(); |
|
|
|
ThingRelationDTO.RelationEntity relation = new ThingRelationDTO.RelationEntity(); |
|
|
|
|
|
|
|
relationDTO.setId(relationDetailDTOS.get(0).getId()); |
|
|
|
List<IotThingRelationDetailParamDTO> 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)); |
|
|
|
} |
|
|
|
|