From f210130db47344ae08fbe8ba1aed6f983fe31df8 Mon Sep 17 00:00:00 2001 From: "H.X" <7458466+huangxing1023@user.noreply.gitee.com> Date: Wed, 22 Mar 2023 19:09:05 +0800 Subject: [PATCH] =?UTF-8?q?#=20=E6=8E=A5=E7=AB=99=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../monitor/server/impl/EquipmentInstanceServiceImpl.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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)