Jelajahi Sumber

联调内容修改

learshaw 6 bulan lalu
induk
melakukan
80e455fbd4

+ 3 - 1
ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/TaskExecutor.java

@@ -22,6 +22,7 @@ import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.concurrent.CompletableFuture;
 
 /**
  * 任务调度
@@ -67,7 +68,8 @@ public class TaskExecutor {
      * 定时刷新设备在线状态
      */
     @Scheduled(cron = "0 0/5 * * * ?")
-    public void refreshOnline() {
+    public void refresh5min() {
+        CompletableFuture.runAsync(() -> squareLightCtlHandler.execSyncDevAttrAll());
         inDoorEnergyHandler.refreshOnline();
         squareLightCtlHandler.refreshOnline();
     }

+ 1 - 1
ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/core/Acrel3000Template.java

@@ -171,7 +171,7 @@ public class Acrel3000Template extends BaseApiTemplate {
             // 执行调用
             Call<String> call = api.getStationTreeList(getAuthToken(), fields);
             Response<String> response = call.execute();
-            log.debug("getStationTreeList response:{}", response);
+            log.debug("getStationTreeList response:{}", response.body());
 
             JSONObject resJson = JSONObject.parseObject(response.body());
             Assert.isTrue(StringUtils.equals(resJson.getString("code"), "200"), resJson.getInteger("code"),

+ 3 - 15
ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/core/SquareLightCtlTemplate.java

@@ -13,7 +13,6 @@ package com.ruoyi.ems.core;
 import com.alibaba.fastjson.support.retrofit.Retrofit2ConverterFactory;
 import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSONObject;
-import com.huashe.common.domain.JsonEntity;
 import com.huashe.common.exception.Assert;
 import com.ruoyi.common.core.utils.SpringUtils;
 import com.ruoyi.ems.config.SquareLightCtlConfig;
@@ -273,26 +272,15 @@ public class SquareLightCtlTemplate extends BaseApiTemplate {
             Assert.notEmpty(token, -1, "获取Token失败");
             token = "Bearer " + token;
 
-            JsonEntity<JSONObject> syncBody = JsonEntity.objBuilder().addKeyArray("idList", deviceId).build();
-
             // 执行调用
-            builder.addCallParam("syncStatus req", syncBody.getJsonObj().toString());
-            Call<String> call = api.syncStatus(config.getClientId(), projectId, token, syncBody.getJsonObj());
+            builder.addCallParam("projectId", projectId);
+            Call<String> call = api.getDeviceInfo(config.getClientId(), projectId, token, deviceId);
             Response<String> response = call.execute();
             String resBody = response.body();
-            log.debug("syncStatus response:{}", resBody);
-            builder.appendResPayload(String.format("syncStatus response: %s%s", resBody, System.lineSeparator()));
-            Assert.notNull(resBody, -1, "同步状态响应失败.");
-
-            builder.addCallParam("projectId", projectId);
-            call = api.getDeviceInfo(config.getClientId(), projectId, token, deviceId);
-            response = call.execute();
-            resBody = response.body();
             log.debug("getDeviceInfo response:{}", resBody);
             builder.appendResPayload(String.format("getDeviceInfo response: %s%s", resBody, System.lineSeparator()));
-            Assert.notEmpty(resBody, -1, "获取同步状态响应失败");
             SlcResponse slcRes = JSON.parseObject(resBody, SlcResponse.class);
-            Assert.notNull(slcRes, -1, "解析同步状态响应失败.");
+            Assert.notNull(slcRes, -1, "解析设备状态响应失败.");
             Assert.isTrue(200 == slcRes.getCode(), -1, slcRes.getMsg());
             String data = slcRes.getData();
             DeviceInfo deviceInfo = JSON.parseObject(data, DeviceInfo.class);

+ 46 - 27
ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/handle/SquareLightCtlHandler.java

@@ -50,6 +50,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.CompletableFuture;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 
@@ -158,7 +159,10 @@ public class SquareLightCtlHandler extends BaseMeterDevHandler {
                         execGetProjectSubsetList();
                         break;
                     case "GetDeviceList":
-                        execGetDeviceList();
+                        CompletableFuture.runAsync(this::execGetDeviceList);
+                        break;
+                    case "SyncDevAttrAll":
+                        CompletableFuture.runAsync(this::execSyncDevAttrAll);
                         break;
                     case "lightControlAll":
                         lightControlAll(abilityParam.getAbilityParam());
@@ -173,9 +177,6 @@ public class SquareLightCtlHandler extends BaseMeterDevHandler {
                     case "lightControlAll":
                         lampPostLightControl(abilityParam.getObjCode(), abilityParam.getAbilityParam());
                         break;
-                    //                    case "lightControlBrightness":
-                    //                        lampPostLightControlBrightness(abilityParam.getObjCode(), abilityParam.getAbilityParam());
-                    //                        break;
                     default:
                         throw new UnsupportedOperationException("不支持的abilityKey");
                 }
@@ -186,6 +187,9 @@ public class SquareLightCtlHandler extends BaseMeterDevHandler {
                     case "lightControl":
                         lightControl(abilityParam.getObjCode(), abilityParam.getAbilityParam());
                         break;
+                    case "SyncDevAttr":
+                        execSyncDevAttr(abilityParam.getObjCode());
+                        break;
                     case "lightControlBrightness":
                         lightControlBrightness(abilityParam.getObjCode(), abilityParam.getAbilityParam());
                         break;
@@ -204,6 +208,36 @@ public class SquareLightCtlHandler extends BaseMeterDevHandler {
         return callResponse;
     }
 
+    public void execSyncDevAttrAll() {
+        SquareLightCtlTemplate template = new SquareLightCtlTemplate(config.getUrl());
+        CallData<SlcProject> projecCallData = template.getProjectList();
+        List<SlcProject> projects = projecCallData.getList();
+
+        if (CollectionUtils.isNotEmpty(projects)) {
+            for (SlcProject project : projects) {
+                CallData<SlcDevice> callData = template.getDeviceList(project.getProjectId(), null);
+
+                // 灯组设备同步
+                List<SlcDevice> lightDevs = callData.getList().stream()
+                    .filter(dev -> StringUtils.equals(dev.getDeviceModelId(), "1945454135655632897"))
+                    .collect(Collectors.toList());
+                mergeLightDevAttrs(project.getProjectId(), lightDevs);
+
+                // 集中器设备同步
+                List<SlcDevice> centDevs = callData.getList().stream()
+                    .filter(dev -> StringUtils.equals(dev.getDeviceModelId(), "1943504597877362689"))
+                    .collect(Collectors.toList());
+                mergeCentDevAttrValue(project.getProjectId(), centDevs);
+            }
+        }
+    }
+
+    public void execSyncDevAttr(String objCode) {
+        EmsObjAttrValue proAttr = objAttrValueService.selectObjAttrValue(DEV_MODE_CODE, objCode, "projectId");
+        SquareLightCtlTemplate template = new SquareLightCtlTemplate(config.getUrl());
+        mergeLightDevAttr(template, proAttr.getAttrValue(), objCode, null);
+    }
+
     public void execGetProjectList() {
         SquareLightCtlTemplate template = new SquareLightCtlTemplate(config.getUrl());
         CallData<SlcProject> callData = template.getProjectList();
@@ -272,16 +306,8 @@ public class SquareLightCtlHandler extends BaseMeterDevHandler {
                 .putKv("lampOnOff", paramValue).putKv("brightness", 0);
             json.addKeyArray("lampList", lampListObj.build().getJsonObj());
 
-            SquareLightCtlTemplate template = new SquareLightCtlTemplate(config.getUrl());
-
             // 下发执行命令
-            lightControl(template, projectIdAttr.getAttrValue(), json.build().getJsonObj());
-
-            // 刷新属性
-            lights.forEach(item -> {
-                JSONObject object = (JSONObject) item;
-                mergeLightDevAttr(template, projectIdAttr.getAttrValue(), object.getString("deviceCode"), null);
-            });
+            lightControl(projectIdAttr.getAttrValue(), json.build().getJsonObj());
         }
     }
 
@@ -309,19 +335,15 @@ public class SquareLightCtlHandler extends BaseMeterDevHandler {
             json.addKeyArray("lampList", lampListObj.build().getJsonObj());
         }
 
-        SquareLightCtlTemplate template = new SquareLightCtlTemplate(config.getUrl());
-
         // 下发执行命令
-        lightControl(template, projectIdAttr.getAttrValue(), json.build().getJsonObj());
-
-        // 刷新属性
-        mergeLightDevAttr(template, projectIdAttr.getAttrValue(), deviceIdAttr.getAttrValue(), null);
+        lightControl(projectIdAttr.getAttrValue(), json.build().getJsonObj());
     }
 
     /**
      * 灯组开关控制
      */
-    public void lightControl(SquareLightCtlTemplate template, String projectId, JSONObject req) {
+    public void lightControl(String projectId, JSONObject req) {
+        SquareLightCtlTemplate template = new SquareLightCtlTemplate(config.getUrl());
         CallData<Void> callData = template.lightControl(projectId, req);
         saveCallLog(SUBSYSTEM_CODE, SYS_MODE_CODE, "lightControl", callData.getCallStatus(), callData.getCallPayload(),
             callData.getResPayload());
@@ -351,19 +373,15 @@ public class SquareLightCtlHandler extends BaseMeterDevHandler {
             json.addKeyArray("lampList", lampListObj.build().getJsonObj());
         }
 
-        SquareLightCtlTemplate template = new SquareLightCtlTemplate(config.getUrl());
-
         // 下发控制命令
-        lightControlBrightness(template, projectIdAttr.getAttrValue(), json.build().getJsonObj());
-
-        // 刷新属性
-        mergeLightDevAttr(template, projectIdAttr.getAttrValue(), deviceIdAttr.getAttrValue(), null);
+        lightControlBrightness(projectIdAttr.getAttrValue(), json.build().getJsonObj());
     }
 
     /**
      * 灯组亮度控制
      */
-    public void lightControlBrightness(SquareLightCtlTemplate template, String projectId, JSONObject req) {
+    public void lightControlBrightness(String projectId, JSONObject req) {
+        SquareLightCtlTemplate template = new SquareLightCtlTemplate(config.getUrl());
         CallData<Void> callData = template.controlBrightness(projectId, req);
         saveCallLog(SUBSYSTEM_CODE, SYS_MODE_CODE, "lightControlBrightness", callData.getCallStatus(),
             callData.getCallPayload(), callData.getResPayload());
@@ -613,6 +631,7 @@ public class SquareLightCtlHandler extends BaseMeterDevHandler {
             oaValues.add(new EmsObjAttrValue(deviceId, DEV_MODE_CODE, "deviceId", deviceId));
 
             if (null != slcDevice) {
+                oaValues.add(new EmsObjAttrValue(deviceId, DEV_MODE_CODE, "deviceName", slcDevice.getDeviceName()));
                 oaValues.add(new EmsObjAttrValue(deviceId, DEV_MODE_CODE, "imageUrl", slcDevice.getImageUrl()));
                 oaValues.add(
                     new EmsObjAttrValue(deviceId, DEV_MODE_CODE, "abnormal", String.valueOf(slcDevice.getAbnormal())));

+ 3 - 3
ems/ems-cloud/ems-dev-adapter/src/main/resources/application-local.yml

@@ -57,10 +57,10 @@ mqtt:
 adapter:
   # 安科瑞
   acrel:
-    url: http://116.236.149.165:8092
+    url: http://127.0.0.1:8090
     auth:
-      loginName: guest
-      password: 123456
+      loginName: admin
+      password: Acrel001
   # 室内能耗
   id-energy:
     url: http://127.0.0.1:8093

+ 3 - 3
ems/ems-cloud/ems-dev-adapter/src/main/resources/application-prod-ct.yml

@@ -57,10 +57,10 @@ mqtt:
 adapter:
   # 安科瑞
   acrel:
-    url: http://172.61.55.66:8092
+    url: http://172.61.55.66:8090
     auth:
-      loginName: guest
-      password: 123456
+      loginName: admin
+      password: Acrel001
   # 室内能耗
   id-energy:
     url: http://172.17.50.186:80

+ 1 - 1
ems/ems-cloud/ems-dev-adapter/src/test/java/com/huashe/test/Acrel3000Test.java

@@ -36,7 +36,7 @@ import java.util.List;
 import java.util.concurrent.TimeUnit;
 
 /**
- * 高德 - 拥堵接口测试
+ * 安科瑞 - 3000 接口测试
  * <功能详细描述>
  *
  * @author learshaw

+ 35 - 7
ems/sql/ems_init_data.sql

@@ -30,7 +30,8 @@ INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `s
 INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S30010101', '321283124S300101', '0,321283124S3001,321283124S300101', '一楼', '一楼', '综合楼一楼', 1, 0);
 INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S30010102', '321283124S300101', '0,321283124S3001,321283124S300101', '商铺', '商铺', '综合楼商铺', 2, 0);
 INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S30010103', '321283124S300101', '0,321283124S3001,321283124S300101', '厨房', '厨房', '综合楼厨房', 3, 0);
-INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S30010104', '321283124S300101', '0,321283124S3001,321283124S300101', '二楼', '二楼', '综合楼厨房', 4, 0);
+INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S30010104', '321283124S300101', '0,321283124S3001,321283124S300101', '二楼', '二楼', '综合楼二楼', 4, 0);
+INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S30010105', '321283124S300101', '0,321283124S3001,321283124S300101', '公共', '公共', '综合楼公共', 5, 0);
 INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('B-10101', '321283124S30010101', '0,321283124S3001,321283124S300101,321283124S30010101', '卫生间', '卫生间', '卫生间', 1, 0);
 INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('B-10102', '321283124S30010101', '0,321283124S3001,321283124S300101,321283124S30010101', '开水间', '开水间', '开水间', 2, 0);
 INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('B-10103', '321283124S30010101', '0,321283124S3001,321283124S300101,321283124S30010101', '货车服务空间', '货车服务空间', '货车服务空间', 3, 0);
@@ -51,7 +52,8 @@ INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `s
 INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S30020101', '321283124S300201', '0,321283124S3002,321283124S300201', '一楼', '一楼', '综合楼一楼', 1, 0);
 INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S30020102', '321283124S300201', '0,321283124S3002,321283124S300201', '商铺', '商铺', '综合楼商铺', 2, 0);
 INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S30020103', '321283124S300201', '0,321283124S3002,321283124S300201', '厨房', '厨房', '综合楼厨房', 3, 0);
-INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S30020104', '321283124S300201', '0,321283124S3002,321283124S300201', '二楼', '二楼', '综合楼厨房', 4, 0);
+INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S30020104', '321283124S300201', '0,321283124S3002,321283124S300201', '二楼', '二楼', '综合楼二楼', 4, 0);
+INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S30020105', '321283124S300201', '0,321283124S3002,321283124S300201', '公共', '公共', '综合楼公共', 5, 0);
 INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('N-10101', '321283124S30020101', '0,321283124S3002,321283124S300201,321283124S30020101', '卫生间', '卫生间', '卫生间', 1, 0);
 INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('N-10102', '321283124S30020101', '0,321283124S3002,321283124S300201,321283124S30020101', '开水间', '开水间', '开水间', 2, 0);
 INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('N-10103', '321283124S30020101', '0,321283124S3002,321283124S300201,321283124S30020101', '货车服务空间', '货车服务空间', '货车服务空间', 3, 0);
@@ -100,6 +102,7 @@ INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phon
 INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S30020102', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', NULL, NULL, 1, 120.050937, 32.071956);
 INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S30020103', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', NULL, NULL, 1, 120.050937, 32.071956);
 INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S30020104', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', NULL, NULL, 1, 120.050937, 32.071956);
+INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S30020105', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', NULL, NULL, 1, 120.050937, 32.071956);
 INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('N-10101', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', NULL, NULL, 1, 120.050937, 32.071956);
 INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('N-10102', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', NULL, NULL, 1, 120.050937, 32.071956);
 INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('N-10103', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', NULL, NULL, 1, 120.050937, 32.071956);
@@ -121,6 +124,7 @@ INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phon
 INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S30010102', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', NULL, NULL, 1, 120.050937, 32.071956);
 INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S30010103', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', NULL, NULL, 1, 120.050937, 32.071956);
 INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S30010104', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', NULL, NULL, 1, 120.050937, 32.071956);
+INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S30010105', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', NULL, NULL, 1, 120.050937, 32.071956);
 INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('B-10101', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', NULL, NULL, 1, 120.050937, 32.071956);
 INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('B-10102', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', NULL, NULL, 1, 120.050937, 32.071956);
 INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('B-10103', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', NULL, NULL, 1, 120.050937, 32.071956);
@@ -278,6 +282,7 @@ INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_na
 INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_Z010_DEV_SQUARE_LAMP_POST', 'Base', 'subDev', '灯组列表', NULL, 'String');
 
 INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_Z010_DEV_SQUARE_LIGHT', 'Base', 'projectId', '项目ID', NULL, 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_Z010_DEV_SQUARE_LIGHT', 'Base', 'deviceName', '设备名称', NULL, 'String');
 INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_Z010_DEV_SQUARE_LIGHT', 'Base', 'deviceId', '控制器ID', NULL, 'String');
 INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_Z010_DEV_SQUARE_LIGHT', 'Base', 'deviceUid', '控制器sn号', NULL, 'String');
 INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_Z010_DEV_SQUARE_LIGHT', 'Base', 'deviceModelId', '设备型号id', NULL, 'String');
@@ -399,11 +404,12 @@ INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`,
 INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_Z010_SYS_SQUARE_LIGHT', 'GetProjectList', '同步项目列表', '同步项目列表', null, 1);
 INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_Z010_SYS_SQUARE_LIGHT', 'GetProjectSubsetList', '同步项目分组列表', '同步项目分组列表', null, 1);
 INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_Z010_SYS_SQUARE_LIGHT', 'GetDeviceList', '同步设备列表', '同步设备列表', null, 1);
+INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_Z010_SYS_SQUARE_LIGHT', 'SyncDevAttrAll', '全量刷新状态', '全量刷新状态', null, 1);
 INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_Z010_SYS_SQUARE_LIGHT', 'lightControlAll', '全量开关', '全量开关', '{"type":"Options", "list":[{"key":"全部开灯", "value":"1"},{"key":"全部关灯", "value":"0"}]}', 1);
 INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_Z010_DEV_SQUARE_LAMP_POST', 'lightControlAll', '全量开关', '全量开关', '{"type":"Options", "list":[{"key":"全部开灯", "value":"1"},{"key":"全部关灯", "value":"0"}]}', 1);
 INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_Z010_DEV_SQUARE_LIGHT', 'lightControl', '照明开关', '照明开关', '{"type":"Options", "list":[{"key":"开灯", "value":"1"},{"key":"关灯", "value":"0"}]}', 1);
 INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_Z010_DEV_SQUARE_LIGHT', 'lightControlBrightness', '亮度设置', '亮度设置', '{"type":"Slider", "min":0, "max":100}', 1);
-
+INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_Z010_DEV_SQUARE_LIGHT', 'SyncDevAttr', '刷新状态', '全量灯组状态', null, 1);
 
 -- 对象事件数据
 INSERT INTO `adm_ems_obj_event` (`model_code`, `event_key`, `event_type`, `event_name`, `event_desc`, `event_code`, `ext_event_code`) VALUES ('M_W4_SYS_IN_DOOR', 'connect', 1, '连接恢复', '连接正常', 'M_W4_SYS_IN_DOOR_00', NULL);
@@ -605,7 +611,7 @@ INSERT INTO `adm_meter_device` (`area_code`, `device_code`, `device_model`, `dev
 INSERT INTO `adm_meter_device` (`area_code`, `device_code`, `device_model`, `device_name`, `device_enable`, `location_ref`, `location`, `meter_cls`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('321283124S3002', 'C_1007_AV_0000','M_W4_SM_INDOOR_ENERGY', '南区宿舍ALZ', 1,   '321283124S300203', '一楼强电间',   45, 300, 0, 1, null);
 INSERT INTO `adm_meter_device` (`area_code`, `device_code`, `device_model`, `device_name`, `device_enable`, `location_ref`, `location`, `meter_cls`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('321283124S3002', 'C_1007_AV_0200','M_W4_SM_INDOOR_ENERGY', '南区宿舍ALE', 1,   '321283124S300203', '一楼强电间',   45, 300, 0, 1, null);
 -- 南区水
--- 综合楼水
+-- 综合楼水
 INSERT INTO `adm_meter_device` (`area_code`, `device_code`, `device_model`, `device_name`, `device_enable`, `location_ref`, `location`, `meter_cls`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('321283124S3002', 'C_1004_AV_0000','M_W4_SM_INDOOR_ENERGY', '货车服务空间', 1, '321283124S30020101', '货车服务空间',   70, 300, 0, 1, null);
 INSERT INTO `adm_meter_device` (`area_code`, `device_code`, `device_model`, `device_name`, `device_enable`, `location_ref`, `location`, `meter_cls`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('321283124S3002', 'C_1004_AV_0001','M_W4_SM_INDOOR_ENERGY', '沪上阿姨', 1,    '321283124S30020102', '沪上阿姨',      70, 300, 0, 1, null);
 INSERT INTO `adm_meter_device` (`area_code`, `device_code`, `device_model`, `device_name`, `device_enable`, `location_ref`, `location`, `meter_cls`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('321283124S3002', 'C_1004_AV_0002','M_W4_SM_INDOOR_ENERGY', '微团生活馆', 1,   '321283124S30020102', '微团生活馆',    70, 300, 0, 1, null);
@@ -622,6 +628,7 @@ INSERT INTO `adm_meter_device` (`area_code`, `device_code`, `device_model`, `dev
 INSERT INTO `adm_meter_device` (`area_code`, `device_code`, `device_model`, `device_name`, `device_enable`, `location_ref`, `location`, `meter_cls`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('321283124S3002', 'C_1004_AV_0200','M_W4_SM_INDOOR_ENERGY', '二楼', 1,       '321283124S30020104', '二楼',     70, 300, 0, 1, null);
 -- 司机之家水
 INSERT INTO `adm_meter_device` (`area_code`, `device_code`, `device_model`, `device_name`, `device_enable`, `location_ref`, `location`, `meter_cls`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('321283124S3002', 'C_1005_AV_0600','M_W4_SM_INDOOR_ENERGY', '司机之家水表', 1, '321283124S300202', '司机之家',   70, 300, 0, 1, null);
+
 -- 测试
 INSERT INTO `adm_meter_device` (`area_code`, `device_code`, `device_model`, `device_name`, `device_enable`, `location_ref`, `location`, `meter_cls`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('321283124S3001', '864142073640059', 'M_W2_QF_GEEKOPEN', '智能断路器', 1, '321283124S300101', '综合楼C3-茶水间', 45, 3600, 0, 1, '智能表');
 INSERT INTO `adm_meter_device` (`area_code`, `device_code`, `device_model`, `device_name`, `device_enable`, `location_ref`, `location`, `meter_cls`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('321283124S3001', 'J-E-B-101', 'test', '综合楼B-101', 1, '321283124S300101', '一楼设备间', 45, NULL, 1, 1, '智能表');
@@ -652,6 +659,17 @@ INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `
 INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30010104', 45, 'C_2003_AV_0601');
 INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30010104', 45, 'C_2003_AV_0603');
 INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30010104', 45, 'C_2003_AV_0604');
+INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30010105', 45, 'C_2003_AV_0222');
+INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30010105', 45, 'C_2003_AV_0230');
+INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30010105', 45, 'C_2003_AV_0254');
+INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30010105', 45, 'C_2003_AV_0262');
+INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30010105', 45, 'C_2003_AV_0270');
+INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30010105', 45, 'C_2003_AV_0286');
+INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30010105', 45, 'C_2003_AV_0302');
+INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30010105', 45, 'C_2003_AV_0326');
+INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30010105', 45, 'C_2003_AV_0334');
+INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30010105', 45, 'C_2003_AV_0342');
+INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30010105', 45, 'C_2003_AV_0350');
 INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S300102', 45, 'C_2005_AV_0200');
 INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S300102', 45, 'C_2005_AV_0201');
 INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S300102', 45, 'C_2005_AV_0400');
@@ -696,6 +714,19 @@ INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `
 INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30020104', 45, 'C_1003_AV_0602');
 INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30020104', 45, 'C_1003_AV_0603');
 INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30020104', 45, 'C_1003_AV_0604');
+
+INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30020105', 45, 'C_1003_AV_0222');
+INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30020105', 45, 'C_1003_AV_0230');
+INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30020105', 45, 'C_1003_AV_0254');
+INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30020105', 45, 'C_1003_AV_0262');
+INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30020105', 45, 'C_1003_AV_0270');
+INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30020105', 45, 'C_1003_AV_0286');
+INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30020105', 45, 'C_1003_AV_0302');
+INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30020105', 45, 'C_1003_AV_0326');
+INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30020105', 45, 'C_1003_AV_0334');
+INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30020105', 45, 'C_1003_AV_0342');
+INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S30020105', 45, 'C_1003_AV_0350');
+
 INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S300202', 45, 'C_1005_AV_0000');
 INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S300202', 45, 'C_1005_AV_0200');
 INSERT INTO `adm_meter_boundary_rel` (`obj_type`, `boundary_obj`, `meter_cls`, `meter_device`) VALUES (1, '321283124S300202', 45, 'C_1005_AV_0201');
@@ -957,12 +988,9 @@ INSERT INTO `adm_ems_subsystem` (`system_code`, `system_name`, `short_name`, `mo
 INSERT INTO `adm_ems_subsystem` (`system_code`, `system_name`, `short_name`, `model_code`, `man_facturer`, `contact_person`, `contact_number`, `maintainer_person`, `maintainer_number`, `descr`) VALUES ('SYS_CD', '充电桩系统', '充电桩', 'M_TEST', '特来电', '张三', '1212121121', '刘工', '1212221111', NULL);
 INSERT INTO `adm_ems_subsystem` (`system_code`, `system_name`, `short_name`, `model_code`, `man_facturer`, `contact_person`, `contact_number`, `maintainer_person`, `maintainer_number`, `descr`) VALUES ('SYS_GCC', '光储充系统', '光储充', 'M_TEST', '光储充厂商', '张三', '1212121121', '刘工', '1212221111', NULL);
 INSERT INTO `adm_ems_subsystem` (`system_code`, `system_name`, `short_name`, `model_code`, `man_facturer`, `contact_person`, `contact_number`, `maintainer_person`, `maintainer_number`, `descr`) VALUES ('SYS_GCZR', '光储直柔系统', '光储直柔', 'M_TEST', '光储直柔厂商', '张三', '1212121121', '刘工', '1212221111', NULL);
-INSERT INTO `adm_ems_subsystem` (`system_code`, `system_name`, `short_name`, `model_code`, `man_facturer`, `contact_person`, `contact_number`, `maintainer_person`, `maintainer_number`, `descr`) VALUES ('SYS_Charge', '充电桩系统', '充电桩', 'M_TEST', '充电桩厂商', '张三', '1212121121', '刘工', '1212221111', NULL);
 INSERT INTO `adm_ems_subsystem` (`system_code`, `system_name`, `short_name`, `model_code`, `man_facturer`, `contact_person`, `contact_number`, `maintainer_person`, `maintainer_number`, `descr`) VALUES ('SYS_ZHHM', '智慧海绵系统', '智慧海绵', 'M_TEST', '智慧海绵厂商', '张三', '1212121121', '刘工', '1212221111', NULL);
 INSERT INTO `adm_ems_subsystem` (`system_code`, `system_name`, `short_name`, `model_code`, `man_facturer`, `contact_person`, `contact_number`, `maintainer_person`, `maintainer_number`, `descr`) VALUES ('SYS_LG', '垃圾厨余系统', '垃圾厨余', 'M_TEST', '垃圾厨余厂商', '张三', '1212121121', '刘工', '1212221111', NULL);
 
-
-
 -- 台账数据
 INSERT INTO `adm_ems_device_rbook` (`record_code`, `area_code`, `obj_type`, `obj_code`, `obj_name`, `record_time`, `ins_location`, `maintain_title`, `maintain_content`, `maintain_person`) VALUES ('TZ-20240901001', '321283124S3001', 1, 'W201', '北区-电网', '2024-09-01 10:32:00', '北区-广场', '北区广场变压器维护', '执行例行维护', '李大航');
 INSERT INTO `adm_ems_device_rbook` (`record_code`, `area_code`, `obj_type`, `obj_code`, `obj_name`, `record_time`, `ins_location`, `maintain_title`, `maintain_content`, `maintain_person`) VALUES ('TZ-20240901002', '321283124S3001', 2, 'Z010-R101-001', '北区-开水炉', '2024-09-10 17:34:56', '北区/综合楼/一楼开水间', '开水炉除垢', '执行开水炉除垢', '王凯');

+ 1 - 1
ems/sql/ems_server.sql

@@ -651,7 +651,7 @@ create table adm_meter_device  (
 drop table if exists adm_meter_boundary_rel;
 create table adm_meter_boundary_rel  (
   `id`              bigint(20)      not null auto_increment      comment '序号',
-  `obj_type`        int             not null                     comment '对象类型',
+  `obj_type`        int             not null                     comment '对象类型 1-区域,2-设施',
   `boundary_obj`    varchar(64)     not null                     comment '边界对象',
   `meter_cls`       int             not null                     comment '计量介质',
   `meter_device`    varchar(64)     not null                     comment '计量设备',

+ 0 - 1
ems/sql/ems_sys_data.sql

@@ -81,7 +81,6 @@ insert into sys_menu values ('178',  '日志管理',       '7',   '9',  'log',
 insert into sys_menu values ('179',  '在线用户',       '7',   '10', 'online',             'monitor/online/index',   '', 1, 0, 'C', '0', '0',   'monitor:online:list',    'online',         'admin', sysdate(), '', null, '在线用户菜单');
 INSERT INTO sys_menu VALUES ('180',  '任务调度',       '7',   '10', 'task/job',           'monitor/job/index',      '', 1, 0, 'C', '0', '0',   'monitor:job',            'date-range',     'admin', sysdate(), '', NULL, '任务调度');
 
-insert into sys_menu values ('1550',  '系统信息',       '155',   '1',  'adapter-subsystem',  'adapter/subsystem/index',  '', 1, 0, 'C', '0', '0',   'adapter:subsystem:list',  'note',           'admin', sysdate(), '', null, '系统信息');
 insert into sys_menu values ('1551',  '能耗监测',       '155',   '2',  'adapter-nhjc',       'adapter/nhjc/index',    '', 1, 0, 'C', '0', '0',   'adapter:notice:list',     'system',      'admin', sysdate(), '', null, '能耗监测');
 insert into sys_menu values ('1552',  '智慧照明',       '155',   '3',  'adapter-zm',         'adapter/zm/index',      '', 1, 0, 'C', '0', '0',   'adapter:post:list',       'system',        'admin', sysdate(), '', null, '智慧照明');
 insert into sys_menu values ('1553',  '光伏',          '155',   '4',  'adapter-pv',         'adapter/pv/index',      '', 1, 0, 'C', '0', '0',   'adapter:user:list',       'photovoltaic',        'admin', sysdate(), '', null, '光伏');