Browse Source

室内监控模型变更

learshaw 5 months ago
parent
commit
c65fa6a3a0

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

@@ -12,8 +12,8 @@ package com.ruoyi.ems;
 
 
 import com.ruoyi.ems.core.ObjectCache;
 import com.ruoyi.ems.core.ObjectCache;
 import com.ruoyi.ems.handle.AcrelElecMonitorHandler;
 import com.ruoyi.ems.handle.AcrelElecMonitorHandler;
+import com.ruoyi.ems.handle.BaCtlHandler;
 import com.ruoyi.ems.handle.GeekOpenCbHandler;
 import com.ruoyi.ems.handle.GeekOpenCbHandler;
-import com.ruoyi.ems.handle.InDoorEnergyHandler;
 import com.ruoyi.ems.handle.SquareLightCtlHandler;
 import com.ruoyi.ems.handle.SquareLightCtlHandler;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
@@ -48,9 +48,9 @@ public class TaskExecutor {
     @Resource
     @Resource
     private GeekOpenCbHandler geekOpenCbHandler;
     private GeekOpenCbHandler geekOpenCbHandler;
 
 
-    @Qualifier("inDoorEnergyHandler")
+    @Qualifier("baCtlHandler")
     @Resource
     @Resource
-    private InDoorEnergyHandler inDoorEnergyHandler;
+    private BaCtlHandler baCtlHandler;
 
 
     @Qualifier("squareLightCtlHandler")
     @Qualifier("squareLightCtlHandler")
     @Resource
     @Resource
@@ -76,7 +76,7 @@ public class TaskExecutor {
     public void refresh5min() {
     public void refresh5min() {
         CompletableFuture.runAsync(() -> squareLightCtlHandler.execSyncDevAttrAll());
         CompletableFuture.runAsync(() -> squareLightCtlHandler.execSyncDevAttrAll());
         CompletableFuture.runAsync(() -> acrelElecMonitorHandler.execSyncDevAttrAll());
         CompletableFuture.runAsync(() -> acrelElecMonitorHandler.execSyncDevAttrAll());
-        inDoorEnergyHandler.refreshOnline();
+        baCtlHandler.refreshOnline();
         squareLightCtlHandler.refreshOnline();
         squareLightCtlHandler.refreshOnline();
     }
     }
 
 
@@ -93,8 +93,8 @@ public class TaskExecutor {
      * 每5min采集能耗数据
      * 每5min采集能耗数据
      */
      */
     @Scheduled(cron = "0 0/15 * * * ?")
     @Scheduled(cron = "0 0/15 * * * ?")
-    public void inDoorMeterCollect() {
-        int cnt = inDoorEnergyHandler.meterCollect();
+    public void baMeterCollect() {
+        int cnt = baCtlHandler.meterCollect();
         log.debug("采集室内能耗设备计量数据: {} 条", cnt);
         log.debug("采集室内能耗设备计量数据: {} 条", cnt);
     }
     }
 
 
@@ -102,8 +102,8 @@ public class TaskExecutor {
      * 每小时产出设备计量数据
      * 每小时产出设备计量数据
      */
      */
     @Scheduled(cron = "0 0 0/1 * * ?")
     @Scheduled(cron = "0 0 0/1 * * ?")
-    public void inDoorMeterHourProd() {
-        int cnt = inDoorEnergyHandler.meterHourProd();
+    public void baMeterHourProd() {
+        int cnt = baCtlHandler.meterHourProd();
         log.debug("产出室内能耗设备计量数据: {} 条", cnt);
         log.debug("产出室内能耗设备计量数据: {} 条", cnt);
     }
     }
 }
 }

+ 2 - 2
ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/config/InDoorEnergyConfig.java → ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/config/BaCtlConfig.java

@@ -25,8 +25,8 @@ import org.springframework.context.annotation.Configuration;
  */
  */
 @Data
 @Data
 @Configuration
 @Configuration
-@ConfigurationProperties(prefix = "adapter.id-energy")
-public class InDoorEnergyConfig {
+@ConfigurationProperties(prefix = "adapter.ba-ctl")
+public class BaCtlConfig {
     private String url;
     private String url;
 
 
     private String appId;
     private String appId;

+ 12 - 12
ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/controller/InDoorEnergyController.java → ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/controller/BaCtlController.java

@@ -10,7 +10,7 @@
  */
  */
 package com.ruoyi.ems.controller;
 package com.ruoyi.ems.controller;
 
 
-import com.ruoyi.ems.handle.InDoorEnergyHandler;
+import com.ruoyi.ems.handle.BaCtlHandler;
 import com.ruoyi.ems.model.AbilityPayload;
 import com.ruoyi.ems.model.AbilityPayload;
 import com.ruoyi.ems.model.CallResponse;
 import com.ruoyi.ems.model.CallResponse;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
@@ -29,7 +29,7 @@ import org.springframework.web.bind.annotation.RestController;
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 
 
 /**
 /**
- * 室内能耗Api
+ * 楼宇采集控制Api
  * <功能详细描述>
  * <功能详细描述>
  *
  *
  * @author lvwenbin
  * @author lvwenbin
@@ -39,17 +39,17 @@ import javax.annotation.Resource;
  */
  */
 @RestController
 @RestController
 @CrossOrigin(allowedHeaders = "*", allowCredentials = "false")
 @CrossOrigin(allowedHeaders = "*", allowCredentials = "false")
-@RequestMapping("/in-door-energy")
-@Api(value = "InDoorEnergyController", description = "室内能耗Api")
-public class InDoorEnergyController {
+@RequestMapping("/ba")
+@Api(value = "InDoorEnergyController", description = "楼宇采集控制Api")
+public class BaCtlController {
     /**
     /**
      * 日志
      * 日志
      */
      */
-    private static final Logger log = LoggerFactory.getLogger(InDoorEnergyController.class);
+    private static final Logger log = LoggerFactory.getLogger(BaCtlController.class);
 
 
-    @Qualifier("inDoorEnergyHandler")
+    @Qualifier("baCtlHandler")
     @Resource
     @Resource
-    private InDoorEnergyHandler inDoorEnergyHandler;
+    private BaCtlHandler baCtlHandler;
 
 
     /**
     /**
      * 常泰室内能耗能力调用
      * 常泰室内能耗能力调用
@@ -57,18 +57,18 @@ public class InDoorEnergyController {
      * @return 数据列表
      * @return 数据列表
      */
      */
     @RequestMapping(value = "/ct/abilityCall", method = RequestMethod.POST)
     @RequestMapping(value = "/ct/abilityCall", method = RequestMethod.POST)
-    @ApiOperation(value = "/ct/abilityCall", notes = "常泰室内能耗能力调用")
+    @ApiOperation(value = "/ct/abilityCall", notes = "常泰BA能力调用")
     @ApiResponses({ @ApiResponse(code = 200, message = "success"),
     @ApiResponses({ @ApiResponse(code = 200, message = "success"),
         @ApiResponse(code = 400, message = "{code:****,message:'fail'}")
         @ApiResponse(code = 400, message = "{code:****,message:'fail'}")
     })
     })
-    public CallResponse<Void> ctIdeAbilityCall(@RequestBody AbilityPayload abilityPayload) {
+    public CallResponse<Void> ctAbilityCall(@RequestBody AbilityPayload abilityPayload) {
         CallResponse<Void> res = null;
         CallResponse<Void> res = null;
 
 
         try {
         try {
-            res = inDoorEnergyHandler.call(abilityPayload);
+            res = baCtlHandler.call(abilityPayload);
         }
         }
         catch (Exception e) {
         catch (Exception e) {
-            log.error("ctIdeAbilityCall fail!", e);
+            log.error("ctAbilityCall fail!", e);
             res = new CallResponse<>(501, "内部错误:" + e.getMessage());
             res = new CallResponse<>(501, "内部错误:" + e.getMessage());
         }
         }
 
 

+ 1 - 2
ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/controller/SquareLightCtlController.java

@@ -10,7 +10,6 @@
  */
  */
 package com.ruoyi.ems.controller;
 package com.ruoyi.ems.controller;
 
 
-import com.ruoyi.ems.handle.InDoorEnergyHandler;
 import com.ruoyi.ems.handle.SquareLightCtlHandler;
 import com.ruoyi.ems.handle.SquareLightCtlHandler;
 import com.ruoyi.ems.model.AbilityPayload;
 import com.ruoyi.ems.model.AbilityPayload;
 import com.ruoyi.ems.model.CallResponse;
 import com.ruoyi.ems.model.CallResponse;
@@ -46,7 +45,7 @@ public class SquareLightCtlController {
     /**
     /**
      * 日志
      * 日志
      */
      */
-    private static final Logger log = LoggerFactory.getLogger(InDoorEnergyController.class);
+    private static final Logger log = LoggerFactory.getLogger(BaCtlController.class);
 
 
     @Qualifier("squareLightCtlHandler")
     @Qualifier("squareLightCtlHandler")
     @Resource
     @Resource

+ 11 - 11
ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/core/InDoorEnergyTemplate.java → ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/core/BaCtlEnergyTemplate.java

@@ -15,10 +15,10 @@ import com.alibaba.fastjson.support.retrofit.Retrofit2ConverterFactory;
 import com.huashe.common.exception.Assert;
 import com.huashe.common.exception.Assert;
 import com.ruoyi.common.core.utils.SpringUtils;
 import com.ruoyi.common.core.utils.SpringUtils;
 import com.ruoyi.common.redis.service.RedisService;
 import com.ruoyi.common.redis.service.RedisService;
-import com.ruoyi.ems.config.InDoorEnergyConfig;
+import com.ruoyi.ems.config.BaCtlConfig;
 import com.ruoyi.ems.model.idenergy.CodesValReq;
 import com.ruoyi.ems.model.idenergy.CodesValReq;
 import com.ruoyi.ems.model.idenergy.Token;
 import com.ruoyi.ems.model.idenergy.Token;
-import com.ruoyi.ems.retrofit.InDoorEnergyApi;
+import com.ruoyi.ems.retrofit.BaCtlEnergyApi;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import okhttp3.OkHttpClient;
 import okhttp3.OkHttpClient;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -38,7 +38,7 @@ import java.util.concurrent.TimeUnit;
  * @since [产品/模块版本]
  * @since [产品/模块版本]
  */
  */
 @Slf4j
 @Slf4j
-public class InDoorEnergyTemplate extends BaseApiTemplate {
+public class BaCtlEnergyTemplate extends BaseApiTemplate {
     /**
     /**
      * 访问地址
      * 访问地址
      */
      */
@@ -47,15 +47,15 @@ public class InDoorEnergyTemplate extends BaseApiTemplate {
     /**
     /**
      * 调用代理
      * 调用代理
      */
      */
-    protected final InDoorEnergyApi api;
+    protected final BaCtlEnergyApi api;
 
 
-    public InDoorEnergyTemplate(String restUrl) {
+    public BaCtlEnergyTemplate(String restUrl) {
         this.url = restUrl;
         this.url = restUrl;
 
 
         OkHttpClient httpClient = getClient();
         OkHttpClient httpClient = getClient();
         Retrofit retrofit = new Retrofit.Builder().baseUrl(restUrl)
         Retrofit retrofit = new Retrofit.Builder().baseUrl(restUrl)
             .addConverterFactory(Retrofit2ConverterFactory.create()).client(httpClient).build();
             .addConverterFactory(Retrofit2ConverterFactory.create()).client(httpClient).build();
-        this.api = retrofit.create(InDoorEnergyApi.class);
+        this.api = retrofit.create(BaCtlEnergyApi.class);
     }
     }
 
 
     /**
     /**
@@ -66,7 +66,7 @@ public class InDoorEnergyTemplate extends BaseApiTemplate {
      * @param readTimeout    读取超时
      * @param readTimeout    读取超时
      * @param writeTimeout   写超时
      * @param writeTimeout   写超时
      */
      */
-    public InDoorEnergyTemplate(String restUrl, int connectTimeout, int readTimeout, int writeTimeout) {
+    public BaCtlEnergyTemplate(String restUrl, int connectTimeout, int readTimeout, int writeTimeout) {
         super.connectTimeout = connectTimeout;
         super.connectTimeout = connectTimeout;
         super.readTimeout = readTimeout;
         super.readTimeout = readTimeout;
         super.writeTimeout = writeTimeout;
         super.writeTimeout = writeTimeout;
@@ -75,7 +75,7 @@ public class InDoorEnergyTemplate extends BaseApiTemplate {
         OkHttpClient httpClient = getClient();
         OkHttpClient httpClient = getClient();
         Retrofit retrofit = new Retrofit.Builder().baseUrl(restUrl)
         Retrofit retrofit = new Retrofit.Builder().baseUrl(restUrl)
             .addConverterFactory(Retrofit2ConverterFactory.create()).client(httpClient).build();
             .addConverterFactory(Retrofit2ConverterFactory.create()).client(httpClient).build();
-        api = retrofit.create(InDoorEnergyApi.class);
+        api = retrofit.create(BaCtlEnergyApi.class);
     }
     }
 
 
     public synchronized String getToken() {
     public synchronized String getToken() {
@@ -92,7 +92,7 @@ public class InDoorEnergyTemplate extends BaseApiTemplate {
     public String getNewToken() {
     public String getNewToken() {
         RedisService redisService = SpringUtils.getBean(RedisService.class);
         RedisService redisService = SpringUtils.getBean(RedisService.class);
 
 
-        InDoorEnergyConfig config = SpringUtils.getBean(InDoorEnergyConfig.class);
+        BaCtlConfig config = SpringUtils.getBean(BaCtlConfig.class);
         Token token = getAuthToken(config.getAppId());
         Token token = getAuthToken(config.getAppId());
         log.info("getAuthToken response:{}", JSONObject.toJSONString(token));
         log.info("getAuthToken response:{}", JSONObject.toJSONString(token));
         redisService.setCacheObject("INDOOR_ENERGY_ACCESS_TOKEN", token.getAccessToken(), 5 * 60L, TimeUnit.SECONDS);
         redisService.setCacheObject("INDOOR_ENERGY_ACCESS_TOKEN", token.getAccessToken(), 5 * 60L, TimeUnit.SECONDS);
@@ -104,7 +104,7 @@ public class InDoorEnergyTemplate extends BaseApiTemplate {
     public synchronized String refreshToken() {
     public synchronized String refreshToken() {
         RedisService redisService = SpringUtils.getBean(RedisService.class);
         RedisService redisService = SpringUtils.getBean(RedisService.class);
         String refreshToken = redisService.getCacheObject("INDOOR_ENERGY_REFRESH_TOKEN");
         String refreshToken = redisService.getCacheObject("INDOOR_ENERGY_REFRESH_TOKEN");
-        InDoorEnergyConfig config = SpringUtils.getBean(InDoorEnergyConfig.class);
+        BaCtlConfig config = SpringUtils.getBean(BaCtlConfig.class);
         Token token = StringUtils.isEmpty(refreshToken) ?
         Token token = StringUtils.isEmpty(refreshToken) ?
             getAuthToken(config.getAppId()) :
             getAuthToken(config.getAppId()) :
             refreshToken(config.getAppId(), refreshToken);
             refreshToken(config.getAppId(), refreshToken);
@@ -178,7 +178,7 @@ public class InDoorEnergyTemplate extends BaseApiTemplate {
 
 
         try {
         try {
             String token = getToken();
             String token = getToken();
-            InDoorEnergyConfig config = SpringUtils.getBean(InDoorEnergyConfig.class);
+            BaCtlConfig config = SpringUtils.getBean(BaCtlConfig.class);
             // 执行调用
             // 执行调用
             Call<String> call = api.getCodesVal(config.getAppId(), token, req);
             Call<String> call = api.getCodesVal(config.getAppId(), token, req);
             Response<String> response = call.execute();
             Response<String> response = call.execute();

+ 218 - 250
ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/handle/InDoorEnergyHandler.java → ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/handle/BaCtlHandler.java

@@ -1,13 +1,14 @@
 package com.ruoyi.ems.handle;
 package com.ruoyi.ems.handle;
 
 
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson2.JSONObject;
 import com.huashe.common.exception.Assert;
 import com.huashe.common.exception.Assert;
 import com.huashe.common.exception.BusinessException;
 import com.huashe.common.exception.BusinessException;
 import com.huashe.common.utils.DateUtils;
 import com.huashe.common.utils.DateUtils;
 import com.ruoyi.common.redis.service.RedisService;
 import com.ruoyi.common.redis.service.RedisService;
-import com.ruoyi.ems.config.InDoorEnergyConfig;
-import com.ruoyi.ems.core.InDoorEnergyTemplate;
+import com.ruoyi.ems.config.BaCtlConfig;
+import com.ruoyi.ems.core.BaCtlEnergyTemplate;
 import com.ruoyi.ems.domain.ElecMeterH;
 import com.ruoyi.ems.domain.ElecMeterH;
 import com.ruoyi.ems.domain.ElecPgSupplyH;
 import com.ruoyi.ems.domain.ElecPgSupplyH;
 import com.ruoyi.ems.domain.EmsDevice;
 import com.ruoyi.ems.domain.EmsDevice;
@@ -36,6 +37,7 @@ import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.HashSet;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
@@ -45,7 +47,7 @@ import java.util.function.Function;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
 /**
 /**
- * 室内能耗对接处理
+ * BA楼控处理类
  * <功能详细描述>
  * <功能详细描述>
  *
  *
  * @author lvwenbin
  * @author lvwenbin
@@ -54,14 +56,26 @@ import java.util.stream.Collectors;
  * @since [产品/模块版本]
  * @since [产品/模块版本]
  */
  */
 @Service
 @Service
-public class InDoorEnergyHandler extends BaseMeterDevHandler {
-    private static final Logger log = LoggerFactory.getLogger(InDoorEnergyHandler.class);
+public class BaCtlHandler extends BaseMeterDevHandler {
+    private static final Logger log = LoggerFactory.getLogger(BaCtlHandler.class);
 
 
     // 对接系统
     // 对接系统
-    private static final String SYS_MODE_CODE = "M_W4_SYS_IN_DOOR";
+    private static final String SYS_MODE_CODE = "M_W4_SYS_BA";
 
 
-    // 设备模型代码
-    private static final String DEV_MODE_CODE = "M_W4_SM_INDOOR_ENERGY";
+    // 网关模型代码
+    private static final String GATEWAY_MODEL = "M_W4_DEV_BA_GA";
+
+    // 电表测点模型代码
+    private static final String METER_MODEL_E = "M_W4_DEV_BA_METER_E";
+
+    // 水表测点模型代码
+    private static final String METER_MODEL_W = "M_W4_DEV_BA_METER_W";
+
+    // DDC点位模型代码
+    private static final String DDC_MODEL = "M_Z_DEV_BA_DDC";
+
+    // 照明模型代码
+    private static final String LIGHT_MODEL = "M_Z_DEV_BA_LIGHT";
 
 
     // 设备子系统代码
     // 设备子系统代码
     private static final String SUBSYSTEM_CODE = "SYS_NHJC";
     private static final String SUBSYSTEM_CODE = "SYS_NHJC";
@@ -79,7 +93,7 @@ public class InDoorEnergyHandler extends BaseMeterDevHandler {
     private IEmsObjAttrValueService objAttrValueService;
     private IEmsObjAttrValueService objAttrValueService;
 
 
     @Resource
     @Resource
-    private InDoorEnergyConfig config;
+    private BaCtlConfig config;
 
 
     @Autowired
     @Autowired
     private RedisService redisService;
     private RedisService redisService;
@@ -87,7 +101,21 @@ public class InDoorEnergyHandler extends BaseMeterDevHandler {
     @Override
     @Override
     public List<MeterDevice> getMeterDeviceList() {
     public List<MeterDevice> getMeterDeviceList() {
         QueryDevice queryDevice = new QueryDevice();
         QueryDevice queryDevice = new QueryDevice();
-        queryDevice.setDeviceModel(DEV_MODE_CODE);
+        queryDevice.setDeviceModel(METER_MODEL_E);
+        queryDevice.setDeviceEnable(1);
+        List<MeterDevice> list = new ArrayList<>(meterDeviceService.selectMeterDeviceList(queryDevice));
+
+        QueryDevice queryDevice2 = new QueryDevice();
+        queryDevice2.setDeviceModel(METER_MODEL_W);
+        queryDevice2.setDeviceEnable(1);
+        list.addAll(meterDeviceService.selectMeterDeviceList(queryDevice2));
+
+        return list;
+    }
+
+    public List<MeterDevice> getMeterDeviceList(String modelCode) {
+        QueryDevice queryDevice = new QueryDevice();
+        queryDevice.setDeviceModel(modelCode);
         queryDevice.setDeviceEnable(1);
         queryDevice.setDeviceEnable(1);
         return meterDeviceService.selectMeterDeviceList(queryDevice);
         return meterDeviceService.selectMeterDeviceList(queryDevice);
     }
     }
@@ -95,7 +123,7 @@ public class InDoorEnergyHandler extends BaseMeterDevHandler {
     @Override
     @Override
     public List<EmsDevice> getDeviceList() {
     public List<EmsDevice> getDeviceList() {
         QueryDevice queryDevice = new QueryDevice();
         QueryDevice queryDevice = new QueryDevice();
-        queryDevice.setDeviceModel(DEV_MODE_CODE);
+        queryDevice.setDeviceModel(GATEWAY_MODEL);
         return deviceService.selectList(queryDevice);
         return deviceService.selectList(queryDevice);
     }
     }
 
 
@@ -157,7 +185,8 @@ public class InDoorEnergyHandler extends BaseMeterDevHandler {
             String statusKey = "interfaceStatus";
             String statusKey = "interfaceStatus";
 
 
             // 查询当前状态
             // 查询当前状态
-            EmsObjAttrValue currentStatus = objAttrValueService.selectObjAttrValue(SYS_MODE_CODE, SUBSYSTEM_CODE, statusKey);
+            EmsObjAttrValue currentStatus = objAttrValueService.selectObjAttrValue(SYS_MODE_CODE, SUBSYSTEM_CODE,
+                statusKey);
 
 
             String newStatus = isOnline ? "1" : "0";
             String newStatus = isOnline ? "1" : "0";
             String oldStatus = currentStatus != null ? currentStatus.getAttrValue() : null;
             String oldStatus = currentStatus != null ? currentStatus.getAttrValue() : null;
@@ -183,32 +212,31 @@ public class InDoorEnergyHandler extends BaseMeterDevHandler {
 
 
     private void meterReadingGw(String modeCode, String abilityKey, String objCode) {
     private void meterReadingGw(String modeCode, String abilityKey, String objCode) {
         // 查询当前设备的接口属性值
         // 查询当前设备的接口属性值
-        List<EmsObjAttrValue> attrValues = objAttrValueService.selectByObjCode(modeCode, objCode);
-        attrValues = attrValues.stream()
-            // 过滤条件:attrKey以"interface"开头
-            .filter(attr -> StringUtils.startsWith(attr.getAttrKey(), "interface"))
-            // 收集为新的List
-            .collect(Collectors.toList());
+        EmsObjAttrValue subDevAttr = objAttrValueService.selectObjAttrValue(modeCode, objCode, "subDev");
 
 
-        Set<String> pointIdSet = getPointIds(attrValues);
-        CodesValReq req = new CodesValReq(pointIdSet);
+        if (null != subDevAttr && StringUtils.isNotEmpty(subDevAttr.getAttrValue())) {
+            JSONArray subDevs = JSON.parseArray(subDevAttr.getAttrValue());
+            Set<String> pointIdSet = subDevs.stream().map(item -> ((JSONObject) item).getString("deviceCode"))
+                .collect(Collectors.toSet());
 
 
-        // 调用能耗数据接口获取实时数据
-        InDoorEnergyTemplate template = new InDoorEnergyTemplate(config.getUrl());
-        String callRes = template.getCodesVal(req);
-        JSONObject resJson = JSONObject.parseObject(callRes);
+            CodesValReq req = new CodesValReq(pointIdSet);
 
 
-        if (resJson.getInteger("code") == 200) {
-            saveCallLog(objCode, modeCode, abilityKey, 0, JSON.toJSONString(req), callRes);
+            // 调用能耗数据接口获取实时数据
+            String callRes = new BaCtlEnergyTemplate(config.getUrl()).getCodesVal(req);
+            JSONObject resJson = JSONObject.parseObject(callRes);
 
 
-            String dataStr = resJson.getString("ResultPointObjArr");
-            List<CodesVal> retList = JSONObject.parseArray(dataStr, CodesVal.class);
-            // 更新设备属性
-            updateDeviceAttrList(attrValues, retList);
-        }
-        else {
-            saveCallLog(objCode, modeCode, abilityKey, 2, JSON.toJSONString(req), callRes);
-            throw new BusinessException(-1, resJson.getString("error"));
+            if (resJson.getInteger("code") == 200) {
+                saveCallLog(objCode, modeCode, abilityKey, 0, JSON.toJSONString(req), callRes);
+
+                String dataStr = resJson.getString("ResultPointObjArr");
+                List<CodesVal> retList = JSON.parseArray(dataStr, CodesVal.class);
+                // 更新设备属性
+                updateDeviceAttrList(objCode, subDevs, retList);
+            }
+            else {
+                saveCallLog(objCode, modeCode, abilityKey, 2, JSON.toJSONString(req), callRes);
+                throw new BusinessException(-1, resJson.getString("error"));
+            }
         }
         }
     }
     }
 
 
@@ -221,16 +249,15 @@ public class InDoorEnergyHandler extends BaseMeterDevHandler {
         int cnt = 0;
         int cnt = 0;
 
 
         try {
         try {
-            // 获取所有能源设备列表
-            List<EmsDevice> deviceList = getDeviceList();
+            List<EmsObjAttrValue> gwDeviceList = objAttrValueService.selectByAttrKey(GATEWAY_MODEL, "subDev");
 
 
-            // 遍历每个能源设备
-            if (CollectionUtils.isNotEmpty(deviceList)) {
+            // 遍历每个网关设备
+            if (CollectionUtils.isNotEmpty(gwDeviceList)) {
                 // 调用能耗数据接口获取实时数据
                 // 调用能耗数据接口获取实时数据
-                InDoorEnergyTemplate template = new InDoorEnergyTemplate(config.getUrl());
+                BaCtlEnergyTemplate template = new BaCtlEnergyTemplate(config.getUrl());
 
 
-                for (EmsDevice emsDevice : deviceList) {
-                    cnt += meterDevCollect(template, emsDevice);
+                for (EmsObjAttrValue gwDevice : gwDeviceList) {
+                    cnt += meterDevCollect(template, gwDevice);
                 }
                 }
             }
             }
         }
         }
@@ -241,100 +268,77 @@ public class InDoorEnergyHandler extends BaseMeterDevHandler {
         return cnt;
         return cnt;
     }
     }
 
 
-    private int meterDevCollect(InDoorEnergyTemplate template, EmsDevice emsDevice) {
+    private int meterDevCollect(BaCtlEnergyTemplate template, EmsObjAttrValue subDevAttr) {
         int cnt = 0;
         int cnt = 0;
 
 
         try {
         try {
-            // 查询当前设备的接口属性值
-            List<EmsObjAttrValue> attrValues = objAttrValueService.selectByObjCode(DEV_MODE_CODE,
-                emsDevice.getDeviceCode());
-            attrValues = attrValues.stream()
-                // 过滤条件:attrKey以"interface"开头
-                .filter(attr -> StringUtils.startsWith(attr.getAttrKey(), "interface"))
-                // 收集为新的List
-                .collect(Collectors.toList());
-
-            Set<String> pointIdSet = getPointIds(attrValues);
-            CodesValReq req = new CodesValReq(pointIdSet);
 
 
-            // 调用能耗数据接口获取实时数据
-            String callRes = template.getCodesVal(req);
-            JSONObject resJson = JSONObject.parseObject(callRes);
-            Assert.isTrue(StringUtils.equals(resJson.getString("code"), "200"), resJson.getInteger("code"),
-                resJson.getString("error"));
-            int callStatus = StringUtils.equals(resJson.getString("code"), "200") ? 0 : 2;
-            saveCallLog(emsDevice.getDeviceCode(), DEV_MODE_CODE, "MeterReadingGw", callStatus, JSON.toJSONString(req),
-                callRes);
+            if (null != subDevAttr && StringUtils.isNotEmpty(subDevAttr.getAttrValue())) {
+                JSONArray subDevs = JSON.parseArray(subDevAttr.getAttrValue());
+                Set<String> pointIdSet = subDevs.stream().map(item -> ((JSONObject) item).getString("deviceCode"))
+                    .collect(Collectors.toSet());
 
 
-            String dataStr = resJson.getString("ResultPointObjArr");
-            List<CodesVal> retList = JSONObject.parseArray(dataStr, CodesVal.class);
+                CodesValReq req = new CodesValReq(pointIdSet);
 
 
-            // 更新设备属性
-            updateDeviceAttrList(attrValues, retList);
+                // 调用能耗数据接口获取实时数据
+                String callRes = template.getCodesVal(req);
+                JSONObject resJson = JSONObject.parseObject(callRes);
+                Assert.isTrue(StringUtils.equals(resJson.getString("code"), "200"), resJson.getInteger("code"),
+                    resJson.getString("error"));
+                int callStatus = StringUtils.equals(resJson.getString("code"), "200") ? 0 : 2;
+                saveCallLog(subDevAttr.getObjCode(), GATEWAY_MODEL, "MeterReadingGw", callStatus,
+                    JSON.toJSONString(req), callRes);
+
+                String dataStr = resJson.getString("ResultPointObjArr");
+                List<CodesVal> retList = JSON.parseArray(dataStr, CodesVal.class);
+
+                // 更新设备属性
+                updateDeviceAttrList(subDevAttr.getObjCode(), subDevs, retList);
+            }
         }
         }
         catch (Exception e) {
         catch (Exception e) {
-            log.error("meterDevHourProd error! deviceCode:{}", emsDevice.getDeviceCode(), e);
+            log.error("meterDevHourProd error! deviceCode:{}", subDevAttr.getObjCode(), e);
         }
         }
 
 
         return cnt;
         return cnt;
     }
     }
 
 
-    private void updateDeviceAttrList(List<EmsObjAttrValue> attrValues, List<CodesVal> retList) {
+    private void updateDeviceAttrList(String gwDevieCode, JSONArray subDevs, List<CodesVal> retList) {
         try {
         try {
             // 将新采集数据转换为Map
             // 将新采集数据转换为Map
             Map<String, CodesVal> codesValMap = retList.stream()
             Map<String, CodesVal> codesValMap = retList.stream()
                 .collect(Collectors.toMap(CodesVal::getPointId, Function.identity()));
                 .collect(Collectors.toMap(CodesVal::getPointId, Function.identity()));
 
 
-            for (EmsObjAttrValue dbAttr : attrValues) {
-                // 更新列表中的值
-                boolean dbNeedUpdate = false;
-                String dbAttrValue = dbAttr.getAttrValue();
-                List<ObjAttrTableItem> dbItems = JSON.parseArray(dbAttrValue, ObjAttrTableItem.class);
-
-                if (CollectionUtils.isNotEmpty(dbItems)) {
-                    Map<String, ObjAttrTableItem> itemMap = dbItems.stream()
-                        .collect(Collectors.toMap(ObjAttrTableItem::getKey, Function.identity()));
-
-                    for (Map.Entry<String, ObjAttrTableItem> dbItemEntry : itemMap.entrySet()) {
-                        String pointId = dbItemEntry.getKey();
-                        ObjAttrTableItem dbItem = dbItemEntry.getValue();
-
-                        CodesVal syncCodesVal = codesValMap.get(pointId);
-
-                        if (null != syncCodesVal) {
-                            // 数据验证和处理
-                            DataValidationResult validationResult = validateMeterData(dbAttr.getObjCode(), pointId,
-                                dbItem.getValue(), syncCodesVal.getValue());
-
-                            if (validationResult.isValid()) {
-                                // 更新缓存中的数据
-                                String hKey = NEW_HOUR_READING + "-" + pointId;
-                                redisService.setCacheMapValue(dbAttr.getObjCode(), hKey,
-                                    validationResult.getValidValue());
-
-                                if (!StringUtils.equals(validationResult.getValidValue(), dbItem.getValue())
-                                    || !StringUtils.equals(syncCodesVal.getTime(), dbItem.getUpdateTime())) {
-                                    dbNeedUpdate = true;
-
-                                    dbItem.setValue(validationResult.getValidValue());
-                                    dbItem.setUpdateTime(syncCodesVal.getTime());
-                                }
-                            }
-                            else {
-                                // 记录异常数据但不更新
-                                log.warn("检测到异常抄表数据 - 设备:{}, 测点:{}, 旧值:{}, 新值:{}, 原因:{}",
-                                    dbAttr.getObjCode(), pointId, dbItem.getValue(), syncCodesVal.getValue(),
-                                    validationResult.getReason());
-                            }
+            for (Object subDev : subDevs) {
+                JSONObject subDevObj = (JSONObject) subDev;
+                String pointId = subDevObj.getString("deviceCode");
+                String modelCode = subDevObj.getString("modelCode");
+
+                CodesVal syncCodesVal = codesValMap.get(pointId);
+
+                if (null != syncCodesVal) {
+                    EmsObjAttrValue dbAttr = objAttrValueService.selectObjAttrValue(modelCode, pointId, "value");
+
+                    // 数据验证和处理
+                    DataValidationResult validationResult = validateMeterData(gwDevieCode, pointId,
+                        dbAttr.getAttrValue(), syncCodesVal.getValue());
+
+                    if (validationResult.isValid()) {
+                        // 更新缓存中的数据
+                        String hKey = NEW_HOUR_READING + "-" + pointId;
+                        redisService.setCacheMapValue(gwDevieCode, hKey, validationResult.getValidValue());
+
+                        if (!StringUtils.equals(validationResult.getValidValue(), dbAttr.getAttrValue())) {
+                            objAttrValueService.updateObjAttrValue(modelCode, pointId, "value",
+                                validationResult.getValidValue());
                         }
                         }
                     }
                     }
-                }
-
-                // 如果有更新,则保存回数据库
-                if (dbNeedUpdate) {
-                    dbAttrValue = JSON.toJSONString(dbItems);
-                    objAttrValueService.updateObjAttrValue(dbAttr.getModelCode(), dbAttr.getObjCode(),
-                        dbAttr.getAttrKey(), dbAttrValue);
+                    else {
+                        // 记录异常数据但不更新
+                        log.warn("检测到异常抄表数据 - 设备:{}, 测点:{}, 旧值:{}, 新值:{}, 原因:{}",
+                            dbAttr.getObjCode(), pointId, dbAttr.getAttrValue(), syncCodesVal.getValue(),
+                            validationResult.getReason());
+                    }
                 }
                 }
             }
             }
         }
         }
@@ -351,32 +355,61 @@ public class InDoorEnergyHandler extends BaseMeterDevHandler {
         int cnt = 0;
         int cnt = 0;
 
 
         try {
         try {
-            // 获取所有能源设备列表
-            List<EmsDevice> deviceList = getDeviceList();
-            List<MeterDevice> meterDeviceList = getMeterDeviceList();
-            List<ElecMeterH> allElecMeterHList = new ArrayList<>();
-
-            // 遍历每个能源设备
-            if (CollectionUtils.isNotEmpty(deviceList)) {
-                for (EmsDevice emsDevice : deviceList) {
-                    // 产出表计小时计量数据
-                    MeterHourProdResult result = meterDevHourProd(emsDevice, meterDeviceList);
-
-                    if (CollectionUtils.isNotEmpty(result.getElecMeterHList())) {
-                        elecMeterHService.insertBatch(result.getElecMeterHList());
-                        allElecMeterHList.addAll(result.getElecMeterHList());
+            // 计量设备-网关设备映射集合
+            Map<String, EmsDevice> refParentMap = getRefParentMap();
+
+            // 电表
+            List<MeterDevice> meterDeviceList = getMeterDeviceList(METER_MODEL_E);
+
+            // 计算电表小时数据
+            if (CollectionUtils.isNotEmpty(meterDeviceList)) {
+                Map<String, Price> priceMap = new ConcurrentHashMap<>();
+                Date date = DateUtils.adjustHour(new Date(), -1);
+                List<ElecMeterH> elecMeterHList = new ArrayList<>();
+
+                for (MeterDevice meterDevice : meterDeviceList) {
+                    EmsDevice gwDevice = refParentMap.get(meterDevice.getDeviceCode());
+                    ElecMeterH elecMeterH = workElecMeterReading(gwDevice, meterDevice);
+
+                    if (null != elecMeterH) {
+                        Price price = priceMap.computeIfAbsent(gwDevice.getAreaCode(),
+                            k -> priceService.getElecHourPrice(gwDevice.getAreaCode(), date));
+                        completeElecPrice(elecMeterH, price);
+                        elecMeterHList.add(elecMeterH);
                     }
                     }
+                }
 
 
-                    if (CollectionUtils.isNotEmpty(result.getWaterMeterHList())) {
-                        waterMeterHService.insertBatch(result.getWaterMeterHList());
-                    }
+                if (CollectionUtils.isNotEmpty(elecMeterHList)) {
+                    elecMeterHService.insertBatch(elecMeterHList);
+                    cnt += elecMeterHList.size();
+                    generatePgSupplyData(elecMeterHList);
+                }
+            }
+
+            // 水表
+            meterDeviceList = getMeterDeviceList(METER_MODEL_W);
+
+            // 计算水表小时数据
+            if (CollectionUtils.isNotEmpty(meterDeviceList)) {
+                Map<String, FdEnergyPriceConfig> priceMap = new ConcurrentHashMap<>();
+                List<WaterMeterH> waterMeterHList = new ArrayList<>();
+
+                for (MeterDevice meterDevice : meterDeviceList) {
+                    EmsDevice gwDevice = refParentMap.get(meterDevice.getDeviceCode());
+                    WaterMeterH waterMeterH = workWaterMeterReading(gwDevice, meterDevice);
 
 
-                    cnt += result.getElecMeterHList().size() + result.getWaterMeterHList().size();
+                    if (null != waterMeterH) {
+                        FdEnergyPriceConfig price = priceMap.computeIfAbsent(gwDevice.getAreaCode(),
+                            k -> fdEnergyPriceConfigService.selectByAreaCode(gwDevice.getAreaCode(), 70));
+                        completeWaterPrice(waterMeterH, price);
+                        waterMeterHList.add(waterMeterH);
+                    }
                 }
                 }
 
 
-                // 统一处理市电供应数据(避免重复)
-                if (CollectionUtils.isNotEmpty(allElecMeterHList)) {
-                    generatePgSupplyData(allElecMeterHList);
+                if (CollectionUtils.isNotEmpty(waterMeterHList)) {
+                    waterMeterHService.insertBatch(waterMeterHList);
+                    cnt += waterMeterHList.size();
+
                 }
                 }
             }
             }
         }
         }
@@ -387,82 +420,53 @@ public class InDoorEnergyHandler extends BaseMeterDevHandler {
         return cnt;
         return cnt;
     }
     }
 
 
-    /**
-     * 修改后的单设备计量产出方法,返回详细结果
-     */
-    private MeterHourProdResult meterDevHourProd(EmsDevice emsDevice, List<MeterDevice> meterDeviceList) {
-        MeterHourProdResult result = new MeterHourProdResult();
-
-        try {
-            // 查询当前设备的接口属性值
-            List<EmsObjAttrValue> attrValues = objAttrValueService.selectByObjCode(DEV_MODE_CODE,
-                emsDevice.getDeviceCode());
-            attrValues = attrValues.stream()
-                // 过滤条件:attrKey以"interface"开头
-                .filter(attr -> StringUtils.startsWith(attr.getAttrKey(), "interface"))
-                // 收集为新的List
-                .collect(Collectors.toList());
-
-            Set<String> pointIdSet = getPointIds(attrValues);
-
-            // 电表过滤
-            List<MeterDevice> elecDevs = meterDeviceList.stream()
-                .filter(device -> pointIdSet.contains(device.getDeviceCode()) && 45 == device.getMeterCls())
-                .collect(Collectors.toList());
-
-            // 电表抄表数据保存
-            if (CollectionUtils.isNotEmpty(elecDevs)) {
-                List<ElecMeterH> elecMeterHList = saveElecMeterReading(emsDevice, elecDevs);
-                result.setElecMeterHList(elecMeterHList);
-            }
-
-            // 水表过滤
-            List<MeterDevice> waterDevs = meterDeviceList.stream()
-                .filter(device -> pointIdSet.contains(device.getDeviceCode()) && 70 == device.getMeterCls())
-                .collect(Collectors.toList());
-
-            // 水表抄表数据保存
-            if (CollectionUtils.isNotEmpty(waterDevs)) {
-                List<WaterMeterH> waterMeterHList = saveWaterMeterReading(emsDevice, waterDevs);
-                result.setWaterMeterHList(waterMeterHList);
+    private Map<String, EmsDevice> getRefParentMap() {
+        Map<String, EmsDevice> refParentMap = new HashMap<>();
+
+        List<EmsObjAttrValue> attrValues = objAttrValueService.selectByAttrKey(GATEWAY_MODEL, "subDev");
+        Map<String, String> attrValueMap = attrValues.stream()
+            .collect(Collectors.toMap(EmsObjAttrValue::getObjCode, EmsObjAttrValue::getAttrValue));
+
+        // 网关设备列表
+        List<EmsDevice> gwDevices = getDeviceList();
+
+        if (CollectionUtils.isNotEmpty(gwDevices)) {
+            for (EmsDevice gwDevice : gwDevices) {
+                String subDevStr = attrValueMap.get(gwDevice.getDeviceCode());
+                if (StringUtils.isNotBlank(subDevStr)) {
+                    JSONArray jsonArray = JSON.parseArray(subDevStr);
+                    jsonArray.forEach(obj -> {
+                        JSONObject jsonObject = (JSONObject) obj;
+                        refParentMap.put(jsonObject.getString("deviceCode"), gwDevice);
+                    });
+                }
             }
             }
         }
         }
-        catch (Exception e) {
-            log.error("meterDevHourProd error! deviceCode:{}", emsDevice.getDeviceCode(), e);
-        }
 
 
-        return result;
+        return refParentMap;
     }
     }
 
 
-    private List<ElecMeterH> saveElecMeterReading(EmsDevice gwDevice, List<MeterDevice> deviceList) {
-        Map<String, Price> priceMap = new ConcurrentHashMap<>();
-        List<ElecMeterH> meterHList = new ArrayList<>();
-        Date date = DateUtils.adjustHour(new Date(), -1);
+    /**
+     * 修改后的单设备计量产出方法,返回详细结果
+     */
 
 
-        for (MeterDevice meterDevice : deviceList) {
-            // 读取最新抄表值
-            String newMeterReading = redisService.getCacheMapValue(gwDevice.getDeviceCode(),
-                NEW_HOUR_READING + "-" + meterDevice.getDeviceCode());
+    private ElecMeterH workElecMeterReading(EmsDevice gwDevice, MeterDevice meterDevice) {
+        ElecMeterH elecMeterH = null;
 
 
-            if (null != newMeterReading) {
-                String lastCacheKey = LAST_HOUR_READING + "-" + meterDevice.getDeviceCode();
+        // 读取最新抄表值
+        String newMeterReading = redisService.getCacheMapValue(gwDevice.getDeviceCode(),
+            NEW_HOUR_READING + "-" + meterDevice.getDeviceCode());
 
 
-                // 读取历史抄表
-                String lastMeterReading = redisService.getCacheMapValue(gwDevice.getDeviceCode(), lastCacheKey);
+        if (null != newMeterReading) {
+            String lastCacheKey = LAST_HOUR_READING + "-" + meterDevice.getDeviceCode();
 
 
-                ElecMeterH elecMeterH = getElecMeterH(gwDevice.getDeviceCode(), meterDevice, lastMeterReading,
-                    newMeterReading);
+            // 读取历史抄表
+            String lastMeterReading = redisService.getCacheMapValue(gwDevice.getDeviceCode(), lastCacheKey);
 
 
-                if (null != elecMeterH) {
-                    Price price = priceMap.computeIfAbsent(gwDevice.getAreaCode(),
-                        k -> priceService.getElecHourPrice(gwDevice.getAreaCode(), date));
-                    completeElecPrice(elecMeterH, price);
-                    meterHList.add(elecMeterH);
-                }
-            }
+            elecMeterH = getElecMeterH(gwDevice.getDeviceCode(), meterDevice, lastMeterReading, newMeterReading);
         }
         }
 
 
-        return meterHList;
+        return elecMeterH;
     }
     }
 
 
     @Override
     @Override
@@ -530,35 +534,24 @@ public class InDoorEnergyHandler extends BaseMeterDevHandler {
         return elecMeterH;
         return elecMeterH;
     }
     }
 
 
-    private List<WaterMeterH> saveWaterMeterReading(EmsDevice gwDevice, List<MeterDevice> deviceList) {
-        Map<String, FdEnergyPriceConfig> priceMap = new ConcurrentHashMap<>();
-        List<WaterMeterH> meterHList = new ArrayList<>();
-
-        for (MeterDevice meterDevice : deviceList) {
-            // 读取最新抄表值
-            String newMeterReading = redisService.getCacheMapValue(gwDevice.getDeviceCode(),
-                NEW_HOUR_READING + "-" + meterDevice.getDeviceCode());
+    private WaterMeterH workWaterMeterReading(EmsDevice gwDevice, MeterDevice meterDevice) {
+        WaterMeterH waterMeterH = null;
 
 
-            if (null != newMeterReading) {
-                String lastCacheKey = LAST_HOUR_READING + "-" + meterDevice.getDeviceCode();
+        // 读取最新抄表值
+        String newMeterReading = redisService.getCacheMapValue(gwDevice.getDeviceCode(),
+            NEW_HOUR_READING + "-" + meterDevice.getDeviceCode());
 
 
-                // 读取历史抄表
-                String lastMeterReading = redisService.getCacheMapValue(gwDevice.getDeviceCode(), lastCacheKey);
+        if (null != newMeterReading) {
+            String lastCacheKey = LAST_HOUR_READING + "-" + meterDevice.getDeviceCode();
 
 
-                // 组装水表抄报数据
-                WaterMeterH waterMeterH = getWaterMeterH(gwDevice.getDeviceCode(), meterDevice, lastMeterReading,
-                    newMeterReading);
+            // 读取历史抄表
+            String lastMeterReading = redisService.getCacheMapValue(gwDevice.getDeviceCode(), lastCacheKey);
 
 
-                if (null != waterMeterH) {
-                    FdEnergyPriceConfig price = priceMap.computeIfAbsent(gwDevice.getAreaCode(),
-                        k -> fdEnergyPriceConfigService.selectByAreaCode(gwDevice.getAreaCode(), 70));
-                    completeWaterPrice(waterMeterH, price);
-                    meterHList.add(waterMeterH);
-                }
-            }
+            // 组装水表抄报数据
+            waterMeterH = getWaterMeterH(gwDevice.getDeviceCode(), meterDevice, lastMeterReading, newMeterReading);
         }
         }
 
 
-        return meterHList;
+        return waterMeterH;
     }
     }
 
 
     @Override
     @Override
@@ -817,31 +810,6 @@ public class InDoorEnergyHandler extends BaseMeterDevHandler {
     }
     }
 
 
     /**
     /**
-     * 单个设备的计量数据产出结果
-     */
-    private static class MeterHourProdResult {
-        private List<ElecMeterH> elecMeterHList = new ArrayList<>();
-
-        private List<WaterMeterH> waterMeterHList = new ArrayList<>();
-
-        public List<ElecMeterH> getElecMeterHList() {
-            return elecMeterHList;
-        }
-
-        public void setElecMeterHList(List<ElecMeterH> elecMeterHList) {
-            this.elecMeterHList = elecMeterHList;
-        }
-
-        public List<WaterMeterH> getWaterMeterHList() {
-            return waterMeterHList;
-        }
-
-        public void setWaterMeterHList(List<WaterMeterH> waterMeterHList) {
-            this.waterMeterHList = waterMeterHList;
-        }
-    }
-
-    /**
      * 数据验证结果内部类
      * 数据验证结果内部类
      */
      */
     private static class DataValidationResult {
     private static class DataValidationResult {

+ 1 - 1
ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/retrofit/InDoorEnergyApi.java → ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/retrofit/BaCtlEnergyApi.java

@@ -28,7 +28,7 @@ import retrofit2.http.Query;
  * @see [相关类/方法]
  * @see [相关类/方法]
  * @since [产品/模块版本]
  * @since [产品/模块版本]
  */
  */
-public interface InDoorEnergyApi {
+public interface BaCtlEnergyApi {
     /**
     /**
      * 获取TOKEN
      * 获取TOKEN
      *
      *

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

@@ -62,8 +62,8 @@ adapter:
       loginName: admin
       loginName: admin
       password: Acrel001
       password: Acrel001
     subids: 10100002,10100003
     subids: 10100002,10100003
-  # 室内能耗
-  id-energy:
+  # BA楼控
+  ba-ctl:
     url: http://127.0.0.1:8093
     url: http://127.0.0.1:8093
     appId: httpsjy
     appId: httpsjy
   # 广场照明控制
   # 广场照明控制

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

@@ -62,8 +62,8 @@ adapter:
       loginName: admin
       loginName: admin
       password: Acrel001
       password: Acrel001
     subids: 10100002,10100003
     subids: 10100002,10100003
-  # 室内能耗
-  id-energy:
+  # BA楼控
+  ba-ctl:
     url: http://172.17.50.186:80
     url: http://172.17.50.186:80
     appId: httpsjy
     appId: httpsjy
   # 广场照明控制
   # 广场照明控制

+ 7 - 11
ems/ems-cloud/ems-dev-adapter/src/test/java/com/huashe/test/InDoorEnergyTest.java → ems/ems-cloud/ems-dev-adapter/src/test/java/com/huashe/test/BaCtlTest.java

@@ -11,9 +11,8 @@
 package com.huashe.test;
 package com.huashe.test;
 
 
 import com.ruoyi.ems.EmsDevAdpApplication;
 import com.ruoyi.ems.EmsDevAdpApplication;
-import com.ruoyi.ems.config.InDoorEnergyConfig;
-import com.ruoyi.ems.core.InDoorEnergyTemplate;
-import com.ruoyi.ems.handle.InDoorEnergyHandler;
+import com.ruoyi.ems.config.BaCtlConfig;
+import com.ruoyi.ems.core.BaCtlEnergyTemplate;
 import com.ruoyi.ems.model.idenergy.CodesValReq;
 import com.ruoyi.ems.model.idenergy.CodesValReq;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.junit.Assert;
 import org.junit.Assert;
@@ -36,19 +35,16 @@ import javax.annotation.Resource;
 @Slf4j
 @Slf4j
 @RunWith(SpringRunner.class)
 @RunWith(SpringRunner.class)
 @SpringBootTest(classes = EmsDevAdpApplication.class)
 @SpringBootTest(classes = EmsDevAdpApplication.class)
-public class InDoorEnergyTest {
+public class BaCtlTest {
     @Resource
     @Resource
-    private InDoorEnergyConfig config;
-
-    @Resource
-    private InDoorEnergyHandler handler;
+    private BaCtlConfig config;
 
 
     /**
     /**
      * 测试-获取权限
      * 测试-获取权限
      */
      */
     @Test
     @Test
     public void testGetToken() {
     public void testGetToken() {
-        InDoorEnergyTemplate template = new InDoorEnergyTemplate(config.getUrl());
+        BaCtlEnergyTemplate template = new BaCtlEnergyTemplate(config.getUrl());
         String token = template.getToken();
         String token = template.getToken();
         Assert.assertNotNull(token);
         Assert.assertNotNull(token);
         log.info("Token: {}", token);
         log.info("Token: {}", token);
@@ -56,7 +52,7 @@ public class InDoorEnergyTest {
 
 
     @Test
     @Test
     public void testRefreshToken() {
     public void testRefreshToken() {
-        InDoorEnergyTemplate template = new InDoorEnergyTemplate(config.getUrl());
+        BaCtlEnergyTemplate template = new BaCtlEnergyTemplate(config.getUrl());
         String token = template.refreshToken();
         String token = template.refreshToken();
         Assert.assertNotNull(token);
         Assert.assertNotNull(token);
         log.info("Token: {}", token);
         log.info("Token: {}", token);
@@ -64,7 +60,7 @@ public class InDoorEnergyTest {
 
 
     @Test
     @Test
     public void testGetCodesVal() {
     public void testGetCodesVal() {
-        InDoorEnergyTemplate template = new InDoorEnergyTemplate(config.getUrl());
+        BaCtlEnergyTemplate template = new BaCtlEnergyTemplate(config.getUrl());
         String ret = template.getCodesVal(new CodesValReq("C_2003_AV_0000", "C_2003_AV_0002"));
         String ret = template.getCodesVal(new CodesValReq("C_2003_AV_0000", "C_2003_AV_0002"));
         Assert.assertNotNull(ret);
         Assert.assertNotNull(ret);
     }
     }

+ 9 - 0
ems/ems-core/src/main/java/com/ruoyi/ems/mapper/EmsObjAttrValueMapper.java

@@ -49,6 +49,15 @@ public interface EmsObjAttrValueMapper {
     List<EmsObjAttrValue> selectByObjCode(@Param("modelCode") String modelCode, @Param("objCode") String objCode);
     List<EmsObjAttrValue> selectByObjCode(@Param("modelCode") String modelCode, @Param("objCode") String objCode);
 
 
     /**
     /**
+     * 查询能源对象属性值列表
+     *
+     * @param modelCode 对象类型
+     * @param attrKey   对象代码
+     * @return 能源对象属性值集合
+     */
+    List<EmsObjAttrValue> selectByAttrKey(@Param("modelCode") String modelCode, @Param("attrKey") String attrKey);
+
+    /**
      * 新增能源对象属性值
      * 新增能源对象属性值
      *
      *
      * @param objAttrValue 能源对象属性值
      * @param objAttrValue 能源对象属性值

+ 9 - 0
ems/ems-core/src/main/java/com/ruoyi/ems/service/IEmsObjAttrValueService.java

@@ -48,6 +48,15 @@ public interface IEmsObjAttrValueService {
     List<EmsObjAttrValue> selectByObjCode(String modelCode, String objCode);
     List<EmsObjAttrValue> selectByObjCode(String modelCode, String objCode);
 
 
     /**
     /**
+     * 查询能源对象属性值列表
+     *
+     * @param modelCode 对象类型
+     * @param attrKey   对象代码
+     * @return 能源对象属性值集合
+     */
+    List<EmsObjAttrValue> selectByAttrKey(String modelCode, String attrKey);
+
+    /**
      * 新增能源对象属性值
      * 新增能源对象属性值
      *
      *
      * @param objAttrValue 能源对象属性值
      * @param objAttrValue 能源对象属性值

+ 5 - 0
ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/EmsObjAttrValueServiceImpl.java

@@ -51,6 +51,11 @@ public class EmsObjAttrValueServiceImpl implements IEmsObjAttrValueService {
         return objAttrValueMapper.selectByObjCode(modelCode, objCode);
         return objAttrValueMapper.selectByObjCode(modelCode, objCode);
     }
     }
 
 
+    @Override
+    public List<EmsObjAttrValue> selectByAttrKey(String modelCode, String attrKey) {
+        return objAttrValueMapper.selectByAttrKey(modelCode, attrKey);
+    }
+
     /**
     /**
      * 新增/更新能源对象属性值
      * 新增/更新能源对象属性值
      *
      *

+ 5 - 0
ems/ems-core/src/main/resources/mapper/ems/EmsObjAttrValueMapper.xml

@@ -36,6 +36,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where model_code = #{modelCode} and obj_code = #{objCode}
         where model_code = #{modelCode} and obj_code = #{objCode}
     </select>
     </select>
 
 
+    <select id="selectByAttrKey" resultMap="objAttrValueResult">
+        <include refid="selectObjAttrValueVo"/>
+        where model_code = #{modelCode} and attr_key = #{attrKey}
+    </select>
+
     <select id="selectObjAttrValueById" parameterType="Long" resultMap="objAttrValueResult">
     <select id="selectObjAttrValueById" parameterType="Long" resultMap="objAttrValueResult">
         <include refid="selectObjAttrValueVo"/>
         <include refid="selectObjAttrValueVo"/>
         where id = #{id}
         where id = #{id}

File diff suppressed because it is too large
+ 44 - 73
ems/sql/ems_init_data.sql


Some files were not shown because too many files changed in this diff