diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/EquipmentInstanceServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/EquipmentInstanceServiceImpl.java index 05fc2cf..d86c986 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/EquipmentInstanceServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/monitor/server/impl/EquipmentInstanceServiceImpl.java @@ -50,10 +50,13 @@ public class EquipmentInstanceServiceImpl implements IEquipmentInstanceService { virtualDeviceDTO.setDeviceName(submitAnswerReq.getEmName()); // 模型标识根据题目答案获取 virtualDeviceDTO.setModelSignage(this.getModelSignageByAnswer(submitAnswerReq)); - R saveResult = deviceClient.saveVirtualDevice(virtualDeviceDTO); - Assert.isTrue(saveResult.isSuccess(),() -> { - throw new ServiceException(saveResult.getMsg()); - }); + R exist = deviceClient.isDeviceCodeExist(submitAnswerReq.getEmCode()); + if(exist.isSuccess() && !exist.getData()) { + R saveResult = deviceClient.saveVirtualDevice(virtualDeviceDTO); + Assert.isTrue(saveResult.isSuccess(),() -> { + throw new ServiceException(saveResult.getMsg()); + }); + } // Long instanceId = Long.valueOf(String.valueOf(saveResult.getData())); // LambdaUpdateWrapper luw = Wrappers.lambdaUpdate() // .set(EmInfoEntity::getDeviceInstanceId, instanceId)