Browse Source

计价策略修改

lv.wenbin 8 months ago
parent
commit
1b9e7f6f4d
18 changed files with 145 additions and 202 deletions
  1. 16 20
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/ElecAttrController.java
  2. 15 7
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/ElecAttr.java
  3. 6 6
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/ElecAttrMapper.java
  4. 8 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IElecAttrService.java
  5. 60 15
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaElectricityAttrServiceImpl.java
  6. 0 13
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaServiceImpl.java
  7. 1 1
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/CoChargingConfigMapper.xml
  8. 2 12
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecAttrMapper.xml
  9. 1 1
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecLoadIndex15minMapper.xml
  10. 1 1
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecPgSupplyHMapper.xml
  11. 1 1
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecProdForecastMapper.xml
  12. 1 1
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecPvSupplyHMapper.xml
  13. 3 3
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecUseHMapper.xml
  14. 1 1
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/EmsDeviceMapper.xml
  15. 1 1
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/EmsElecStoreHMapper.xml
  16. 1 1
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/EmsFacsMapper.xml
  17. 26 117
      ems-cloud/sql/ems_init_data.sql
  18. 1 1
      ems-cloud/sql/ems_server.sql

+ 16 - 20
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/ElecAttrController.java

@@ -3,7 +3,6 @@ package com.ruoyi.ems.controller;
 import com.ruoyi.common.core.utils.poi.ExcelUtil;
 import com.ruoyi.common.core.web.controller.BaseController;
 import com.ruoyi.common.core.web.domain.AjaxResult;
-import com.ruoyi.common.core.web.page.TableDataInfo;
 import com.ruoyi.common.log.annotation.Log;
 import com.ruoyi.common.log.enums.BusinessType;
 import com.ruoyi.common.security.annotation.RequiresPermissions;
