Browse Source

86面板集成

learshaw 3 months ago
parent
commit
6204453a7e

+ 1 - 1
ems/ems-cloud/docker/Dockerfile

@@ -8,7 +8,7 @@ MAINTAINER learshaw@gmail.com
 
 # 创建目录
 RUN mkdir -p /usr/local/java && \
-    mkdir -p /opt/ems/{ruoyi-gateway,ruoyi-auth,auth-system,ems-server,ems-dev-adapter}
+    mkdir -p /opt/ems/{ruoyi-gateway,ruoyi-auth,ruoyi-system,ems-server,ems-dev-adapter}
 WORKDIR /opt/ems
 
 # 添加JDK

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

@@ -11,7 +11,9 @@
 package com.ruoyi.ems;
 
 import com.ruoyi.ems.core.ObjectCache;
-import com.ruoyi.ems.handle.MqttBaseHandler;
+import com.ruoyi.ems.handle.BaseDevHandler;
+import com.ruoyi.ems.handle.BaseMeterDevHandler;
+import com.ruoyi.ems.handle.BaseMqttHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -42,7 +44,7 @@ public class TaskExecutor {
 
     @Qualifier("geekOpenCbHandler")
     @Resource
-    private MqttBaseHandler geekOpenCbHandler;
+    private BaseMeterDevHandler geekOpenCbHandler;
 
     /**
      * 定时清理过期设备上报响应

+ 82 - 0
ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/controller/ButtonSwitchController.java

@@ -0,0 +1,82 @@
+/*
+ * 文 件 名:  ButtonSwitchController
+ * 版    权:  华设设计集团股份有限公司
+ * 描    述:  <描述>
+ * 修 改 人:  lvwenbin
+ * 修改时间:  2025/4/15
+ * 跟踪单号:  <跟踪单号>
+ * 修改单号:  <修改单号>
+ * 修改内容:  <修改内容>
+ */
+package com.ruoyi.ems.controller;
+
+import com.huashe.common.exception.BusinessException;
+import com.ruoyi.ems.handle.BaseDevHandler;
+import com.ruoyi.ems.model.AbilityPayload;
+import com.ruoyi.ems.model.CallResponse;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+/**
+ * 按钮开关接口
+ * <功能详细描述>
+ *
+ * @author lvwenbin
+ * @version [版本号, 2025/4/15]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+@RestController
+@CrossOrigin(allowedHeaders = "*", allowCredentials = "false")
+@RequestMapping("/button-switch")
+@Api(value = "ButtonSwitchController", description = "按钮开关控制接口")
+public class ButtonSwitchController {
+    /**
+     * 日志
+     */
+    private static final Logger log = LoggerFactory.getLogger(CircuitBreakerController.class);
+
+    @Qualifier("keka86BsHandler")
+    @Resource
+    private BaseDevHandler keka86BsHandler;
+
+    /**
+     * KEKA 86型开关能力调用
+     *
+     * @return 数据列表
+     */
+    @RequestMapping(value = "/keka/86ButtonSwitchCall", method = RequestMethod.POST)
+    @ApiOperation(value = "/keka/86ButtonSwitchCall", notes = "KEKA 86型按钮开关能力调用")
+    @ApiResponses({ @ApiResponse(code = 200, message = "success"),
+        @ApiResponse(code = 400, message = "{code:****,message:'fail'}")
+    })
+    public CallResponse<Void> keka86ButtonSwitchCall(@RequestBody AbilityPayload abilityPayload) {
+        CallResponse<Void> res = null;
+
+        try {
+            res = keka86BsHandler.call(abilityPayload);
+        }
+        catch (BusinessException e) {
+            log.warn(e.getMessage());
+            res = new CallResponse<>(501, e.getMessage());
+        }
+        catch (Exception e) {
+            log.error("keka86ButtonSwitchCall fail!", e);
+            res = new CallResponse<>(501, "内部错误:" + e.getMessage());
+        }
+
+        return res;
+    }
+}

+ 4 - 3
ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/controller/CircuitBreakerController.java

@@ -10,7 +10,8 @@
  */
 package com.ruoyi.ems.controller;
 
-import com.ruoyi.ems.handle.MqttBaseHandler;
+import com.ruoyi.ems.handle.BaseMeterDevHandler;
+import com.ruoyi.ems.handle.BaseMqttHandler;
 import com.ruoyi.ems.model.AbilityPayload;
 import com.ruoyi.ems.model.CallResponse;
 import io.swagger.annotations.Api;
@@ -29,7 +30,7 @@ import org.springframework.web.bind.annotation.RestController;
 import javax.annotation.Resource;
 
 /**
- * GeekOpen 断路器接口
+ * 断路器接口
  * <功能详细描述>
  *
  * @author lvwenbin
@@ -49,7 +50,7 @@ public class CircuitBreakerController {
 
     @Qualifier("geekOpenCbHandler")
     @Resource
-    private MqttBaseHandler geekOpenCbHandler;
+    private BaseMeterDevHandler geekOpenCbHandler;
 
     /**
      * GeekOpen 断路器能力调用

+ 39 - 5
ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/core/MqttTemplate.java

@@ -20,6 +20,7 @@ import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.math.BigInteger;
 import java.nio.charset.StandardCharsets;
 
 /**
@@ -103,20 +104,53 @@ public class MqttTemplate {
 
     /**
      * 消息发送
-     * @param topic 主题
-     * @param payload 报文
-     * @param qos 消息级别
+     *
+     * @param topic    主题
+     * @param payload  报文
+     * @param qos      消息级别
      * @param retained 回复
      */
-    public void send(String topic, String payload, int qos, boolean retained) {
+    public void sendString(String topic, String payload, int qos, boolean retained) {
         try {
             MqttMessage message = new MqttMessage();
             message.setPayload(payload.getBytes(StandardCharsets.UTF_8));
             message.setQos(qos);
             message.setRetained(retained);
             mqttClient.publish(topic, message);
-        } catch (MqttException e) {
+        }
+        catch (MqttException e) {
             log.error("[Send]fail!", e);
         }
     }
+
+    public void sendHex(String topic, String hexPayload, int qos, boolean retained) {
+        try {
+            byte[] payloadBytes = hexStringToByteArray(hexPayload);
+            MqttMessage message = new MqttMessage();
+            message.setPayload(payloadBytes);
+            message.setQos(qos);
+            message.setRetained(retained);
+            mqttClient.publish(topic, message);
+        }
+        catch (MqttException e) {
+            log.error("[SendHex]fail!", e);
+        }
+    }
+
+    private byte[] hexStringToByteArray(String hexString) {
+        // 去除字符串前后的空格
+        hexString = hexString.trim();
+
+        // 分割字符串
+        String[] hexParts = hexString.split(" ");
+        byte[] byteArray = new byte[hexParts.length];
+
+        for (int i = 0; i < hexParts.length; i++) {
+            // 将每个十六进制部分转换为整数,再转为字节
+            int value = Integer.parseInt(hexParts[i], 16);
+            byteArray[i] = (byte) value;
+        }
+
+        return byteArray;
+    }
 }

+ 11 - 231
ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/handle/MqttBaseHandler.java → ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/handle/BaseDevHandler.java

@@ -1,9 +1,9 @@
 /*
- * 文 件 名:  BaseSendHandler
+ * 文 件 名:  BaseDevHandler
  * 版    权:  华设设计集团股份有限公司
  * 描    述:  <描述>
  * 修 改 人:  lvwenbin
- * 修改时间:  2025/3/3
+ * 修改时间:  2025/4/15
  * 跟踪单号:  <跟踪单号>
  * 修改单号:  <修改单号>
  * 修改内容:  <修改内容>
@@ -12,40 +12,27 @@ package com.ruoyi.ems.handle;
 
 import com.alibaba.fastjson2.JSONObject;
 import com.huashe.common.utils.DateUtils;
-import com.ruoyi.ems.core.MqttTemplate;
-import com.ruoyi.ems.domain.ElecMeterH;
 import com.ruoyi.ems.domain.EmsDevice;
 import com.ruoyi.ems.domain.EmsObjAbilityCallLog;
 import com.ruoyi.ems.domain.EmsObjAttrValue;
 import com.ruoyi.ems.domain.EmsObjEventLog;
 import com.ruoyi.ems.domain.EmsObjReportLog;
-import com.ruoyi.ems.domain.MeterDevice;
 import com.ruoyi.ems.enums.DevOnlineStatus;
 import com.ruoyi.ems.model.AbilityPayload;
 import com.ruoyi.ems.model.CallResponse;
 import com.ruoyi.ems.model.MqttCacheMsg;
-import com.ruoyi.ems.model.Price;
 import com.ruoyi.ems.service.IElecMeterHService;
 import com.ruoyi.ems.service.IEmsDeviceService;
 import com.ruoyi.ems.service.IEmsObjAbilityCallLogService;
 import com.ruoyi.ems.service.IEmsObjAttrValueService;
 import com.ruoyi.ems.service.IEmsObjEventLogService;
-import com.ruoyi.ems.service.IEmsObjEventService;
 import com.ruoyi.ems.service.IEmsObjReportLogService;
-import com.ruoyi.ems.service.IMeterDeviceService;
 import com.ruoyi.ems.service.IPriceService;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.MapUtils;
 import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
 
-import javax.annotation.Resource;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -53,43 +40,19 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.stream.Collectors;
 
 /**
- * Mqtt基类
+ * 设备处理基类
  * <功能详细描述>
  *
  * @author lvwenbin
- * @version [版本号, 2025/3/3]
+ * @version [版本号, 2025/4/15]
  * @see [相关类/方法]
  * @since [产品/模块版本]
  */
