فهرست منبع

Merge remote-tracking branch 'origin/master'

chen.cheng 3 ماه پیش
والد
کامیت
200774f776
27فایلهای تغییر یافته به همراه727 افزوده شده و 1123 حذف شده
  1. 0 101
      ems/ems-application/ems-admin/src/main/java/com/ruoyi/web/controller/ems/DeviceComponentController.java
  2. 0 10
      ems/ems-application/ems-admin/src/main/java/com/ruoyi/web/controller/ems/EmsObjAttrController.java
  3. 0 11
      ems/ems-application/ems-admin/src/main/java/com/ruoyi/web/controller/ems/EmsObjAttrValueController.java
  4. 1 1
      ems/ems-cloud/docker/Dockerfile
  5. 4 2
      ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/TaskExecutor.java
  6. 82 0
      ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/controller/ButtonSwitchController.java
  7. 4 3
      ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/controller/CircuitBreakerController.java
  8. 39 5
      ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/core/MqttTemplate.java
  9. 11 231
      ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/handle/BaseDevHandler.java
  10. 205 0
      ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/handle/BaseMeterDevHandler.java
  11. 86 0
      ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/handle/BaseMqttHandler.java
  12. 6 2
      ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/handle/GeekOpenCbHandler.java
  13. 74 0
      ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/handle/Keka86BsHandler.java
  14. 0 101
      ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/DeviceComponentController.java
  15. 0 11
      ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/EmsObjAttrValueController.java
  16. 0 177
      ems/ems-core/src/main/java/com/ruoyi/ems/domain/EmsDeviceComponent.java
  17. 2 0
      ems/ems-core/src/main/java/com/ruoyi/ems/domain/EmsObjAttrValue.java
  18. 0 78
      ems/ems-core/src/main/java/com/ruoyi/ems/mapper/EmsDeviceComponentMapper.java
  19. 0 77
      ems/ems-core/src/main/java/com/ruoyi/ems/service/IEmsDeviceComponentService.java
  20. 0 103
      ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/EmsDeviceComponentServiceImpl.java
  21. 20 15
      ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/EmsObjAttrServiceImpl.java
  22. 0 112
      ems/ems-core/src/main/resources/mapper/ems/EmsDeviceComponentMapper.xml
  23. 9 6
      ems/ems-core/src/main/resources/mapper/ems/EmsDeviceMapper.xml
  24. 1 1
      ems/ems-core/src/main/resources/mapper/ems/EmsObjAttrMapper.xml
  25. 171 25
      ems/sql/ems_init_data.sql
  26. 4 45
      ems/sql/ems_server.sql
  27. 8 6
      ems/sql/ems_sys_data.sql

+ 0 - 101
ems/ems-application/ems-admin/src/main/java/com/ruoyi/web/controller/ems/DeviceComponentController.java

@@ -1,101 +0,0 @@
-package com.ruoyi.web.controller.ems;
-
-import com.huashe.common.domain.AjaxResult;
-import com.ruoyi.common.annotation.Log;
-import com.ruoyi.common.core.controller.BaseController;
-import com.ruoyi.common.core.page.TableDataInfo;
-import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.ems.domain.EmsDeviceComponent;
-import com.ruoyi.ems.service.IEmsDeviceComponentService;
-import io.swagger.annotations.Api;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.List;
-
-/**
- * 能源设备部件Controller
- *
- * @author ruoyi
- * @date 2024-09-23
- */
-@RestController
-@RequestMapping("/ems/device/component")
-@Api(value = "DeviceController", description = "设备部件管理")
-public class DeviceComponentController extends BaseController {
-    @Autowired
-    private IEmsDeviceComponentService componentService;
-
-    /**
-     * 查询能源设备部件列表
-     */
-    @GetMapping("/list")
-    public TableDataInfo list(EmsDeviceComponent component) {
-        startPage();
-        List<EmsDeviceComponent> list = componentService.selectList(component);
-        return getDataTable(list);
-    }
-
-    /**
-     * 查询能源设备部件列表
-     *
-     * @param deviceCode 设备编号
-     * @return AjaxResult
-     */
-    @GetMapping("/listByDevice")
-    public AjaxResult list(@RequestParam(name = "deviceCode") String deviceCode) {
-        List<EmsDeviceComponent> list = componentService.selectByDeviceCode(deviceCode);
-        return success(list);
-    }
-
-    /**
-     * 获取能源设备部件详细信息
-     */
-    @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id) {
-        return success(componentService.selectById(id));
-    }
-
-    /**
-     * 获取能源设备部件详细信息
-     */
-    @GetMapping(value = "/getByCode")
-    public AjaxResult getByCode(@RequestParam("compoCode") String compoCode) {
-        return success(componentService.selectByCode(compoCode));
-    }
-
-    /**
-     * 新增能源设备部件
-     */
-    @Log(title = "能源设备部件", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody EmsDeviceComponent component) {
-        return toAjax(componentService.insertComponent(component));
-    }
-
-    /**
-     * 修改能源设备部件
-     */
-    @Log(title = "能源设备部件", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody EmsDeviceComponent component) {
-        return toAjax(componentService.updateComponent(component));
-    }
-
-    /**
-     * 删除能源设备部件
-     */
-    @Log(title = "能源设备部件", businessType = BusinessType.DELETE)
-    @DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids) {
-        return toAjax(componentService.deleteComponentByIds(ids));
-    }
-}

+ 0 - 10
ems/ems-application/ems-admin/src/main/java/com/ruoyi/web/controller/ems/EmsObjAttrController.java

@@ -8,12 +8,10 @@ import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.exception.Assert;
 import com.ruoyi.ems.domain.EmsDevice;
-import com.ruoyi.ems.domain.EmsDeviceComponent;
 import com.ruoyi.ems.domain.EmsFacs;
 import com.ruoyi.ems.domain.EmsObjAttr;
 import com.ruoyi.ems.domain.EmsObjAttrValue;
 import com.ruoyi.ems.enums.DevObjType;
-import com.ruoyi.ems.service.IEmsDeviceComponentService;
 import com.ruoyi.ems.service.IEmsDeviceService;
 import com.ruoyi.ems.service.IEmsFacsService;
 import com.ruoyi.ems.service.IEmsObjAttrService;