@@ -18,6 +17,7 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PutMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletResponse;
@@ -44,31 +44,27 @@ public class ElecAttrController extends BaseController {
      */
     @RequiresPermissions("basecfg:price:list")
     @GetMapping("/list")
-    public TableDataInfo list(ElecAttr areaElectricityAttr) {
-        startPage();
-        List<ElecAttr> list = attrService.selectElecAttrList(areaElectricityAttr);
-        return getDataTable(list);
+    public AjaxResult list(ElecAttr elecAttr) {
+        List<ElecAttr> list = attrService.selectElecAttrList(elecAttr);
+        return success(list);
     }
 
     /**
-     * 导出服务区用电属性列表
+     * 获取服务区用电属性详细信息
      */
-    @RequiresPermissions("basecfg:price:export")
-    @Log(title = "服务区用电属性", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
-    public void export(HttpServletResponse response, ElecAttr areaElectricityAttr) {
-        List<ElecAttr> list = attrService.selectElecAttrList(areaElectricityAttr);
-        ExcelUtil<ElecAttr> util = new ExcelUtil<ElecAttr>(ElecAttr.class);
-        util.exportExcel(response, list, "服务区用电属性数据");
+    @RequiresPermissions("basecfg:price:query")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
+        return success(attrService.selectElecAttrById(id));
     }
 
     /**
      * 获取服务区用电属性详细信息
      */
     @RequiresPermissions("basecfg:price:query")
-    @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id) {
-        return success(attrService.selectElecAttrById(id));
+    @GetMapping(value = "/getByArea")
+    public AjaxResult getByArea(@RequestParam(name="areaCode") String areaCode) {
+        return success(attrService.getElecAttrByArea(areaCode));
     }
 
     /**
@@ -77,8 +73,8 @@ public class ElecAttrController extends BaseController {
     @RequiresPermissions("basecfg:price:add")
     @Log(title = "服务区用电属性", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody ElecAttr areaElectricityAttr) {
-        return toAjax(attrService.insertElecAttr(areaElectricityAttr));
+    public AjaxResult add(@RequestBody ElecAttr elecAttr) {
+        return toAjax(attrService.insertElecAttr(elecAttr));
     }
 
     /**
@@ -87,8 +83,8 @@ public class ElecAttrController extends BaseController {
     @RequiresPermissions("basecfg:price:edit")
     @Log(title = "服务区用电属性", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody ElecAttr areaElectricityAttr) {
-        return toAjax(attrService.updateElecAttr(areaElectricityAttr));
+    public AjaxResult edit(@RequestBody ElecAttr elecAttr) {
+        return toAjax(attrService.updateElecAttr(elecAttr));
     }
 
     /**

+ 15 - 7
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/ElecAttr.java

@@ -1,9 +1,8 @@
 package com.ruoyi.ems.domain;
 
+import com.ruoyi.common.core.annotation.Excel;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
-import com.ruoyi.common.core.annotation.Excel;
-import com.ruoyi.common.core.web.domain.BaseEntity;
 
 /**
  * 服务区用电属性对象 adm_area_elec_attr
@@ -11,10 +10,8 @@ import com.ruoyi.common.core.web.domain.BaseEntity;
  * @author ruoyi
  * @date 2024-07-23
  */
-public class ElecAttr extends BaseEntity
+public class ElecAttr
 {
-    private static final long serialVersionUID = 1L;
-
     /** 序号 */
     private Long id;
 
@@ -51,6 +48,11 @@ public class ElecAttr extends BaseEntity
     @Excel(name = "最大需量(千瓦·月)")
     private Long reqQuantity;
 
+    /**
+     * 状态
+     */
+    private int state;
+
     public Long getId() {
         return id;
     }
@@ -131,6 +133,14 @@ public class ElecAttr extends BaseEntity
         this.reqQuantity = reqQuantity;
     }
 
+    public int getState() {
+        return state;
+    }
+
+    public void setState(int state) {
+        this.state = state;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@@ -143,8 +153,6 @@ public class ElecAttr extends BaseEntity
             .append("reqCapacityFlag", getReqCapacityFlag())
             .append("transCapacity", getTransCapacity())
             .append("reqQuantity", getReqQuantity())
-            .append("createTime", getCreateTime())
-            .append("updateTime", getUpdateTime())
             .toString();
     }
 }

+ 6 - 6
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/ElecAttrMapper.java

@@ -22,26 +22,26 @@ public interface ElecAttrMapper {
     /**
      * 查询服务区用电属性列表
      *
-     * @param areaElectricityAttr 服务区用电属性
+     * @param elecAttr 服务区用电属性
      * @return 服务区用电属性集合
      */
-    List<ElecAttr> selectElecAttrList(ElecAttr areaElectricityAttr);
+    List<ElecAttr> selectElecAttrList(ElecAttr elecAttr);
 
     /**
      * 新增服务区用电属性
      *
-     * @param areaElectricityAttr 服务区用电属性
+     * @param elecAttr 服务区用电属性
      * @return 结果
      */
-    int insertElecAttr(ElecAttr areaElectricityAttr);
+    int insertElecAttr(ElecAttr elecAttr);
 
     /**
      * 修改服务区用电属性
      *
-     * @param areaElectricityAttr 服务区用电属性
+     * @param elecAttr 服务区用电属性
      * @return 结果
      */
-    int updateElecAttr(ElecAttr areaElectricityAttr);
+    int updateElecAttr(ElecAttr elecAttr);
 
     /**
      * 删除服务区用电属性

+ 8 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IElecAttrService.java

@@ -20,6 +20,14 @@ public interface IElecAttrService {
     ElecAttr selectElecAttrById(Long id);
 
     /**
+     * 查询服务区用电属性
+     *
+     * @param areaCode 区域编码
+     * @return 服务区用电属性
+     */
+    List<ElecAttr> getElecAttrByArea(String areaCode);
+
+    /**
      * 查询服务区用电属性列表
      *
      * @param areaElectricityAttr 服务区用电属性

+ 60 - 15
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaElectricityAttrServiceImpl.java

@@ -1,13 +1,21 @@
 package com.ruoyi.ems.service.impl;
 
+import com.ruoyi.common.core.exception.Assert;
 import com.ruoyi.common.core.utils.DateUtils;
+import com.ruoyi.ems.domain.Area;
 import com.ruoyi.ems.domain.ElecAttr;
 import com.ruoyi.ems.mapper.ElecAttrMapper;
+import com.ruoyi.ems.service.IAreaService;
 import com.ruoyi.ems.service.IElecAttrService;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 
 /**
  * 服务区用电属性Service业务层处理
@@ -18,7 +26,10 @@ import java.util.List;
 @Service
 public class AreaElectricityAttrServiceImpl implements IElecAttrService {
     @Autowired
-    private ElecAttrMapper areaElectricityAttrMapper;
+    private ElecAttrMapper areaAttrMapper;
+
+    @Autowired
+    private IAreaService areaService;
 
     /**
      * 查询服务区用电属性
@@ -28,42 +39,76 @@ public class AreaElectricityAttrServiceImpl implements IElecAttrService {
      */
     @Override
     public ElecAttr selectElecAttrById(Long id) {
-        return areaElectricityAttrMapper.selectElecAttrById(id);
+        return areaAttrMapper.selectElecAttrById(id);
+    }
+
+    @Override
+    public List<ElecAttr> getElecAttrByArea(String areaCode) {
+        List<ElecAttr> elecAttrs = areaAttrMapper.selectElecAttrList(new ElecAttr());
+        Map<String, ElecAttr> elecAttrMap = elecAttrs.stream()
+            .collect(Collectors.toMap(ElecAttr::getAreaCode, Function.identity()));
+
+        List<Area> areas = areaService.selectArea(new Area());
+        Map<String, Area> areaMap = areas.stream().collect(Collectors.toMap(Area::getAreaCode, Function.identity()));
+
+        LinkedList<ElecAttr> retList = new LinkedList<>();
+        Area area = areaMap.get(areaCode);
+        Assert.notNull(area, -1, "区域不存在!");
+        int state = 1;
+
+        do {
+            ElecAttr elecAttr = elecAttrMap.get(area.getAreaCode());
+
+            if (null != elecAttr) {
+                if (retList.isEmpty()) {
+                    elecAttr.setState(state);
+                    retList.add(elecAttr);
+                    state = 0;
+                }
+                else {
+                    elecAttr.setState(state);
+                    retList.addFirst(elecAttr);
+                }
+            }
+
+            area = areaMap.get(area.getParentCode());
+        }
+        while (null != area);
+
+        return retList;
     }
 
     /**
      * 查询服务区用电属性列表
      *
-     * @param areaElectricityAttr 服务区用电属性
+     * @param elecAttr 服务区用电属性
      * @return 服务区用电属性
      */
     @Override
-    public List<ElecAttr> selectElecAttrList(ElecAttr areaElectricityAttr) {
-        return areaElectricityAttrMapper.selectElecAttrList(areaElectricityAttr);
+    public List<ElecAttr> selectElecAttrList(ElecAttr elecAttr) {
+        return areaAttrMapper.selectElecAttrList(elecAttr);
     }
 
     /**
      * 新增服务区用电属性
      *
-     * @param areaElectricityAttr 服务区用电属性
+     * @param elecAttr 服务区用电属性
      * @return 结果
      */
     @Override
-    public int insertElecAttr(ElecAttr areaElectricityAttr) {
-        areaElectricityAttr.setCreateTime(DateUtils.getNowDate());
-        return areaElectricityAttrMapper.insertElecAttr(areaElectricityAttr);
+    public int insertElecAttr(ElecAttr elecAttr) {
+        return areaAttrMapper.insertElecAttr(elecAttr);
     }
 
     /**
      * 修改服务区用电属性
      *
-     * @param areaElectricityAttr 服务区用电属性
+     * @param elecAttr 服务区用电属性
      * @return 结果
      */
     @Override
-    public int updateElecAttr(ElecAttr areaElectricityAttr) {
-        areaElectricityAttr.setUpdateTime(DateUtils.getNowDate());
-        return areaElectricityAttrMapper.updateElecAttr(areaElectricityAttr);
+    public int updateElecAttr(ElecAttr elecAttr) {
+        return areaAttrMapper.updateElecAttr(elecAttr);
     }
 
     /**
@@ -74,7 +119,7 @@ public class AreaElectricityAttrServiceImpl implements IElecAttrService {
      */
     @Override
     public int deleteElecAttrByIds(Long[] ids) {
-        return areaElectricityAttrMapper.deleteElecAttrByIds(ids);
+        return areaAttrMapper.deleteElecAttrByIds(ids);
     }
 
     /**
@@ -85,6 +130,6 @@ public class AreaElectricityAttrServiceImpl implements IElecAttrService {
      */
     @Override
     public int deleteElecAttrById(Long id) {
-        return areaElectricityAttrMapper.deleteElecAttrById(id);
+        return areaAttrMapper.deleteElecAttrById(id);
     }
 }

+ 0 - 13
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaServiceImpl.java

@@ -77,8 +77,6 @@ public class AreaServiceImpl implements IAreaService {
         List<Area> list = areaMapper.selectAreaList(param);
 
         if (CollectionUtils.isNotEmpty(list)) {
-            
-
             List<String> areaCodes = list.stream().map(Area::getAreaCode).collect(Collectors.toList());
             List<AreaAttr> attrList = attrService.selectAreaAttrList(areaCodes);
             Map<String, AreaAttr> attrMap = attrList.stream()
@@ -187,17 +185,6 @@ public class AreaServiceImpl implements IAreaService {
         }
     }
 
-    private void fillAreaAttr(List<Area> list) {
-        List<String> codes = list.stream().map(Area::getAreaCode).distinct().collect(Collectors.toList());
-        List<AreaAttr> areaAttrs = attrService.selectAreaAttrList(codes);
-        Map<String, AreaAttr> map = areaAttrs.stream()
-            .collect(Collectors.toMap(AreaAttr::getAreaCode, Function.identity()));
-
-        for (Area area : list) {
-            area.setAreaAttr(map.get(area.getAreaCode()));
-        }
-    }
-
     /**
      * 递归构建树
      *

+ 1 - 1
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/CoChargingConfigMapper.xml

@@ -21,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         select
             c.id, c.area_code, a.area_name, a.short_name as area_short_name, c.elec_unit_price, c.elec_gt_compute_type, c.elec_compute_desc, c.water_unit_price, c.water_gt_compute_type, c.water_compute_desc
         from adm_co_charging_config c
-          LEFT JOIN adm_service_area a ON c.area_code = a.area_code
+          LEFT JOIN adm_area a ON c.area_code = a.area_code
     </sql>
 
     <select id="selectCoChargingConfigList" parameterType="com.ruoyi.ems.domain.CoChargingConfig" resultMap="CoChargingConfigResult">

+ 2 - 12
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecAttrMapper.xml

@@ -15,14 +15,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="reqCapacityFlag"    column="req_capacity_flag"    />
         <result property="transCapacity"    column="trans_capacity"    />
         <result property="reqQuantity"    column="req_quantity"    />
-        <result property="createTime"    column="create_time"    />
-        <result property="updateTime"    column="update_time"    />
     </resultMap>
 
     <sql id="selectElecAttrVo">
-        SELECT attr.id, attr.area_code, area.area_name, price.elec_type, attr.price_code, t.`name` as elec_type_name, price.voltage_level, attr.req_capacity_flag, attr.trans_capacity, attr.req_quantity, attr.create_time, attr.update_time
+        SELECT attr.id, attr.area_code, area.area_name, price.elec_type, attr.price_code, t.`name` as elec_type_name, price.voltage_level, attr.req_capacity_flag, attr.trans_capacity, attr.req_quantity
           FROM adm_area_elec_attr attr
-            LEFT JOIN adm_service_area area ON attr.area_code = area.area_code
+            LEFT JOIN adm_area area ON attr.area_code = area.area_code
             LEFT JOIN adm_gw_elecprice_config price ON attr.price_code = price.cfg_code
             LEFT JOIN dim_ems_elecprice_type t ON t.`code` = price.elec_type
     </sql>
@@ -33,8 +31,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="areaCode != null  and areaCode != ''"> and attr.area_code = #{areaCode}</if>
             <if test="priceCode != null  and priceCode != ''"> and attr.price_code = #{priceCode}</if>
             <if test="reqCapacityFlag != null "> and attr.req_capacity_flag = #{reqCapacityFlag}</if>
-            <if test="transCapacity != null "> and attr.trans_capacity = #{transCapacity}</if>
-            <if test="reqQuantity != null "> and attr.req_quantity = #{reqQuantity}</if>
         </where>
     </select>
     
@@ -51,8 +47,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="reqCapacityFlag != null">req_capacity_flag,</if>
             <if test="transCapacity != null">trans_capacity,</if>
             <if test="reqQuantity != null">req_quantity,</if>
-            <if test="createTime != null">create_time,</if>
-            <if test="updateTime != null">update_time,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="areaCode != null and areaCode != ''">#{areaCode},</if>
@@ -60,8 +54,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="reqCapacityFlag != null">#{reqCapacityFlag},</if>
             <if test="transCapacity != null">#{transCapacity},</if>
             <if test="reqQuantity != null">#{reqQuantity},</if>
-            <if test="createTime != null">#{createTime},</if>
-            <if test="updateTime != null">#{updateTime},</if>
          </trim>
     </insert>
 
@@ -73,8 +65,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             req_capacity_flag = #{reqCapacityFlag},
             trans_capacity = #{transCapacity},
             req_quantity = #{reqQuantity},
-            create_time = #{createTime},
-            update_time = #{updateTime},
         </trim>
         where id = #{id}
     </update>

+ 1 - 1
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecLoadIndex15minMapper.xml

@@ -79,7 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           sum(i.pf) as pf
         from adm_ems_elec_load_index_15min i
         <if test="areaCode != null and areaCode != '' and areaCode != '-1'">
-            LEFT JOIN adm_service_area a ON i.`area_code` = a.`area_code`
+            LEFT JOIN adm_area a ON i.`area_code` = a.`area_code`
         </if>
         <if test="objCode != null and objCode != ''">
             LEFT JOIN adm_ems_facs f ON i.`obj_code` = f.`facs_code`

+ 1 - 1
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecPgSupplyHMapper.xml

@@ -25,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         select
             pg.`id`, pg.`area_code`, a.`area_name`, a.`short_name` as area_short_name, pg.`facs_code`, f.`facs_name`, pg.`record_time`, pg.`date`, pg.`time`, pg.`time_index`, pg.`meter_type`, pg.`meter_unit_price`, pg.`use_elec_quantity`, pg.`use_elec_cost`
         from adm_ems_pg_supply_h pg
-            LEFT JOIN adm_service_area a ON pg.`area_code` = a.`area_code`
+            LEFT JOIN adm_area a ON pg.`area_code` = a.`area_code`
             LEFT JOIN adm_ems_facs f ON pg.`facs_code` = f.`facs_code`
     </sql>
 

+ 1 - 1
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecProdForecastMapper.xml

@@ -23,7 +23,7 @@
             adm_ems_elec_prod_forecast forecast
             INNER JOIN adm_ems_facs facs
         ON forecast.facs_code = facs.facs_code
-            INNER JOIN adm_service_area area ON forecast.area_code = area.area_code
+            INNER JOIN adm_area area ON forecast.area_code = area.area_code
     </sql>
 
     <select id="selectElecProdForecastList" parameterType="com.ruoyi.ems.domain.ElecProdForecast"

+ 1 - 1
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecPvSupplyHMapper.xml

@@ -38,7 +38,7 @@
                pv.up_elec_quantity,
                pv.up_elec_earn
         from adm_ems_pv_supply_h pv
-                 LEFT JOIN adm_service_area a ON pv.`area_code` = a.`area_code`
+                 LEFT JOIN adm_area a ON pv.`area_code` = a.`area_code`
                  LEFT JOIN adm_ems_facs f ON pv.`facs_code` = f.`facs_code`
     </sql>
 

+ 3 - 3
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecUseHMapper.xml

@@ -44,7 +44,7 @@
                u.time_index,
                u.elec_quantity
         from adm_ems_obj_use_h u
-                 LEFT JOIN adm_service_area a ON u.`area_code` = a.`area_code`
+                 LEFT JOIN adm_area a ON u.`area_code` = a.`area_code`
                  LEFT JOIN adm_ems_facs f ON u.`obj_code` = f.`facs_code`
                  LEFT JOIN adm_ems_device d ON u.`obj_code` = d.`device_code`
     </sql>
@@ -95,7 +95,7 @@
         sum(COALESCE(u.elec_quantity,0)) elec_quantity
         from adm_ems_obj_use_h u
         <if test="areaCode != null and areaCode != '' and areaCode != '-1'">
-            LEFT JOIN adm_service_area a ON u.`area_code` = a.`area_code`
+            LEFT JOIN adm_area a ON u.`area_code` = a.`area_code`
         </if>
         <if test="(facsCategory != null  and facsCategory != '') or (facsSubCategory != null  and facsSubCategory != '')">
             LEFT JOIN adm_ems_facs fa ON u.`obj_code` = fa.`facs_code`
@@ -149,7 +149,7 @@
               sum(COALESCE(u.elec_quantity,0)) elec_quantity
         from adm_ems_obj_use_h u
             <if test="areaCode != null and areaCode != '' and areaCode != '-1'">
-              LEFT JOIN adm_service_area a ON u.`area_code` = a.`area_code`
+              LEFT JOIN adm_area a ON u.`area_code` = a.`area_code`
             </if>
             <if test="(facsCategory != null  and facsCategory != '') or (facsSubCategory != null  and facsSubCategory != '')">
               LEFT JOIN adm_ems_facs fa ON u.`obj_code` = fa.`facs_code`

+ 1 - 1
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/EmsDeviceMapper.xml

@@ -233,7 +233,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             adm_ems_device devc
             INNER JOIN dim_ems_facs_subcategory sc ON devc.device_category = sc.`code`
             <if test="areaCode !=null and areaCode!=''">
-                LEFT JOIN adm_service_area area ON devc.location_ref = area.area_code
+                LEFT JOIN adm_area area ON devc.location_ref = area.area_code
             </if>
         <where>
             <if test="areaCode !=null and areaCode!=''">

+ 1 - 1
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/EmsElecStoreHMapper.xml

@@ -43,7 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         FROM
             adm_ems_elec_store_h st
             LEFT JOIN adm_ems_facs facs ON st.facs_code = facs.facs_code
-            LEFT JOIN adm_service_area area ON st.area_code = area.area_code
+            LEFT JOIN adm_area area ON st.area_code = area.area_code
     </sql>
 
     <select id="selectStoreHList" parameterType="com.ruoyi.ems.domain.ElecStoreH" resultMap="StoreHResult">

+ 1 - 1
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/EmsFacsMapper.xml

@@ -31,7 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         FROM adm_ems_facs f
             LEFT JOIN dim_ems_facs_category t ON f.`facs_category` = t.`code`
             LEFT JOIN dim_ems_facs_subcategory s ON f.`facs_subcategory`= s.`code`
-            LEFT JOIN adm_service_area a ON f.`ref_area` = a.`area_code`
+            LEFT JOIN adm_area a ON f.`ref_area` = a.`area_code`
             LEFT JOIN adm_ems_obj_model m ON f.`facs_model` = m.`model_code`
     </sql>
 

+ 26 - 117
ems-cloud/sql/ems_init_data.sql

@@ -24,7 +24,7 @@ INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `s
 INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('S30K150-S30K180', '321283124S3003', '0,321283124S3003', '桩号段S30K140-S30K150', '桩号段S30K140-S30K150', '区段S30K150+300-S30K180+300', 2, 0);
 
 
---区块
+-- 区块
 INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('B-101', '321283124S300101', '0,321283124S3001,321283124S300101', '开水泡面间', '开水泡面间', '开水泡面', 1, 0);
 INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('B-102', '321283124S300101', '0,321283124S3001,321283124S300101', '超市', '超市', '超市', 1, 0);
 INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('B-103', '321283124S300101', '0,321283124S3001,321283124S300101', '中式糕点', '中式糕点', '中式糕点', 1, 0);
@@ -108,7 +108,6 @@ INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `s
 INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S3002_99-CPD', '321283124S300299', '0,321283124S3001,321283124S300299', '车棚顶', '车棚顶', '车棚顶', 1, 0);
 
 
-
 -- 区域属性属性
 INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S3001', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', 7250, 6000, NULL, 120.050937, 32.071956);
 INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S3002', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', 7250, 6000, NULL, 120.052389, 32.070408);
@@ -217,96 +216,6 @@ INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phon
 INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S3002_99-CPD', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', 7250, 6000, 1, 120.050937, 32.071956);
 
 
-
-
-
-
--- 建筑初始数据
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-101', '开水泡面间', 1, '101', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-102', '超市', 1, '102', 200, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-103', '中式糕点', 1, '103', 150, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-104', '特色产品市集', 1, '104', 200, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-105', '奶茶&咖啡', 1, '105', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-106', '中式套餐', 1, '106', 200, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-107', '特色小吃', 1, '107', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-108', '串串&卤味', 1, '108', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-109', '糖葫芦&水果', 1, '109', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-110', '美食广场', 1, '110', 300, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-111', '男卫', 1, '111', 200, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-112', '男盥洗室', 1, '112', 150, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-113', '女卫', 1, '113', 200, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-114', '女盥洗室', 1, '114', 150, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-115', '工具间1', 1, '115', 50, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-116', '工具间2', 1, '116', 50, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-117', '工具间3', 1, '117', 50, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-118', '工具间4', 1, '118', 50, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-119', '货车服务空间', 1, '119', 50, '使用中');
---
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300102', 'B-120', '配电间', 1, '120', 50, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300102', 'B-121', '水泵间', 1, '121', 50, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300102', 'B-122', '控制间', 1, '122', 50, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300103', 'B-123', '维修车间', 1, '123', 50, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300103', 'B-124', '办公室', 1, '124', 50, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300104', 'B-125', '加油站区', 1, '125', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300104', 'B-126', '油罐区', 1, '126', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300104', 'B-127', '营业区', 1, '127', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300104', 'B-128', '辅助区', 1, '128', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300105', 'B-129', '接待区', 1, '129', 50, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300105', 'B-130', '指挥室', 1, '130', 50, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300105', 'B-131', '调解室', 1, '131', 50, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300105', 'B-132', '便民服务区', 1, '132', 50, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300106', '321283124S3001_CW-XK', '小客停车位', 1, 'CW-XK', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300106', '321283124S3001_CW-CD', '充电车位', 1, 'CW-CD', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300106', '321283124S3001_CW-WZA', '无障碍车位', 1, 'CW-WZA', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300106', '321283124S3001_CW-DKC', '大客车停车位', 1, 'CW-DKC', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300106', '321283124S3001_CW-HC', '货车车位', 1, 'CW-HC', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300106', '321283124S3001_CW-WXP', '危险品车位', 1, 'CW-WXP', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300199', '321283124S3001_99-ZHLD', '综合楼顶', null, 'ZHLD', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300199', '321283124S3001_99-CPD', '车棚顶', null, 'CPD', 100, '使用中');
---
---
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300201', 'N-101', '开水泡面间', 1, '101', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300201', 'N-102', '超市', 1, '102', 200, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300201', 'N-103', '中式糕点', 1, '103', 150, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300201', 'N-104', '特色产品市集', 1, '104', 200, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300201', 'N-105', '奶茶&咖啡', 1, '105', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300201', 'N-106', '中式套餐', 1, '106', 200, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300201', 'N-107', '特色小吃', 1, '107', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300201', 'N-108', '串串&卤味', 1, '108', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300201', 'N-109', '糖葫芦&水果', 1, '109', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300201', 'N-110', '美食广场', 1, '110', 300, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300201', 'N-111', '男卫', 1, '111', 200, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300201', 'N-112', '男盥洗室', 1, '112', 150, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300201', 'N-113', '女卫', 1, '113', 200, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300201', 'N-114', '女盥洗室', 1, '114', 150, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300201', 'N-115', '工具间1', 1, '115', 50, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300201', 'N-116', '工具间2', 1, '116', 50, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300201', 'N-117', '工具间3', 1, '117', 50, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300201', 'N-118', '工具间4', 1, '118', 50, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300201', 'N-119', '货车服务空间', 1, '119', 50, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300202', 'N-120', '配电间', 1, '120', 50, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300202', 'N-121', '水泵间', 1, '121', 50, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300202', 'N-122', '控制间', 1, '122', 50, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300203', 'N-123', '备件仓库', 1, '123', 50, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300203', 'N-124', '集装箱', 1, '124', 50, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300204', 'N-125', '加油站区', 1, '125', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300204', 'N-126', '油罐区', 1, '126', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300204', 'N-127', '营业区', 1, '127', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300204', 'N-128', '辅助区', 1, '128', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300205', 'N-129', '接待区', 1, '129', 50, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300205', 'N-130', '指挥中心', 1, '130', 50, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300205', 'N-131', '调解室', 1, '131', 50, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300205', 'N-132', '便民服务区', 1, '132', 50, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300206', '321283124S3002_CW-XK', '小客停车位', 1, 'CW-XK', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300206', '321283124S3002_CW-CD', '充电车位', 1, 'CW-XK', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300206', '321283124S3002_CW-WZA', '无障碍车位', 1, 'CW-XK', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300206', '321283124S3002_CW-DKC', '大客车停车位', 1, 'CW-XK', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300206', '321283124S3002_CW-HC', '货车车位', 1, 'CW-XK', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300206', '321283124S3002_CW-WXP','危险品车位', 1, 'CW-XK', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300299', '321283124S3002_99-ZHLD', '综合楼顶', null, 'ZHLD', 100, '使用中');
--- INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300299', '321283124S3002_99-CPD', '车棚顶', null, 'CPD', 100, '使用中');
-
-
 -- 能源设施初始数据
 INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_category`, `facs_subcategory`, `enable`, `ref_area`, `facs_model`) VALUES ('W201', '北区-供电网', 'W', 'W2', 1, '321283124S3001', 'M_W2');
 INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_category`, `facs_subcategory`, `enable`, `ref_area`, `facs_model`) VALUES ('W202', '南区-供电网', 'W', 'W2', 1, '321283124S3002', 'M_W2');
@@ -632,7 +541,7 @@ INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_ty
 INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-Z010-R105-101', '321283124S3002', 45, 3, 'Z010-R105-101', 0, 4, 1, 20, '互感器表');
 
 -- 水表
-INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-B-01', '321283124S3001', 70, 1, 2, '321283124S300101', 0, 4, 1, 1, '直采表');
+INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-B-01', '321283124S3001', 70, 1, '321283124S300101', 0, 4, 1, 1, '直采表');
 
 -- 抄表demo数据
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2024', '202401', 0, '2024-02-29', 100, '2024-01-31', 100, NULL, NULL);
@@ -789,30 +698,30 @@ INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `obj_code`, `record_ti
 INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `obj_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3002', 1, 'Z210', CONCAT(CURDATE(), ' ', LPAD(HOUR(NOW()), 2, '0'), ':00:00'), CURDATE(), CONCAT(LPAD(HOUR(NOW()), 2, '0'), ':00:00'), HOUR(NOW()) + 1, FLOOR((RAND() * 100)));
 INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `obj_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3002', 1, 'Z220', CONCAT(CURDATE(), ' ', LPAD(HOUR(NOW()), 2, '0'), ':00:00'), CURDATE(), CONCAT(LPAD(HOUR(NOW()), 2, '0'), ':00:00'), HOUR(NOW()) + 1, FLOOR((RAND() * 100)));
 
-INSERT INTO `adm_ems_obj_use_h` (`area_code`, `facs_code`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 00:00:00', '2024-09-01', '00:00:00', 1, 12);
-INSERT INTO `adm_ems_obj_use_h` (`area_code`, `facs_code`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 01:00:00', '2024-09-01', '01:00:00', 2, 13);
-INSERT INTO `adm_ems_obj_use_h` (`area_code`, `facs_code`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 02:00:00', '2024-09-01', '02:00:00', 3, 10);
-INSERT INTO `adm_ems_obj_use_h` (`area_code`, `facs_code`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 03:00:00', '2024-09-01', '03:00:00', 4, 13);
-INSERT INTO `adm_ems_obj_use_h` (`area_code`, `facs_code`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 04:00:00', '2024-09-01', '04:00:00', 5, 15);
-INSERT INTO `adm_ems_obj_use_h` (`area_code`, `facs_code`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 05:00:00', '2024-09-01', '05:00:00', 6, 12);
-INSERT INTO `adm_ems_obj_use_h` (`area_code`, `facs_code`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 06:00:00', '2024-09-01', '06:00:00', 7, 8);
-INSERT INTO `adm_ems_obj_use_h` (`area_code`, `facs_code`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 07:00:00', '2024-09-01', '07:00:00', 8, 0);
-INSERT INTO `adm_ems_obj_use_h` (`area_code`, `facs_code`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 08:00:00', '2024-09-01', '08:00:00', 9, 0);
-INSERT INTO `adm_ems_obj_use_h` (`area_code`, `facs_code`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 09:00:00', '2024-09-01', '09:00:00', 10, 0);
-INSERT INTO `adm_ems_obj_use_h` (`area_code`, `facs_code`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 10:00:00', '2024-09-01', '10:00:00', 11, 0);
-INSERT INTO `adm_ems_obj_use_h` (`area_code`, `facs_code`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 11:00:00', '2024-09-01', '11:00:00', 12, 0);
-INSERT INTO `adm_ems_obj_use_h` (`area_code`, `facs_code`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 12:00:00', '2024-09-01', '12:00:00', 13, 0);
-INSERT INTO `adm_ems_obj_use_h` (`area_code`, `facs_code`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 13:00:00', '2024-09-01', '13:00:00', 14, 0);
-INSERT INTO `adm_ems_obj_use_h` (`area_code`, `facs_code`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 14:00:00', '2024-09-01', '14:00:00', 15, 0);
-INSERT INTO `adm_ems_obj_use_h` (`area_code`, `facs_code`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 15:00:00', '2024-09-01', '15:00:00', 16, 0);
-INSERT INTO `adm_ems_obj_use_h` (`area_code`, `facs_code`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 16:00:00', '2024-09-01', '16:00:00', 17, 0);
-INSERT INTO `adm_ems_obj_use_h` (`area_code`, `facs_code`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 17:00:00', '2024-09-01', '17:00:00', 18, 0);
-INSERT INTO `adm_ems_obj_use_h` (`area_code`, `facs_code`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 18:00:00', '2024-09-01', '18:00:00', 19, 10);
-INSERT INTO `adm_ems_obj_use_h` (`area_code`, `facs_code`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 19:00:00', '2024-09-01', '19:00:00', 20, 13);
-INSERT INTO `adm_ems_obj_use_h` (`area_code`, `facs_code`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 20:00:00', '2024-09-01', '20:00:00', 21, 20);
-INSERT INTO `adm_ems_obj_use_h` (`area_code`, `facs_code`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 21:00:00', '2024-09-01', '21:00:00', 22, 17);
-INSERT INTO `adm_ems_obj_use_h` (`area_code`, `facs_code`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 22:00:00', '2024-09-01', '22:00:00', 23, 15);
-INSERT INTO `adm_ems_obj_use_h` (`area_code`, `facs_code`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 23:00:00', '2024-09-01', '23:00:00', 24, 13);
+INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 00:00:00', '2024-09-01', '00:00:00', 1, 12);
+INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 01:00:00', '2024-09-01', '01:00:00', 2, 13);
+INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 02:00:00', '2024-09-01', '02:00:00', 3, 10);
+INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 03:00:00', '2024-09-01', '03:00:00', 4, 13);
+INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 04:00:00', '2024-09-01', '04:00:00', 5, 15);
+INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 05:00:00', '2024-09-01', '05:00:00', 6, 12);
+INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 06:00:00', '2024-09-01', '06:00:00', 7, 8);
+INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 07:00:00', '2024-09-01', '07:00:00', 8, 0);
+INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 08:00:00', '2024-09-01', '08:00:00', 9, 0);
+INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 09:00:00', '2024-09-01', '09:00:00', 10, 0);
+INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 10:00:00', '2024-09-01', '10:00:00', 11, 0);
+INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 11:00:00', '2024-09-01', '11:00:00', 12, 0);
+INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 12:00:00', '2024-09-01', '12:00:00', 13, 0);
+INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 13:00:00', '2024-09-01', '13:00:00', 14, 0);
+INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 14:00:00', '2024-09-01', '14:00:00', 15, 0);
+INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 15:00:00', '2024-09-01', '15:00:00', 16, 0);
+INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 16:00:00', '2024-09-01', '16:00:00', 17, 0);
+INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 17:00:00', '2024-09-01', '17:00:00', 18, 0);
+INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 18:00:00', '2024-09-01', '18:00:00', 19, 10);
+INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 19:00:00', '2024-09-01', '19:00:00', 20, 13);
+INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 20:00:00', '2024-09-01', '20:00:00', 21, 20);
+INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 21:00:00', '2024-09-01', '21:00:00', 22, 17);
+INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 22:00:00', '2024-09-01', '22:00:00', 23, 15);
+INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `device_code`, `record_time`, `date`, `time`, `time_index`, `elec_quantity`) VALUES ('321283124S3001', 'Z101', NULL, '2024-09-01 23:00:00', '2024-09-01', '23:00:00', 24, 13);
 
 
 -- 电力负荷数据

+ 1 - 1
ems-cloud/sql/ems_server.sql

@@ -1046,7 +1046,7 @@ drop table if exists adm_co_charging_config_rel;
 create table adm_co_charging_config_rel (
   `price_cfg_id`          bigint(20)      not null auto_increment      comment '计费序号',
   `area_code`             varchar(16)     not null                     comment '区块编码',
-  unique key ux_co_emsprice_config_rel(`price_cfg_id`, `zoning_code`)
+  unique key ux_co_emsprice_config_rel(`price_cfg_id`, `area_code`)
 ) engine=innodb comment = '商户能源计费关系表';