瀏覽代碼

电价配置、用能报表接口修改

learshaw 3 天之前
父節點
當前提交
c3f4cec4b6
共有 25 個文件被更改,包括 603 次插入301 次删除
  1. 76 4
      ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/handle/BaseMeterDevHandler.java
  2. 95 32
      ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/handle/InDoorEnergyHandler.java
  3. 2 0
      ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/ElecMeterHController.java
  4. 14 3
      ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/EnergyConsumptionController.java
  5. 4 3
      ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/MeterBoundaryController.java
  6. 61 54
      ems/ems-core/src/main/java/com/ruoyi/ems/domain/ElecGwPriceConfig.java
  7. 68 40
      ems/ems-core/src/main/java/com/ruoyi/ems/domain/ElecPriceStrategy.java
  8. 6 1
      ems/ems-core/src/main/java/com/ruoyi/ems/mapper/ElecConsumptionMapper.java
  9. 2 1
      ems/ems-core/src/main/java/com/ruoyi/ems/mapper/EmsFacsMapper.java
  10. 26 16
      ems/ems-core/src/main/java/com/ruoyi/ems/model/BoundaryObj.java
  11. 19 6
      ems/ems-core/src/main/java/com/ruoyi/ems/model/ElecConsumptionVO.java
  12. 1 1
      ems/ems-core/src/main/java/com/ruoyi/ems/service/IBoundaryObjService.java
  13. 1 0
      ems/ems-core/src/main/java/com/ruoyi/ems/service/IElecConsumptionService.java
  14. 1 1
      ems/ems-core/src/main/java/com/ruoyi/ems/service/IEmsFacsService.java
  15. 10 10
      ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/BoundaryObjServiceImpl.java
  16. 26 1
      ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/ElecConsumptionServiceImpl.java
  17. 5 4
      ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/EmsFacsServiceImpl.java
  18. 24 16
      ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/PriceServiceImpl.java
  19. 38 10
      ems/ems-core/src/main/resources/mapper/ems/ElecConsumptionMapper.xml
  20. 26 25
      ems/ems-core/src/main/resources/mapper/ems/ElecGwPriceConfigMapper.xml
  21. 18 10
      ems/ems-core/src/main/resources/mapper/ems/ElecPriceStrategyMapper.xml
  22. 5 2
      ems/ems-core/src/main/resources/mapper/ems/EmsFacsMapper.xml
  23. 16 16
      ems/ems-core/src/main/resources/mapper/ems/WaterConsumptionMapper.xml
  24. 50 39
      ems/sql/ems_init_data.sql
  25. 9 6
      ems/sql/ems_server.sql

+ 76 - 4
ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/handle/BaseMeterDevHandler.java

