From 5b734454bac18f2d4dee4e6bb5a24c31e982b2de Mon Sep 17 00:00:00 2001
From: Your Name <you@example.com>
Date: 星期三, 08 三月 2023 01:52:01 +0800
Subject: [PATCH] 优化代码

---
 service-common/src/main/java/com/java110/common/cmd/chargeMachine/SaveChargeMachinePortCmd.java |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/service-common/src/main/java/com/java110/common/cmd/chargeMachine/SaveChargeMachinePortCmd.java b/service-common/src/main/java/com/java110/common/cmd/chargeMachine/SaveChargeMachinePortCmd.java
index 998816e..311546a 100644
--- a/service-common/src/main/java/com/java110/common/cmd/chargeMachine/SaveChargeMachinePortCmd.java
+++ b/service-common/src/main/java/com/java110/common/cmd/chargeMachine/SaveChargeMachinePortCmd.java
@@ -22,6 +22,7 @@
 import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
 import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.dto.chargeMachinePort.ChargeMachinePortDto;
 import com.java110.intf.common.IChargeMachinePortV1InnerServiceSMO;
 import com.java110.po.chargeMachinePort.ChargeMachinePortPo;
 import com.java110.utils.exception.CmdException;
@@ -60,6 +61,15 @@
         Assert.hasKeyAndValue(reqJson, "state", "璇锋眰鎶ユ枃涓湭鍖呭惈state");
         Assert.hasKeyAndValue(reqJson, "communityId", "璇锋眰鎶ユ枃涓湭鍖呭惈communityId");
 
+
+        ChargeMachinePortDto chargeMachinePortDto = new ChargeMachinePortDto();
+        chargeMachinePortDto.setMachineId(reqJson.getString("machineId"));
+        chargeMachinePortDto.setPortCode(reqJson.getString("portCode"));
+        chargeMachinePortDto.setCommunityId(reqJson.getString("communityId"));
+        int flag = chargeMachinePortV1InnerServiceSMOImpl.queryChargeMachinePortsCount(chargeMachinePortDto);
+        if (flag > 0) {
+            throw new CmdException("鎻掑骇宸茬粡瀛樺湪");
+        }
     }
 
     @Override

--
Gitblit v1.8.0