Просмотр исходного кода

优化iot下发设备控制命令和service-eg门禁系统人员校验开门接口,增加设备所属类型和所属网关两个字段

james 2 недель назад
Родитель
Сommit
cc17ab24cc

+ 4 - 2
service-eg/service-eg-biz/src/main/java/com/usky/eg/controller/web/EgDeviceController.java

@@ -92,8 +92,10 @@ public class EgDeviceController {
                                                  @RequestParam("commandValue") String commandValue,
                                                  @RequestParam(value = "domain",required = false) String domain,
                                                  @RequestParam(value = "userId",required = false) Long userId,
-                                                 @RequestParam(value = "userName",required = false) String userName){
-        return ApiResult.success(egDeviceService.control(productCode,deviceUuid,commandCode,commandValue,domain,userId,userName));
+                                                 @RequestParam(value = "userName",required = false) String userName,
+                                                 @RequestParam(value = "categoryType") Integer categoryType,
+                                                 @RequestParam(value = "gatewayUuid",required = false) String gatewayUuid){
+        return ApiResult.success(egDeviceService.control(productCode,deviceUuid,commandCode,commandValue,domain,userId,userName,categoryType,gatewayUuid));
     }
 
 }

+ 1 - 1
service-eg/service-eg-biz/src/main/java/com/usky/eg/service/EgDeviceService.java

@@ -33,5 +33,5 @@ public interface EgDeviceService extends CrudService<EgDevice> {
 
     boolean checkDeviceNameUnique(EgDevice egDevice);
 
-    Map<String,Object> control(String productCode, String deviceUuid, String commandCode, String commandValue, String domain, Long userId, String userName);
+    Map<String,Object> control(String productCode, String deviceUuid, String commandCode, String commandValue, String domain, Long userId, String userName, Integer categoryType, String gatewayUuid);
 }

+ 7 - 2
service-eg/service-eg-biz/src/main/java/com/usky/eg/service/impl/EgDeviceServiceImpl.java

@@ -250,7 +250,7 @@ public class EgDeviceServiceImpl extends AbstractCrudService<EgDeviceMapper, EgD
     }
 
     @Override
-    public Map<String,Object> control(String productCode, String deviceUuid, String commandCode, String commandValue, String domain, Long userId, String userName){
+    public Map<String,Object> control(String productCode, String deviceUuid, String commandCode, String commandValue, String domain, Long userId, String userName, Integer categoryType, String gatewayUuid){
         Integer tenantId;
         long commandUserId;
         String commandUserName;
@@ -290,11 +290,16 @@ public class EgDeviceServiceImpl extends AbstractCrudService<EgDeviceMapper, EgD
 
         Map<String,Object> map = new HashMap<>();
         map.put("method","control");
+        map.put("deviceUuid", deviceUuid);
         Map<String,Object> map1 = new HashMap<>();
         map1.put("commandCode",commandCode);
         map1.put("commandValue",commandValue);
         map.put("params",map1);
 
-        return remoteTransferService.deviceControl(productCode,deviceUuid, JSON.toJSONString(map),tenantId,commandUserId,commandUserName);
+        if(categoryType == 3){
+            return remoteTransferService.deviceControl(productCode, gatewayUuid, JSON.toJSONString(map), tenantId, commandUserId, commandUserName);
+        }else{
+            return remoteTransferService.deviceControl(productCode, deviceUuid, JSON.toJSONString(map), tenantId, commandUserId, commandUserName);
+        }
     }
 }

+ 4 - 2
service-iot/service-iot-biz/src/main/java/com/usky/iot/controller/web/DeviceHttpController.java

@@ -68,8 +68,10 @@ public class DeviceHttpController {
                                                  @RequestParam("commandValue") String commandValue,
                                                  @RequestParam(value = "domain",required = false) String domain,
                                                  @RequestParam(value = "userId",required = false) Long userId,
-                                                 @RequestParam(value = "userName",required = false) String userName){
-        return ApiResult.success(dmpDeviceInfoService.control(productCode,deviceUuid,commandCode,commandValue,domain,userId,userName));
+                                                 @RequestParam(value = "userName",required = false) String userName,
+                                                 @RequestParam(value = "categoryType") Integer categoryType,
+                                                 @RequestParam(value = "gatewayUuid",required = false) String gatewayUuid){
+        return ApiResult.success(dmpDeviceInfoService.control(productCode,deviceUuid,commandCode,commandValue,domain,userId,userName,categoryType,gatewayUuid));
     }
 
 

+ 1 - 1
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/DmpDeviceInfoService.java

@@ -76,7 +76,7 @@ public interface DmpDeviceInfoService extends CrudService<DmpDeviceInfo> {
     List<DataAverageResponseVO> deviceDataAverage(DataAverageRequestVO requestVO);
     List<DataAverageExportVO> DataAverageExport(DataAverageRequestVO requestVO);
 
-    Map<String,Object> control(String productCode, String deviceUuid, String commandCode, String commandValue, String domain, Long userId, String userName);
+    Map<String,Object> control(String productCode, String deviceUuid, String commandCode, String commandValue, String domain, Long userId, String userName, Integer categoryType, String gatewayUuid);
 
     /**
      * @description: 获取设备topic列表

+ 8 - 2
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/DmpDeviceInfoServiceImpl.java

@@ -105,7 +105,7 @@ public class DmpDeviceInfoServiceImpl extends AbstractCrudService<DmpDeviceInfoM
 
 
     @Override
-    public Map<String, Object> control(String productCode, String deviceUuid, String commandCode, String commandValue, String domain, Long userId, String userName) {
+    public Map<String, Object> control(String productCode, String deviceUuid, String commandCode, String commandValue, String domain, Long userId, String userName, Integer categoryType, String gatewayUuid) {
         Integer tenantId;
         long commandUserId;
         String commandUserName;
@@ -146,12 +146,18 @@ public class DmpDeviceInfoServiceImpl extends AbstractCrudService<DmpDeviceInfoM
 
         Map<String, Object> map = new HashMap<>();
         map.put("method", "control");
+        map.put("deviceUuid", deviceUuid);
         Map<String, Object> map1 = new HashMap<>();
         map1.put("commandCode", commandCode);
         map1.put("commandValue", commandValue);
         map.put("params", map1);
 
-        return remoteTransferService.deviceControl(productCode, deviceUuid, JSON.toJSONString(map), tenantId, commandUserId, commandUserName);
+        if(categoryType == 3){
+            return remoteTransferService.deviceControl(productCode, gatewayUuid, JSON.toJSONString(map), tenantId, commandUserId, commandUserName);
+        }else{
+            return remoteTransferService.deviceControl(productCode, deviceUuid, JSON.toJSONString(map), tenantId, commandUserId, commandUserName);
+        }
+
     }
 
     @Override