@@ -48,6 +48,12 @@ public abstract class BaseMeterDevHandler extends BaseDevHandler {
 
     protected static final String NEW_HOUR_READING = "NEW_HOUR_READING";
 
+    protected static final String LAST_HOUR_TIMESTAMP = "LAST_HOUR_TIMESTAMP";
+
+    protected static final long MAX_CACHE_AGE_MILLIS = 2 * 60 * 60 * 1000;
+
+    protected static final long MAX_HOUR_INCREASE_RATE = 1000;
+
     /**
      * 获取计量设备列表
      *
@@ -140,16 +146,49 @@ public abstract class BaseMeterDevHandler extends BaseDevHandler {
      */
     protected ElecMeterH execElecHourMeter(MeterDevice mDevice, String lastMeterReading, String newMeterReading) {
         ElecMeterH elecMeterH = null;
-        BigDecimal lastEngValue = new BigDecimal(lastMeterReading);
 
-        if (StringUtils.isNotEmpty(newMeterReading)) {
+        if (StringUtils.isEmpty(newMeterReading) || StringUtils.isEmpty(lastMeterReading)) {
+            log.warn("电表读数为空 - 设备:{}, 新值:{}, 旧值:{}",
+                mDevice.getDeviceCode(), newMeterReading, lastMeterReading);
+            return null;
+        }
+
+        try {
+            BigDecimal lastEngValue = new BigDecimal(lastMeterReading);
             BigDecimal newEngValue = new BigDecimal(newMeterReading);
+
             // 计算电量差值
             BigDecimal useQuantity = newEngValue.subtract(lastEngValue);
+
+            // 数据合理性校验
+            if (useQuantity.doubleValue() < 0) {
+                // 处理表计重置的情况
+                if (newEngValue.doubleValue() < 100 && lastEngValue.doubleValue() > 10000) {
+                    log.info("检测到电表可能重置 - 设备:{}, 新值:{}, 旧值:{}",
+                        mDevice.getDeviceCode(), newEngValue, lastEngValue);
+                    // 表计重置时,本次不产生数据
+                    return null;
+                } else {
+                    log.error("检测到电表异常负值 - 设备:{}, 新值:{}, 旧值:{}, 差值:{}",
+                        mDevice.getDeviceCode(), newEngValue, lastEngValue, useQuantity);
+                    return null;
+                }
+            }
+
+            // 检查是否增长过快(每小时最大1000度)
+            if (useQuantity.doubleValue() > 1000.0) {
+                log.warn("电表用量增长异常 - 设备:{}, 小时用量:{}度, 新值:{}, 旧值:{}",
+                    mDevice.getDeviceCode(), useQuantity, newEngValue, lastEngValue);
+            }
+
             // 倍率计算
             useQuantity = magnification(useQuantity, mDevice.getMagnification());
             // 封装计量对象
             elecMeterH = buildElecMeterH(mDevice, newEngValue, useQuantity);
+
+        } catch (NumberFormatException e) {
+            log.error("电表读数格式错误 - 设备:{}, 新值:{}, 旧值:{}",
+                mDevice.getDeviceCode(), newMeterReading, lastMeterReading, e);
         }
 
         return elecMeterH;
@@ -225,16 +264,49 @@ public abstract class BaseMeterDevHandler extends BaseDevHandler {
      */
     protected WaterMeterH execWaterHourMeter(MeterDevice device, String lastMeterReading, String newMeterReading) {
         WaterMeterH waterMeterH = null;
-        BigDecimal lastEngValue = new BigDecimal(lastMeterReading);
 
-        if (StringUtils.isNotEmpty(newMeterReading)) {
+        if (StringUtils.isEmpty(newMeterReading) || StringUtils.isEmpty(lastMeterReading)) {
+            log.warn("水表读数为空 - 设备:{}, 新值:{}, 旧值:{}",
+                device.getDeviceCode(), newMeterReading, lastMeterReading);
+            return null;
+        }
+
+        try {
+            BigDecimal lastEngValue = new BigDecimal(lastMeterReading);
             BigDecimal newEngValue = new BigDecimal(newMeterReading);
+
             // 计算水量差值
             BigDecimal useQuantity = newEngValue.subtract(lastEngValue);
+
+            // 数据合理性校验
+            if (useQuantity.doubleValue() < 0) {
+                // 处理表计重置的情况
+                if (newEngValue.doubleValue() < 10 && lastEngValue.doubleValue() > 1000) {
+                    log.info("检测到水表可能重置 - 设备:{}, 新值:{}, 旧值:{}",
+                        device.getDeviceCode(), newEngValue, lastEngValue);
+                    // 表计重置时,本次不产生数据
+                    return null;
+                } else {
+                    log.error("检测到水表异常负值 - 设备:{}, 新值:{}, 旧值:{}, 差值:{}",
+                        device.getDeviceCode(), newEngValue, lastEngValue, useQuantity);
+                    return null;
+                }
+            }
+
+            // 检查是否增长过快(每小时最大100吨)
+            if (useQuantity.doubleValue() > 100.0) {
+                log.warn("水表用量增长异常 - 设备:{}, 小时用量:{}吨, 新值:{}, 旧值:{}",
+                    device.getDeviceCode(), useQuantity, newEngValue, lastEngValue);
+            }
+
             // 倍率计算
             useQuantity = magnification(useQuantity, device.getMagnification());
             // 封装计量对象
             waterMeterH = buildWaterMeterH(device, newEngValue, useQuantity);
+
+        } catch (NumberFormatException e) {
+            log.error("水表读数格式错误 - 设备:{}, 新值:{}, 旧值:{}",
+                device.getDeviceCode(), newMeterReading, lastMeterReading, e);
         }
 
         return waterMeterH;

+ 95 - 32
ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/handle/InDoorEnergyHandler.java

@@ -391,27 +391,58 @@ public class InDoorEnergyHandler extends BaseMeterDevHandler {
         String newMeterReading) {
         ElecMeterH elecMeterH = null;
         String cacheKey = LAST_HOUR_READING + "-" + mDevice.getDeviceCode();
+        String timestampKey = LAST_HOUR_TIMESTAMP + "-" + mDevice.getDeviceCode();
+
+        // 获取缓存时间戳
+        String cachedTimestamp = redisService.getCacheMapValue(deviceCode, timestampKey);
+        boolean shouldUseCache = false;
+
+        if (StringUtils.isNotEmpty(lastMeterReading) && StringUtils.isNotEmpty(cachedTimestamp)) {
+            try {
+                long lastUpdateTime = Long.parseLong(cachedTimestamp);
+                long currentTime = System.currentTimeMillis();
+                // 只有当缓存数据在2小时内才使用
+                shouldUseCache = (currentTime - lastUpdateTime) <= MAX_CACHE_AGE_MILLIS;
+            } catch (NumberFormatException e) {
+                log.warn("无效的时间戳缓存: {}", cachedTimestamp);
+            }
+        }
 
-        // 缓存不为空,使用缓存抄表计算
-        if (StringUtils.isNotEmpty(lastMeterReading)) {
+        if (shouldUseCache) {
+            // 缓存有效,使用缓存计算
             elecMeterH = execElecHourMeter(mDevice, lastMeterReading, newMeterReading);
-            // 本周期抄表完成,将新抄表值覆盖作为下个周期的起始
+            // 更新缓存和时间戳
             updateCacheAfterSuccess(deviceCode, cacheKey, newMeterReading);
-        }
-        // 缓存为空,使用数据库记录计算
-        else {
-            ElecMeterH dbElecMeterH = elecMeterHService.selectLatelyItem(deviceCode);
+            redisService.setCacheMapValue(deviceCode, timestampKey,
+                String.valueOf(System.currentTimeMillis()));
+        } else {
+            // 缓存过期或无效,查询数据库
+            ElecMeterH dbElecMeterH = elecMeterHService.selectLatelyItem(mDevice.getDeviceCode());
 
             if (null != dbElecMeterH && null != dbElecMeterH.getMeterReading()) {
-                elecMeterH = execElecHourMeter(mDevice, String.valueOf(dbElecMeterH.getMeterReading()),
-                    newMeterReading);
-                // 本周期抄表完成,将新抄表值覆盖作为下个周期的起始
+                // 验证数据库记录是否为上一小时
+                Date currentHour = DateUtils.adjustHour(new Date(), -1);
+                long timeDiff = currentHour.getTime() - dbElecMeterH.getRecordTime().getTime();
+
+                // 只有时间差在1小时左右(容差30分钟)才计算
+                if (Math.abs(timeDiff) <= 30 * 60 * 1000) {
+                    elecMeterH = execElecHourMeter(mDevice,
+                        String.valueOf(dbElecMeterH.getMeterReading()), newMeterReading);
+                } else {
+                    log.warn("数据时间差过大,跳过计算 - 设备:{}, 时间差:{}小时",
+                        mDevice.getDeviceCode(), timeDiff / (60 * 60 * 1000));
+                }
+
+                // 无论是否计算,都更新缓存为当前值,作为下次计算基准
                 updateCacheAfterSuccess(deviceCode, cacheKey, newMeterReading);
-            }
-            else {
-                // 无缓存也无数据库记录,则认为是首次上报
+                redisService.setCacheMapValue(deviceCode, timestampKey,
+                    String.valueOf(System.currentTimeMillis()));
+            } else {
+                // 首次上报,仅更新缓存
                 if (StringUtils.isNotEmpty(newMeterReading)) {
                     updateCacheAfterSuccess(deviceCode, cacheKey, newMeterReading);
+                    redisService.setCacheMapValue(deviceCode, timestampKey,
+                        String.valueOf(System.currentTimeMillis()));
                 }
             }
         }
@@ -455,30 +486,62 @@ public class InDoorEnergyHandler extends BaseMeterDevHandler {
         String newMeterReading) {
         WaterMeterH waterMeterH = null;
         String cacheKey = LAST_HOUR_READING + "-" + mDevice.getDeviceCode();
+        String timestampKey = LAST_HOUR_TIMESTAMP + "-" + mDevice.getDeviceCode();
+
+        // 获取缓存时间戳
+        String cachedTimestamp = redisService.getCacheMapValue(deviceCode, timestampKey);
+        boolean shouldUseCache = false;
+
+        if (StringUtils.isNotEmpty(lastMeterReading) && StringUtils.isNotEmpty(cachedTimestamp)) {
+            try {
+                long lastUpdateTime = Long.parseLong(cachedTimestamp);
+                long currentTime = System.currentTimeMillis();
+                // 只有当缓存数据在2小时内才使用
+                shouldUseCache = (currentTime - lastUpdateTime) <= MAX_CACHE_AGE_MILLIS;
+
+                if (!shouldUseCache) {
+                    log.warn("水表缓存数据过期 - 设备:{}, 缓存时长:{}小时",
+                        mDevice.getDeviceCode(),
+                        (currentTime - lastUpdateTime) / (60 * 60 * 1000));
+                }
+            } catch (NumberFormatException e) {
+                log.warn("无效的时间戳缓存: {}", cachedTimestamp);
+            }
+        }
 
-        // 缓存不为空,使用缓存抄表计算
-        if (StringUtils.isNotEmpty(lastMeterReading)) {
+        if (shouldUseCache) {
+            // 缓存有效,使用缓存计算
             waterMeterH = execWaterHourMeter(mDevice, lastMeterReading, newMeterReading);
-
-            // 更新缓存
-            updateCacheAfterSuccess(deviceCode, cacheKey, newMeterReading);
-        }
-        // 缓存为空,使用数据库记录计算
-        else {
+            if (waterMeterH != null) {
+                // 只有成功计算后才更新缓存
+                updateCacheAfterSuccess(deviceCode, cacheKey, newMeterReading);
+                redisService.setCacheMapValue(deviceCode, timestampKey,
+                    String.valueOf(System.currentTimeMillis()));
+            }
+        } else {
+            // 缓存过期或无效,查询数据库
             WaterMeterH dbWaterMeterH = waterMeterHService.selectLatelyItem(mDevice.getDeviceCode());
 
             if (null != dbWaterMeterH && null != dbWaterMeterH.getMeterReading()) {
-                waterMeterH = execWaterHourMeter(mDevice, String.valueOf(dbWaterMeterH.getMeterReading()),
-                    newMeterReading);
+                // 验证数据库记录是否为上一小时
+                Date currentHour = DateUtils.adjustHour(new Date(), -1);
+                long timeDiff = currentHour.getTime() - dbWaterMeterH.getRecordTime().getTime();
+
+                // 只有时间差在1小时左右(容差30分钟)才计算
+                if (Math.abs(timeDiff) <= 30 * 60 * 1000) {
+                    waterMeterH = execWaterHourMeter(mDevice,
+                        String.valueOf(dbWaterMeterH.getMeterReading()), newMeterReading);
+                } else {
+                    log.warn("水表数据时间差过大,跳过计算 - 设备:{}, 时间差:{}小时",
+                        mDevice.getDeviceCode(), timeDiff / (60 * 60 * 1000));
+                }
+            }
 
-                // 更新缓存
+            // 无论是否计算成功,都更新缓存为当前值,作为下次计算基准
+            if (StringUtils.isNotEmpty(newMeterReading)) {
                 updateCacheAfterSuccess(deviceCode, cacheKey, newMeterReading);
-            }
-            else {
-                // 无缓存也无数据库记录,则认为是首次上报
-                if (StringUtils.isNotEmpty(newMeterReading)) {
-                    updateCacheAfterSuccess(deviceCode, cacheKey, newMeterReading);
-                }
+                redisService.setCacheMapValue(deviceCode, timestampKey,
+                    String.valueOf(System.currentTimeMillis()));
             }
         }
 
@@ -503,7 +566,7 @@ public class InDoorEnergyHandler extends BaseMeterDevHandler {
             // 按区域查询市电设施
             for (String areaCode : areaCodeSet) {
                 // 查询区域下市电的供应设施(同时获取了设施绑定的表计)
-                List<BoundaryObj> facsMeterBinds = facsService.getFacsWithMeterDev(areaCode, "W", "W2");
+                List<BoundaryObj> facsMeterBinds = facsService.getFacsWithMeterDev(areaCode, "W", "W2", 45);
 
                 if (CollectionUtils.isNotEmpty(facsMeterBinds)) {
                     for (BoundaryObj facsMeterBind : facsMeterBinds) {
@@ -578,7 +641,7 @@ public class InDoorEnergyHandler extends BaseMeterDevHandler {
     }
 
     private List<ElecMeterH> filterBindElecMeterDevs(BoundaryObj facsMeterBind, List<ElecMeterH> allElecMeterHList) {
-        Set<String> bindElecMeterDevs = facsMeterBind.getBindElecMeterDevs();
+        Set<String> bindElecMeterDevs = facsMeterBind.getBindMeterDevs();
         if (CollectionUtils.isEmpty(bindElecMeterDevs)) {
             return new ArrayList<>();
         }

+ 2 - 0
ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/ElecMeterHController.java

@@ -119,6 +119,7 @@ public class ElecMeterHController extends BaseController {
      */
     @GetMapping("/hour/listFacsMeterTotal")
     public AjaxResult listFacsMeterTotal(QueryMeter queryMeter) {
+        queryMeter.setMeterCls(45);
         List<EnergyMeter> list = boundaryObjService.getMeterStaByFacsCategory(queryMeter);
         return success(list);
     }
@@ -134,6 +135,7 @@ public class ElecMeterHController extends BaseController {
         PageDomain pageDomain = TableSupport.buildPageRequest();
         Integer pageNum = pageDomain.getPageNum();
         Integer pageSize = pageDomain.getPageSize();
+        queryMeter.setMeterCls(45);
         List<ElecMeterH> list = boundaryObjService.getMeterByFacsCategory(queryMeter);
         int total = list.size();
         list = ListUtils.subList(list, (pageNum - 1) * pageSize, pageNum * pageSize -1);

+ 14 - 3
ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/EnergyConsumptionController.java

@@ -8,11 +8,11 @@ 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.common.security.annotation.RequiresPermissions;
-import com.ruoyi.ems.model.ElecConsumptionVO;
 import com.ruoyi.ems.model.ElecConsumptionExportVO;
-import com.ruoyi.ems.model.WaterConsumptionVO;
-import com.ruoyi.ems.model.WaterConsumptionExportVO;
+import com.ruoyi.ems.model.ElecConsumptionVO;
 import com.ruoyi.ems.model.QueryMeter;
+import com.ruoyi.ems.model.WaterConsumptionExportVO;
+import com.ruoyi.ems.model.WaterConsumptionVO;
 import com.ruoyi.ems.service.IElecConsumptionService;
 import com.ruoyi.ems.service.IWaterConsumptionService;
 import io.swagger.annotations.Api;
@@ -48,6 +48,17 @@ public class EnergyConsumptionController extends BaseController {
     // ==================== 区域用电统计 ====================
 
     /**
+     * 查询用电小时计量类型列表
+     */
+    @RequiresPermissions("ems:consumption:list")
+    @GetMapping("/area/elec/hourTypes")
+    @ApiOperation("查询区域用电统计列表")
+    public AjaxResult getElecHourTypes(@ApiParam("查询参数") QueryMeter queryMeter) {
+        List<String> list = elecConsumptionService.getElecHourTypes(queryMeter);
+        return success(list);
+    }
+
+    /**
      * 查询区域用电统计列表
      */
     @RequiresPermissions("ems:consumption:list")

+ 4 - 3
ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/MeterBoundaryController.java

@@ -42,10 +42,11 @@ public class MeterBoundaryController extends BaseController {
     /**
      * 查询区域-边界对象-绑定设备拓扑
      */
-    @RequiresPermissions("ems:meterBoundary:list")
+    //@RequiresPermissions("ems:meterBoundary:list")
     @GetMapping("/getBoundaryTreeByArea")
-    public AjaxResult getBoundaryTreeByArea(@RequestParam(value = "areaCode") String areaCode) {
-        BoundaryObj list = boundaryObjService.getBoundaryByArea(areaCode);
+    public AjaxResult getBoundaryTreeByArea(@RequestParam(value = "areaCode") String areaCode,
+        @RequestParam(value = "meterCls") Integer meterCls) {
+        BoundaryObj list = boundaryObjService.getBoundaryByArea(areaCode, meterCls);
         return success(list);
     }
 

+ 61 - 54
ems/ems-core/src/main/java/com/ruoyi/ems/domain/ElecGwPriceConfig.java

@@ -33,21 +33,25 @@ public class ElecGwPriceConfig extends BaseEntity
     @Excel(name = "电压等级")
     private String voltageLevel;
 
-    /** 电度用电价格 */
-    @Excel(name = "电度用电价格")
-    private Double degreePrice;
+    /** 电度用电价格 Off-Peak Price  */
+    @Excel(name = "平时段电价")
+    private Double opPrice;
 
-    /** 分时尖峰时段价格 */
-    @Excel(name = "分时尖峰时段价格")
-    private Double fsPeakDegreePrice;
+    /** 尖峰时段价格 Critical Peak Price */
+    @Excel(name = "尖峰时段价格")
+    private Double cpPrice;
 
-    /** 分时高峰时段价格 */
-    @Excel(name = "分时高峰时段价格")
-    private Double fsHighDegreePrice;
+    /** 高峰时段价格 Peak Price */
+    @Excel(name = "峰时段价格")
+    private Double pPrice;
 
-    /** 分时低谷时段价格 */
-    @Excel(name = "分时低谷时段价格")
-    private Double fsLowDegreePrice;
+    /** 谷时段价格 Valley Price */
+    @Excel(name = "谷时段价格")
+    private Double vPrice;
+
+    /** 谷时段价格 Deep Valley Price */
+    @Excel(name = "深谷时段价格")
+    private Double dvPrice;
 
     /** 最大需量用电价格 */
     @Excel(name = "最大需量用电价格")
@@ -57,34 +61,30 @@ public class ElecGwPriceConfig extends BaseEntity
     @Excel(name = "变压器容量用电价格")
     private Double transCapacityPrice;
 
-    public void setId(Long id) 
-    {
-        this.id = id;
-    }
-
-    public Long getId() 
-    {
+    public Long getId() {
         return id;
     }
-    public void setCfgCode(String cfgCode) 
-    {
-        this.cfgCode = cfgCode;
+
+    public void setId(Long id) {
+        this.id = id;
     }
 
-    public String getCfgCode() 
-    {
+    public String getCfgCode() {
         return cfgCode;
     }
-    public void setElecType(Long elecType) 
-    {
-        this.elecType = elecType;
+
+    public void setCfgCode(String cfgCode) {
+        this.cfgCode = cfgCode;
     }
 
-    public Long getElecType() 
-    {
+    public Long getElecType() {
         return elecType;
     }
 
+    public void setElecType(Long elecType) {
+        this.elecType = elecType;
+    }
+
     public String getElecTypeName() {
         return elecTypeName;
     }
@@ -93,46 +93,52 @@ public class ElecGwPriceConfig extends BaseEntity
         this.elecTypeName = elecTypeName;
     }
 
-    public void setVoltageLevel(String voltageLevel)
-    {
+    public String getVoltageLevel() {
+        return voltageLevel;
+    }
+
+    public void setVoltageLevel(String voltageLevel) {
         this.voltageLevel = voltageLevel;
     }
 
-    public String getVoltageLevel() 
-    {
-        return voltageLevel;
+    public Double getOpPrice() {
+        return opPrice;
+    }
+
+    public void setOpPrice(Double opPrice) {
+        this.opPrice = opPrice;
     }
 
-    public Double getDegreePrice() {
-        return degreePrice;
+    public Double getCpPrice() {
+        return cpPrice;
     }
 
-    public void setDegreePrice(Double degreePrice) {
-        this.degreePrice = degreePrice;
+    public void setCpPrice(Double cpPrice) {
+        this.cpPrice = cpPrice;
     }
 
-    public Double getFsPeakDegreePrice() {
-        return fsPeakDegreePrice;
+    public Double getpPrice() {
+        return pPrice;
     }
 
-    public void setFsPeakDegreePrice(Double fsPeakDegreePrice) {
-        this.fsPeakDegreePrice = fsPeakDegreePrice;
+    public void setpPrice(Double pPrice) {
+        this.pPrice = pPrice;
     }
 
-    public Double getFsHighDegreePrice() {
-        return fsHighDegreePrice;
+    public Double getvPrice() {
+        return vPrice;
     }
 
-    public void setFsHighDegreePrice(Double fsHighDegreePrice) {
-        this.fsHighDegreePrice = fsHighDegreePrice;
+    public void setvPrice(Double vPrice) {
+        this.vPrice = vPrice;
     }
 
-    public Double getFsLowDegreePrice() {
-        return fsLowDegreePrice;
+    public Double getDvPrice() {
+        return dvPrice;
     }
 
-    public void setFsLowDegreePrice(Double fsLowDegreePrice) {
-        this.fsLowDegreePrice = fsLowDegreePrice;
+    public void setDvPrice(Double dvPrice) {
+        this.dvPrice = dvPrice;
     }
 
     public Double getMaxReqPrice() {
@@ -158,10 +164,11 @@ public class ElecGwPriceConfig extends BaseEntity
             .append("cfgCode", getCfgCode())
             .append("elecType", getElecType())
             .append("voltageLevel", getVoltageLevel())
-            .append("degreePrice", getDegreePrice())
-            .append("fsPeakDegreePrice", getFsPeakDegreePrice())
-            .append("fsHighDegreePrice", getFsHighDegreePrice())
-            .append("fsLowDegreePrice", getFsLowDegreePrice())
+            .append("cpPrice", getCpPrice())
+            .append("pPrice", getpPrice())
+            .append("opPrice", getOpPrice())
+            .append("vPrice", getvPrice())
+            .append("dvPrice", getDvPrice())
             .append("maxReqPrice", getMaxReqPrice())
             .append("transCapacityPrice", getTransCapacityPrice())
             .toString();

+ 68 - 40
ems/ems-core/src/main/java/com/ruoyi/ems/domain/ElecPriceStrategy.java

@@ -9,41 +9,59 @@ import java.util.List;
 
 /**
  * 电价策略对象 adm_elecprice_strategy
- * 
+ *
  * @author ruoyi
  * @date 2024-08-23
  */
-public class ElecPriceStrategy extends BaseEntity
-{
+public class ElecPriceStrategy extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** 序号 */
+    /**
+     * 序号
+     */
     private Long id;
 
-    /** 策略代码 */
-    @Excel(name = "策略代码")
+    /**
+     * 策略代码
+     */
     private String strategyCode;
 
-    /** 策略名称 */
-    @Excel(name = "策略名称")
+    /**
+     * 策略名称
+     */
     private String strategyName;
 
-    @Excel(name = "策略名称")
     private String strategyDesc;
 
-    /** 重复类型 */
-    @Excel(name = "重复类型")
-    private int repeatType;
-
-    /** 重复参数 */
-    @Excel(name = "重复参数")
-    private String repeatParam;
-
-    /** 优先级 */
-    @Excel(name = "优先级")
+    /**
+     * 支持类型峰谷类型,逗号分隔
+     * -2:低谷,-1:谷段,0:平段,1:峰段,2:尖峰
+     */
+    private String supportType;
+
+    /**
+     * 执行月份,逗号分隔
+     */
+    private String execMonth;
+
+    /**
+     * 重复类型
+     */
+    private int execDateType;
+
+    /**
+     * 重复参数
+     */
+    private String execDate;
+
+    /**
+     * 优先级
+     */
     private Integer priority;
 
-    /** 编辑标记 */
+    /**
+     * 编辑标记
+     */
     private Integer editFlag = 1;
 
     private List<ElecPriceStrategyHour> hourList;
@@ -80,20 +98,36 @@ public class ElecPriceStrategy extends BaseEntity
         this.strategyDesc = strategyDesc;
     }
 
-    public int getRepeatType() {
-        return repeatType;
+    public String getSupportType() {
+        return supportType;
+    }
+
+    public void setSupportType(String supportType) {
+        this.supportType = supportType;
+    }
+
+    public String getExecMonth() {
+        return execMonth;
+    }
+
+    public void setExecMonth(String execMonth) {
+        this.execMonth = execMonth;
+    }
+
+    public int getExecDateType() {
+        return execDateType;
     }
 
-    public void setRepeatType(int repeatType) {
-        this.repeatType = repeatType;
+    public void setExecDateType(int execDateType) {
+        this.execDateType = execDateType;
     }
 
-    public String getRepeatParam() {
-        return repeatParam;
+    public String getExecDate() {
+        return execDate;
     }
 
-    public void setRepeatParam(String repeatParam) {
-        this.repeatParam = repeatParam;
+    public void setExecDate(String execDate) {
+        this.execDate = execDate;
     }
 
     public Integer getPriority() {
@@ -122,17 +156,11 @@ public class ElecPriceStrategy extends BaseEntity
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("strategyCode", getStrategyCode())
-            .append("strategyName", getStrategyName())
-            .append("strategyDesc", getStrategyDesc())
-            .append("repeatType", getRepeatType())
-            .append("repeatParam", getRepeatParam())
-            .append("priority", getPriority())
-            .append("editFlag", getEditFlag())
-            .append("createTime", getCreateTime())
-            .append("updateTime", getUpdateTime())
-            .toString();
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("id", getId())
+            .append("strategyCode", getStrategyCode()).append("strategyName", getStrategyName())
+            .append("strategyDesc", getStrategyDesc()).append("supportType", getSupportType())
+            .append("execMonth", getExecMonth()).append("execDateType", getExecDateType())
+            .append("execDate", getExecDate()).append("priority", getPriority()).append("editFlag", getEditFlag())
+            .append("createTime", getCreateTime()).append("updateTime", getUpdateTime()).toString();
     }
 }

+ 6 - 1
ems/ems-core/src/main/java/com/ruoyi/ems/mapper/ElecConsumptionMapper.java

@@ -11,7 +11,12 @@ import java.util.Set;
  * 用电统计Mapper接口
  */
 public interface ElecConsumptionMapper {
-
+    /**
+     * 根据设备代码列表查询区域日用电统计
+     */
+    List<String> selectElecHourSupportTypes(
+        @Param("queryMeter") QueryMeter queryMeter,
+        @Param("meterDevices") Set<String> meterDevices);
     // ==================== 区域用电统计方法 ====================
 
     /**

+ 2 - 1
ems/ems-core/src/main/java/com/ruoyi/ems/mapper/EmsFacsMapper.java

@@ -43,10 +43,11 @@ public interface EmsFacsMapper {
      * @param areaCode    区域
      * @param category    设施类别
      * @param subCategory 设施子类别
+     * @param meterCls 设施子类别
      * @return
      */
     List<BoundaryObj> selectFacsWithMeter(@Param("areaCode") String areaCode, @Param("category") String category,
-        @Param("subCategory") String subCategory);
+        @Param("subCategory") String subCategory, @Param("meterCls") Integer meterCls);
 
     /**
      * 新增能源设施/系统

+ 26 - 16
ems/ems-core/src/main/java/com/ruoyi/ems/model/BoundaryObj.java

@@ -40,20 +40,22 @@ public class BoundaryObj {
      */
     private String objName;
 
+    private Integer meterCls;
+
     /**
      * 绑定设备字符串
      */
-    private String bindMeterDevs;
+    private String bindMeterDevsStr;
 
     /**
      * 直接绑定的电表
      */
-    private Set<String> bindElecMeterDevs = new HashSet<>();
+    private Set<String> bindMeterDevs = new HashSet<>();
 
     /**
      * 分项关联计量电表
      */
-    private Set<String> subElecMeterDevs = new HashSet<>();;
+    private Set<String> subMeterDevs = new HashSet<>();;
 
     /**
      * 子对象集合
@@ -84,28 +86,36 @@ public class BoundaryObj {
         this.objName = objName;
     }
 
-    public String getBindMeterDevs() {
-        return bindMeterDevs;
+    public Integer getMeterCls() {
+        return meterCls;
     }
 
-    public void setBindMeterDevs(String bindMeterDevs) {
-        this.bindMeterDevs = bindMeterDevs;
+    public void setMeterCls(Integer meterCls) {
+        this.meterCls = meterCls;
+    }
+
+    public String getBindMeterDevsStr() {
+        return bindMeterDevsStr;
     }
 
-    public Set<String> getBindElecMeterDevs() {
-        return bindElecMeterDevs;
+    public void setBindMeterDevsStr(String bindMeterDevsStr) {
+        this.bindMeterDevsStr = bindMeterDevsStr;
     }
 
-    public void setBindElecMeterDevs(Set<String> bindElecMeterDevs) {
-        this.bindElecMeterDevs = bindElecMeterDevs;
+    public Set<String> getBindMeterDevs() {
+        return bindMeterDevs;
+    }
+
+    public void setBindMeterDevs(Set<String> bindMeterDevs) {
+        this.bindMeterDevs = bindMeterDevs;
     }
 
-    public Set<String> getSubElecMeterDevs() {
-        return subElecMeterDevs;
+    public Set<String> getSubMeterDevs() {
+        return subMeterDevs;
     }
 
-    public void setSubElecMeterDevs(Set<String> subElecMeterDevs) {
-        this.subElecMeterDevs = subElecMeterDevs;
+    public void setSubMeterDevs(Set<String> subMeterDevs) {
+        this.subMeterDevs = subMeterDevs;
     }
 
     public List<BoundaryObj> getChildren() {
@@ -119,7 +129,7 @@ public class BoundaryObj {
     @Override
     public String toString() {
         return "BoundaryObj{" + "objType=" + objType + ", objCode='" + objCode + '\'' + ", objName='" + objName + '\''
-            + ", bindElecMeterDevs=" + bindElecMeterDevs + ", subElecMeterDevs=" + subElecMeterDevs + ", children="
+            + ", bindElecMeterDevs=" + bindMeterDevs + ", subElecMeterDevs=" + subMeterDevs + ", children="
             + children + '}';
     }
 }

+ 19 - 6
ems/ems-core/src/main/java/com/ruoyi/ems/model/ElecConsumptionVO.java

@@ -55,18 +55,22 @@ public class ElecConsumptionVO {
     @Excel(name = "尖峰电量(kWh)")
     private BigDecimal sharpPeakQuantity;
 
-    @ApiModelProperty("峰电量(kWh)")
-    @Excel(name = "峰电量(kWh)")
+    @ApiModelProperty("峰电量(kWh)")
+    @Excel(name = "峰电量(kWh)")
     private BigDecimal peakQuantity;
 
-    @ApiModelProperty("平电量(kWh)")
-    @Excel(name = "平电量(kWh)")
+    @ApiModelProperty("平电量(kWh)")
+    @Excel(name = "平电量(kWh)")
     private BigDecimal normalQuantity;
 
-    @ApiModelProperty("谷电量(kWh)")
-    @Excel(name = "谷电量(kWh)")
+    @ApiModelProperty("谷电量(kWh)")
+    @Excel(name = "谷电量(kWh)")
     private BigDecimal valleyQuantity;
 
+    @ApiModelProperty("深谷电量(kWh)")
+    @Excel(name = "深谷电量(kWh)")
+    private BigDecimal deepValleyQuantity;
+
     @ApiModelProperty("总用电费用(元)")
     @Excel(name = "总用电费用(元)")
     private BigDecimal totalElecCost;
@@ -191,6 +195,14 @@ public class ElecConsumptionVO {
         this.valleyQuantity = valleyQuantity;
     }
 
+    public BigDecimal getDeepValleyQuantity() {
+        return deepValleyQuantity;
+    }
+
+    public void setDeepValleyQuantity(BigDecimal deepValleyQuantity) {
+        this.deepValleyQuantity = deepValleyQuantity;
+    }
+
     public BigDecimal getTotalElecCost() {
         return totalElecCost;
     }
@@ -224,6 +236,7 @@ public class ElecConsumptionVO {
             ", peakQuantity=" + peakQuantity +
             ", normalQuantity=" + normalQuantity +
             ", valleyQuantity=" + valleyQuantity +
+            ", deepValleyQuantity=" + deepValleyQuantity +
             ", totalElecCost=" + totalElecCost +
             ", createTime=" + createTime +
             '}';

+ 1 - 1
ems/ems-core/src/main/java/com/ruoyi/ems/service/IBoundaryObjService.java

@@ -33,7 +33,7 @@ public interface IBoundaryObjService {
      * @param areaCode 区域编码
      * @return 边界对象
      */
-    BoundaryObj getBoundaryByArea(String areaCode);
+    BoundaryObj getBoundaryByArea(String areaCode, Integer meterCls);
 
     /**
      * 查询用电计量统计-根据边界设施分类

+ 1 - 0
ems/ems-core/src/main/java/com/ruoyi/ems/service/IElecConsumptionService.java

@@ -10,6 +10,7 @@ import java.util.List;
  * 用电统计服务接口
  */
 public interface IElecConsumptionService {
+    List<String> getElecHourTypes(QueryMeter queryMeter);
 
     /**
      * 查询区域用电统计列表

+ 1 - 1
ems/ems-core/src/main/java/com/ruoyi/ems/service/IEmsFacsService.java

@@ -53,7 +53,7 @@ public interface IEmsFacsService {
      * @param subCategory 设施子类别
      * @return 绑定计量设备列表
      */
-    List<BoundaryObj> getFacsWithMeterDev(String areaCode, String category, String subCategory);
+    List<BoundaryObj> getFacsWithMeterDev(String areaCode, String category, String subCategory, Integer meterCls);
 
     /**
      * 新增能源设施/系统

+ 10 - 10
ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/BoundaryObjServiceImpl.java

@@ -77,13 +77,13 @@ public class BoundaryObjServiceImpl implements IBoundaryObjService {
      * @return 边界对象
      */
     @Override
-    public BoundaryObj getBoundaryByArea(String areaCode) {
+    public BoundaryObj getBoundaryByArea(String areaCode, Integer meterCls) {
         BoundaryObj boundaryObj = null;
 
         try {
             // 查询电表绑定关系
             List<MeterBoundaryRel> relList = boundaryRelService.selectRelByObj(null, MeterObjType.METER_AREA.getType(),
-                45);
+                meterCls);
             Map<String, Set<MeterBoundaryRel>> relMap = relList.stream()
                 .collect(Collectors.groupingBy(MeterBoundaryRel::getBoundaryObj, Collectors.toSet()));
 
@@ -113,7 +113,7 @@ public class BoundaryObjServiceImpl implements IBoundaryObjService {
     public List<EnergyMeter> getMeterStaByFacsCategory(QueryMeter queryMeter) {
         List<EnergyMeter> result = new ArrayList<>();
         List<BoundaryObj> bObjs = facsService.getFacsWithMeterDev(queryMeter.getAreaCode(),
-            queryMeter.getFacsCategory(), queryMeter.getFacsSubCategory());
+            queryMeter.getFacsCategory(), queryMeter.getFacsSubCategory(), queryMeter.getMeterCls());
 
         if (CollectionUtils.isNotEmpty(bObjs)) {
             for (BoundaryObj bObj : bObjs) {
@@ -123,7 +123,7 @@ public class BoundaryObjServiceImpl implements IBoundaryObjService {
                 meter.setObjCode(bObj.getObjCode());
                 meter.setObjName(bObj.getObjName());
 
-                if (CollectionUtils.isNotEmpty(bObj.getBindElecMeterDevs())) {
+                if (CollectionUtils.isNotEmpty(bObj.getBindMeterDevs())) {
                     EnergyMeter staObj = getElecMeter(queryMeter, bObj);
 
                     if (null != staObj) {
@@ -174,11 +174,11 @@ public class BoundaryObjServiceImpl implements IBoundaryObjService {
             }
 
             bObjs = facsService.getFacsWithMeterDev(queryMeter.getAreaCode(), queryMeter.getFacsCategory(),
-                queryMeter.getFacsSubCategory());
+                queryMeter.getFacsSubCategory(), queryMeter.getMeterCls());
 
             for (BoundaryObj bObj : bObjs) {
-                if (CollectionUtils.isNotEmpty(bObj.getBindElecMeterDevs())) {
-                    devCodes.addAll(bObj.getBindElecMeterDevs());
+                if (CollectionUtils.isNotEmpty(bObj.getBindMeterDevs())) {
+                    devCodes.addAll(bObj.getBindMeterDevs());
                 }
             }
         }
@@ -279,7 +279,7 @@ public class BoundaryObjServiceImpl implements IBoundaryObjService {
         condition.setObjName(bObj.getObjName());
         condition.setStartRecTime(queryMeter.getStartRecTime());
         condition.setEndRecTime(queryMeter.getEndRecTime());
-        condition.setDeviceCodes(bObj.getBindElecMeterDevs());
+        condition.setDeviceCodes(bObj.getBindMeterDevs());
 
         EnergyMeter meterRes = elecMeterHService.staByMeterDev(condition);
         return meterRes;
@@ -304,7 +304,7 @@ public class BoundaryObjServiceImpl implements IBoundaryObjService {
 
         if (CollectionUtils.isNotEmpty(relSet)) {
             Set<String> bindDevs = relSet.stream().map(MeterBoundaryRel::getMeterDevice).collect(Collectors.toSet());
-            boundaryObj.setBindElecMeterDevs(bindDevs);
+            boundaryObj.setBindMeterDevs(bindDevs);
         }
 
         List<BoundaryObj> subObjs = new ArrayList<>();
@@ -319,7 +319,7 @@ public class BoundaryObjServiceImpl implements IBoundaryObjService {
             }
 
             // 设置子区绑定电表
-            boundaryObj.setSubElecMeterDevs(getSubElecMeterDev(subList, relMap));
+            boundaryObj.setSubMeterDevs(getSubElecMeterDev(subList, relMap));
         }
 
         return boundaryObj;

+ 26 - 1
ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/ElecConsumptionServiceImpl.java

@@ -47,6 +47,30 @@ public class ElecConsumptionServiceImpl implements IElecConsumptionService {
     private static final int ELEC_METER_CLS = 45;
 
     @Override
+    public List<String> getElecHourTypes(QueryMeter queryMeter) {
+        if (queryMeter == null) {
+            logger.warn("查询参数为空,返回空列表");
+            return Collections.emptyList();
+        }
+
+        try {
+            // 1. 获取所有相关测点设备
+            Set<String> meterDevices = getMeterDevicesByArea(queryMeter.getObjCode());
+            if (meterDevices.isEmpty()) {
+                logger.info("未找到相关电表设备,查询条件: areaCode={}, objCode={}", queryMeter.getAreaCode(),
+                    queryMeter.getObjCode());
+                return Collections.emptyList();
+            }
+
+            return elecConsumptionMapper.selectElecHourSupportTypes(queryMeter, meterDevices);
+        }
+        catch (Exception e) {
+            logger.error("查询区域用电统计列表异常", e);
+            return Collections.emptyList();
+        }
+    }
+
+    @Override
     public List<ElecConsumptionVO> selectAreaElecConsumptionList(QueryMeter queryMeter) {
         if (queryMeter == null) {
             logger.warn("查询参数为空,返回空列表");
@@ -519,7 +543,8 @@ public class ElecConsumptionServiceImpl implements IElecConsumptionService {
             }
 
             logger.debug("完成用电统计区域名称填充,记录数: {}", consumptionList.size());
-        } catch (Exception e) {
+        }
+        catch (Exception e) {
             logger.error("填充用电统计区域名称异常", e);
         }
     }

+ 5 - 4
ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/EmsFacsServiceImpl.java

@@ -163,17 +163,18 @@ public class EmsFacsServiceImpl implements IEmsFacsService {
     }
 
     @Override
-    public List<BoundaryObj> getFacsWithMeterDev(String areaCode, String category, String subCategory) {
-        List<BoundaryObj> facsMeterObjs = emsFacsMapper.selectFacsWithMeter(areaCode, category, subCategory);
+    public List<BoundaryObj> getFacsWithMeterDev(String areaCode, String category, String subCategory,
+        Integer meterCls) {
+        List<BoundaryObj> facsMeterObjs = emsFacsMapper.selectFacsWithMeter(areaCode, category, subCategory, meterCls);
 
         if (CollectionUtils.isNotEmpty(facsMeterObjs)) {
             for (BoundaryObj obj : facsMeterObjs) {
-                String[] array = StringUtils.split(obj.getBindMeterDevs(), ",");
+                String[] array = StringUtils.split(obj.getBindMeterDevsStr(), ",");
                 List<String> devList = ArrayUtils.isNotEmpty(array) ? Arrays.asList(array) : new ArrayList<>();
 
                 Set<String> bindDevs = devList.stream().map(String::trim).filter(s -> !s.isEmpty())
                     .collect(Collectors.toSet());
-                obj.setBindElecMeterDevs(bindDevs);
+                obj.setBindMeterDevs(bindDevs);
             }
         }
         return facsMeterObjs;

+ 24 - 16
ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/PriceServiceImpl.java

@@ -109,17 +109,20 @@ public class PriceServiceImpl implements IPriceService {
         Price price = null;
 
         switch (hourType) {
+            case -2:
+                price = new Price(priceCode, strategyCode, hourType, priceConfig.getDvPrice());
+                break;
             case -1:
-                price = new Price(priceCode, strategyCode, hourType, priceConfig.getFsLowDegreePrice());
+                price = new Price(priceCode, strategyCode, hourType, priceConfig.getvPrice());
                 break;
             case 1:
-                price = new Price(priceCode, strategyCode, hourType, priceConfig.getFsHighDegreePrice());
+                price = new Price(priceCode, strategyCode, hourType, priceConfig.getpPrice());
                 break;
             case 2:
-                price = new Price(priceCode, strategyCode, hourType, priceConfig.getFsPeakDegreePrice());
+                price = new Price(priceCode, strategyCode, hourType, priceConfig.getCpPrice());
                 break;
             default:
-                price = new Price(priceCode, strategyCode, hourType, priceConfig.getDegreePrice());
+                price = new Price(priceCode, strategyCode, hourType, priceConfig.getOpPrice());
                 break;
         }
 
@@ -149,19 +152,24 @@ public class PriceServiceImpl implements IPriceService {
      */
     private boolean dateMatch(ElecPriceStrategy strategy, Date date) {
         boolean flag = false;
+        String curMonth = DateUtils.dateToString(date, "MM");
+        String[] execMonthArr = StringUtils.split(strategy.getExecMonth(), ",");
 
-        if (strategy.getRepeatType() == 1 || strategy.getRepeatType() == 3 || strategy.getRepeatType() == 4) {
-            throw new UnsupportedOperationException("不支持的日期重复类型");
-        }
-        else if (strategy.getRepeatType() == 2) {
-            flag = true;
-        }
-        else if (strategy.getRepeatType() == 5 || strategy.getRepeatType() == 6) {
-            Calendar calendar = Calendar.getInstance();
-            calendar.setTime(date);
-            int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK) - 1;
-            String[] array = StringUtils.split(strategy.getRepeatParam(), ",");
-            flag = ArrayUtils.contains(array, String.valueOf(dayOfWeek));
+        // 优先匹配月份
+        if (ArrayUtils.contains(execMonthArr, curMonth)) {
+            if (strategy.getExecDateType() == 1 || strategy.getExecDateType() == 3 || strategy.getExecDateType() == 4) {
+                throw new UnsupportedOperationException("不支持的日期重复类型");
+            }
+            else if (strategy.getExecDateType() == 2) {
+                flag = true;
+            }
+            else if (strategy.getExecDateType() == 5 || strategy.getExecDateType() == 6) {
+                Calendar calendar = Calendar.getInstance();
+                calendar.setTime(date);
+                int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK) - 1;
+                String[] array = StringUtils.split(strategy.getExecDate(), ",");
+                flag = ArrayUtils.contains(array, String.valueOf(dayOfWeek));
+            }
         }
 
         return flag;

+ 38 - 10
ems/ems-core/src/main/resources/mapper/ems/ElecConsumptionMapper.xml

@@ -19,11 +19,31 @@
         <result property="peakQuantity" column="peak_quantity"/>
         <result property="normalQuantity" column="normal_quantity"/>
         <result property="valleyQuantity" column="valley_quantity"/>
+        <result property="deepValleyQuantity" column="deep_valley_quantity"/>
         <result property="totalElecCost" column="total_elec_cost"/>
         <result property="createTime" column="create_time"/>
     </resultMap>
 
     <!-- ==================== 区域用电统计查询(基于设备codes汇总,支持峰谷电) ==================== -->
+    <select id="selectElecHourSupportTypes" resultType="java.lang.String">
+        SELECT
+        DISTINCT h.meter_type
+        FROM adm_elec_meter_h h
+        <where>
+            h.meter_type IS NOT NULL
+            AND h.device_code IN
+            <foreach collection="meterDevices" item="device" open="(" close=")" separator=",">
+                #{device}
+            </foreach>
+            <if test="queryMeter.startRecTime != null and queryMeter.startRecTime != ''">
+                AND h.record_time &gt;= #{queryMeter.startRecTime}
+            </if>
+            <if test="queryMeter.endRecTime != null and queryMeter.endRecTime != ''">
+                AND h.record_time &lt;= #{queryMeter.endRecTime}
+            </if>
+        </where>
+        ORDER BY h.meter_type DESC
+    </select>
 
     <!-- 根据设备代码列表查询区域日用电统计 -->
     <select id="selectAreaDailyElecConsumptionByDevices" resultMap="ElecConsumptionResult">
@@ -39,6 +59,7 @@
         ROUND(SUM(CASE WHEN h.meter_type = 1 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as peak_quantity,
         ROUND(SUM(CASE WHEN h.meter_type = 0 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as normal_quantity,
         ROUND(SUM(CASE WHEN h.meter_type = -1 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as valley_quantity,
+        ROUND(SUM(CASE WHEN h.meter_type = -2 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as deep_valley_quantity,
         ROUND(SUM(COALESCE(h.use_elec_cost, 0)), 2) as total_elec_cost,
         NOW() as create_time
         FROM adm_elec_meter_h h
@@ -49,10 +70,10 @@
             #{device}
         </foreach>
         <if test="queryMeter.startRecTime != null and queryMeter.startRecTime != ''">
-            AND h.date &gt;= DATE(#{queryMeter.startRecTime})
+            AND h.record_time &gt;= #{queryMeter.startRecTime}
         </if>
         <if test="queryMeter.endRecTime != null and queryMeter.endRecTime != ''">
-            AND h.date &lt;= DATE(#{queryMeter.endRecTime})
+            AND h.record_time &lt;= #{queryMeter.endRecTime}
         </if>
         AND h.date IS NOT NULL
         GROUP BY a.area_code, a.area_name, h.date
@@ -74,6 +95,7 @@
         ROUND(SUM(CASE WHEN h.meter_type = 1 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as peak_quantity,
         ROUND(SUM(CASE WHEN h.meter_type = 0 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as normal_quantity,
         ROUND(SUM(CASE WHEN h.meter_type = -1 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as valley_quantity,
+        ROUND(SUM(CASE WHEN h.meter_type = -2 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as deep_valley_quantity,
         ROUND(SUM(COALESCE(h.use_elec_cost, 0)), 2) as total_elec_cost,
         NOW() as create_time
         FROM adm_elec_meter_h h
@@ -84,10 +106,10 @@
             #{device}
         </foreach>
         <if test="queryMeter.startRecTime != null and queryMeter.startRecTime != ''">
-            AND h.date &gt;= DATE(#{queryMeter.startRecTime})
+            AND h.record_time &gt;= #{queryMeter.startRecTime}
         </if>
         <if test="queryMeter.endRecTime != null and queryMeter.endRecTime != ''">
-            AND h.date &lt;= DATE(#{queryMeter.endRecTime})
+            AND h.record_time &lt;= #{queryMeter.endRecTime}
         </if>
         AND h.date IS NOT NULL
         GROUP BY a.area_code, a.area_name, DATE_FORMAT(h.date, '%Y-%m')
@@ -109,6 +131,7 @@
         ROUND(SUM(CASE WHEN h.meter_type = 1 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as peak_quantity,
         ROUND(SUM(CASE WHEN h.meter_type = 0 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as normal_quantity,
         ROUND(SUM(CASE WHEN h.meter_type = -1 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as valley_quantity,
+        ROUND(SUM(CASE WHEN h.meter_type = -2 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as deep_valley_quantity,
         ROUND(SUM(COALESCE(h.use_elec_cost, 0)), 2) as total_elec_cost,
         NOW() as create_time
         FROM adm_elec_meter_h h
@@ -119,10 +142,10 @@
             #{device}
         </foreach>
         <if test="queryMeter.startRecTime != null and queryMeter.startRecTime != ''">
-            AND h.date &gt;= DATE(#{queryMeter.startRecTime})
+            AND h.record_time &gt;= #{queryMeter.startRecTime}
         </if>
         <if test="queryMeter.endRecTime != null and queryMeter.endRecTime != ''">
-            AND h.date &lt;= DATE(#{queryMeter.endRecTime})
+            AND h.record_time &lt;= #{queryMeter.endRecTime}
         </if>
         AND h.date IS NOT NULL
         GROUP BY a.area_code, a.area_name, YEAR(h.date)
@@ -142,6 +165,7 @@
         ROUND(SUM(CASE WHEN h.meter_type = 1 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as peak_quantity,
         ROUND(SUM(CASE WHEN h.meter_type = 0 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as normal_quantity,
         ROUND(SUM(CASE WHEN h.meter_type = -1 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as valley_quantity,
+        ROUND(SUM(CASE WHEN h.meter_type = -2 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as deep_valley_quantity,
         ROUND(SUM(COALESCE(h.use_elec_cost, 0)), 2) as total_elec_cost
         FROM adm_elec_meter_h h
         WHERE h.device_code IN
@@ -149,10 +173,10 @@
             #{device}
         </foreach>
         <if test="queryMeter.startRecTime != null and queryMeter.startRecTime != ''">
-            AND h.date &gt;= DATE(#{queryMeter.startRecTime})
+            AND h.record_time &gt;= #{queryMeter.startRecTime}
         </if>
         <if test="queryMeter.endRecTime != null and queryMeter.endRecTime != ''">
-            AND h.date &lt;= DATE(#{queryMeter.endRecTime})
+            AND h.record_time &lt;= #{queryMeter.endRecTime}
         </if>
         AND h.date IS NOT NULL
     </select>
@@ -173,6 +197,7 @@
         ROUND(SUM(CASE WHEN h.meter_type = 1 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as peak_quantity,
         ROUND(SUM(CASE WHEN h.meter_type = 0 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as normal_quantity,
         ROUND(SUM(CASE WHEN h.meter_type = -1 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as valley_quantity,
+        ROUND(SUM(CASE WHEN h.meter_type = -2 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as deep_valley_quantity,
         ROUND(SUM(COALESCE(h.use_elec_cost, 0)), 2) as total_elec_cost,
         NOW() as create_time
         FROM adm_ems_facs f
@@ -189,10 +214,10 @@
                 AND f.facs_category = #{facsCategory}
             </if>
             <if test="startRecTime != null and startRecTime != ''">
-                AND h.date &gt;= DATE(#{startRecTime})
+                AND h.record_time &gt;= #{startRecTime}
             </if>
             <if test="endRecTime != null and endRecTime != ''">
-                AND h.date &lt;= DATE(#{endRecTime})
+                AND h.record_time &lt;= #{endRecTime}
             </if>
             AND h.date IS NOT NULL
             AND f.enable = 1
@@ -216,6 +241,7 @@
         ROUND(SUM(CASE WHEN h.meter_type = 1 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as peak_quantity,
         ROUND(SUM(CASE WHEN h.meter_type = 0 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as normal_quantity,
         ROUND(SUM(CASE WHEN h.meter_type = -1 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as valley_quantity,
+        ROUND(SUM(CASE WHEN h.meter_type = -2 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as deep_valley_quantity,
         ROUND(SUM(COALESCE(h.use_elec_cost, 0)), 2) as total_elec_cost,
         NOW() as create_time
         FROM adm_ems_facs f
@@ -259,6 +285,7 @@
         ROUND(SUM(CASE WHEN h.meter_type = 1 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as peak_quantity,
         ROUND(SUM(CASE WHEN h.meter_type = 0 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as normal_quantity,
         ROUND(SUM(CASE WHEN h.meter_type = -1 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as valley_quantity,
+        ROUND(SUM(CASE WHEN h.meter_type = -2 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as deep_valley_quantity,
         ROUND(SUM(COALESCE(h.use_elec_cost, 0)), 2) as total_elec_cost,
         NOW() as create_time
         FROM adm_ems_facs f
@@ -300,6 +327,7 @@
         ROUND(SUM(CASE WHEN h.meter_type = 1 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as peak_quantity,
         ROUND(SUM(CASE WHEN h.meter_type = 0 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as normal_quantity,
         ROUND(SUM(CASE WHEN h.meter_type = -1 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as valley_quantity,
+        ROUND(SUM(CASE WHEN h.meter_type = -2 THEN COALESCE(h.elec_quantity, 0) ELSE 0 END), 2) as deep_valley_quantity,
         ROUND(SUM(COALESCE(h.use_elec_cost, 0)), 2) as total_elec_cost
         FROM adm_ems_facs f
         LEFT JOIN adm_meter_boundary_rel rel ON rel.obj_type = 2 AND rel.boundary_obj = f.facs_code

+ 26 - 25
ems/ems-core/src/main/resources/mapper/ems/ElecGwPriceConfigMapper.xml

@@ -10,17 +10,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="elecType"    column="elec_type"    />
         <result property="elecTypeName"    column="elec_type_name"    />
         <result property="voltageLevel"    column="voltage_level"    />
-        <result property="degreePrice"    column="degree_price"    />
-        <result property="fsPeakDegreePrice"    column="fs_peak_degree_price"    />
-        <result property="fsHighDegreePrice"    column="fs_high_degree_price"    />
-        <result property="fsLowDegreePrice"    column="fs_low_degree_price"    />
+        <result property="opPrice"    column="op_price"    />
+        <result property="cpPrice"    column="cp_price"    />
+        <result property="pPrice"    column="p_price"    />
+        <result property="vPrice"    column="v_Price"    />
+        <result property="dvPrice"    column="dv_Price"    />
         <result property="maxReqPrice"    column="max_req_price"    />
         <result property="transCapacityPrice"    column="trans_capacity_price"    />
     </resultMap>
 
     <sql id="selectElecPriceConfigVo">
         select
-            v.id, v.cfg_code, v.elec_type, t.`name` as elec_type_name, v.voltage_level, v.degree_price, v.fs_peak_degree_price, v.fs_high_degree_price, v.fs_low_degree_price, v.max_req_price, v.trans_capacity_price
+            v.id, v.cfg_code, v.elec_type, t.`name` as elec_type_name, v.voltage_level, v.op_price, v.cp_price, v.p_price, v.v_Price, v.dv_Price, v.max_req_price, v.trans_capacity_price
         from adm_gw_elecprice_config v
             LEFT JOIN dim_ems_elecprice_type t ON v.elec_type = t.`code`
     </sql>
@@ -49,10 +50,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="cfgCode != null and cfgCode != ''">cfg_code,</if>
             <if test="elecType != null">elec_type,</if>
             <if test="voltageLevel != null and voltageLevel != ''">voltage_level,</if>
-            <if test="degreePrice != null">degree_price,</if>
-            <if test="fsPeakDegreePrice != null">fs_peak_degree_price,</if>
-            <if test="fsHighDegreePrice != null">fs_high_degree_price,</if>
-            <if test="fsLowDegreePrice != null">fs_low_degree_price,</if>
+            <if test="opPrice != null">op_price,</if>
+            <if test="cpPrice != null">cp_price,</if>
+            <if test="pPrice != null">p_price,</if>
+            <if test="vPrice != null">v_price,</if>
+            <if test="dvPrice != null">dv_price,</if>
             <if test="maxReqPrice != null">max_req_price,</if>
             <if test="transCapacityPrice != null">trans_capacity_price,</if>
          </trim>
@@ -60,10 +62,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="cfgCode != null and cfgCode != ''">#{cfgCode},</if>
             <if test="elecType != null">#{elecType},</if>
             <if test="voltageLevel != null and voltageLevel != ''">#{voltageLevel},</if>
-            <if test="degreePrice != null">#{degreePrice},</if>
-            <if test="fsPeakDegreePrice != null">#{fsPeakDegreePrice},</if>
-            <if test="fsHighDegreePrice != null">#{fsHighDegreePrice},</if>
-            <if test="fsLowDegreePrice != null">#{fsLowDegreePrice},</if>
+            <if test="opPrice != null">#{opPrice},</if>
+            <if test="cpPrice != null">#{cpPrice},</if>
+            <if test="pPrice != null">#{pPrice},</if>
+            <if test="vPrice != null">#{vPrice},</if>
+            <if test="dvPrice != null">#{dvPrice},</if>
             <if test="maxReqPrice != null">#{maxReqPrice},</if>
             <if test="transCapacityPrice != null">#{transCapacityPrice},</if>
          </trim>
@@ -72,18 +75,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <update id="updateElecPriceConfig" parameterType="com.ruoyi.ems.domain.ElecGwPriceConfig">
         update adm_gw_elecprice_config
         <set>
-            <if test="degreePrice != null">degree_price = #{degreePrice},</if>
-            <if test="degreePrice == null">degree_price = NULL,</if>
-            <if test="fsPeakDegreePrice != null">fs_peak_degree_price = #{fsPeakDegreePrice},</if>
-            <if test="fsPeakDegreePrice == null">fs_peak_degree_price = NULL,</if>
-            <if test="fsHighDegreePrice != null">fs_high_degree_price = #{fsHighDegreePrice},</if>
-            <if test="fsHighDegreePrice == null">fs_high_degree_price = NULL,</if>
-            <if test="fsLowDegreePrice != null">fs_low_degree_price = #{fsLowDegreePrice},</if>
-            <if test="fsLowDegreePrice == null">fs_low_degree_price = NULL,</if>
-            <if test="maxReqPrice != null">max_req_price = #{maxReqPrice},</if>
-            <if test="maxReqPrice == null">max_req_price = NULL,</if>
-            <if test="transCapacityPrice != null">trans_capacity_price = #{transCapacityPrice},</if>
-            <if test="transCapacityPrice == null">trans_capacity_price = NULL,</if>
+            <if test="opPrice != null">op_price = #{opPrice},</if>
+            <if test="opPrice == null">op_price = NULL,</if>
+            <if test="cpPrice != null">cp_price = #{cpPrice},</if>
+            <if test="cpPrice == null">cp_price = NULL,</if>
+            <if test="pPrice != null">p_price = #{pPrice},</if>
+            <if test="pPrice == null">p_price = NULL,</if>
+            <if test="vPrice != null">v_price = #{vPrice},</if>
+            <if test="vPrice == null">v_price = NULL,</if>
+            <if test="dvPrice != null">dv_price = #{dvPrice},</if>
+            <if test="dvPrice == null">dv_price = NULL,</if>
         </set>
         where id = #{id}
     </update>

+ 18 - 10
ems/ems-core/src/main/resources/mapper/ems/ElecPriceStrategyMapper.xml

@@ -9,8 +9,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="strategyCode"    column="strategy_code"    />
         <result property="strategyName"    column="strategy_name"    />
         <result property="strategyDesc"    column="strategy_desc"    />
-        <result property="repeatType"    column="repeat_type"    />
-        <result property="repeatParam"    column="repeat_param"    />
+        <result property="supportType"    column="support_type"    />
+        <result property="execMonth"    column="exec_month"    />
+        <result property="execDateType"    column="exec_date_type"    />
+        <result property="execDate"    column="exec_date"    />
         <result property="priority"    column="priority"    />
         <result property="editFlag"    column="edit_flag"    />
         <result property="createTime"    column="create_time"    />
@@ -18,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectElecPriceStrategyVo">
-        select id, strategy_code, strategy_name, strategy_desc, repeat_type, repeat_param, priority, edit_flag, create_time, update_time from adm_elecprice_strategy
+        select id, strategy_code, strategy_name, strategy_desc, support_type, exec_month, exec_date_type, exec_date, priority, edit_flag, create_time, update_time from adm_elecprice_strategy
     </sql>
 
     <select id="selectList" parameterType="com.ruoyi.ems.domain.ElecPriceStrategy" resultMap="ElecpriceStrategyResult">
@@ -26,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <where>  
             <if test="strategyCode != null  and strategyCode != ''"> and strategy_code = #{strategyCode}</if>
             <if test="strategyName != null  and strategyName != ''"> and strategy_name like concat('%', #{strategyName}, '%')</if>
-            <if test="repeatType != null  and repeatType != ''"> and repeat_type = #{repeatType}</if>
+            <if test="execDateType != null  and execDateType != ''"> and exec_date_type = #{execDateType}</if>
             <if test="priority != null "> and priority = #{priority}</if>
         </where>
     </select>
@@ -42,8 +44,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="strategyCode != null and strategyCode != ''">strategy_code,</if>
             <if test="strategyName != null and strategyName != ''">strategy_name,</if>
             <if test="strategyDesc != null and strategyDesc != ''">strategy_desc,</if>
-            <if test="repeatType != null">repeat_type,</if>
-            <if test="repeatParam != null">repeat_param,</if>
+            <if test="supportType != null">support_type,</if>
+            <if test="execMonth != null">exec_month,</if>
+            <if test="execDateType != null">exec_date_type,</if>
+            <if test="execDate != null">exec_date,</if>
             <if test="priority != null">priority,</if>
             <if test="editFlag != null">edit_flag,</if>
             <if test="createTime != null">create_time,</if>
@@ -53,8 +57,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="strategyCode != null and strategyCode != ''">#{strategyCode},</if>
             <if test="strategyName != null and strategyName != ''">#{strategyName},</if>
             <if test="strategyDesc != null and strategyDesc != ''">#{strategyDesc},</if>
-            <if test="repeatType != null">#{repeatType},</if>
-            <if test="repeatParam != null">#{repeatParam},</if>
+            <if test="supportType != null">#{supportType},</if>
+            <if test="execMonth != null">#{execMonth},</if>
+            <if test="execDateType != null">#{execDateType},</if>
+            <if test="execDate != null">#{execDate},</if>
             <if test="priority != null">#{priority},</if>
             <if test="editFlag != null">#{editFlag},</if>
             <if test="createTime != null">#{createTime},</if>
@@ -68,8 +74,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="strategyCode != null and strategyCode != ''">strategy_code = #{strategyCode},</if>
             <if test="strategyName != null and strategyName != ''">strategy_name = #{strategyName},</if>
             <if test="strategyDesc != null and strategyDesc != ''">strategy_desc = #{strategyDesc},</if>
-            <if test="repeatType != null">repeat_type = #{repeatType},</if>
-            <if test="repeatParam != null">repeat_param = #{repeatParam},</if>
+            <if test="supportType != null">support_type = #{supportType},</if>
+            <if test="execMonth != null">exec_month = #{execMonth},</if>
+            <if test="execDateType != null">exec_date_type = #{execDateType},</if>
+            <if test="execDate != null">exec_date = #{execDate},</if>
             <if test="priority != null">priority = #{priority},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>

+ 5 - 2
ems/ems-core/src/main/resources/mapper/ems/EmsFacsMapper.xml

@@ -23,7 +23,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="objType"    column="obj_type"    />
         <result property="objCode"    column="obj_code"    />
         <result property="objName"    column="obj_name"    />
-        <result property="bindMeterDevs"    column="meter_devices"    />
+        <result property="meterCls"    column="meter_cls"    />
+        <result property="bindMeterDevsStr"    column="meter_devices"    />
     </resultMap>
 
     <sql id="selectEmsFacsVo">
@@ -52,7 +53,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectFacsWithMeter" resultMap="FacsBoundaryObjResult">
         SELECT
-            2 as obj_type,
+            r.obj_type,
+            r.meter_cls,
             e.facs_code as obj_code,
             e.facs_name as obj_name,
             e.facs_category,
@@ -66,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="areaCode != null and areaCode != '-1'"> and e.ref_area = #{areaCode}</if>
             <if test="category != null and category != ''"> and e.facs_category = #{category}</if>
             <if test="subCategory != null and subCategory != ''"> and e.facs_subcategory = #{subCategory}</if>
+            <if test="meterCls != null"> and r.meter_cls = #{meterCls}</if>
         </where>
         GROUP BY
             e.facs_code, e.facs_category, e.facs_subcategory

+ 16 - 16
ems/ems-core/src/main/resources/mapper/ems/WaterConsumptionMapper.xml

@@ -41,10 +41,10 @@
             #{device}
         </foreach>
         <if test="queryMeter.startRecTime != null and queryMeter.startRecTime != ''">
-            AND h.date &gt;= DATE(#{queryMeter.startRecTime})
+            AND h.record_time &gt;= #{queryMeter.startRecTime}
         </if>
         <if test="queryMeter.endRecTime != null and queryMeter.endRecTime != ''">
-            AND h.date &lt;= DATE(#{queryMeter.endRecTime})
+            AND h.record_time &lt;= #{queryMeter.endRecTime}
         </if>
         AND h.date IS NOT NULL
         GROUP BY a.area_code, a.area_name, h.date
@@ -72,10 +72,10 @@
             #{device}
         </foreach>
         <if test="queryMeter.startRecTime != null and queryMeter.startRecTime != ''">
-            AND h.date &gt;= DATE(#{queryMeter.startRecTime})
+            AND h.record_time &gt;= #{queryMeter.startRecTime}
         </if>
         <if test="queryMeter.endRecTime != null and queryMeter.endRecTime != ''">
-            AND h.date &lt;= DATE(#{queryMeter.endRecTime})
+            AND h.record_time &lt;= #{queryMeter.endRecTime}
         </if>
         AND h.date IS NOT NULL
         GROUP BY a.area_code, a.area_name, DATE_FORMAT(h.date, '%Y-%m')
@@ -103,10 +103,10 @@
             #{device}
         </foreach>
         <if test="queryMeter.startRecTime != null and queryMeter.startRecTime != ''">
-            AND h.date &gt;= DATE(#{queryMeter.startRecTime})
+            AND h.record_time &gt;= #{queryMeter.startRecTime}
         </if>
         <if test="queryMeter.endRecTime != null and queryMeter.endRecTime != ''">
-            AND h.date &lt;= DATE(#{queryMeter.endRecTime})
+            AND h.record_time &lt;= #{queryMeter.endRecTime}
         </if>
         AND h.date IS NOT NULL
         GROUP BY a.area_code, a.area_name, YEAR(h.date)
@@ -129,10 +129,10 @@
             #{device}
         </foreach>
         <if test="queryMeter.startRecTime != null and queryMeter.startRecTime != ''">
-            AND h.date &gt;= DATE(#{queryMeter.startRecTime})
+            AND h.record_time &gt;= #{queryMeter.startRecTime}
         </if>
         <if test="queryMeter.endRecTime != null and queryMeter.endRecTime != ''">
-            AND h.date &lt;= DATE(#{queryMeter.endRecTime})
+            AND h.record_time &lt;= #{queryMeter.endRecTime}
         </if>
         AND h.date IS NOT NULL
     </select>
@@ -165,10 +165,10 @@
                 AND f.facs_category = #{facsCategory}
             </if>
             <if test="startRecTime != null and startRecTime != ''">
-                AND h.date &gt;= DATE(#{startRecTime})
+                AND h.record_time &gt;= #{startRecTime}
             </if>
             <if test="endRecTime != null and endRecTime != ''">
-                AND h.date &lt;= DATE(#{endRecTime})
+                AND h.record_time &lt;= #{endRecTime}
             </if>
             AND h.date IS NOT NULL
             AND f.enable = 1
@@ -204,10 +204,10 @@
                 AND f.facs_category = #{facsCategory}
             </if>
             <if test="startRecTime != null and startRecTime != ''">
-                AND h.date &gt;= DATE(#{startRecTime})
+                AND h.record_time &gt;= #{startRecTime}
             </if>
             <if test="endRecTime != null and endRecTime != ''">
-                AND h.date &lt;= DATE(#{endRecTime})
+                AND h.record_time &lt;= #{endRecTime}
             </if>
             AND h.date IS NOT NULL
             AND f.enable = 1
@@ -243,10 +243,10 @@
                 AND f.facs_category = #{facsCategory}
             </if>
             <if test="startRecTime != null and startRecTime != ''">
-                AND h.date &gt;= DATE(#{startRecTime})
+                AND h.record_time &gt;= #{startRecTime}
             </if>
             <if test="endRecTime != null and endRecTime != ''">
-                AND h.date &lt;= DATE(#{endRecTime})
+                AND h.record_time &lt;= #{endRecTime}
             </if>
             AND h.date IS NOT NULL
             AND f.enable = 1
@@ -279,10 +279,10 @@
                 AND f.facs_code = #{objCode}
             </if>
             <if test="startRecTime != null and startRecTime != ''">
-                AND h.date &gt;= DATE(#{startRecTime})
+                AND h.record_time &gt;= #{startRecTime}
             </if>
             <if test="endRecTime != null and endRecTime != ''">
-                AND h.date &lt;= DATE(#{endRecTime})
+                AND h.record_time &lt;= #{endRecTime}
             </if>
             AND h.date IS NOT NULL
             AND f.enable = 1

+ 50 - 39
ems/sql/ems_init_data.sql

@@ -186,28 +186,35 @@ 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 ( 'ID-E-C-1007', '南区宿舍能耗采集器', '-', '-', '1', '宿舍', '321283124S300203', '321283124S3002', 'M_W2_SM_INDOOR_ENERGY', 'NH02', 'SM', 'SYS_NHJC');
 
 -- mock设备
-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 ('GCZR-001', '光储设备1',    'xxx', 'xxx', 1, '北区广场', '321283124S300104', '321283124S3001',  'test', 'GCC01', NULL, 'SYS_GCC');
-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 ('GCZR-002', '光储设备2',    'xxx', 'xxx', 1, '北区广场', '321283124S300104', '321283124S3001',  'test', 'GCC01', NULL, 'SYS_GCC');
-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 ('GCZR-003', '光储设备3',    'xxx', 'xxx', 1, '北区广场', '321283124S300104', '321283124S3001',  'test', 'GCC01', NULL, 'SYS_GCC');
-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 ('GCZR-004', '光储设备4',    'xxx', 'xxx', 1, '北区广场', '321283124S300104', '321283124S3001',  'test', 'GCC01', NULL, 'SYS_GCC');
-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 ('GCZR-005', '光储设备5',    'xxx', 'xxx', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'GCC02', NULL, 'SYS_GCC');
-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 ('GCZR-006', '光储设备6',    'xxx', 'xxx', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'GCC02', NULL, 'SYS_GCC');
-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 ('GCZR-007', '光储设备7',    'xxx', 'xxx', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'GCC02', NULL, 'SYS_GCC');
-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 ('GCZR-008', '光储设备8',    'xxx', 'xxx', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'GCC02', NULL, 'SYS_GCC');
-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, '北区广场', '321283124S300104', '321283124S3001',  'test', 'Charge01', NULL, '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, '北区广场', '321283124S300104', '321283124S3001',  'test', 'Charge01', NULL, '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, '北区广场', '321283124S300104', '321283124S3001',  'test', 'Charge01', NULL, '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, '北区广场', '321283124S300104', '321283124S3001',  'test', 'Charge01', NULL, '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-N-EVSE-20001', '1号充电桩',    '特来电', 'TCDZ-DCO.7', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'Charge02', NULL, '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-N-EVSE-20002', '2号充电桩',    '特来电', 'TCDZ-DCO.7', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'Charge02', NULL, '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-N-EVSE-20003', '3号充电桩',    '特来电', 'TCDZ-DCO.7', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'Charge02', NULL, '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-N-EVSE-20004', '4号充电桩',    '特来电', 'TCDZ-DCO.7', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'Charge02', NULL, '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 ('ZHZM-01', '照明01',    'xxx', 'xxx', 1, '北区广场', '321283124S300104', '321283124S3001',  'test', 'ZHZM01', NULL, 'SYS_ZHZM');
-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 ('ZHZM-02', '照明02',    'xxx', 'xxx', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'ZHZM02', NULL, 'SYS_ZHZM');
-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 ('ZHHM-01', '海绵设备1',    'xxx', 'xxx', 1, '北区广场', '321283124S300104', '321283124S3001',  'test', 'ZHHM01', NULL, 'SYS_ZHHM');
-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 ('ZHHM-02', '海绵设备2',    'xxx', 'xxx', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'ZHHM02', NULL, 'SYS_ZHHM');
-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 ('LGCY-01', '厨余垃圾设备1',    'xxx', 'xxx', 1, '北区广场', '321283124S300104', '321283124S3001',  'test', 'LG01', NULL, 'SYS_LG');
-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 ('LGCY-02', '厨余垃圾设备2',    'xxx', 'xxx', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'LG02', NULL, 'SYS_LG');
+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 ('GCZR-001', '光储设备1',    'xxx', 'xxx', 1, '北区广场', '321283124S300104', '321283124S3001',  'test', 'C101', NULL, 'SYS_GCC');
+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 ('GCZR-002', '光储设备2',    'xxx', 'xxx', 1, '北区广场', '321283124S300104', '321283124S3001',  'test', 'C101', NULL, 'SYS_GCC');
+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 ('GCZR-003', '光储设备3',    'xxx', 'xxx', 1, '北区广场', '321283124S300104', '321283124S3001',  'test', 'C101', NULL, 'SYS_GCC');
+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 ('GCZR-004', '光储设备4',    'xxx', 'xxx', 1, '北区广场', '321283124S300104', '321283124S3001',  'test', 'C101', NULL, 'SYS_GCC');
+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 ('GCZR-005', '光储设备5',    'xxx', 'xxx', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'C102', NULL, 'SYS_GCC');
+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 ('GCZR-006', '光储设备6',    'xxx', 'xxx', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'C102', NULL, 'SYS_GCC');
+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 ('GCZR-007', '光储设备7',    'xxx', 'xxx', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'C102', NULL, 'SYS_GCC');
+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 ('GCZR-008', '光储设备8',    'xxx', 'xxx', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'C102', NULL, 'SYS_GCC');
+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, '北区广场', '321283124S300104', '321283124S3001',  'test', 'Z-FW-01', '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, '北区广场', '321283124S300104', '321283124S3001',  'test', 'Z-FW-01', '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, '北区广场', '321283124S300104', '321283124S3001',  'test', 'Z-FW-01', '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, '北区广场', '321283124S300104', '321283124S3001',  'test', 'Z-FW-01', '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-N-EVSE-20001', '1号充电桩',    '特来电', 'TCDZ-DCO.7', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'Z-FW-02', '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-N-EVSE-20002', '2号充电桩',    '特来电', 'TCDZ-DCO.7', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'Z-FW-02', '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-N-EVSE-20003', '3号充电桩',    '特来电', 'TCDZ-DCO.7', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'Z-FW-02', '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-N-EVSE-20004', '4号充电桩',    '特来电', 'TCDZ-DCO.7', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'Z-FW-02', '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 ('ZHZM-01', '照明01',    'xxx', 'xxx', 1, '北区广场', '321283124S300104', '321283124S3001',  'test', 'Z-ZM-01', NULL, 'SYS_ZHZM');
+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 ('ZHZM-02', '照明02',    'xxx', 'xxx', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'Z-ZM-02', NULL, 'SYS_ZHZM');
+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 ('ZHHM-01', '海绵设备1',    'xxx', 'xxx', 1, '北区广场', '321283124S300104', '321283124S3001',  'test', 'Z-QT-01', NULL, 'SYS_ZHHM');
+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 ('ZHHM-02', '海绵设备2',    'xxx', 'xxx', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'Z-QT-02', NULL, 'SYS_ZHHM');
+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 ('LGCY-01', '厨余垃圾设备1',    'xxx', 'xxx', 1, '北区广场', '321283124S300104', '321283124S3001',  'test', 'Z-QT-01', NULL, 'SYS_LG');
+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 ('LGCY-02', '厨余垃圾设备2',    'xxx', 'xxx', 1, '南区广场', '321283124S300204', '321283124S3002',  'test', 'Z-QT-02', NULL, 'SYS_LG');
+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 ( '321283124S3001_99-ZHLD-001', '光伏板1','Canadian Solar', 'x1', '1', null, '321283124S300150', '321283124S3001', 'test', 'E501', null, 'SYS_GF');
+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 ( '321283124S3001_99-CPD-001', '光伏板2', 'Canadian Solar', 'x1', '1', null, '321283124S300150', '321283124S3001', 'test', 'E501', null, 'SYS_GF');
+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 ( '321283124S3002_99-ZHLD-001', '光伏板3','Canadian Solar', 'x1', '1', null, '321283124S300250', '321283124S3002', 'test', 'E502', null, 'SYS_GF');
+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 ( '321283124S3002_99-CPD-001', '光伏板4', 'Canadian Solar', 'x1', '1', null, '321283124S300250', '321283124S3002', 'test', 'E502', null, 'SYS_GF');
+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 ( 'E503-K140-K150-001', '光伏板5',        'Canadian Solar', 'x1', '1', null, 'S30K140-S30K150', '321283124S3003', 'test', 'E503', null, 'SYS_GF');
+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 ( 'E503-K140-K150-002', '光伏板6',        'Canadian Solar', 'x1', '1', null, 'S30K140-S30K150', '321283124S3003', 'test', 'E503', null, 'SYS_GF');
+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 ( 'E503-K140-K150-003', '光伏板7',        'Canadian Solar', 'x1', '1', null, 'S30K150-S30K180', '321283124S3003', 'test', 'E503', null, 'SYS_GF');
 
 
 -- 策略初始数据
@@ -372,31 +379,35 @@ insert into adm_obj_tag_rel (`obj_code`, `obj_type`, `tag_code`) VALUES ('321283
 INSERT INTO adm_area_elec_attr (`area_code`, `price_code`, `req_capacity_flag`, `trans_capacity`, `req_quantity`) VALUES ('321283124S3001', '4001', 1, 630, NULL);
 INSERT INTO adm_area_elec_attr (`area_code`, `price_code`, `req_capacity_flag`, `trans_capacity`, `req_quantity`) VALUES ('321283124S3002', '4001', 1, 630, 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 ('3001', 3, '不满1千伏', 0.7624, 1.5296, 1.2747,  0.3445, 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 ('3002', 3, '1-10(20)千伏', 0.7364, 1.4774, 1.2312,  0.3327, 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 ('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);
-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 ('4004', 4, '220千伏及以上', 0.5827, 1.2024, 1.002,  0.2439, 41.6, 26);
+INSERT INTO adm_gw_elecprice_config (`cfg_code`, `elec_type`, `voltage_level`, `op_price`, `cp_price`, `p_price`, `v_Price`, `dv_Price`, `max_req_price`, `trans_capacity_price`) VALUES ('4001', 4, '1-10(20)千伏', 0.6587,NULL,1.05392, 0.428155,  NULL, 51.2, 32);
 
 
 -- 峰谷电价策略数据
 -- 默认策略
-INSERT INTO adm_elecprice_strategy (`strategy_code`, `strategy_name`, `strategy_desc`, `repeat_type`, `repeat_param`, `priority`, `edit_flag`) VALUES ('-1', '默认策略', '0:00-24:00 执行平段电价', 2, null, 0, 0);
+INSERT INTO adm_elecprice_strategy (`strategy_code`, `strategy_name`, `strategy_desc`, `support_type`, `exec_month`, `exec_date_type`, `exec_date`, `priority`, `edit_flag`) VALUES ('-1', '默认策略', '0:00-24:00 执行平段电价', '0', '01,02,03,04,05,06,07,08,09,10,11,12',2, null, 0, 0);
 INSERT INTO adm_elecprice_strategy_hour (`strategy_code`, `start_time`, `end_time`, `type`) VALUES ('-1', '00:00:00', '23:59:59', 0);
 
 -- 默认策略
-INSERT INTO adm_elecprice_strategy (`strategy_code`, `strategy_name`, `strategy_desc`, `repeat_type`, `repeat_param`, `priority`, `edit_flag`) VALUES ('1001', '100千伏安', '100千伏安以上峰谷电价', 2, null, 1, 1);
-INSERT INTO adm_elecprice_strategy_hour (`strategy_code`, `start_time`, `end_time`, `type`) VALUES ('1001', '00:00:00', '08:00:00', -1);
-INSERT INTO adm_elecprice_strategy_hour (`strategy_code`, `start_time`, `end_time`, `type`) VALUES ('1001', '08:00:00', '10:00:00', 1);
-INSERT INTO adm_elecprice_strategy_hour (`strategy_code`, `start_time`, `end_time`, `type`) VALUES ('1001', '11:00:00', '17:00:00', 0);
-INSERT INTO adm_elecprice_strategy_hour (`strategy_code`, `start_time`, `end_time`, `type`) VALUES ('1001', '17:00:00', '22:00:00', 1);
-INSERT INTO adm_elecprice_strategy_hour (`strategy_code`, `start_time`, `end_time`, `type`) VALUES ('1001', '22:00:00', '23:59:59', 0);
+INSERT INTO adm_elecprice_strategy (`strategy_code`, `strategy_name`, `strategy_desc`, `support_type`, `exec_month`, `exec_date_type`, `exec_date`, `priority`, `edit_flag`) VALUES ('1001', '春秋两季峰谷', '3-5月,9-11月', '-1,0,1', '03,04,05,09,10,11', 2, null, 1, 1);
+INSERT INTO adm_elecprice_strategy_hour (`strategy_code`, `start_time`, `end_time`, `type`) VALUES ('1001', '00:00:00', '01:59:59', 0);
+INSERT INTO adm_elecprice_strategy_hour (`strategy_code`, `start_time`, `end_time`, `type`) VALUES ('1001', '02:00:00', '05:59:59', -1);
+INSERT INTO adm_elecprice_strategy_hour (`strategy_code`, `start_time`, `end_time`, `type`) VALUES ('1001', '06:00:00', '09:59:59', 0);
+INSERT INTO adm_elecprice_strategy_hour (`strategy_code`, `start_time`, `end_time`, `type`) VALUES ('1001', '10:00:00', '13:59:59', -1);
+INSERT INTO adm_elecprice_strategy_hour (`strategy_code`, `start_time`, `end_time`, `type`) VALUES ('1001', '14:00:00', '14:59:59', -1);
+INSERT INTO adm_elecprice_strategy_hour (`strategy_code`, `start_time`, `end_time`, `type`) VALUES ('1001', '15:00:00', '21:59:59', 1);
+INSERT INTO adm_elecprice_strategy_hour (`strategy_code`, `start_time`, `end_time`, `type`) VALUES ('1001', '22:00:00', '23:59:59', 1);
+
+
+INSERT INTO adm_elecprice_strategy (`strategy_code`, `strategy_name`, `strategy_desc`, `support_type`, `exec_month`, `exec_date_type`, `exec_date`, `priority`, `edit_flag`) VALUES ('1002', '夏冬两季峰谷', '1-2月,6-8月,12月', '-1,0,1', '01,02,06,07,08,12', 2, null, 1, 1);
+INSERT INTO adm_elecprice_strategy_hour (`strategy_code`, `start_time`, `end_time`, `type`) VALUES ('1002', '00:00:00', '05:59:59', -1);
+INSERT INTO adm_elecprice_strategy_hour (`strategy_code`, `start_time`, `end_time`, `type`) VALUES ('1002', '06:00:00', '10:59:59', 0);
+INSERT INTO adm_elecprice_strategy_hour (`strategy_code`, `start_time`, `end_time`, `type`) VALUES ('1002', '11:00:00', '12:59:59', -1);
+INSERT INTO adm_elecprice_strategy_hour (`strategy_code`, `start_time`, `end_time`, `type`) VALUES ('1002', '13:00:00', '13:59:59', 0);
+INSERT INTO adm_elecprice_strategy_hour (`strategy_code`, `start_time`, `end_time`, `type`) VALUES ('1002', '14:00:00', '21:59:59', 1);
+INSERT INTO adm_elecprice_strategy_hour (`strategy_code`, `start_time`, `end_time`, `type`) VALUES ('1002', '22:00:00', '23:59:59', 0);
+
+
 
 -- 非电能源价格
 INSERT INTO `adm_fd_energyprice_config` (`cfg_code`, `area_code`, `meter_cls`, `unit_price`, `meter_unit`) VALUES ('0000', '-1', 70, 4.1, '吨');

+ 9 - 6
ems/sql/ems_server.sql

@@ -1104,10 +1104,11 @@ create table adm_gw_elecprice_config (
   `cfg_code`              varchar(4)      not null                     comment '配置代码',
   `elec_type`             int             not null                     comment '用电分类 1-居民 2-农业 3-工业单一制 4-工业两部制',
   `voltage_level`         varchar(32)     not null                     comment '电压等级',
-  `degree_price`          double          not null                     comment '单位电价',
-  `fs_peak_degree_price`  double          default null                 comment '分时尖峰时段价格',
-  `fs_high_degree_price`  double          default null                 comment '分时高峰时段价格',
-  `fs_low_degree_price`   double          default null                 comment '分时低谷时段价格',
+  `op_price`              double          not null                     comment '平时段电价',
+  `cp_price`              double          default null                 comment '尖峰时段电价',
+  `p_price`               double          default null                 comment '峰时段电价',
+  `v_price`               double          default null                 comment '谷时段电价',
+  `dv_price`              double          default null                 comment '深谷时段电价',
   `max_req_price`         double          default null                 comment '最大需量用电价格',
   `trans_capacity_price`  double          default null                 comment '变压器容量用电价格',
   primary key (`id`),
@@ -1156,8 +1157,10 @@ create table adm_elecprice_strategy (
   `strategy_code`        varchar(32)     not null                     comment '策略代码',
   `strategy_name`        varchar(16)     not null                     comment '策略名称',
   `strategy_desc`        varchar(128)    default null                 comment '策略描述',
-  `repeat_type`          int             not null                     comment '重复类型',
-  `repeat_param`         varchar(128)    default null                 comment '重复参数',
+  `support_type`         varchar(128)    default null                 comment '支持小时电价类型',
+  `exec_month`           varchar(128)    default null                 comment '执行月份',
+  `exec_date_type`       int             default null                 comment '执行日期类型',
+  `exec_date`            varchar(128)    default null                 comment '执行日期',
   `priority`             int             default 0                    comment '优先级',
   `edit_flag`            int             default 1                    comment '编辑标识',
   `create_time`          datetime        default CURRENT_TIMESTAMP    comment '创建时间',