Selaa lähdekoodia

1.修复openapi接口的一些bug
2.编辑设备name的时候添加判断不可重复名称

dsy 1 vuosi sitten
vanhempi
commit
9fa0056fef

+ 5 - 0
iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/impl/DeviceServiceImpl.java

@@ -415,6 +415,11 @@ public class DeviceServiceImpl implements IDeviceService {
         DeviceInfo di=data.to(DeviceInfo.class);
         di.setLocate(new DeviceInfo.Locate(data.getLongitude(),data.getLatitude()));
         di.setState(data.getState());
+        //同产品不可重复设备名
+        DeviceInfo deviceRepetition = deviceInfoData.findByProductKeyAndDeviceName(data.getProductKey(), data.getDeviceName());
+        if (deviceRepetition != null && !deviceRepetition.getDeviceId().equals(di.getDeviceId())) {
+            throw new BizException(ErrCode.MODEL_DEVICE_ALREADY);
+        }
         return deviceInfoData.save(di)!=null;
     }
 

+ 0 - 37
iot-module/iot-openapi/pom.xml

@@ -13,36 +13,13 @@
 
     <dependencies>
 
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-web</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.bouncycastle</groupId>
-            <artifactId>bcprov-jdk15on</artifactId>
-        </dependency>
 
-        <dependency>
-            <groupId>com.aliyun.oss</groupId>
-            <artifactId>aliyun-sdk-oss</artifactId>
-        </dependency>
 
         <dependency>
             <groupId>joda-time</groupId>
             <artifactId>joda-time</artifactId>
         </dependency>
 
-        <dependency>
-            <groupId>it.ozimov</groupId>
-            <artifactId>embedded-redis</artifactId>
-            <exclusions>
-                <exclusion>
-                    <artifactId>slf4j-simple</artifactId>
-                    <groupId>org.slf4j</groupId>
-                </exclusion>
-            </exclusions>
-        </dependency>
 
         <dependency>
             <groupId>cc.iotkit</groupId>
@@ -59,20 +36,6 @@
             <artifactId>iot-rule-engine</artifactId>
         </dependency>
 
-        <dependency>
-            <groupId>cc.iotkit</groupId>
-            <artifactId>iot-screen</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>cc.iotkit</groupId>
-            <artifactId>iot-component-server</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>cc.iotkit</groupId>
-            <artifactId>iot-component-converter</artifactId>
-        </dependency>
 
         <dependency>
             <groupId>cc.iotkit</groupId>

+ 2 - 2
iot-module/iot-openapi/src/main/java/cc/iotkit/openapi/controller/OpenDeviceController.java

@@ -38,7 +38,7 @@ public class OpenDeviceController {
     }
 
     @ApiOperation(value = "单个设备注册")
-    @PostMapping("/v1/registerDevice ")
+    @PostMapping("/v1/registerDevice")
     public boolean createDevice(@RequestBody @Validated Request<OpenapiDeviceBo> bo) {
         return openDeviceService.addDevice(bo.getData());
     }
@@ -50,7 +50,7 @@ public class OpenDeviceController {
     }
 
     @ApiOperation(value = "设置设备的属性", notes = "设置设备的属性", httpMethod = "POST")
-    @PostMapping("/v1/setDeviceProperty ")
+    @PostMapping("/v1/setDeviceProperty")
     public InvokeResult setProperty(@RequestBody @Validated Request<OpenapiSetDeviceServicePropertyBo> request) {
         return new InvokeResult(openDeviceService.setProperty(request.getData().getProductKey(), request.getData().getDeviceName(), request.getData().getArgs()));
     }

+ 2 - 1
iot-module/iot-openapi/src/main/java/cc/iotkit/openapi/service/impl/OpenBaseServiceImpl.java

@@ -52,7 +52,8 @@ public class OpenBaseServiceImpl implements OpenBaseService {
 
         // 校验租户
         checkTenant(bo.getTenantId());
-
+        System.out.println("boAppid + password + boTimeStamp = " + boAppid + password + boTimeStamp);
+        System.out.println("boIdentifier = " + boIdentifier);
         if (!CodecUtil.md5Str(boAppid + password + boTimeStamp).equals(boIdentifier)){
             throw new BizException(ErrCode.IDENTIFIER_ERROR);
         }