@@ -56,9 +54,6 @@ public class EmsObjAttrController extends BaseController {
     @Autowired
     private IEmsFacsService facsService;
 
-    @Autowired
-    private IEmsDeviceComponentService componentService;
-
     /**
      * 查询能源对象属性列表
      */
@@ -98,11 +93,6 @@ public class EmsObjAttrController extends BaseController {
                 Assert.notNull(device, -1, "能源设备不存在");
                 modeCode = device.getDeviceModel();
             }
-            else if (objType == DevObjType.COMPONENT.getCode()) {
-                EmsDeviceComponent devCompo = componentService.selectByCode(objCode);
-                Assert.notNull(devCompo, -1, "设备部件不存在");
-                modeCode = devCompo.getCompoModel();
-            }
 
             JSONObject json = new JSONObject();
             json.put("objType", objType);

+ 0 - 11
ems/ems-application/ems-admin/src/main/java/com/ruoyi/web/controller/ems/EmsObjAttrValueController.java

@@ -6,11 +6,9 @@ import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.exception.Assert;
 import com.ruoyi.ems.domain.EmsDevice;
-import com.ruoyi.ems.domain.EmsDeviceComponent;
 import com.ruoyi.ems.domain.EmsFacs;
 import com.ruoyi.ems.domain.EmsObjAttrValue;
 import com.ruoyi.ems.enums.DevObjType;
-import com.ruoyi.ems.service.IEmsDeviceComponentService;
 import com.ruoyi.ems.service.IEmsDeviceService;
 import com.ruoyi.ems.service.IEmsFacsService;
 import com.ruoyi.ems.service.IEmsObjAttrValueService;
@@ -47,9 +45,6 @@ public class EmsObjAttrValueController extends BaseController {
     @Autowired
     private IEmsFacsService facsService;
 
-    @Autowired
-    private IEmsDeviceComponentService componentService;
-
     /**
      * 查询能源对象属性值列表
      */
@@ -117,12 +112,6 @@ public class EmsObjAttrValueController extends BaseController {
             modeCode = device.getDeviceModel();
             cnt = objAttrValueService.deleteByObjCode(modeCode, objCode);
         }
-        else if (objType == DevObjType.COMPONENT.getCode()) {
-            EmsDeviceComponent devCompo = componentService.selectByCode(objCode);
-            Assert.notNull(devCompo, -1, "设备部件不存在");
-            modeCode = devCompo.getCompoModel();
-            cnt = objAttrValueService.deleteByObjCode(modeCode, objCode);
-        }
 
         return toAjax(cnt);
     }

+ 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);
+    }
+}

+ 0 - 101
ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/DeviceComponentController.java

@@ -1,101 +0,0 @@
-package com.ruoyi.ems.controller;
-
-import com.ruoyi.common.core.web.controller.BaseController;
-import com.huashe.common.domain.AjaxResult;
-import com.ruoyi.common.core.web.page.TableDataInfo;
-import com.ruoyi.common.log.annotation.Log;
-import com.ruoyi.common.log.enums.BusinessType;
-import com.ruoyi.ems.domain.EmsDeviceComponent;
-import com.ruoyi.ems.service.IEmsDeviceComponentService;
-import io.swagger.annotations.Api;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.List;
-
-/**
- * 能源设备部件Controller
- *
- * @author ruoyi
- * @date 2024-09-23
- */
-@RestController
-@RequestMapping("/device/component")
-@Api(value = "DeviceController", description = "设备部件管理")
-public class DeviceComponentController extends BaseController {
-    @Autowired
-    private IEmsDeviceComponentService componentService;
-
-    /**
-     * 查询能源设备部件列表
-     */
-    @GetMapping("/list")
-    public TableDataInfo list(EmsDeviceComponent component) {
-        startPage();
-        List<EmsDeviceComponent> list = componentService.selectList(component);
-        return getDataTable(list);
-    }
-
-    /**
-     * 查询能源设备部件列表
-     *
-     * @param deviceCode 设备编号
-     * @return AjaxResult
-     */
-    @GetMapping("/listByDevice")
-    public AjaxResult list(@RequestParam(name = "deviceCode") String deviceCode) {
-        List<EmsDeviceComponent> list = componentService.selectByDeviceCode(deviceCode);
-        return success(list);
-    }
-
-    /**
-     * 获取能源设备部件详细信息
-     */
-    @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id) {
-        return success(componentService.selectById(id));
-    }
-
-    /**
-     * 获取能源设备部件详细信息
-     */
-    @GetMapping(value = "/getByCode")
-    public AjaxResult getByCode(@RequestParam("compoCode") String compoCode) {
-        return success(componentService.selectByCode(compoCode));
-    }
-
-    /**
-     * 新增能源设备部件
-     */
-    @Log(title = "能源设备部件", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody EmsDeviceComponent component) {
-        return toAjax(componentService.insertComponent(component));
-    }
-
-    /**
-     * 修改能源设备部件
-     */
-    @Log(title = "能源设备部件", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody EmsDeviceComponent component) {
-        return toAjax(componentService.updateComponent(component));
-    }
-
-    /**
-     * 删除能源设备部件
-     */
-    @Log(title = "能源设备部件", businessType = BusinessType.DELETE)
-    @DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids) {
-        return toAjax(componentService.deleteComponentByIds(ids));
-    }
-}

+ 0 - 11
ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/EmsObjAttrValueController.java

@@ -6,11 +6,9 @@ import com.ruoyi.common.core.web.controller.BaseController;
 import com.ruoyi.common.log.annotation.Log;
 import com.ruoyi.common.log.enums.BusinessType;
 import com.ruoyi.ems.domain.EmsDevice;
-import com.ruoyi.ems.domain.EmsDeviceComponent;
 import com.ruoyi.ems.domain.EmsFacs;
 import com.ruoyi.ems.domain.EmsObjAttrValue;
 import com.ruoyi.ems.enums.DevObjType;
-import com.ruoyi.ems.service.IEmsDeviceComponentService;
 import com.ruoyi.ems.service.IEmsDeviceService;
 import com.ruoyi.ems.service.IEmsFacsService;
 import com.ruoyi.ems.service.IEmsObjAttrValueService;