-public abstract class MqttBaseHandler {
-    /**
-     * 日志服务
-     */
-    protected static final Logger log = LoggerFactory.getLogger(MqttBaseHandler.class);
-
-    /**
-     * 缓存设备属性
-     */
-    protected static final Map<String, Map<String, String>> attrCache = new ConcurrentHashMap<>();
-
-    /**
-     * 最后一次消息时间缓存key
-     */
-    protected static final String MQTT_LAST_TIME = "mqttLastMsgTime";
-
-    protected static final String LAST_HOUR_READING = "lastHourReading";
-
-    @Resource
-    @Qualifier("mqttTemplate")
-    protected MqttTemplate mqttTemplate;
-
+public abstract class BaseDevHandler extends BaseMqttHandler {
     @Autowired
     protected IEmsDeviceService deviceService;
 
     @Autowired
-    protected IMeterDeviceService meterDeviceService;
-
-    @Autowired
     protected IEmsObjAttrValueService objAttrValueService;
 
     @Autowired
@@ -116,15 +79,6 @@ public abstract class MqttBaseHandler {
     public abstract CallResponse<Void> call(AbilityPayload abilityParam);
 
     /**
-     * 抽象方法,用于消息处理
-     *
-     * @param deviceCode 设备编码
-     * @param payload    负载数据
-     * @return 处理结果字符串
-     */
-    public abstract void msgHandle(String deviceCode, String payload);
-
-    /**
      * 获取设备列表
      *
      * @return 设备列表
@@ -132,36 +86,14 @@ public abstract class MqttBaseHandler {
     public abstract List<EmsDevice> getDeviceList();
 
     /**
-     * 获取计量设备列表
-     *
-     * @return 设备列表
-     */
-    public abstract List<MeterDevice> getMeterDeviceList();
-
-    /**
-     * 添加消息ID到消息中
-     *
-     * @param msg 消息
-     * @return msgBody
+     * 缓存设备属性
      */
-    public String addMsgId(String msg, String msgIdKey, String msgIdValue) {
-        JSONObject json = JSONObject.parseObject(msg);
-        json.put(msgIdKey, msgIdValue);
-        return json.toString();
-    }
+    protected static final Map<String, Map<String, String>> attrCache = new ConcurrentHashMap<>();
 
     /**
-     * 发送MQTT消息
-     *
-     * @param topic    主题
-     * @param payload  负载数据
-     * @param qos      质量服务等级
-     * @param retained 是否保留消息
+     * 最后一次消息时间缓存key
      */
-    public void sendMqttMsg(String topic, String payload, int qos, boolean retained) {
-        log.info("[Send] Topic:{}, message:{}, qos:{}, retained:{}", topic, payload, qos, retained);
-        mqttTemplate.send(topic, payload, 2, false);
-    }
+    protected static final String MQTT_LAST_TIME = "mqttLastMsgTime";
 
     /**
      * 更新最后消息时
@@ -212,153 +144,6 @@ public abstract class MqttBaseHandler {
     }
 
     /**
-     * 产出小时电量计量
-     */
-    public int meterHourProd() {
-        int cnt = 0;
-
-        try {
-            List<MeterDevice> deviceList = getMeterDeviceList();
-            List<ElecMeterH> meterHList = new ArrayList<>();
-            Map<String, Price> priceMap = new ConcurrentHashMap<>();
-            Date date = DateUtils.adjustHour(new Date(), -1);
-
-            for (MeterDevice device : deviceList) {
-                ElecMeterH elecMeterH = meterHourProdSub(device);
-
-                if (null != elecMeterH) {
-                    Price price = priceMap.computeIfAbsent(device.getAreaCode(),
-                        k -> priceService.getElecHourPrice(device.getAreaCode(), date));
-                    completePrice(elecMeterH, price);
-                    meterHList.add(elecMeterH);
-                }
-            }
-
-            if (CollectionUtils.isNotEmpty(meterHList)) {
-                cnt = elecMeterHService.insertBatch(meterHList);
-            }
-        }
-        catch (Exception e) {
-            log.error("定时产出小时电量计量失败!", e);
-        }
-
-        return cnt;
-    }
-
-    private ElecMeterH meterHourProdSub(MeterDevice device) {
-        ElecMeterH elecMeterH = null;
-
-        // 获取设备属性缓存
-        Map<String, String> attrMap = attrCache.computeIfAbsent(device.getDeviceCode(), k -> new ConcurrentHashMap<>());
-
-        String lastMeterReading = attrMap.get(LAST_HOUR_READING);
-        String newMeterReading = attrMap.get("energy");
-
-        // 缓存不为空,使用缓存抄表计算
-        if (StringUtils.isNotEmpty(lastMeterReading)) {
-            elecMeterH = execHourMeter(device, lastMeterReading, newMeterReading);
-        }
-        // 缓存为空,使用数据库记录计算
-        else {
-            ElecMeterH dbElecMeterH = elecMeterHService.selectLatelyItem(device.getDeviceCode());
-
-            if (null != dbElecMeterH && null != dbElecMeterH.getMeterReading()) {
-                elecMeterH = execHourMeter(device, String.valueOf(dbElecMeterH.getMeterReading()), newMeterReading);
-            }
-            else {
-                // 无缓存也无数据库记录,则认为是首次上报
-                if (StringUtils.isNotEmpty(newMeterReading)) {
-                    updateCacheAfterSuccess(device.getDeviceCode(), LAST_HOUR_READING, newMeterReading);
-                }
-            }
-        }
-
-        return elecMeterH;
-    }
-
-    /**
-     * 执行小时抄表计算
-     *
-     * @param device           设备信息
-     * @param lastMeterReading 上次抄表值
-     * @param newMeterReading  本次抄表值
-     * @return
-     */
-    private ElecMeterH execHourMeter(MeterDevice device, String lastMeterReading, String newMeterReading) {
-        ElecMeterH elecMeterH = null;
-        BigDecimal lastEngValue = new BigDecimal(lastMeterReading);
-
-        if (StringUtils.isNotEmpty(newMeterReading)) {
-            BigDecimal newEngValue = new BigDecimal(newMeterReading);
-            // 计算电量差值
-            BigDecimal useQuantity = newEngValue.subtract(lastEngValue);
-            // 倍率计算
-            useQuantity = magnification(useQuantity, device.getMagnification());
-            // 更新缓存
-            updateCacheAfterSuccess(device.getDeviceCode(), LAST_HOUR_READING, newMeterReading);
-            // 封装计量对象
-            elecMeterH = buildElecMeterH(device, newEngValue, useQuantity);
-        }
-        else {
-            BigDecimal useQuantity = BigDecimal.ZERO;
-            // 封装计量对象
-            elecMeterH = buildElecMeterH(device, lastEngValue, useQuantity);
-        }
-
-        return elecMeterH;
-    }
-
-    /**
-     * 封装计量对象
-     *
-     * @param device      设备信息
-     * @param newEngValue 最新电量值
-     * @param useQuantity 用量差值
-     * @return ElecMeterH 计量对象
-     */
-    private ElecMeterH buildElecMeterH(MeterDevice device, BigDecimal newEngValue, BigDecimal useQuantity) {
-        Date date = DateUtils.adjustHour(new Date(), -1);
-        ElecMeterH elecMeterH = new ElecMeterH();
-        elecMeterH.setAreaCode(device.getAreaCode());
-        elecMeterH.setDeviceCode(device.getDeviceCode());
-        elecMeterH.setRecordTime(date);
-        elecMeterH.setDate(date);
-        elecMeterH.setTime(date);
-        elecMeterH.setTimeIndex(getHourIndex(date));
-        elecMeterH.setElecQuantity(useQuantity.doubleValue());
-        elecMeterH.setMeterReading(newEngValue.doubleValue());
-
-        return elecMeterH;
-    }
-
-    /**
-     * 倍率计算
-     *
-     * @param quantity      原始用量
-     * @param magnification 倍率
-     * @return
-     */
-    private BigDecimal magnification(BigDecimal quantity, Integer magnification) {
-        return null != magnification ? quantity.multiply(new BigDecimal(String.valueOf(magnification))) : quantity;
-    }
-
-    /**
-     * 完善价格信息
-     *
-     * @param elecMeterH 计量对象
-     * @param price      价格信息
-     */
-    private void completePrice(ElecMeterH elecMeterH, Price price) {
-        if (null != price) {
-            BigDecimal useQuantity = new BigDecimal(String.valueOf(elecMeterH.getElecQuantity()));
-            BigDecimal cost = useQuantity.multiply(new BigDecimal(String.valueOf(price.getPriceValue())));
-            elecMeterH.setMeterType(price.getMeterType());
-            elecMeterH.setMeterUnitPrice(price.getPriceValue());
-            elecMeterH.setUseElecCost(cost.doubleValue());
-        }
-    }
-
-    /**
      * 校验是否需要更新属性值
      *
      * @param jsonBody jsonBody 消息体
@@ -433,7 +218,7 @@ public abstract class MqttBaseHandler {
      * @param device 设备信息
      */
     public void refreshStatus(EmsDevice device, DevOnlineStatus status) {
-        if (device.getDeviceStatus() != status.getCode()) {
+        if (null == device.getDeviceStatus() || device.getDeviceStatus() != status.getCode()) {
             device.setDeviceStatus(status.getCode());
             deviceService.updateEmsDevice(device);
             triggerEvent(device, status == DevOnlineStatus.ONLINE ? "online" : "offline", null, new Date());
@@ -459,12 +244,7 @@ public abstract class MqttBaseHandler {
         objEventLogService.insertLog(eventLog);
     }
 
-    protected static int getHourIndex(Date date) {
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTime(date);
-        int hour = calendar.get(Calendar.HOUR_OF_DAY);
-        return hour + 1;
-    }
+
 
     protected EmsObjAbilityCallLog saveCallLog(AbilityPayload abilityParam, long sendTime, int callStatus) {
         EmsObjAbilityCallLog objAbilityCallLog = new EmsObjAbilityCallLog();

+ 205 - 0
ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/handle/BaseMeterDevHandler.java

@@ -0,0 +1,205 @@
+/*
+ * 文 件 名:  MeterDevHandler
+ * 版    权:  华设设计集团股份有限公司
+ * 描    述:  <描述>
+ * 修 改 人:  lvwenbin
+ * 修改时间:  2025/4/15
+ * 跟踪单号:  <跟踪单号>
+ * 修改单号:  <修改单号>
+ * 修改内容:  <修改内容>
+ */
+package com.ruoyi.ems.handle;
+
+import com.huashe.common.utils.DateUtils;
+import com.ruoyi.ems.domain.ElecMeterH;
+import com.ruoyi.ems.domain.MeterDevice;
+import com.ruoyi.ems.model.Price;
+import com.ruoyi.ems.service.IMeterDeviceService;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * 计量设备处理类
+ * <功能详细描述>
+ *
+ * @author lvwenbin
+ * @version [版本号, 2025/4/15]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+public abstract class BaseMeterDevHandler extends BaseDevHandler {
+    @Autowired
+    protected IMeterDeviceService meterDeviceService;
+
+    protected static final String LAST_HOUR_READING = "lastHourReading";
+
+    /**
+     * 获取计量设备列表
+     *
+     * @return 设备列表
+     */
+    public abstract List<MeterDevice> getMeterDeviceList();
+
+    /**
+     * 产出小时电量计量
+     */
+    public int meterHourProd() {
+        int cnt = 0;
+
+        try {
+            List<MeterDevice> deviceList = getMeterDeviceList();
+            List<ElecMeterH> meterHList = new ArrayList<>();
+            Map<String, Price> priceMap = new ConcurrentHashMap<>();
+            Date date = DateUtils.adjustHour(new Date(), -1);
+
+            for (MeterDevice device : deviceList) {
+                ElecMeterH elecMeterH = meterHourProdSub(device);
+
+                if (null != elecMeterH) {
+                    Price price = priceMap.computeIfAbsent(device.getAreaCode(),
+                        k -> priceService.getElecHourPrice(device.getAreaCode(), date));
+                    completePrice(elecMeterH, price);
+                    meterHList.add(elecMeterH);
+                }
+            }
+
+            if (CollectionUtils.isNotEmpty(meterHList)) {
+                cnt = elecMeterHService.insertBatch(meterHList);
+            }
+        }
+        catch (Exception e) {
+            log.error("定时产出小时电量计量失败!", e);
+        }
+
+        return cnt;
+    }
+
+    private ElecMeterH meterHourProdSub(MeterDevice device) {
+        ElecMeterH elecMeterH = null;
+
+        // 获取设备属性缓存
+        Map<String, String> attrMap = attrCache.computeIfAbsent(device.getDeviceCode(), k -> new ConcurrentHashMap<>());
+
+        String lastMeterReading = attrMap.get(LAST_HOUR_READING);
+        String newMeterReading = attrMap.get("energy");
+
+        // 缓存不为空,使用缓存抄表计算
+        if (StringUtils.isNotEmpty(lastMeterReading)) {
+            elecMeterH = execHourMeter(device, lastMeterReading, newMeterReading);
+        }
+        // 缓存为空,使用数据库记录计算
+        else {
+            ElecMeterH dbElecMeterH = elecMeterHService.selectLatelyItem(device.getDeviceCode());
+
+            if (null != dbElecMeterH && null != dbElecMeterH.getMeterReading()) {
+                elecMeterH = execHourMeter(device, String.valueOf(dbElecMeterH.getMeterReading()), newMeterReading);
+            }
+            else {
+                // 无缓存也无数据库记录,则认为是首次上报
+                if (StringUtils.isNotEmpty(newMeterReading)) {
+                    updateCacheAfterSuccess(device.getDeviceCode(), LAST_HOUR_READING, newMeterReading);
+                }
+            }
+        }
+
+        return elecMeterH;
+    }
+
+    /**
+     * 执行小时抄表计算
+     *
+     * @param device           设备信息
+     * @param lastMeterReading 上次抄表值
+     * @param newMeterReading  本次抄表值
+     * @return
+     */
+    private ElecMeterH execHourMeter(MeterDevice device, String lastMeterReading, String newMeterReading) {
+        ElecMeterH elecMeterH = null;
+        BigDecimal lastEngValue = new BigDecimal(lastMeterReading);
+
+        if (StringUtils.isNotEmpty(newMeterReading)) {
+            BigDecimal newEngValue = new BigDecimal(newMeterReading);
+            // 计算电量差值
+            BigDecimal useQuantity = newEngValue.subtract(lastEngValue);
+            // 倍率计算
+            useQuantity = magnification(useQuantity, device.getMagnification());
+            // 更新缓存
+            updateCacheAfterSuccess(device.getDeviceCode(), LAST_HOUR_READING, newMeterReading);
+            // 封装计量对象
+            elecMeterH = buildElecMeterH(device, newEngValue, useQuantity);
+        }
+        else {
+            BigDecimal useQuantity = BigDecimal.ZERO;
+            // 封装计量对象
+            elecMeterH = buildElecMeterH(device, lastEngValue, useQuantity);
+        }
+
+        return elecMeterH;
+    }
+
+    /**
+     * 封装计量对象
+     *
+     * @param device      设备信息
+     * @param newEngValue 最新电量值
+     * @param useQuantity 用量差值
+     * @return ElecMeterH 计量对象
+     */
+    private ElecMeterH buildElecMeterH(MeterDevice device, BigDecimal newEngValue, BigDecimal useQuantity) {
+        Date date = DateUtils.adjustHour(new Date(), -1);
+        ElecMeterH elecMeterH = new ElecMeterH();
+        elecMeterH.setAreaCode(device.getAreaCode());
+        elecMeterH.setDeviceCode(device.getDeviceCode());
+        elecMeterH.setRecordTime(date);
+        elecMeterH.setDate(date);
+        elecMeterH.setTime(date);
+        elecMeterH.setTimeIndex(getHourIndex(date));
+        elecMeterH.setElecQuantity(useQuantity.doubleValue());
+        elecMeterH.setMeterReading(newEngValue.doubleValue());
+
+        return elecMeterH;
+    }
+
+    /**
+     * 倍率计算
+     *
+     * @param quantity      原始用量
+     * @param magnification 倍率
+     * @return
+     */
+    private BigDecimal magnification(BigDecimal quantity, Integer magnification) {
+        return null != magnification ? quantity.multiply(new BigDecimal(String.valueOf(magnification))) : quantity;
+    }
+
+    /**
+     * 完善价格信息
+     *
+     * @param elecMeterH 计量对象
+     * @param price      价格信息
+     */
+    private void completePrice(ElecMeterH elecMeterH, Price price) {
+        if (null != price) {
+            BigDecimal useQuantity = new BigDecimal(String.valueOf(elecMeterH.getElecQuantity()));
+            BigDecimal cost = useQuantity.multiply(new BigDecimal(String.valueOf(price.getPriceValue())));
+            elecMeterH.setMeterType(price.getMeterType());
+            elecMeterH.setMeterUnitPrice(price.getPriceValue());
+            elecMeterH.setUseElecCost(cost.doubleValue());
+        }
+    }
+
+    protected static int getHourIndex(Date date) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        int hour = calendar.get(Calendar.HOUR_OF_DAY);
+        return hour + 1;
+    }
+}

+ 86 - 0
ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/handle/BaseMqttHandler.java

@@ -0,0 +1,86 @@
+/*
+ * 文 件 名:  BaseSendHandler
+ * 版    权:  华设设计集团股份有限公司
+ * 描    述:  <描述>
+ * 修 改 人:  lvwenbin
+ * 修改时间:  2025/3/3
+ * 跟踪单号:  <跟踪单号>
+ * 修改单号:  <修改单号>
+ * 修改内容:  <修改内容>
+ */
+package com.ruoyi.ems.handle;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.ruoyi.ems.core.MqttTemplate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Qualifier;
+
+import javax.annotation.Resource;
+
+/**
+ * Mqtt基类
+ * <功能详细描述>
+ *
+ * @author lvwenbin
+ * @version [版本号, 2025/3/3]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+public abstract class BaseMqttHandler {
+    /**
+     * 日志服务
+     */
+    protected static final Logger log = LoggerFactory.getLogger(BaseMqttHandler.class);
+
+    @Resource
+    @Qualifier("mqttTemplate")
+    protected MqttTemplate mqttTemplate;
+
+    /**
+     * 抽象方法,用于消息处理
+     *
+     * @param deviceCode 设备编码
+     * @param payload    负载数据
+     * @return 处理结果字符串
+     */
+    public abstract void msgHandle(String deviceCode, String payload);
+
+    /**
+     * 添加消息ID到消息中
+     *
+     * @param msg 消息
+     * @return msgBody
+     */
+    public String addMsgId(String msg, String msgIdKey, String msgIdValue) {
+        JSONObject json = JSONObject.parseObject(msg);
+        json.put(msgIdKey, msgIdValue);
+        return json.toString();
+    }
+
+    /**
+     * 发送MQTT消息
+     *
+     * @param topic    主题
+     * @param payload  负载数据
+     * @param qos      质量服务等级
+     * @param retained 是否保留消息
+     */
+    public void sendMqttMsg(String topic, String payload, int qos, boolean retained) {
+        log.info("[Send] Topic:{}, message:{}, qos:{}, retained:{}", topic, payload, qos, retained);
+        mqttTemplate.sendString(topic, payload, 2, false);
+    }
+
+    /**
+     * 发送MQTT消息
+     *
+     * @param topic    主题
+     * @param payload  负载数据
+     * @param qos      质量服务等级
+     * @param retained 是否保留消息
+     */
+    public void sendMqttHex(String topic, String payload, int qos, boolean retained) {
+        log.info("[Send] Topic:{}, message:{}, qos:{}, retained:{}", topic, payload, qos, retained);
+        mqttTemplate.sendHex(topic, payload, 2, false);
+    }
+}

+ 6 - 2
ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/handle/GeekOpenCbHandler.java

@@ -44,14 +44,18 @@ import java.util.List;
  * @since [产品/模块版本]
  */
 @Service
-public class GeekOpenCbHandler extends MqttBaseHandler {
+public class GeekOpenCbHandler extends BaseMeterDevHandler {
     private static final Logger log = LoggerFactory.getLogger(GeekOpenCbHandler.class);
 
     @Autowired
     private ObjectCache messageCache;
 
+    // 主题前缀
     private static final String TOPIC_PREFIX = "/device/dlq/";
 
+    // 设备模型代码
+    private static final String MODE_CODE = "M_W2_QF_GEEKOPEN";
+
     /**
      * 能力执行
      *
@@ -159,7 +163,7 @@ public class GeekOpenCbHandler extends MqttBaseHandler {
     @Override
     public List<EmsDevice> getDeviceList() {
         QueryDevice queryDevice = new QueryDevice();
-        queryDevice.setDeviceModel("M_W2_QF_GEEKOPEN");
+        queryDevice.setDeviceModel(MODE_CODE);
         return deviceService.selectList(queryDevice);
     }
 

+ 74 - 0
ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/handle/Keka86BsHandler.java

@@ -0,0 +1,74 @@
+/*
+ * 文 件 名:  KekaBs86Handler
+ * 版    权:  华设设计集团股份有限公司
+ * 描    述:  <描述>
+ * 修 改 人:  lvwenbin
+ * 修改时间:  2025/4/15
+ * 跟踪单号:  <跟踪单号>
+ * 修改单号:  <修改单号>
+ * 修改内容:  <修改内容>
+ */
+package com.ruoyi.ems.handle;
+
+import com.huashe.common.exception.Assert;
+import com.ruoyi.ems.domain.EmsDevice;
+import com.ruoyi.ems.domain.EmsObjAttrValue;
+import com.ruoyi.ems.model.AbilityPayload;
+import com.ruoyi.ems.model.CallResponse;
+import com.ruoyi.ems.model.QueryDevice;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * 86开关对接处理
+ * <功能详细描述>
+ *
+ * @author lvwenbin
+ * @version [版本号, 2025/4/15]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+@Service
+public class Keka86BsHandler extends BaseDevHandler {
+    // 主题前置
+    private static final String TOPIC_PREFIX = "/sc/dtu/ctl/";
+
+    // 设备模型代码
+    private static final String MODE_CODE = "M_W2_QS_KEKA_86";
+
+
+    @Override
+    public CallResponse<Void> call(AbilityPayload abilityParam) {
+        CallResponse<Void> callResponse = null;
+
+        // 获取协议属性
+        List<EmsObjAttrValue> attrList = objAttrValueService.selectByObjCode(MODE_CODE, abilityParam.getObjCode());
+        Assert.notEmpty(attrList, -1, "设备协议属性未配置!");
+        Map<String, String> attrMap = attrList.stream().collect(Collectors.toMap(EmsObjAttrValue::getAttrKey,EmsObjAttrValue::getAttrValue));
+
+        String gatewayId = attrMap.get("gatewayId");
+
+        // 发送消息到MQTT服务器
+        String topic = TOPIC_PREFIX + gatewayId;
+        sendMqttHex(topic, abilityParam.getAbilityParam(), 2, false);
+        saveCallLog(abilityParam, System.currentTimeMillis(), 0);
+        callResponse = new CallResponse<>(0, "执行成功!");
+        return callResponse;
+    }
+
+    @Override
+    public void msgHandle(String deviceCode, String payload) {
+
+    }
+
+    @Override
+    public List<EmsDevice> getDeviceList() {
+        QueryDevice queryDevice = new QueryDevice();
+        queryDevice.setDeviceModel(MODE_CODE);
+        return deviceService.selectList(queryDevice);
+    }
+}

+ 2 - 0
ems/ems-core/src/main/java/com/ruoyi/ems/domain/EmsObjAttrValue.java

@@ -1,5 +1,6 @@
 package com.ruoyi.ems.domain;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 
@@ -40,6 +41,7 @@ public class EmsObjAttrValue {
     /**
      * 更新时间
      */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date updateTime;
 
     public EmsObjAttrValue() {

+ 19 - 6
ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/EmsObjAttrServiceImpl.java

@@ -17,6 +17,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * 能源对象属性Service业务层处理
@@ -49,11 +51,12 @@ public class EmsObjAttrServiceImpl implements IEmsObjAttrService {
         EmsObjAttr objAttr = objAttrMapper.selectObjAttrById(id);
 
         if (null != objAttr) {
-            List<EmsObjAttrEnum> valueEnums = enumService.getObjAttrEnumList(objAttr.getModelCode(), null);
+            List<EmsObjAttrEnum> valueEnums = enumService.getObjAttrEnumList(objAttr.getModelCode(),
+                objAttr.getAttrKey());
             objAttr.setValueEnums(valueEnums);
         }
 
-        return objAttrMapper.selectObjAttrById(id);
+        return objAttr;
     }
 
     /**
@@ -67,9 +70,14 @@ public class EmsObjAttrServiceImpl implements IEmsObjAttrService {
         List<EmsObjAttr> list = objAttrMapper.selectObjAttrList(objAttr);
 
         if (CollectionUtils.isNotEmpty(list)) {
+            List<EmsObjAttrEnum> valueEnums = enumService.getObjAttrEnumList(objAttr.getModelCode(), null);
+            Map<String, List<EmsObjAttrEnum>> enumMap = valueEnums.stream()
+                .collect(Collectors.groupingBy(EmsObjAttrEnum::getAttrKey, Collectors.toList()));
+
             for (EmsObjAttr obj : list) {
-                List<EmsObjAttrEnum> valueEnums = enumService.getObjAttrEnumList(obj.getModelCode(), null);
-                obj.setValueEnums(valueEnums);
+                if (enumMap.containsKey(obj.getAttrKey())) {
+                    obj.setValueEnums(enumMap.get(obj.getAttrKey()));
+                }
             }
         }
 
@@ -81,9 +89,14 @@ public class EmsObjAttrServiceImpl implements IEmsObjAttrService {
         List<EmsObjAttr> list = objAttrMapper.selectByModelCode(modelCode);
 
         if (CollectionUtils.isNotEmpty(list)) {
+            List<EmsObjAttrEnum> valueEnums = enumService.getObjAttrEnumList(modelCode, null);
+            Map<String, List<EmsObjAttrEnum>> enumMap = valueEnums.stream()
+                .collect(Collectors.groupingBy(EmsObjAttrEnum::getAttrKey, Collectors.toList()));
+
             for (EmsObjAttr obj : list) {
-                List<EmsObjAttrEnum> valueEnums = enumService.getObjAttrEnumList(obj.getModelCode(), null);
-                obj.setValueEnums(valueEnums);
+                if (enumMap.containsKey(obj.getAttrKey())) {
+                    obj.setValueEnums(enumMap.get(obj.getAttrKey()));
+                }
             }
         }
 

+ 4 - 1
ems/ems-core/src/main/resources/mapper/ems/EmsDeviceMapper.xml

@@ -64,8 +64,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="selectByFlowRel" parameterType="com.ruoyi.ems.model.QueryDevice" resultMap="EmsDeviceResult">
-        <include refid="selectDeviceVo"/>
+        select
+            d.`id`, d.`device_code`, d.`device_name`, d.`device_brand`, d.`device_spec`, d.`device_status`, d.`location`, d.`location_ref`, d.`area_code`, d.`device_model`, d.`ref_facs`, d.`subsystem_code`, d.`ps_code`, p.`ps_name`, d.`create_time`, d.`update_time`
+        from adm_ems_device d
         LEFT JOIN adm_ems_flow_rel rel ON d.`device_code` = rel.`input_obj`
+        LEFT JOIN dim_ems_dev_process p ON p.`ps_code` = d.`ps_code`
         <where>
             <if test="areaCode != null  and areaCode != ''"> and d.`area_code` = #{areaCode}</if>
             <if test="locationRef != null  and locationRef != ''"> and d.`location_ref` = #{locationRef}</if>

+ 1 - 1
ems/ems-core/src/main/resources/mapper/ems/EmsObjAttrMapper.xml

@@ -32,7 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectAdmEmsObjAttrVo"/>
         <where>  
             <if test="modelCode != null  and modelCode != ''"> and model_code = #{modelCode}</if>
-            <if test="attr_group != null and attr_group != ''"> and attr_group = #{attrGroup}</if>
+            <if test="attrGroup != null and attrGroup != ''"> and attr_group = #{attrGroup}</if>
             <if test="attrKey != null  and attrKey != ''"> and attr_key = #{attrKey}</if>
             <if test="attrName != null  and attrName != ''"> and attr_name like concat('%', #{attrName}, '%')</if>
         </where>

+ 153 - 10
ems/sql/ems_init_data.sql

@@ -263,7 +263,8 @@ INSERT INTO `adm_op_energy_strategy_param` (`strategy_code`, `param_group`, `par
 
 -- 对象模型表
 INSERT INTO `adm_ems_obj_model` (`model_code`, `model_name`, `obj_type`, `ability_handler`, `event_handler`) VALUES ('M_W2_QF_GEEKOPEN', 'GeekOpen断路器', 2, 'http://172.192.13.95:9203/ems-dev-adapter/circuit-breaker/GeekOpen/abilityCall', NULL);
-
+INSERT INTO `adm_ems_obj_model` (`model_code`, `model_name`, `obj_type`, `ability_handler`, `event_handler`) VALUES ('M_Z040_DC-EVSE_TLD', '特来电直流桩', 2, NULL, NULL);
+INSERT INTO `adm_ems_obj_model` (`model_code`, `model_name`, `obj_type`, `ability_handler`, `event_handler`) VALUES ('M_W2_QS_KEKA_86', 'KEKA开关(86型)', 2, NULL, NULL);
 
 -- 对象属性DEMO数据
 INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'Base', 'version', '固件版本号', NULL, 'Value');
@@ -278,7 +279,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_W2_QF_GEEKOPEN', 'State', 'onState', '设备上电的默认状态', '1', 'Enum');
 INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'Measure', 'power', '实时功率', '瓦(W)', 'Value');
 INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'Measure', 'voltage', '实时电压', '伏特(V)', 'Value');
-INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'Measure', 'current', '实时电流', '安培(A)', 'Value');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'Measure', 'current', '实时电流', '安培(A)', 'Value');
 INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'Measure', 'energy', '累计电量值', '千瓦时(kW·h)', 'Value');
 INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'Protocol', 'protocol', '协议', NULL, 'Value');
 INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'Protocol', 'server', 'MQTT地址', NULL, 'Value');
@@ -288,6 +289,22 @@ 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_W2_QF_GEEKOPEN', 'Protocol', 'subcribe', '订阅主题', NULL, 'Value');
 INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'Protocol', 'publish', '发布主题', NULL, 'Value');
 
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_Z040_DC-EVSE_TLD', 'Base', 'model', '产品型号', NULL, 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_Z040_DC-EVSE_TLD', 'Base', 'inputVoltage', '输入电压', 'V AC', 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_Z040_DC-EVSE_TLD', 'Base', 'ratedPower', '额定功率', 'KW', 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_Z040_DC-EVSE_TLD', 'Base', 'outputVoltage', '输出电压', 'V DC', 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_Z040_DC-EVSE_TLD', 'Base', 'outputCurrent', '输出电流', 'A DC', 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_Z040_DC-EVSE_TLD', 'Measure', 'power', '实时功率', '瓦(W)', 'Value');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_Z040_DC-EVSE_TLD', 'Measure', 'voltage', '实时电压', '伏特(V)', 'Value');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_Z040_DC-EVSE_TLD', 'Measure', 'current', '实时电流', '安培(A)', 'Value');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_Z040_DC-EVSE_TLD', 'State', 'useState', '使用状态', NULL, 'Enum');
+
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QS_KEKA_86', 'Base', 'gatewayId', '网关编号', NULL, 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QS_KEKA_86', 'Protocol', 'protocol', '协议', NULL, 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QS_KEKA_86', 'Protocol', 'server', 'MQTT地址', NULL, 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QS_KEKA_86', 'Protocol', 'port', 'MQTT端口', NULL, 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QS_KEKA_86', 'Protocol', 'publish', '发布主题', NULL, 'String');
+INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QS_KEKA_86', 'Protocol', 'subcribe', '订阅主题', NULL, 'String');
 
 -- 对象属性DEMO数据
 INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('864142073640059', 'M_W2_QF_GEEKOPEN', 'current', '0.050', '2025-03-05 16:07:36');
@@ -303,6 +320,93 @@ INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `att
 INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('864142073640059', 'M_W2_QF_GEEKOPEN', 'timerInterval', '300', '2025-03-05 15:51:00');
 INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('864142073640059', 'M_W2_QF_GEEKOPEN', 'version', '1.0.1', '2025-03-05 15:51:00');
 
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000001', 'M_W2_QS_KEKA_86', 'gatewayId', '864814074089037', null);
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000001', 'M_W2_QS_KEKA_86', 'protocol', 'mqtt', null);
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000001', 'M_W2_QS_KEKA_86', 'server', 'xt.wenhq.top', null);
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000001', 'M_W2_QS_KEKA_86', 'port', '8581', null);
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000001', 'M_W2_QS_KEKA_86', 'publish', '/sc/dtu/rep/864814074089037', null);
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000001', 'M_W2_QS_KEKA_86', 'subcribe', '/sc/dtu/ctl/864814074089037', null);
+
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10001', 'M_Z040_DC-EVSE_TLD', 'model', 'TZD-H-G-32');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10001', 'M_Z040_DC-EVSE_TLD', 'inputVoltage', '380 VAC');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10001', 'M_Z040_DC-EVSE_TLD', 'ratedPower', '120KW');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10001', 'M_Z040_DC-EVSE_TLD', 'outputVoltage', '200VDC~1000VDC');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10001', 'M_Z040_DC-EVSE_TLD', 'outputCurrent', 'DC 1~400A');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10001', 'M_Z040_DC-EVSE_TLD', 'power', '100');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10001', 'M_Z040_DC-EVSE_TLD', 'voltage', '800');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10001', 'M_Z040_DC-EVSE_TLD', 'current', '125');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10001', 'M_Z040_DC-EVSE_TLD', 'useState', '1');
+
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10002', 'M_Z040_DC-EVSE_TLD', 'model', 'TZD-H-G-32');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10002', 'M_Z040_DC-EVSE_TLD', 'inputVoltage', '380 VAC');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10002', 'M_Z040_DC-EVSE_TLD', 'ratedPower', '120KW');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10002', 'M_Z040_DC-EVSE_TLD', 'outputVoltage', '200VDC~1000VDC');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10002', 'M_Z040_DC-EVSE_TLD', 'outputCurrent', 'DC 1~400A');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10002', 'M_Z040_DC-EVSE_TLD', 'power', '90');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10002', 'M_Z040_DC-EVSE_TLD', 'voltage', '800');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10002', 'M_Z040_DC-EVSE_TLD', 'current', '112.5');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10002', 'M_Z040_DC-EVSE_TLD', 'useState', '1');
+
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10003', 'M_Z040_DC-EVSE_TLD', 'model', 'TZD-H-G-32');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10003', 'M_Z040_DC-EVSE_TLD', 'inputVoltage', '380 VAC');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10003', 'M_Z040_DC-EVSE_TLD', 'ratedPower', '120KW');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10003', 'M_Z040_DC-EVSE_TLD', 'outputVoltage', '200VDC~1000VDC');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10003', 'M_Z040_DC-EVSE_TLD', 'outputCurrent', 'DC 1~400A');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10003', 'M_Z040_DC-EVSE_TLD', 'power', '80');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10003', 'M_Z040_DC-EVSE_TLD', 'voltage', '800');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10003', 'M_Z040_DC-EVSE_TLD', 'current', '100');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10003', 'M_Z040_DC-EVSE_TLD', 'useState', '1');
+
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10004', 'M_Z040_DC-EVSE_TLD', 'model', 'TZD-H-G-32');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10004', 'M_Z040_DC-EVSE_TLD', 'inputVoltage', '380 VAC');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10004', 'M_Z040_DC-EVSE_TLD', 'ratedPower', '120KW');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10004', 'M_Z040_DC-EVSE_TLD', 'outputVoltage', '200VDC~1000VDC');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10004', 'M_Z040_DC-EVSE_TLD', 'outputCurrent', 'DC 1~400A');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10004', 'M_Z040_DC-EVSE_TLD', 'power', '110');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10004', 'M_Z040_DC-EVSE_TLD', 'voltage', '800');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10004', 'M_Z040_DC-EVSE_TLD', 'current', '137.5');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-B-EVSE-10004', 'M_Z040_DC-EVSE_TLD', 'useState', '1');
+
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20001', 'M_Z040_DC-EVSE_TLD', 'model', 'TZD-H-G-32');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20001', 'M_Z040_DC-EVSE_TLD', 'inputVoltage', '380 VAC');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20001', 'M_Z040_DC-EVSE_TLD', 'ratedPower', '120KW');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20001', 'M_Z040_DC-EVSE_TLD', 'outputVoltage', '200VDC~1000VDC');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20001', 'M_Z040_DC-EVSE_TLD', 'outputCurrent', 'DC 1~400A');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20001', 'M_Z040_DC-EVSE_TLD', 'power', '100');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20001', 'M_Z040_DC-EVSE_TLD', 'voltage', '800');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20001', 'M_Z040_DC-EVSE_TLD', 'current', '125');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20001', 'M_Z040_DC-EVSE_TLD', 'useState', '1');
+
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20002', 'M_Z040_DC-EVSE_TLD', 'model', 'TZD-H-G-32');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20002', 'M_Z040_DC-EVSE_TLD', 'inputVoltage', '380 VAC');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20002', 'M_Z040_DC-EVSE_TLD', 'ratedPower', '120KW');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20002', 'M_Z040_DC-EVSE_TLD', 'outputVoltage', '200VDC~1000VDC');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20002', 'M_Z040_DC-EVSE_TLD', 'outputCurrent', 'DC 1~400A');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20002', 'M_Z040_DC-EVSE_TLD', 'power', '-');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20002', 'M_Z040_DC-EVSE_TLD', 'voltage', '-');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20002', 'M_Z040_DC-EVSE_TLD', 'current', '-');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20002', 'M_Z040_DC-EVSE_TLD', 'useState', '2');
+
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20003', 'M_Z040_DC-EVSE_TLD', 'model', 'TZD-H-G-32');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20003', 'M_Z040_DC-EVSE_TLD', 'inputVoltage', '380 VAC');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20003', 'M_Z040_DC-EVSE_TLD', 'ratedPower', '120KW');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20003', 'M_Z040_DC-EVSE_TLD', 'outputVoltage', '200VDC~1000VDC');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20003', 'M_Z040_DC-EVSE_TLD', 'outputCurrent', 'DC 1~400A');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20003', 'M_Z040_DC-EVSE_TLD', 'power', '80');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20003', 'M_Z040_DC-EVSE_TLD', 'voltage', '800');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20003', 'M_Z040_DC-EVSE_TLD', 'current', '100');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20003', 'M_Z040_DC-EVSE_TLD', 'useState', '1');
+
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-N0004', 'M_Z040_DC-EVSE_TLD', 'model', 'TZD-H-G-32');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20004', 'M_Z040_DC-EVSE_TLD', 'inputVoltage', '380 VAC');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20004', 'M_Z040_DC-EVSE_TLD', 'ratedPower', '120KW');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20004', 'M_Z040_DC-EVSE_TLD', 'outputVoltage', '200VDC~1000VDC');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20004', 'M_Z040_DC-EVSE_TLD', 'outputCurrent', 'DC 1~400A');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20004', 'M_Z040_DC-EVSE_TLD', 'power', '16');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20004', 'M_Z040_DC-EVSE_TLD', 'voltage', '800');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20004', 'M_Z040_DC-EVSE_TLD', 'current', '0.2');
+INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`) VALUES ('D-N-EVSE-20004', 'M_Z040_DC-EVSE_TLD', 'useState', '0');
+
 -- 对象属性值枚举
 INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_W2_QF_GEEKOPEN', 'onState', '0', '记忆');
 INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_W2_QF_GEEKOPEN', 'onState', '1', '分闸');
@@ -316,6 +420,9 @@ INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `at
 INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_W2_QF_GEEKOPEN', 'resetLock', '0', '关闭');
 INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_W2_QF_GEEKOPEN', 'resetLock', '1', '开启');
 
+INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_Z040_DC-EVSE_TLD', 'useState', '0', '空闲');
+INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_Z040_DC-EVSE_TLD', 'useState', '1', '使用中');
+INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_Z040_DC-EVSE_TLD', 'useState', '2', '不可用');
 
 -- 对象能力DEMO数据
 INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `ability_param`, `hidden_flag`) VALUES ('M_W2_QF_GEEKOPEN', 'Circuit-Closing', '分闸', '控制线路断电', '{\"type\":\"event\",\"key\":0}', 1);
@@ -330,6 +437,11 @@ 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`, `ability_param`, `hidden_flag`) VALUES ('M_W2_QF_GEEKOPEN', 'syncStatistic', '触发电量信息同步', '获取设备电量信息', '{\"type\":\"statistic\"}', 1);
 INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `ability_param`, `hidden_flag`) VALUES ('M_W2_QF_GEEKOPEN', 'syncInfo', '触发基础信息同步', '获取设备状态信息', '{\"type\":\"info\"}', 0);
 
+INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `ability_param`, `hidden_flag`) VALUES ('M_W2_QS_KEKA_86', 'light1-on', '灯1-开启', '灯1-开启', '01 06 10 21 00 01 1C C0', 1);
+INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `ability_param`, `hidden_flag`) VALUES ('M_W2_QS_KEKA_86', 'light1-off', '灯1-关闭', '灯1-关闭', '01 06 10 21 00 00 DD 00', 1);
+INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `ability_param`, `hidden_flag`) VALUES ('M_W2_QS_KEKA_86', 'light2-on', '灯2-开启', '灯2-开启', '01 06 10 22 00 01 EC C0', 1);
+INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `ability_param`, `hidden_flag`) VALUES ('M_W2_QS_KEKA_86', 'light2-off', '灯2-关闭', '灯2-关闭', '01 06 10 22 00 00 2D 00', 1);
+
 -- 对象事件DEMO数据
 INSERT INTO `adm_ems_obj_event` (`model_code`, `event_type`, `event_key`, `event_name`, `event_desc`, `event_code`, `ext_event_code`) VALUES ('M_W2', 2, 'overload', '过载', '功率过载', 'e-gy-0001', '0x0001');
 INSERT INTO `adm_ems_obj_event` (`model_code`, `event_type`, `event_key`, `event_name`, `event_desc`, `event_code`, `ext_event_code`) VALUES ('M_W2', 2, 'undervoltage', '欠压', '电压不足', 'e-gy-0002', '0x0002');
@@ -464,6 +576,17 @@ INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `dev
 INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-B-AP-10001-QF_01', '照明',    '施耐德', 'DX2121021', 1, '广场配电柜', '321283124S3001', '321283124S3001',  null, 'W201', 'QR', null);
 INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-B-AP-10001-QF_02', '风机',    '施耐德', 'DX2121021', 1, '广场配电柜', '321283124S3001', '321283124S3001',  null, 'W201', 'QR', null);
 
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-B-EVSE-10001', '1号充电桩',    '特来电', 'TCDZ-DCO.7', 1, '北区广场', '321283124S3001_CW-CD', '321283124S3001',  null, 'Z130', 'DC-EVSE', 'SYS_CD');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-B-EVSE-10002', '2号充电桩',    '特来电', 'TCDZ-DCO.7', 1, '北区广场', '321283124S3001_CW-CD', '321283124S3001',  null, 'Z130', 'DC-EVSE', 'SYS_CD');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-B-EVSE-10003', '3号充电桩',    '特来电', 'TCDZ-DCO.7', 1, '北区广场', '321283124S3001_CW-CD', '321283124S3001',  null, 'Z130', 'DC-EVSE', 'SYS_CD');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-B-EVSE-10004', '4号充电桩',    '特来电', 'TCDZ-DCO.7', 1, '北区广场', '321283124S3001_CW-CD', '321283124S3001',  null, 'Z130', 'DC-EVSE', 'SYS_CD');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-B-EVSE-20001', '1号充电桩',    '特来电', 'TCDZ-DCO.7', 1, '南区广场', '321283124S3002_CW-CD', '321283124S3002',  null, 'Z130', 'DC-EVSE', 'SYS_CD');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-B-EVSE-20002', '2号充电桩',    '特来电', 'TCDZ-DCO.7', 1, '南区广场', '321283124S3002_CW-CD', '321283124S3002',  null, 'Z130', 'DC-EVSE', 'SYS_CD');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-B-EVSE-20003', '3号充电桩',    '特来电', 'TCDZ-DCO.7', 1, '南区广场', '321283124S3002_CW-CD', '321283124S3002',  null, 'Z130', 'DC-EVSE', 'SYS_CD');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-B-EVSE-20004', '4号充电桩',    '特来电', 'TCDZ-DCO.7', 1, '南区广场', '321283124S3002_CW-CD', '321283124S3002',  null, 'Z130', 'DC-EVSE', 'SYS_CD');
+
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('864142073640059', '开水器断路器', NULL, NULL, 1, '综合楼茶水间', '321283124S300101', '321283124S3001', 'M_W2_QF_GEEKOPEN', 'W201', 'QF', 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-B-QS-10000001', '大厅照明开关', NULL, NULL, 1, '综合楼大厅', '321283124S300101', '321283124S3001', 'M_W2_QS_KEKA_86', 'W201', 'QS', 'SYS_BA');
 
 -- 区域&标签关系表
 insert into adm_obj_tag_rel (`obj_code`, `obj_type`, `tag_code`) VALUES ('B-101', 1, 'Area_00');
@@ -531,6 +654,7 @@ INSERT INTO adm_gw_elecprice_config (`cfg_code`, `elec_type`, `voltage_level`, `
 INSERT INTO adm_gw_elecprice_config (`cfg_code`, `elec_type`, `voltage_level`, `degree_price`, `fs_peak_degree_price`, `fs_high_degree_price`, `fs_low_degree_price`, `max_req_price`, `trans_capacity_price`) VALUES ('3003', 3, '35千伏', 0.7114, 1.4273, 1.1894,  0.3214, NULL, NULL);
 
 -- 两部制初始电价数据
+-- 两部制初始电价数据
 INSERT INTO adm_gw_elecprice_config (`cfg_code`, `elec_type`, `voltage_level`, `degree_price`, `fs_peak_degree_price`, `fs_high_degree_price`, `fs_low_degree_price`, `max_req_price`, `trans_capacity_price`) VALUES ('4001', 4, '1-10(20)千伏', 0.6587, 1.3592, 1.1327,  0.2757, 51.2, 32);
 INSERT INTO adm_gw_elecprice_config (`cfg_code`, `elec_type`, `voltage_level`, `degree_price`, `fs_peak_degree_price`, `fs_high_degree_price`, `fs_low_degree_price`, `max_req_price`, `trans_capacity_price`) VALUES ('4002', 4, '35千伏', 0.6337, 1.3076, 1.0897,  0.2652, 48, 30);
 INSERT INTO adm_gw_elecprice_config (`cfg_code`, `elec_type`, `voltage_level`, `degree_price`, `fs_peak_degree_price`, `fs_high_degree_price`, `fs_low_degree_price`, `max_req_price`, `trans_capacity_price`) VALUES ('4003', 4, '110千伏', 0.6087, 1.256, 1.0467,  0.2547, 44.8, 28);
@@ -558,6 +682,7 @@ INSERT INTO adm_co_charging_config (`area_code`, `elec_unit_price`, `elec_gt_com
 INSERT INTO `adm_ems_subsystem` (`system_code`, `system_name`, `short_name`, `man_facturer`, `contact_person`, `contact_number`, `maintainer_person`, `maintainer_number`, `descr`) VALUES ('SYS_GF', '光伏系统', '光伏', '南通', '张', '1380000', '李工', '123123', NULL);
 INSERT INTO `adm_ems_subsystem` (`system_code`, `system_name`, `short_name`, `man_facturer`, `contact_person`, `contact_number`, `maintainer_person`, `maintainer_number`, `descr`) VALUES ('SYS_CN', '储能系统', '储能', '储能厂商', '王', '122112', '陈', '21212', NULL);
 INSERT INTO `adm_ems_subsystem` (`system_code`, `system_name`, `short_name`, `man_facturer`, `contact_person`, `contact_number`, `maintainer_person`, `maintainer_number`, `descr`) VALUES ('SYS_BA', 'BA', '楼控', '楼控', '李', '12', '王', '121', NULL);
+INSERT INTO `adm_ems_subsystem` (`system_code`, `system_name`, `short_name`, `man_facturer`, `contact_person`, `contact_number`, `maintainer_person`, `maintainer_number`, `descr`) VALUES ('SYS_CD', '充电桩系统', '充电桩', '特来电', '张三', '1212121121', '刘工', '1212221111', NULL);
 
 
 -- 能源计量设备DEMO数据
@@ -644,7 +769,8 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-101', '321283124S3001', '2024', '202411', 2045, '2024-10-31', 2345, '2024-11-30', 300, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-101', '321283124S3001', '2024', '202412', 2345, '2024-11-30', 2570, '2024-12-31', 225, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-101', '321283124S3001', '2025', '202501', 2570, '2024-12-31', 2815, '2025-01-31', 245, NULL, NULL);
-
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-101', '321283124S3001', '2025', '202502', 2815, '2025-01-31', 3123, '2025-02-28', 308, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-101', '321283124S3001', '2025', '202503', 3123, '2025-02-28', 3441, '2025-03-31', 318, NULL, NULL);
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2024', '202401', 0, '2023-12-31', 100, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2024', '202402', 100, '2024-01-31', 238, '2024-02-28', 138, NULL, NULL);
@@ -659,6 +785,8 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2024', '202411', 2045, '2024-10-31', 2345, '2024-11-30', 300, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2024', '202412', 2345, '2024-11-30', 2620, '2024-12-31', 275, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2025', '202501', 2620, '2024-12-31', 2877, '2025-01-31', 257, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2025', '202502', 2877, '2025-01-31', 3111, '2025-02-28', 234, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2025', '202503', 3111, '2025-02-28', 3254, '2025-03-31', 143, NULL, NULL);
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2024', '202401', 0, '2023-12-31', 100, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2024', '202402', 100, '2024-01-31', 250, '2024-02-28', 150, NULL, NULL);
@@ -673,7 +801,8 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2024', '202411', 1213, '2024-10-31', 1413, '2024-11-30', 200, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2024', '202412', 1413, '2024-11-30', 1690, '2024-12-31', 277, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2025', '202501', 1690, '2024-12-31', 1928, '2025-01-31', 238, NULL, NULL);
-
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2025', '202502', 1928, '2025-01-31', 2247, '2025-02-28', 319, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2025', '202503', 2247, '2025-02-28', 2630, '2025-03-31', 383, NULL, NULL);
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2024', '202401', 0, '2023-12-31', 100, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2024', '202402', 100, '2024-01-31', 200, '2024-02-28', 100, NULL, NULL);
@@ -688,7 +817,8 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2024', '202411', 1000, '2024-10-31', 1100, '2024-11-30', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2024', '202412', 1100, '2024-11-30', 1200, '2024-12-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2025', '202501', 1200, '2024-11-30', 1300, '2025-01-31', 100, NULL, NULL);
-
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2025', '202502', 1300, '2025-01-31', 1400, '2025-02-28', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2025', '202503', 1400, '2025-02-28', 1500, '2025-03-31', 100, NULL, NULL);
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2024', '202401', 0, '2023-12-31', 100, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2024', '202402', 100, '2024-01-31', 200, '2024-02-28', 100, NULL, NULL);
@@ -703,7 +833,8 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2024', '202411', 1000, '2024-10-31', 1100, '2024-11-30', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2024', '202412', 1100, '2024-11-30', 1200, '2024-12-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2025', '202501', 1200, '2024-12-31', 1300, '2025-01-31', 100, NULL, NULL);
-
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2025', '202502', 1300, '2025-01-31', 1400, '2025-02-28', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2025', '202503', 1400, '2025-02-28', 1500, '2025-03-31', 100, NULL, NULL);
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2024', '202401', 0, '2023-12-31', 100, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2024', '202402', 100, '2024-01-31', 200, '2024-02-28', 100, NULL, NULL);
@@ -718,6 +849,8 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2024', '202411', 1000, '2024-10-31', 1100, '2024-11-30', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2024', '202412', 1100, '2024-11-30', 1200, '2024-12-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2025', '202501', 1200, '2024-12-31', 1300, '2025-01-31', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2025', '202502', 1300, '2025-01-31', 1400, '2025-02-28', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2025', '202503', 1400, '2025-02-28', 1500, '2025-03-31', 100, NULL, NULL);
 
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2024', '202401', 0, '2023-12-31', 100, '2024-01-31', 100, NULL, NULL);
@@ -733,7 +866,8 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2024', '202411', 1000, '2024-10-31', 1100, '2024-11-30', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2024', '202412', 1100, '2024-11-30', 1200, '2024-12-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2025', '202501', 1200, '2024-12-31', 1300, '2025-01-31', 100, NULL, NULL);
-
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2025', '202502', 1300, '2025-01-31', 1400, '2025-02-28', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2025', '202503', 1400, '2025-02-28', 1500, '2025-03-31', 100, NULL, NULL);
 
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-108', '321283124S3001', '2024', '202401', 0, '2023-12-31', 100, '2024-01-31', 100, NULL, NULL);
@@ -749,6 +883,8 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-108', '321283124S3001', '2024', '202411', 1000, '2024-10-31', 1100, '2024-11-30', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-108', '321283124S3001', '2024', '202412', 1100, '2024-11-30', 1200, '2024-12-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-108', '321283124S3001', '2025', '202501', 1200, '2024-12-31', 1300, '2025-01-31', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-108', '321283124S3001', '2025', '202502', 1300, '2025-01-31', 1400, '2025-02-28', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-108', '321283124S3001', '2025', '202503', 1400, '2025-02-28', 1500, '2025-03-31', 100, NULL, NULL);
 
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-109', '321283124S3001', '2024', '202401', 0, '2023-12-31', 100, '2024-01-31', 100, NULL, NULL);
@@ -764,6 +900,8 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-109', '321283124S3001', '2024', '202411', 1000, '2024-10-31', 1100, '2024-11-30', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-109', '321283124S3001', '2024', '202412', 1100, '2024-11-30', 1200, '2024-12-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-109', '321283124S3001', '2025', '202501', 1200, '2024-12-31', 1300, '2025-01-31', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-109', '321283124S3001', '2025', '202502', 1300, '2025-01-31', 1400, '2025-02-28', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-109', '321283124S3001', '2025', '202503', 1400, '2025-02-28', 1500, '2025-03-31', 100, NULL, NULL);
 
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2024', '202401', 0, '2023-12-31', 100, '2024-01-31', 100, NULL, NULL);
@@ -779,7 +917,8 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2024', '202411', 1000, '2024-10-31', 1100, '2024-11-30', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2024', '202412', 1100, '2024-11-30', 1200, '2024-12-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2025', '202501', 1200, '2024-12-31', 1300, '2025-01-31', 100, NULL, NULL);
-
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2025', '202502', 1300, '2025-01-31', 1400, '2025-02-28', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2025', '202503', 1400, '2025-02-28', 1500, '2025-03-31', 100, NULL, NULL);
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2024', '202401', 0, '2024-12-31', 1000, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2024', '202402', 1000, '2024-01-31', 2120, '2024-02-28', 1120, NULL, NULL);
@@ -792,8 +931,10 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2024', '202409', 8947, '2024-08-31', 10158, '2024-09-30', 1211, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2024', '202410', 10158, '2024-09-30', 11700, '2024-10-31', 1542, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2024', '202411', 11700, '2024-10-31', 13520, '2024-11-30', 1820, NULL, NULL);
-INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2024', '202412', 1100, '2024-11-30', 1200, '2024-12-31', 100, NULL, NULL);
-INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2025', '202501', 1200, '2024-12-31', 1300, '2025-01-31', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2024', '202412', 13520, '2024-11-30', 14720, '2024-12-31', 1200, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2025', '202501', 14720, '2024-12-31', 16720, '2025-01-31', 1200, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2025', '202502', 16720, '2025-01-31', 18820, '2025-02-28', 2100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2025', '202503', 18820, '2025-02-28', 19900, '2025-03-31', 1080, NULL, NULL);
 
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z120', '321283124S3001', '2024', '202401', 0, '2023-12-31', 25, '2024-01-31', 1250, NULL, NULL);
@@ -809,6 +950,8 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z120', '321283124S3001', '2024', '202411', 758, '2024-10-31', 948, '2024-11-30', 9500, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z120', '321283124S3001', '2024', '202412', 948, '2024-11-30', 1237, '2024-12-31', 14450, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z120', '321283124S3001', '2025', '202501', 1237, '2024-12-31', 1547, '2025-01-31', 15500, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z120', '321283124S3001', '2025', '202502', 1547, '2025-01-31', 1823, '2025-02-28', 13800, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z120', '321283124S3001', '2025', '202503', 1823, '2025-02-28', 2074, '2025-03-31', 12550, NULL, NULL);
 
 
 -- 自动抄表数据

+ 4 - 24
ems/sql/ems_server.sql

@@ -277,7 +277,8 @@ INSERT INTO `dim_ems_dev_process` (`ps_code`, `ps_name`, `desc`, `category_code`
 INSERT INTO `dim_ems_dev_process` (`ps_code`, `ps_name`, `desc`, `category_code`, `subcategory_code`, `version`) VALUES ('QF', '断路器', '空开', 'W', 'W2', null);
 INSERT INTO `dim_ems_dev_process` (`ps_code`, `ps_name`, `desc`, `category_code`, `subcategory_code`, `version`) VALUES ('QR', '漏电保护器', null, 'W', 'W2', null);
 INSERT INTO `dim_ems_dev_process` (`ps_code`, `ps_name`, `desc`, `category_code`, `subcategory_code`, `version`) VALUES ('QS', '隔离开关', null, 'W', 'W2', null);
-
+INSERT INTO `dim_ems_dev_process` (`ps_code`, `ps_name`, `desc`, `category_code`, `subcategory_code`, `version`) VALUES ('AC-EVSE', '交流充电桩', null, 'Z', 'Z040', null);
+INSERT INTO `dim_ems_dev_process` (`ps_code`, `ps_name`, `desc`, `category_code`, `subcategory_code`, `version`) VALUES ('DC-EVSE', '直流充电桩', null, 'Z', 'Z040', null);
 
 -- ----------------------------
 -- 标签分类
@@ -470,7 +471,7 @@ create table adm_ems_device  (
   `location`        varchar(200)    default null                 comment '安装位置',
   `location_ref`    varchar(64)     default null                 comment '安装位置关联区域',
   `area_code`       varchar(32)     default null                 comment '归属地块代码',
-  `device_model`    varchar(16)     default null                 comment '设备模型',
+  `device_model`    varchar(32)     default null                 comment '设备模型',
   `ref_facs`        varchar(64)     default null                 comment '归属设施代码',
   `ps_code`         varchar(16)     default null                 comment '工艺标识',
   `subsystem_code`  varchar(16)     default null                 comment '子系统名称',
@@ -561,34 +562,13 @@ create table adm_ems_obj_attr  (
 ) engine=innodb auto_increment=1 comment = '能源对象属性表';
 
 
--- 对象属性初始数据
-INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2', 'Base', 'voltageLevel', '电压等级', 'kV', 'Value');
-INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2', 'Base', 'frequency', '电流频率', 'Hz', 'Value');
-INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_E5', 'Base', 'installedCapacity', '装机容量', 'kw', 'Value');
-INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_C1', 'Base', 'storageCapacity',   '储能容量', 'kW-h', 'Value');
-
-INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_T', 'Base', 'ratedCapacity', '额定容量', 'kVA', 'Value');
-INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_T', 'Base', 'ratedVoltage', '额定电压', 'kV', 'Value');
-INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_T', 'Base', 'ratedFrequency', '额定频率', 'Hz', 'Value');
-INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_T', 'Base', 'phaseNumber', '相数', '相', 'Value');
-
-INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QR', 'Base', 'ratedVoltage', '额定电压', 'V', 'Value');
-INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QR', 'Base', 'ratedCurrent', '额定电流', 'A', 'Value');
-INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QR', 'Base', 'triggerCurrent', '触发电流', 'A', 'Value');
-INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QR', 'State', 'onOffState', '开关状态', null, 'Value');
-
-INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF', 'Base', 'ratedVoltage', '额定电压', 'V', 'Value');
-INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF', 'Base', 'ratedCurrent', '额定电流', 'A', 'Value');
-INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF', 'State', 'onOffState', '开关状态', null, 'Value');
-
-
 -- ----------------------------
 -- 能源对象属性值表
 -- ----------------------------
 drop table if exists adm_ems_obj_attr_enum;
 create table adm_ems_obj_attr_enum  (
   `id`               bigint(20)      not null auto_increment      comment '序号',
-  `model_code`       varchar(64)     not null                     comment '对象代码',
+  `model_code`       varchar(64)     not null                     comment '模型code',
   `attr_key`         varchar(128)    not null                     comment '属性标识',
   `attr_value`       varchar(32)     not null                     comment '属性枚举值',
   `attr_value_name`  varchar(32)     default null                 comment '属性枚举值描述',