@@ -47,9 +45,6 @@ public class EmsObjAttrValueController extends BaseController {
     @Autowired
     private IEmsFacsService facsService;
 
-    @Autowired
-    private IEmsDeviceComponentService componentService;
-
     /**
      * 查询能源对象属性值列表
      */
@@ -116,12 +111,6 @@ public class EmsObjAttrValueController extends BaseController {
             modeCode = device.getDeviceModel();
             cnt = objAttrValueService.deleteByObjCode(modeCode, objCode);
         }
-        else if (objType == DevObjType.COMPONENT.getCode()) {
-            EmsDeviceComponent devCompo = componentService.selectByCode(objCode);
-            Assert.notNull(devCompo, -1, "设备部件不存在");
-            modeCode = devCompo.getCompoModel();
-            cnt = objAttrValueService.deleteByObjCode(modeCode, objCode);
-        }
 
         return toAjax(cnt);
     }

+ 0 - 177
ems/ems-core/src/main/java/com/ruoyi/ems/domain/EmsDeviceComponent.java

@@ -1,177 +0,0 @@
-package com.ruoyi.ems.domain;
-
-import com.huashe.common.domain.BaseEntity;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-
-/**
- * 能源设备部件对象 adm_ems_device_component
- * 
- * @author ruoyi
- * @date 2024-09-23
- */
-public class EmsDeviceComponent extends BaseEntity
-{
-    private static final long serialVersionUID = 1L;
-
-    /** 序号 */
-    private Long id;
-
-    /** 设备编码 */
-    private String deviceCode;
-
-    /** 部件编码 */
-    private String compoCode;
-
-    /** 部件标签 */
-    private String compoTag;
-
-    /** 外部系统编码 */
-    private String extCompoCode;
-
-    /**
-     * 工艺代码
-     */
-    private String psCode;
-
-    /** 工艺名称 */
-    private String psName;
-
-    /** 部件模型 */
-    private String compoModel;
-
-    /** 部件品牌 */
-    private String compoBrand;
-
-    /** 部件型号 */
-    private String compoSpec;
-
-    /** 祖籍列表 */
-    private String ancestors;
-
-    /** 上级部件 */
-    private String parentCompo;
-
-    public void setId(Long id) 
-    {
-        this.id = id;
-    }
-
-    public Long getId() 
-    {
-        return id;
-    }
-    public void setDeviceCode(String deviceCode) 
-    {
-        this.deviceCode = deviceCode;
-    }
-
-    public String getDeviceCode() 
-    {
-        return deviceCode;
-    }
-    public void setCompoCode(String compoCode) 
-    {
-        this.compoCode = compoCode;
-    }
-
-    public String getCompoCode() 
-    {
-        return compoCode;
-    }
-
-    public String getCompoTag() {
-        return compoTag;
-    }
-
-    public void setCompoTag(String compoTag) {
-        this.compoTag = compoTag;
-    }
-
-    public void setExtCompoCode(String extCompoCode)
-    {
-        this.extCompoCode = extCompoCode;
-    }
-
-    public String getExtCompoCode() 
-    {
-        return extCompoCode;
-    }
-
-    public String getPsCode() {
-        return psCode;
-    }
-
-    public void setPsCode(String psCode) {
-        this.psCode = psCode;
-    }
-
-    public String getPsName() {
-        return psName;
-    }
-
-    public void setPsName(String psName) {
-        this.psName = psName;
-    }
-
-    public void setCompoModel(String compoModel)
-    {
-        this.compoModel = compoModel;
-    }
-
-    public String getCompoModel() 
-    {
-        return compoModel;
-    }
-    public void setCompoBrand(String compoBrand) 
-    {
-        this.compoBrand = compoBrand;
-    }
-
-    public String getCompoBrand() 
-    {
-        return compoBrand;
-    }
-    public void setCompoSpec(String compoSpec) 
-    {
-        this.compoSpec = compoSpec;
-    }
-
-    public String getCompoSpec() 
-    {
-        return compoSpec;
-    }
-    public void setAncestors(String ancestors) 
-    {
-        this.ancestors = ancestors;
-    }
-
-    public String getAncestors() 
-    {
-        return ancestors;
-    }
-    public void setParentCompo(String parentCompo) 
-    {
-        this.parentCompo = parentCompo;
-    }
-
-    public String getParentCompo() 
-    {
-        return parentCompo;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("deviceCode", getDeviceCode())
-            .append("compoCode", getCompoCode())
-            .append("extCompoCode", getExtCompoCode())
-            .append("compoModel", getCompoModel())
-            .append("compoBrand", getCompoBrand())
-            .append("compoSpec", getCompoSpec())
-            .append("ancestors", getAncestors())
-            .append("parentCompo", getParentCompo())
-            .toString();
-    }
-}

+ 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() {

+ 0 - 78
ems/ems-core/src/main/java/com/ruoyi/ems/mapper/EmsDeviceComponentMapper.java

@@ -1,78 +0,0 @@
-package com.ruoyi.ems.mapper;
-
-import com.ruoyi.ems.domain.EmsDeviceComponent;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * 能源设备部件Mapper接口
- *
- * @author ruoyi
- * @date 2024-09-23
- */
-public interface EmsDeviceComponentMapper {
-    /**
-     * 查询能源设备部件
-     *
-     * @param id 能源设备部件主键
-     * @return 能源设备部件
-     */
-    EmsDeviceComponent selectById(Long id);
-
-    /**
-     * 查询能源设备部件
-     *
-     * @param compoCode 能源设备部件代码
-     * @return 能源设备部件
-     */
-    EmsDeviceComponent selectByCode(@Param("compoCode") String compoCode);
-
-    /**
-     * 查询能源设备部件列表
-     *
-     * @param deviceComponent 能源设备部件
-     * @return 能源设备部件集合
-     */
-    List<EmsDeviceComponent> selectList(EmsDeviceComponent deviceComponent);
-
-    /**
-     * 查询能源设备部件列表
-     *
-     * @param deviceCode 设备代码
-     * @return 能源设备部件集合
-     */
-    List<EmsDeviceComponent> selectByDeviceCode(@Param("deviceCode") String deviceCode);
-
-    /**
-     * 新增能源设备部件
-     *
-     * @param deviceComponent 能源设备部件
-     * @return 结果
-     */
-    int insertComponent(EmsDeviceComponent deviceComponent);
-
-    /**
-     * 修改能源设备部件
-     *
-     * @param deviceComponent 能源设备部件
-     * @return 结果
-     */
-    int updateComponent(EmsDeviceComponent deviceComponent);
-
-    /**
-     * 删除能源设备部件
-     *
-     * @param id 能源设备部件主键
-     * @return 结果
-     */
-    int deleteComponentById(Long id);
-
-    /**
-     * 批量删除能源设备部件
-     *
-     * @param ids 需要删除的数据主键集合
-     * @return 结果
-     */
-    int deleteComponentByIds(Long[] ids);
-}

+ 0 - 77
ems/ems-core/src/main/java/com/ruoyi/ems/service/IEmsDeviceComponentService.java

@@ -1,77 +0,0 @@
-package com.ruoyi.ems.service;
-
-import com.ruoyi.ems.domain.EmsDeviceComponent;
-
-import java.util.List;
-
-/**
- * 能源设备部件Service接口
- *
- * @author ruoyi
- * @date 2024-09-23
- */
-public interface IEmsDeviceComponentService {
-    /**
-     * 查询能源设备部件
-     *
-     * @param id 能源设备部件主键
-     * @return 能源设备部件
-     */
-    EmsDeviceComponent selectById(Long id);
-
-    /**
-     * 查询能源设备部件
-     *
-     * @param componentCode 设备部件代码
-     * @return 能源设备部件
-     */
-    EmsDeviceComponent selectByCode(String componentCode);
-
-    /**
-     * 查询能源设备部件列表
-     *
-     * @param deviceComponent 能源设备部件
-     * @return 能源设备部件集合
-     */
-    List<EmsDeviceComponent> selectList(EmsDeviceComponent deviceComponent);
-
-    /**
-     * 查询能源设备部件列表
-     *
-     * @param deviceCode 设备编号
-     * @return 能源设备部件集合
-     */
-    List<EmsDeviceComponent> selectByDeviceCode(String deviceCode);
-
-    /**
-     * 新增能源设备部件
-     *
-     * @param deviceComponent 能源设备部件
-     * @return 结果
-     */
-    int insertComponent(EmsDeviceComponent deviceComponent);
-
-    /**
-     * 修改能源设备部件
-     *
-     * @param deviceComponent 能源设备部件
-     * @return 结果
-     */
-    int updateComponent(EmsDeviceComponent deviceComponent);
-
-    /**
-     * 批量删除能源设备部件
-     *
-     * @param ids 需要删除的能源设备部件主键集合
-     * @return 结果
-     */
-    int deleteComponentByIds(Long[] ids);
-
-    /**
-     * 删除能源设备部件信息
-     *
-     * @param id 能源设备部件主键
-     * @return 结果
-     */
-    int deleteComponentById(Long id);
-}

+ 0 - 103
ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/EmsDeviceComponentServiceImpl.java

@@ -1,103 +0,0 @@
-package com.ruoyi.ems.service.impl;
-
-import com.ruoyi.ems.domain.EmsDeviceComponent;
-import com.ruoyi.ems.mapper.EmsDeviceComponentMapper;
-import com.ruoyi.ems.service.IEmsDeviceComponentService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * 能源设备部件Service业务层处理
- *
- * @author ruoyi
- * @date 2024-09-23
- */
-@Service
-public class EmsDeviceComponentServiceImpl implements IEmsDeviceComponentService {
-    @Autowired
-    private EmsDeviceComponentMapper componentMapper;
-
-    /**
-     * 查询能源设备部件
-     *
-     * @param id 能源设备部件主键
-     * @return 能源设备部件
-     */
-    @Override
-    public EmsDeviceComponent selectById(Long id) {
-        return componentMapper.selectById(id);
-    }
-
-    @Override
-    public EmsDeviceComponent selectByCode(String componentCode) {
-        return componentMapper.selectByCode(componentCode);
-    }
-
-    /**
-     * 查询能源设备部件列表
-     *
-     * @param deviceComponent 能源设备部件
-     * @return 能源设备部件
-     */
-    @Override
-    public List<EmsDeviceComponent> selectList(EmsDeviceComponent deviceComponent) {
-        return componentMapper.selectList(deviceComponent);
-    }
-
-    /**
-     * 根据设备编号查询能源设备部件
-     *
-     * @param deviceCode 设备编号
-     * @return 能源设备部件
-     */
-    @Override
-    public List<EmsDeviceComponent> selectByDeviceCode(String deviceCode) {
-        return componentMapper.selectByDeviceCode(deviceCode);
-    }
-
-    /**
-     * 新增能源设备部件
-     *
-     * @param deviceComponent 能源设备部件
-     * @return 结果
-     */
-    @Override
-    public int insertComponent(EmsDeviceComponent deviceComponent) {
-        return componentMapper.insertComponent(deviceComponent);
-    }
-
-    /**
-     * 修改能源设备部件
-     *
-     * @param deviceComponent 能源设备部件
-     * @return 结果
-     */
-    @Override
-    public int updateComponent(EmsDeviceComponent deviceComponent) {
-        return componentMapper.updateComponent(deviceComponent);
-    }
-
-    /**
-     * 批量删除能源设备部件
-     *
-     * @param ids 需要删除的能源设备部件主键
-     * @return 结果
-     */
-    @Override
-    public int deleteComponentByIds(Long[] ids) {
-        return componentMapper.deleteComponentByIds(ids);
-    }
-
-    /**
-     * 删除能源设备部件信息
-     *
-     * @param id 能源设备部件主键
-     * @return 结果
-     */
-    @Override
-    public int deleteComponentById(Long id) {
-        return componentMapper.deleteComponentById(id);
-    }
-}

+ 20 - 15
ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/EmsObjAttrServiceImpl.java

@@ -1,14 +1,12 @@
 package com.ruoyi.ems.service.impl;
 
 import com.ruoyi.ems.domain.EmsDevice;
-import com.ruoyi.ems.domain.EmsDeviceComponent;
 import com.ruoyi.ems.domain.EmsFacs;
 import com.ruoyi.ems.domain.EmsObjAttr;
 import com.ruoyi.ems.domain.EmsObjAttrDto;
 import com.ruoyi.ems.domain.EmsObjAttrEnum;
 import com.ruoyi.ems.enums.DevObjType;
 import com.ruoyi.ems.mapper.EmsObjAttrMapper;
-import com.ruoyi.ems.service.IEmsDeviceComponentService;
 import com.ruoyi.ems.service.IEmsDeviceService;
 import com.ruoyi.ems.service.IEmsFacsService;
 import com.ruoyi.ems.service.IEmsObjAttrEnumService;
@@ -19,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业务层处理
@@ -40,9 +40,6 @@ public class EmsObjAttrServiceImpl implements IEmsObjAttrService {
     @Autowired
     private IEmsFacsService facsService;
 
-    @Autowired
-    private IEmsDeviceComponentService componentService;
-
     /**
      * 查询能源对象属性
      *
@@ -54,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;
     }
 
     /**
@@ -72,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()));
+                }
             }
         }
 
@@ -86,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()));
+                }
             }
         }
 
@@ -217,10 +225,7 @@ public class EmsObjAttrServiceImpl implements IEmsObjAttrService {
             EmsDevice device = deviceService.selectByCode(objCode);
             modeCode = null != device ? device.getDeviceModel() : null;
         }
-        else if (objType == DevObjType.COMPONENT.getCode()) {
-            EmsDeviceComponent devCompo = componentService.selectByCode(objCode);
-            modeCode = null != devCompo ? devCompo.getCompoModel() : null;
-        }
+
         return modeCode;
     }
 }

+ 0 - 112
ems/ems-core/src/main/resources/mapper/ems/EmsDeviceComponentMapper.xml

@@ -1,112 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.ruoyi.ems.mapper.EmsDeviceComponentMapper">
-    
-    <resultMap type="com.ruoyi.ems.domain.EmsDeviceComponent" id="DeviceComponentResult">
-        <result property="id"    column="id"    />
-        <result property="deviceCode"      column="device_code"    />
-        <result property="compoCode"       column="compo_code"    />
-        <result property="compoTag"        column="compo_tag"    />
-        <result property="extCompoCode"    column="ext_compo_code"    />
-        <result property="psCode"          column="ps_code"    />
-        <result property="psName"          column="ps_name"    />
-        <result property="compoModel"      column="compo_model"    />
-        <result property="compoBrand"      column="compo_brand"    />
-        <result property="compoSpec"       column="compo_spec"    />
-        <result property="ancestors"       column="ancestors"    />
-        <result property="parentCompo"     column="parent_compo"    />
-    </resultMap>
-
-    <sql id="selectComponentVo">
-        select id, device_code, compo_code, compo_tag, ps_code, ext_compo_code, compo_model, compo_brand, compo_spec, ancestors, parent_compo from adm_ems_device_component
-    </sql>
-
-    <select id="selectList" parameterType="com.ruoyi.ems.domain.EmsDeviceComponent" resultMap="DeviceComponentResult">
-        <include refid="selectComponentVo"/>
-        <where>  
-            <if test="deviceCode != null  and deviceCode != ''"> and device_code = #{deviceCode}</if>
-            <if test="compoCode != null  and compoCode != ''"> and compo_code = #{compoCode}</if>
-            <if test="psCode != null  and psCode != ''"> and ps_code = #{psCode}</if>
-            <if test="extCompoCode != null  and extCompoCode != ''"> and ext_compo_code = #{extCompoCode}</if>
-            <if test="compoModel != null  and compoModel != ''"> and compo_model = #{compoModel}</if>
-            <if test="parentCompo != null  and parentCompo != ''"> and parent_compo = #{parentCompo}</if>
-        </where>
-    </select>
-
-    <select id="selectByDeviceCode" parameterType="java.lang.String" resultMap="DeviceComponentResult">
-        select
-            c.id, c.device_code, c.compo_code, c.compo_tag, c.ps_code, c.ext_compo_code, c.compo_model, c.compo_brand, c.compo_spec, c.ancestors, c.parent_compo,
-            p.ps_name
-        from adm_ems_device_component c
-          left join dim_ems_dev_process p on c.ps_code = p.ps_code
-        where device_code = #{deviceCode}
-    </select>
-
-    <select id="selectById" parameterType="Long" resultMap="DeviceComponentResult">
-        <include refid="selectComponentVo"/>
-        where id = #{id}
-    </select>
-
-    <select id="selectByCode"  resultMap="DeviceComponentResult">
-        <include refid="selectComponentVo"/>
-        where compo_code = #{compoCode}
-    </select>
-
-    <insert id="insertComponent" parameterType="com.ruoyi.ems.domain.EmsDeviceComponent" useGeneratedKeys="true" keyProperty="id">
-        insert into adm_ems_device_component
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="deviceCode != null and deviceCode != ''">device_code,</if>
-            <if test="compoCode != null and compoCode != ''">compo_code,</if>
-            <if test="compoTag != null and compoTag != ''">compo_tag,</if>
-            <if test="psCode != null and psCode != ''">ps_code,</if>
-            <if test="extCompoCode != null">ext_compo_code,</if>
-            <if test="compoModel != null">compo_model,</if>
-            <if test="compoBrand != null">compo_brand,</if>
-            <if test="compoSpec != null">compo_spec,</if>
-            <if test="ancestors != null">ancestors,</if>
-            <if test="parentCompo != null">parent_compo,</if>
-         </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="deviceCode != null and deviceCode != ''">#{deviceCode},</if>
-            <if test="compoCode != null and compoCode != ''">#{compoCode},</if>
-            <if test="compoTag != null and compoTag != ''">#{compoTag},</if>
-            <if test="psCode != null and psCode != ''">#{psCode},</if>
-            <if test="extCompoCode != null">#{extCompoCode},</if>
-            <if test="compoModel != null">#{compoModel},</if>
-            <if test="compoBrand != null">#{compoBrand},</if>
-            <if test="compoSpec != null">#{compoSpec},</if>
-            <if test="ancestors != null">#{ancestors},</if>
-            <if test="parentCompo != null">#{parentCompo},</if>
-         </trim>
-    </insert>
-
-    <update id="updateComponent" parameterType="com.ruoyi.ems.domain.EmsDeviceComponent">
-        update adm_ems_device_component
-        <trim prefix="SET" suffixOverrides=",">
-            <if test="deviceCode != null and deviceCode != ''">device_code = #{deviceCode},</if>
-            <if test="compoCode != null and compoCode != ''">compo_code = #{compoCode},</if>
-            <if test="compoTag != null and compoTag != ''">compo_tag = #{compoTag},</if>
-            <if test="psCode != null and psCode != ''">ps_code = #{psCode},</if>
-            <if test="extCompoCode != null">ext_compo_code = #{extCompoCode},</if>
-            <if test="compoModel != null">compo_model = #{compoModel},</if>
-            <if test="compoBrand != null">compo_brand = #{compoBrand},</if>
-            <if test="compoSpec != null">compo_spec = #{compoSpec},</if>
-            <if test="ancestors != null">ancestors = #{ancestors},</if>
-            <if test="parentCompo != null">parent_compo = #{parentCompo},</if>
-        </trim>
-        where id = #{id}
-    </update>
-
-    <delete id="deleteComponentById" parameterType="Long">
-        delete from adm_ems_device_component where id = #{id}
-    </delete>
-
-    <delete id="deleteComponentByIds" parameterType="String">
-        delete from adm_ems_device_component where id in 
-        <foreach item="id" collection="array" open="(" separator="," close=")">
-            #{id}
-        </foreach>
-    </delete>
-</mapper>

+ 9 - 6
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>
@@ -220,23 +223,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="calcDeviceOnlineSummary">
         SELECT
-            device_status  deviceStatus,
             sc.`name` typeName,
             count( devc.id ) total,
-            SUM( CASE WHEN device_status = '0' THEN 1 ELSE 0 END ) AS onlineCount
+            SUM( CASE WHEN device_status = 1 THEN 1 ELSE 0 END ) AS onlineCount
         FROM
             adm_ems_device devc
-            INNER JOIN dim_ems_facs_subcategory sc ON devc.device_category = sc.`code`
+            LEFT JOIN adm_ems_facs f ON devc.`ref_facs` = f.`facs_code`
+            LEFT JOIN dim_ems_facs_subcategory sc ON f.facs_subcategory = sc.`code`
             <if test="areaCode !=null and areaCode!=''">
                 LEFT JOIN adm_area area ON devc.location_ref = area.area_code
             </if>
         <where>
             <if test="areaCode !=null and areaCode!=''">
-                area.ancestors like CONCAT('%/',#{areaCode},'/%')
+                area.ancestors like CONCAT('%',#{areaCode},'%')
             </if>
         </where>
         GROUP BY
-           device_category
+          facs_subcategory
     </select>
 
 </mapper>

+ 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>

+ 171 - 25
ems/sql/ems_init_data.sql

@@ -228,10 +228,12 @@ INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_category`, `facs_sub
 INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_category`, `facs_subcategory`, `enable`, `ref_area`, `facs_model`) VALUES ('Z102', '北区-室外照明', 'Z', 'Z010', 1, '321283124S3001', null);
 INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_category`, `facs_subcategory`, `enable`, `ref_area`, `facs_model`) VALUES ('Z110', '北区-公共设施', 'Z', 'Z040', 1, '321283124S3001', null);
 INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_category`, `facs_subcategory`, `enable`, `ref_area`, `facs_model`) VALUES ('Z120', '北区-空调设施', 'Z', 'Z020', 1, '321283124S3001', null);
+INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_category`, `facs_subcategory`, `enable`, `ref_area`, `facs_model`) VALUES ('Z130', '北区-充电桩', 'Z', 'Z040', 1, '321283124S3001', null);
 INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_category`, `facs_subcategory`, `enable`, `ref_area`, `facs_model`) VALUES ('Z201', '南区-室内照明', 'Z', 'Z010', 1, '321283124S3002', null);
 INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_category`, `facs_subcategory`, `enable`, `ref_area`, `facs_model`) VALUES ('Z202', '南区-室外照明', 'Z', 'Z010', 1, '321283124S3002', null);
 INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_category`, `facs_subcategory`, `enable`, `ref_area`, `facs_model`) VALUES ('Z210', '南区-公共设施', 'Z', 'Z040', 1, '321283124S3002', null);
 INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_category`, `facs_subcategory`, `enable`, `ref_area`, `facs_model`) VALUES ('Z220', '南区-空调设施', 'Z', 'Z020', 1, '321283124S3002', null);
+INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_category`, `facs_subcategory`, `enable`, `ref_area`, `facs_model`) VALUES ('Z230', '南区-充电桩', 'Z', 'Z040', 1, '321283124S3002', null);
 
 
 -- 策略初始数据
@@ -261,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');
@@ -276,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');
@@ -286,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');
@@ -301,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', '分闸');
@@ -314,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);
@@ -328,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');
@@ -337,11 +451,13 @@ INSERT INTO `adm_ems_obj_event` (`model_code`, `event_type`, `event_key`, `event
 INSERT INTO `adm_ems_flow_rel` (`export_obj`, `export_obj_type`, `input_obj`, `input_obj_type`, `ems_cls`, `flow_desc`) VALUES ('W201', 1, 'Z101', 1, '45', '供电');
 INSERT INTO `adm_ems_flow_rel` (`export_obj`, `export_obj_type`, `input_obj`, `input_obj_type`, `ems_cls`, `flow_desc`) VALUES ('E501', 1, 'W201', 1, '45', '供电');
 INSERT INTO `adm_ems_flow_rel` (`export_obj`, `export_obj_type`, `input_obj`, `input_obj_type`, `ems_cls`, `flow_desc`) VALUES ('E501', 1, 'Z101', 1, '45', '供电');
-INSERT INTO `adm_ems_flow_rel` (`export_obj`, `export_obj_type`, `input_obj`, `input_obj_type`, `ems_cls`, `flow_desc`) VALUES ('D-B-T-1001', 2, 'D-B-1001', 2, '45', '供电');
-INSERT INTO `adm_ems_flow_rel` (`export_obj`, `export_obj_type`, `input_obj`, `input_obj_type`, `ems_cls`, `flow_desc`) VALUES ('D-B-T-1001', 2, 'D-B-1002', 2, '45', '供电');
-INSERT INTO `adm_ems_flow_rel` (`export_obj`, `export_obj_type`, `input_obj`, `input_obj_type`, `ems_cls`, `flow_desc`) VALUES ('D-N-T-1002', 2, 'D-N-1001', 2, '45', '供电');
-INSERT INTO `adm_ems_flow_rel` (`export_obj`, `export_obj_type`, `input_obj`, `input_obj_type`, `ems_cls`, `flow_desc`) VALUES ('D-N-T-1002', 2, 'D-N-1002', 2, '45', '供电');
-
+INSERT INTO `adm_ems_flow_rel` (`export_obj`, `export_obj_type`, `input_obj`, `input_obj_type`, `ems_cls`, `flow_desc`) VALUES ('D-B-T-1001', 2, 'D-B-AP-10001', 2, '45', '供电');
+INSERT INTO `adm_ems_flow_rel` (`export_obj`, `export_obj_type`, `input_obj`, `input_obj_type`, `ems_cls`, `flow_desc`) VALUES ('D-B-T-1001', 2, 'D-B-AP-10002', 2, '45', '供电');
+INSERT INTO `adm_ems_flow_rel` (`export_obj`, `export_obj_type`, `input_obj`, `input_obj_type`, `ems_cls`, `flow_desc`) VALUES ('D-N-T-1002', 2, 'D-N-AP-10001', 2, '45', '供电');
+INSERT INTO `adm_ems_flow_rel` (`export_obj`, `export_obj_type`, `input_obj`, `input_obj_type`, `ems_cls`, `flow_desc`) VALUES ('D-N-T-1002', 2, 'D-N-AP-10002', 2, '45', '供电');
+INSERT INTO `adm_ems_flow_rel` (`export_obj`, `export_obj_type`, `input_obj`, `input_obj_type`, `ems_cls`, `flow_desc`) VALUES ('D-B-AP-10001', 2, 'D-B-AP-10001-QR_00', 2, '45', '供电');
+INSERT INTO `adm_ems_flow_rel` (`export_obj`, `export_obj_type`, `input_obj`, `input_obj_type`, `ems_cls`, `flow_desc`) VALUES ('D-B-AP-10001', 2, 'D-B-AP-10001-QF_01', 2, '45', '供电');
+INSERT INTO `adm_ems_flow_rel` (`export_obj`, `export_obj_type`, `input_obj`, `input_obj_type`, `ems_cls`, `flow_desc`) VALUES ('D-B-AP-10001', 2, 'D-B-AP-10001-QF_02', 2, '45', '供电');
 
 -- 能源设备
 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 ( 'Z010-R101-001', '开水炉',              '美的', 'C10', '2', '开水间', 'B-101', '321283124S3001', null, 'Z110', null, 'SYS_BA');
@@ -451,16 +567,26 @@ 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-T-1001', '北区总变',      '西门子', 'T221123', 1, '北区', '321283124S3001', '321283124S3001', 'M_W2_T', 'W201', 'T', 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-N-T-1002', '南区总变',      '西门子', 'T221212', 1, '南区',  '321283124S3002', '321283124S3002', 'M_W2_T', 'W201', 'T', 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-1001', '北区-综合楼配电',  '安科瑞', 'DX2121021', 1, '综合楼配电间', '321283124S3001', '321283124S3001', null, 'W201', 'AP', 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-1002', '北区-广场配电',    '安科瑞', 'DX2121021', 1, '广场配电柜', '321283124S3001', '321283124S3001',  null, 'W201', 'AP', 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-N-1001', '南区-综合楼配电',  '安科瑞', 'DX2121021', 1, '综合楼配电间', '321283124S3002', '321283124S3002', null, 'W202', 'AP', 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-N-1002', '南区-广场配电',    '安科瑞', 'DX2121021', 1, '广场配电柜',  '321283124S3002', '321283124S3002', null, 'W202', 'AP', null);
-
--- 设备部件表
-INSERT INTO `adm_ems_device_component` (`device_code`, `compo_code`, `compo_tag`, `ps_code`, `ext_compo_code`, `compo_model`, `compo_brand`, `compo_spec`, `ancestors`, `parent_compo`) VALUES ('D-B-1001', 'D-B-1001-QR_00', '总开', 'QR', '0x000101', 'M_W2_QR', '德力西', 'DZ47P-C10', '', '');
-INSERT INTO `adm_ems_device_component` (`device_code`, `compo_code`, `compo_tag`, `ps_code`, `ext_compo_code`, `compo_model`, `compo_brand`, `compo_spec`, `ancestors`, `parent_compo`) VALUES ('D-B-1001', 'D-B-1001-QF_01', '照明', 'QF', '0x000102', 'M_W2_QF', '施耐德', 'NXB-63-C16', 'D-B-1001-QS_00/D-B-1001-QF_01', 'D-B-1001-QS_00');
-INSERT INTO `adm_ems_device_component` (`device_code`, `compo_code`, `compo_tag`, `ps_code`, `ext_compo_code`, `compo_model`, `compo_brand`, `compo_spec`, `ancestors`, `parent_compo`) VALUES ('D-B-1001', 'D-B-1001-QF_02', '风机', 'QF', '0x000103', 'M_W2_QF', '施耐德', 'NXB-63-C16', 'D-B-1001-QS_00/D-B-1001-QF_02', 'D-B-1001-QS_00');
-
+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', '北区-综合楼配电',  '安科瑞', 'DX2121021', 1, '综合楼配电间', '321283124S3001', '321283124S3001', null, 'W201', 'AP', 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-10002', '北区-广场配电',    '安科瑞', 'DX2121021', 1, '广场配电柜', '321283124S3001', '321283124S3001',  null, 'W201', 'AP', 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-N-AP-10001', '南区-综合楼配电',  '安科瑞', 'DX2121021', 1, '综合楼配电间', '321283124S3002', '321283124S3002', null, 'W202', 'AP', 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-N-AP-10002', '南区-广场配电',    '安科瑞', 'DX2121021', 1, '广场配电柜',  '321283124S3002', '321283124S3002', null, 'W202', 'AP', 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-QR_00', '总开',    '施耐德', '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_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');
@@ -528,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);
@@ -555,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数据
@@ -641,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);
@@ -656,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);
@@ -670,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);
@@ -685,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);
@@ -700,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);
@@ -715,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);
@@ -730,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);
@@ -746,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);
@@ -761,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);
@@ -776,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);
@@ -789,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);
@@ -806,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 - 45
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 '子系统名称',
@@ -482,27 +483,6 @@ create table adm_ems_device  (
 
 
 -- ----------------------------
--- 能源设备部件表
--- ----------------------------
-drop table if exists adm_ems_device_component;
-create table adm_ems_device_component  (
-  `id`              bigint(20)      not null auto_increment      comment '序号',
-  `device_code`     varchar(64)     not null                     comment '设备编码',
-  `compo_code`      varchar(64)     not null                     comment '部件编码',
-  `compo_tag`       varchar(256)    default null                 comment '部件标签',
-  `ps_code`         varchar(16)     not null                     comment '工艺标识',
-  `ext_compo_code`  varchar(256)    default null                 comment '外部系统编码',
-  `compo_model`     varchar(16)     default null                 comment '部件模型',
-  `compo_brand`     varchar(128)    default null                 comment '部件品牌',
-  `compo_spec`      varchar(128)    default null                 comment '部件型号',
-  `ancestors`       varchar(256)    default null                 comment '祖籍列表',
-  `parent_compo`    varchar(64)     default null                 comment '上级部件',
-  primary key (`id`),
-  unique key ux_device_component(`device_code`,`compo_code`)
-) engine=innodb auto_increment=1 comment = '能源设备部件表';
-
-
--- ----------------------------
 -- 计量设备表
 -- ----------------------------
 drop table if exists adm_meter_device;
@@ -582,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 '属性枚举值描述',

+ 8 - 6
ems/sql/ems_sys_data.sql

@@ -39,12 +39,13 @@ insert into sys_menu values ('99', '开发工具', '0', '99', 'tool',
 insert into sys_menu values ('100',  '服务区',         '1',   '1',   '/largeScreen',         'view/servicearea',          '', 1, 0, 'C', '0', '0',   'view:service-area',      'servicearea',    'admin', sysdate(), '', null, '园区能源概览');
 insert into sys_menu values ('101',  '主路光伏',       '1',   '2',   'hp-view-rpv',        'view/road/photovoltaic',    '', 1, 0, 'C', '0', '0',   'view:road-pv',           'photovoltaic',   'admin', sysdate(), '', null, '主路光伏概览');
 
-insert into sys_menu values ('112',  '源网',            '2',    '1',  'strategy-pg',        'mgr/powergrid',             '', 1, 0, 'C', '0', '0',   'power-mgr:pg',           'powergrid',      'admin', sysdate(), '', null, '源网协调');
-insert into sys_menu values ('113',  '储能',            '2',    '2',  'strategy-gs',        'mgr/powerstore',            '', 1, 0, 'C', '0', '0',   'power-mgr:gs',           'powerstore',     'admin', sysdate(), '', null, '网储互动');
-insert into sys_menu values ('114',  '负荷',            '2',    '3',  'strategy-use',       'mgr/poweruse',              '', 1, 0, 'C', '0', '0',   'power-mgr:use',          'powerload',      'admin', sysdate(), '', null, '源荷互动');
-insert into sys_menu values ('115',  '配电',            '2',    '4',  'powerdist',          'mgr/powerdist',             '', 1, 0, 'C', '0', '0',   'power-mgr:dist',         'powerdist',      'admin', sysdate(), '', null, '配电监控');
-insert into sys_menu values ('116',  '计费',            '2',    '5',  'charging',           'mgr/charging',              '', 1, 0, 'C', '0', '0',   'power-mgr:charging',     'charging',       'admin', sysdate(), '', null, '配电监控');
-insert into sys_menu values ('117',  '策略',            '2',    '6',  'strategy-mgr',       'mgr/strategy',              '', 1, 0, 'C', '0', '0',   'power-mgr:strategy',     'strategy',       'admin', sysdate(), '', null, '管能策略');
+insert into sys_menu values ('111',  '源网',            '2',    '1',  'strategy-pg',        'mgr/powergrid',             '', 1, 0, 'C', '0', '0',   'power-mgr:pg',           'powergrid',      'admin', sysdate(), '', null, '源网协调');
+insert into sys_menu values ('112',  '储能',            '2',    '2',  'strategy-gs',        'mgr/powerstore',            '', 1, 0, 'C', '0', '0',   'power-mgr:gs',           'powerstore',     'admin', sysdate(), '', null, '网储互动');
+insert into sys_menu values ('113',  '负荷',            '2',    '3',  'strategy-use',       'mgr/poweruse',              '', 1, 0, 'C', '0', '0',   'power-mgr:use',          'powerload',      'admin', sysdate(), '', null, '源荷互动');
+insert into sys_menu values ('114',  '配电',            '2',    '4',  'powerdist',          'mgr/powerdist',             '', 1, 0, 'C', '0', '0',   'power-mgr:dist',         'powerdist',      'admin', sysdate(), '', null, '配电监控');
+insert into sys_menu values ('115',  '充电桩',          '2',    '5',  'charging-pile',      'mgr/chargingpile',          '', 1, 0, 'C', '0', '0',   'power-mgr:chargingpile', 'chargingpile',   'admin', sysdate(), '', null, '充电桩');
+insert into sys_menu values ('116',  '计费',            '2',    '6',  'charging',           'mgr/charging',              '', 1, 0, 'C', '0', '0',   'power-mgr:charging',     'charging',       'admin', sysdate(), '', null, '计费');
+insert into sys_menu values ('117',  '策略',            '2',    '7',  'strategy-mgr',       'mgr/strategy',              '', 1, 0, 'C', '0', '0',   'power-mgr:strategy',     'strategy',       'admin', sysdate(), '', null, '管能策略');
 
 insert into sys_menu values ('126',  '产能分析',       '3',    '1',  'power-prod',         'analysis/power/prod',       '', 1, 0, 'C', '0', '0',    'analysis:power:prod',    'energyprod',     'admin', sysdate(), '', null, '产能分析');
 insert into sys_menu values ('127',  '储能分析',       '3',    '2',  'power-store',        'analysis/power/store',      '', 1, 0, 'C', '0', '0',    'analysis:power:store',   'energystore',    'admin', sysdate(), '', null, '储能分析');
@@ -351,6 +352,7 @@ INSERT INTO sys_role_menu (`role_id`, `menu_id`) VALUES (2, 113);
 INSERT INTO sys_role_menu (`role_id`, `menu_id`) VALUES (2, 114);
 INSERT INTO sys_role_menu (`role_id`, `menu_id`) VALUES (2, 115);
 INSERT INTO sys_role_menu (`role_id`, `menu_id`) VALUES (2, 116);
+INSERT INTO sys_role_menu (`role_id`, `menu_id`) VALUES (2, 117);
 INSERT INTO sys_role_menu (`role_id`, `menu_id`) VALUES (2, 120);
 INSERT INTO sys_role_menu (`role_id`, `menu_id`) VALUES (2, 121);
 INSERT INTO sys_role_menu (`role_id`, `menu_id`) VALUES (2, 126);