ali
2025-02-24 c89dd113d8573a10a9e666785b8be5d4c3ef511d
Merge branch 'develop1.0' into develop_alioo
已添加18个文件
已删除1个文件
已修改15个文件
2147 ■■■■ 文件已修改
.gitignore 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LICENSE 213 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
README.md 50 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package-lock.json 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
readme/img/1-登录页.png 补丁 | 查看 | 原始文档 | blame | 历史
readme/img/image.png 补丁 | 查看 | 原始文档 | blame | 历史
readme/img/指标配置.png 补丁 | 查看 | 原始文档 | blame | 历史
readme/img/模型配置.png 补丁 | 查看 | 原始文档 | blame | 历史
readme/img/统计指标.png 补丁 | 查看 | 原始文档 | blame | 历史
readme/img/计算公式.png 补丁 | 查看 | 原始文档 | blame | 历史
readme/logo-chinese.png 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-admin/src/.DS_Store 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-admin/src/main/java/com/zhitan/web/controller/statisticalAnalysis/EnergyDataItemController.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-admin/src/main/java/com/zhitan/web/core/config/SwaggerConfig.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-common/.DS_Store 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-common/src/.DS_Store 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-common/src/main/java/com/zhitan/common/config/BaseConfig.java 71 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-generator/.DS_Store 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-generator/src/main/java/com/zhitan/generator/config/GenConfig.java 47 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-quartz/.DS_Store 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-quartz/src/main/java/com/zhitan/quartz/controller/SysJobController.java 104 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-system/.DS_Store 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-system/src/.DS_Store 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-system/src/main/java/com/zhitan/statisticalAnalysis/domain/vo/EnergyTypeValueContrastedVO.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-system/src/main/java/com/zhitan/statisticalAnalysis/domain/vo/QueryCompareRequest.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-system/src/main/java/com/zhitan/statisticalAnalysis/service/IEnergyConsumeDataService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-system/src/main/java/com/zhitan/statisticalAnalysis/service/impl/EnergyConsumeDataServiceImpl.java 183 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-vue/.env.development 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-vue/.gitignore 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-vue/src/api/energyAnalysis/energyAnalysis.js 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-vue/src/views/energyconservation/policyrule/components/EditModal copy.vue 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-vue/src/views/poweranalysis/pariPassu/index.vue 592 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-vue/src/views/poweranalysis/perPassu/index.vue 594 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhitan-vue/vite.config.js 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.gitignore
@@ -10,6 +10,12 @@
######################################################################
# IDE
.DS_Store
/.DS_Store
zhitan-admin/.DS_Store
zhitan-admin/src/.DS_Store
zhitan-system/.DS_Store
zhitan-system/src/.DS_Store
### STS ###
.apt_generated
@@ -46,4 +52,6 @@
!*/build/*.html
!*/build/*.xml
*/.DS_Store
uploadPath
LICENSE
@@ -1,20 +1,201 @@
The MIT License (MIT)
                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/
Copyright (c) 2018 admin
   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
   1. Definitions.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.
      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.
      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.
      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.
      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.
      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).
      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.
      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."
      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.
   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.
   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.
   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:
      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and
      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and
      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and
      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.
      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.
   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.
   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.
   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.
   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.
   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.
   END OF TERMS AND CONDITIONS
   APPENDIX: How to apply the Apache License to your work.
      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.
   Copyright [yyyy] [name of copyright owner]
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
       http://www.apache.org/licenses/LICENSE-2.0
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
README.md
@@ -1,38 +1,50 @@
<div align="center">
    <img src="readme/logo-chinese.png" alt="输入图片说明" height="150" width="150">
</div>
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">智碳能源管理系统</h1>
<h4 align="center">基于SpringBoot和若依框架开发</h4>
<p align="center">
    <a href='https://gitee.com/ustcyc/zhitan-ems/stargazers'><img src='https://gitee.com/ustcyc/zhitan-ems/badge/star.svg?theme=dark' alt='star'></img></a>
    <a href='https://gitee.com/ustcyc/zhitan-ems/members'><img src='https://gitee.com/ustcyc/zhitan-ems/badge/fork.svg?theme=dark' alt='fork'></img></a>
    <a href="https://gitee.com/y_project/RuoYi/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mashape/apistatus.svg"></a>
</p>
## ä»‹ç»
通过物联网技术,采集企业水、电、气、热等能耗数据,帮企业建立能源管理体系,找到跑冒滴漏,从而为企业节能提供依据。
进一步为企业实现碳跟踪、碳盘查、碳交易、谈汇报的全生命过程。 ä¸ºä¸­å›½ç¢³è¾¾å³°-碳中和做出贡献。
能源管理系统,采集企业水、电、气、热等能耗数据,帮企业建立能源管理体系,找到跑冒滴漏,从而为企业节能提供依据。
进一步为企业实现碳跟踪、碳盘查、碳交易、碳汇报的全生命过程。 ä¸ºä¸­å›½ç¢³è¾¾å³°-碳中和做出贡献。
针对客户场景:政府、园区、企业、工矿、公共建筑等。
墙内仓库地址(码云):https://gitee.com/ustcyc/zhitan-ems
已同步更新到github仓库:https://github.com/Andy-Yin/zhitan-ems
## åœ¨çº¿ä½“验
- guestUser/guest@123456
演示地址:https://demo-ems.zhitancloud.com/
## æ¡†æž¶ï¼š
基于SpringBoot的若依框架 æ˜“读易懂、界面简洁美观。
关系数据库:mysql æˆ–者 postgredb
基于SpringBoot的若依框架 æ˜“读易懂、界面简洁美观。支持深色&浅色两种风格切换(演示系统右上角)
关系数据库:postgresql(mysql需自行适配,mysql性能太差了)
时序数据库:influxdb 2.7+  
中间件:redis,mq  
VUE版本:VUE 3
## æ•°æ®é©±åŠ¨çš„è®¡ç®—æ¨¡åž‹å’Œä¸šåŠ¡æ¨¡åž‹é…ç½®
支持动态点位配置、数据模型、业务模型等。
## ç‰¹è‰²ï¼šæ•°æ®é©±åŠ¨çš„è®¡ç®—æ¨¡åž‹å’Œä¸šåŠ¡æ¨¡åž‹é…ç½®
1.  æ”¯æŒåŠ¨æ€ç‚¹ä½é…ç½®ã€‚
![输入图片说明](readme/img/指标配置.png)
2.  æ”¯æŒè®¡ç®—公式。
![输入图片说明](readme/img/计算公式.png)
3.  æ”¯æŒæ¨¡åž‹é…ç½®ã€åŒ…括数据模型、业务模型。
![输入图片说明](readme/img/模型配置.png)
4.  å¤æ‚项目底层代码&数据结构完全不需要变化,可快速交付实施。
5.  å·²å®Œæˆæ ‡å‡†åŒ–的网关&电表等采集设备对接,快速为客户软硬件一体化交付。
## åœ¨çº¿ä½“验
- guestUser/guestUser
演示地址:https://demo-ems.zhitancloud.com/
## äº®ç‚¹åŠŸèƒ½
![输入图片说明](readme/亮点功能.png)
@@ -42,7 +54,7 @@
2.  å®žæ—¶æ•°æ®ç›‘测  
    2.1.  å®žæ—¶æ•°æ®æŸ¥çœ‹  
    2.2.  ç»„态图分析(svg å›¾ç»‘定)
3. åŽ†å²æ•°æ®åˆ†æž
3. åŽ†å²ç‚¹ä½åˆ†æž
4. ç»¼åˆæŒ‡æ ‡åˆ†æž  
   4.1.  ç»¼åˆæŒ‡æ ‡åˆ†æžï¼ˆæ—¥ï¼‰  
   4.2.  ç»¼åˆæŒ‡æ ‡åˆ†æžï¼ˆæœˆï¼‰  
@@ -61,6 +73,7 @@
8. èƒ½è€—对比分析(各能源品种)  
   8.1.  ç”µåŒçŽ¯æ¯”åˆ†æž      
   8.2.  æ°´åŒçŽ¯æ¯”åˆ†æž
   8.3.  å…¶ä»–能源品种分析
9. æ™ºèƒ½æŠ¥è­¦  
   9.1.  æŠ¥è­¦åˆ†æž        
   9.2.  æŠ¥è­¦é…ç½®
@@ -111,6 +124,15 @@
![输入图片说明](readme/技术架构-1.png)
![输入图片说明](readme/技术架构.png)
## æ²Ÿé€šäº¤æµ
扫码添加微信交流,加微信请备注:ems。
<p align="center">
  <img src="readme/img/image.png" width=50% height=50%>
</p>
## å‚与贡献
1.  Fork æœ¬ä»“库
package-lock.json
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,6 @@
{
  "name": "zhitan-ems",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {}
}
readme/img/1-µÇ¼ҳ.png

readme/img/image.png
readme/img/Ö¸±êÅäÖÃ.png
readme/img/Ä£ÐÍÅäÖÃ.png
readme/img/ͳ¼ÆÖ¸±ê.png
readme/img/¼ÆË㹫ʽ.png
readme/logo-chinese.png
zhitan-admin/src/.DS_Store
Binary files differ
zhitan-admin/src/main/java/com/zhitan/web/controller/statisticalAnalysis/EnergyDataItemController.java
@@ -1,9 +1,12 @@
package com.zhitan.web.controller.statisticalAnalysis;
import com.zhitan.common.annotation.Log;
import com.zhitan.common.constant.CommonConst;
import com.zhitan.common.core.domain.AjaxResult;
import com.zhitan.dataitem.service.IDataItemService;
import com.zhitan.statisticalAnalysis.domain.dto.FlowChartsDTO;
import com.zhitan.statisticalAnalysis.domain.vo.QueryCompareRequest;
import com.zhitan.statisticalAnalysis.service.IEnergyConsumeDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@@ -24,6 +27,9 @@
    @Autowired
    private IDataItemService dataItemService;
    @Autowired
    private IEnergyConsumeDataService energyConsumeDataService;
    /**
     * èŽ·å–èƒ½æµå›¾å½¢åˆ†æž
     *
@@ -36,4 +42,28 @@
    public AjaxResult getFlowCharts(@Validated FlowChartsDTO dto) {
        return AjaxResult.success(dataItemService.getFlowCharts(dto));
    }
    @Log(title = "能耗统计分析-获取同比分析列表数据")
    @ApiOperation(value = "能耗统计分析-获取同比分析列表数据", notes = "能耗统计分析-获取同比分析列表数据")
    @GetMapping(value = "/querySameCompareList")
    public AjaxResult querySameCompareList(@Validated QueryCompareRequest queryCompareRequest) {
        return AjaxResult.success(energyConsumeDataService.listEnergyTypeYoyInfo(queryCompareRequest, CommonConst.ENERGY_COMPARISON_YOY));
    }
    /**
     * èŽ·å–çŽ¯æ¯”åˆ†æžæ•°æ®
     * <p>
     * é€šè¿‡è‡ªå·±çš„æœåŠ¡è®¿é—®åœ°å€ï¼šhttp://localhost:7005/fengniao/energyDataItem/queryLoopCompare?timeType=1
     * é€šè¿‡ç½‘关访问地址:http://localhost:9999/jeecg-fengniao/fengniao/energyDataItem/queryLoopCompare?timeType=1
     *
     * @param queryCompareRequest
     * @return
     */
    @Log(title = "能耗统计分析-获取环比分析列表数据")
    @ApiOperation(value = "能耗统计分析-获取环比分析列表数据", notes = "能耗统计分析-获取环比分析列表数据")
    @GetMapping(value = "/queryLoopCompareList")
    public AjaxResult queryLoopCompareList(@Validated QueryCompareRequest queryCompareRequest) {
        return AjaxResult.success(energyConsumeDataService.listEnergyTypeYoyInfo(queryCompareRequest, CommonConst.ENERGY_COMPARISON_MOM));
    }
}
zhitan-admin/src/main/java/com/zhitan/web/core/config/SwaggerConfig.java
@@ -115,11 +115,11 @@
        // ç”¨ApiInfoBuilder进行定制
        return new ApiInfoBuilder()
                // è®¾ç½®æ ‡é¢˜
                .title("标题:后台管理系统_接口文档")
                .title("智碳_能源管理系统_接口文档")
                // æè¿°
                .description("描述:接口文档")
                .description("采集企业水、电、气、热等能耗数据;帮助企业建立能源管理体系,找到跑冒滴漏,为企业节能提供数据支撑;为企业实现碳跟踪、碳盘查、碳交易、碳汇报的全生命过程;为中国碳达峰-碳中和做出贡献!")
                // ä½œè€…信息
                .contact(new Contact(baseConfig.getName(), null, null))
                .contact(new Contact(baseConfig.getName(), "https://www.zhitancloud.com", "yin.cun@qq.com"))
                // ç‰ˆæœ¬
                .version("版本号:" + baseConfig.getVersion())
                .build();
zhitan-common/.DS_Store
Binary files differ
zhitan-common/src/.DS_Store
Binary files differ
zhitan-common/src/main/java/com/zhitan/common/config/BaseConfig.java
@@ -5,29 +5,40 @@
/**
 * è¯»å–项目相关配置
 *
 *
 * @author zhitan
 */
@Component
@ConfigurationProperties(prefix = "base")
public class BaseConfig
{
    /** é¡¹ç›®åç§° */
public class BaseConfig {
    /**
     * é¡¹ç›®åç§°
     */
    private String name;
    /** ç‰ˆæœ¬ */
    /**
     * ç‰ˆæœ¬
     */
    private String version;
    /** ç‰ˆæƒå¹´ä»½ */
    /**
     * ç‰ˆæƒå¹´ä»½
     */
    private String copyrightYear;
    /** ä¸Šä¼ è·¯å¾„ */
    /**
     * ä¸Šä¼ è·¯å¾„
     */
    private static String profile;
    /** èŽ·å–åœ°å€å¼€å…³ */
    /**
     * èŽ·å–åœ°å€å¼€å…³
     */
    private static boolean addressEnabled;
    /** éªŒè¯ç ç±»åž‹ */
    /**
     * éªŒè¯ç ç±»åž‹
     */
    private static String captchaType;
    /**
@@ -36,53 +47,43 @@
    private String domainName;
    public String getName()
    {
    public String getName() {
        return name;
    }
    public void setName(String name)
    {
    public void setName(String name) {
        this.name = name;
    }
    public String getVersion()
    {
    public String getVersion() {
        return version;
    }
    public void setVersion(String version)
    {
    public void setVersion(String version) {
        this.version = version;
    }
    public String getCopyrightYear()
    {
    public String getCopyrightYear() {
        return copyrightYear;
    }
    public void setCopyrightYear(String copyrightYear)
    {
    public void setCopyrightYear(String copyrightYear) {
        this.copyrightYear = copyrightYear;
    }
    public static String getProfile()
    {
    public static String getProfile() {
        return profile;
    }
    public void setProfile(String profile)
    {
    public void setProfile(String profile) {
        BaseConfig.profile = profile;
    }
    public static boolean isAddressEnabled()
    {
    public static boolean isAddressEnabled() {
        return addressEnabled;
    }
    public void setAddressEnabled(boolean addressEnabled)
    {
    public void setAddressEnabled(boolean addressEnabled) {
        BaseConfig.addressEnabled = addressEnabled;
    }
@@ -97,32 +98,28 @@
    /**
     * èŽ·å–å¯¼å…¥ä¸Šä¼ è·¯å¾„
     */
    public static String getImportPath()
    {
    public static String getImportPath() {
        return getProfile() + "/import";
    }
    /**
     * èŽ·å–å¤´åƒä¸Šä¼ è·¯å¾„
     */
    public static String getAvatarPath()
    {
    public static String getAvatarPath() {
        return getProfile() + "/avatar";
    }
    /**
     * èŽ·å–ä¸‹è½½è·¯å¾„
     */
    public static String getDownloadPath()
    {
    public static String getDownloadPath() {
        return getProfile() + "/download/";
    }
    /**
     * èŽ·å–ä¸Šä¼ è·¯å¾„
     */
    public static String getUploadPath()
    {
    public static String getUploadPath() {
        return getProfile() + "/upload";
    }
zhitan-generator/.DS_Store
Binary files differ
zhitan-generator/src/main/java/com/zhitan/generator/config/GenConfig.java
@@ -7,67 +7,66 @@
/**
 * è¯»å–代码生成相关配置
 *
 *
 * @author zhitan
 */
@Component
@ConfigurationProperties(prefix = "gen")
@PropertySource(value = { "classpath:generator.yml" })
public class GenConfig
{
    /** ä½œè€… */
@PropertySource(value = {"classpath:generator.yml"})
public class GenConfig {
    /**
     * ä½œè€…
     */
    public static String author;
    /** ç”ŸæˆåŒ…路径 */
    /**
     * ç”ŸæˆåŒ…路径
     */
    public static String packageName;
    /** è‡ªåŠ¨åŽ»é™¤è¡¨å‰ç¼€ï¼Œé»˜è®¤æ˜¯false */
    /**
     * è‡ªåŠ¨åŽ»é™¤è¡¨å‰ç¼€ï¼Œé»˜è®¤æ˜¯false
     */
    public static boolean autoRemovePre;
    /** è¡¨å‰ç¼€(类名不会包含表前缀) */
    /**
     * è¡¨å‰ç¼€(类名不会包含表前缀)
     */
    public static String tablePrefix;
    public static String getAuthor()
    {
    public static String getAuthor() {
        return author;
    }
    @Value("${author}")
    public void setAuthor(String author)
    {
    public void setAuthor(String author) {
        GenConfig.author = author;
    }
    public static String getPackageName()
    {
    public static String getPackageName() {
        return packageName;
    }
    @Value("${packageName}")
    public void setPackageName(String packageName)
    {
    public void setPackageName(String packageName) {
        GenConfig.packageName = packageName;
    }
    public static boolean getAutoRemovePre()
    {
    public static boolean getAutoRemovePre() {
        return autoRemovePre;
    }
    @Value("${autoRemovePre}")
    public void setAutoRemovePre(boolean autoRemovePre)
    {
    public void setAutoRemovePre(boolean autoRemovePre) {
        GenConfig.autoRemovePre = autoRemovePre;
    }
    public static String getTablePrefix()
    {
    public static String getTablePrefix() {
        return tablePrefix;
    }
    @Value("${tablePrefix}")
    public void setTablePrefix(String tablePrefix)
    {
    public void setTablePrefix(String tablePrefix) {
        GenConfig.tablePrefix = tablePrefix;
    }
}
zhitan-quartz/.DS_Store
Binary files differ
zhitan-quartz/src/main/java/com/zhitan/quartz/controller/SysJobController.java
@@ -1,23 +1,5 @@
package com.zhitan.quartz.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.zhitan.quartz.domain.SysJob;
import com.zhitan.quartz.service.ISysJobService;
import com.zhitan.quartz.util.CronUtils;
import com.zhitan.quartz.util.ScheduleUtils;
import org.quartz.SchedulerException;
import javax.annotation.Resource;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhitan.common.annotation.Log;
import com.zhitan.common.constant.Constants;
import com.zhitan.common.core.controller.BaseController;
@@ -27,16 +9,26 @@
import com.zhitan.common.exception.job.TaskException;
import com.zhitan.common.utils.StringUtils;
import com.zhitan.common.utils.poi.ExcelUtil;
import com.zhitan.quartz.domain.SysJob;
import com.zhitan.quartz.service.ISysJobService;
import com.zhitan.quartz.util.CronUtils;
import com.zhitan.quartz.util.ScheduleUtils;
import org.quartz.SchedulerException;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
 * è°ƒåº¦ä»»åŠ¡ä¿¡æ¯æ“ä½œå¤„ç†
 *
 *
 * @author zhitan
 */
@RestController
@RequestMapping("/monitor/job")
public class SysJobController extends BaseController
{
public class SysJobController extends BaseController {
    @Resource
    private ISysJobService jobService;
@@ -45,8 +37,7 @@
     */
    @PreAuthorize("@ss.hasPermi('monitor:job:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysJob sysJob)
    {
    public TableDataInfo list(SysJob sysJob) {
        startPage();
        List<SysJob> list = jobService.selectJobList(sysJob);
        return getDataTable(list);
@@ -58,8 +49,7 @@
    @PreAuthorize("@ss.hasPermi('monitor:job:export')")
    @Log(title = "定时任务", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysJob sysJob)
    {
    public void export(HttpServletResponse response, SysJob sysJob) {
        List<SysJob> list = jobService.selectJobList(sysJob);
        ExcelUtil<SysJob> util = new ExcelUtil<SysJob>(SysJob.class);
        util.exportExcel(response, list, "定时任务");
@@ -70,8 +60,7 @@
     */
    @PreAuthorize("@ss.hasPermi('monitor:job:query')")
    @GetMapping(value = "/{jobId}")
    public AjaxResult getInfo(@PathVariable("jobId") Long jobId)
    {
    public AjaxResult getInfo(@PathVariable("jobId") Long jobId) {
        return success(jobService.selectJobById(jobId));
    }
@@ -81,30 +70,18 @@
    @PreAuthorize("@ss.hasPermi('monitor:job:add')")
    @Log(title = "定时任务", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysJob job) throws SchedulerException, TaskException
    {
        if (!CronUtils.isValid(job.getCronExpression()))
        {
    public AjaxResult add(@RequestBody SysJob job) throws SchedulerException, TaskException {
        if (!CronUtils.isValid(job.getCronExpression())) {
            return error("新增任务'" + job.getJobName() + "'失败,Cron表达式不正确");
        }
        else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI))
        {
        } else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI)) {
            return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi'调用");
        }
        else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS }))
        {
        } else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[]{Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS})) {
            return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'ldap(s)'调用");
        }
        else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS }))
        {
        } else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[]{Constants.HTTP, Constants.HTTPS})) {
            return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)'调用");
        }
        else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR))
        {
        } else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR)) {
            return error("新增任务'" + job.getJobName() + "'失败,目标字符串存在违规");
        }
        else if (!ScheduleUtils.whiteList(job.getInvokeTarget()))
        {
        } else if (!ScheduleUtils.whiteList(job.getInvokeTarget())) {
            return error("新增任务'" + job.getJobName() + "'失败,目标字符串不在白名单内");
        }
        job.setCreateBy(getUsername());
@@ -117,30 +94,18 @@
    @PreAuthorize("@ss.hasPermi('monitor:job:edit')")
    @Log(title = "定时任务", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysJob job) throws SchedulerException, TaskException
    {
        if (!CronUtils.isValid(job.getCronExpression()))
        {
    public AjaxResult edit(@RequestBody SysJob job) throws SchedulerException, TaskException {
        if (!CronUtils.isValid(job.getCronExpression())) {
            return error("修改任务'" + job.getJobName() + "'失败,Cron表达式不正确");
        }
        else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI))
        {
        } else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI)) {
            return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi'调用");
        }
        else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS }))
        {
        } else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[]{Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS})) {
            return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'ldap(s)'调用");
        }
        else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS }))
        {
        } else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[]{Constants.HTTP, Constants.HTTPS})) {
            return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)'调用");
        }
        else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR))
        {
        } else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR)) {
            return error("修改任务'" + job.getJobName() + "'失败,目标字符串存在违规");
        }
        else if (!ScheduleUtils.whiteList(job.getInvokeTarget()))
        {
        } else if (!ScheduleUtils.whiteList(job.getInvokeTarget())) {
            return error("修改任务'" + job.getJobName() + "'失败,目标字符串不在白名单内");
        }
        job.setUpdateBy(getUsername());
@@ -153,8 +118,7 @@
    @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')")
    @Log(title = "定时任务", businessType = BusinessType.UPDATE)
    @PutMapping("/changeStatus")
    public AjaxResult changeStatus(@RequestBody SysJob job) throws SchedulerException
    {
    public AjaxResult changeStatus(@RequestBody SysJob job) throws SchedulerException {
        SysJob newJob = jobService.selectJobById(job.getJobId());
        newJob.setStatus(job.getStatus());
        return toAjax(jobService.changeStatus(newJob));
@@ -166,8 +130,7 @@
    @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')")
    @Log(title = "定时任务", businessType = BusinessType.UPDATE)
    @PutMapping("/run")
    public AjaxResult run(@RequestBody SysJob job) throws SchedulerException
    {
    public AjaxResult run(@RequestBody SysJob job) throws SchedulerException {
        boolean result = jobService.run(job);
        return result ? success() : error("任务不存在或已过期!");
    }
@@ -178,8 +141,7 @@
    @PreAuthorize("@ss.hasPermi('monitor:job:remove')")
    @Log(title = "定时任务", businessType = BusinessType.DELETE)
    @DeleteMapping("/{jobIds}")
    public AjaxResult remove(@PathVariable Long[] jobIds) throws SchedulerException, TaskException
    {
    public AjaxResult remove(@PathVariable Long[] jobIds) throws SchedulerException, TaskException {
        jobService.deleteJobByIds(jobIds);
        return success();
    }
zhitan-system/.DS_Store
Binary files differ
zhitan-system/src/.DS_Store
Binary files differ
zhitan-system/src/main/java/com/zhitan/statisticalAnalysis/domain/vo/EnergyTypeValueContrastedVO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,62 @@
package com.zhitan.statisticalAnalysis.domain.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
 * å„能源类型值同比、环比VO
 *
 * @Author: Zhujw
 * @Date: 2023/2/8
 */
@Data
public class EnergyTypeValueContrastedVO {
    /**
     * ç”¨èƒ½å•元名称
     */
    @ApiModelProperty(value = "用能单元名称")
    private String energyUnitName;
    /**
     * èƒ½æºç±»åž‹
     */
    @ApiModelProperty(value = "能源类型")
    private String energyType;
    /**
     * æœ¬æœŸæ—¶é—´
     */
    @ApiModelProperty(value = "本期时间")
    private String currentTime;
    /**
     * æœ¬æœŸå€¼
     */
    @ApiModelProperty(value = "本期值")
    private BigDecimal currentValue;
    /**
     * å¯¹æ¯”æ—¶é—´
     */
    @ApiModelProperty(value = "对比时间")
    private String compareTime;
    /**
     * å¯¹æ¯”值
     */
    @ApiModelProperty(value = "对比值")
    private BigDecimal contrastValues;
    /**
     * åŒæ¯”值
     * åŒæ¯”增长率=(本期值-去年同期值)/去年同期值×100%
     * çŽ¯æ¯”å€¼
     * çŽ¯æ¯”å¢žé•¿çŽ‡=(本期值-上期值)/上期值×100%
     */
    @ApiModelProperty(value = "同比增长率/环比增长率")
    private BigDecimal ratio;
}
zhitan-system/src/main/java/com/zhitan/statisticalAnalysis/domain/vo/QueryCompareRequest.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,49 @@
package com.zhitan.statisticalAnalysis.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
/**
 * @Description: æ•°æ®æŸ¥è¯¢æ¡ä»¶å®žä½“
 * @author: yxw
 * @date: 2022å¹´01月28日 14:49
 */
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="QueryCompareRequest", description="获取数据的参数实体")
public class QueryCompareRequest {
    /**
     * æŸ¥è¯¢æ—¶é—´ç±»åž‹,对应常量类:TimeTypeConst
     */
    @NotBlank(message = "时间类型不能为空")
    @ApiModelProperty(value = "查询时间类型,对应常量:DAY/MONTH/SEASON/YEAR,默认MONTH")
    private String timeType;
    /**
     * æ—¥æœŸå€¼ï¼Œæœˆä»½(202201-202212)、年份(2022-~)
     */
    @NotBlank(message = "时间编码不能为空")
    @ApiModelProperty(value = "日期值,月份(202201-202212)、年份(2022-~)")
    private String timeCode;
    /**
     * èŠ‚ç‚¹Id
     */
    @NotBlank(message = "节点Id")
    @ApiModelProperty(value = "节点Id")
    private String nodeId;
    /**
     * èƒ½æºç±»åž‹ï¼Œé€šè¿‡/隔开,water/gas
     */
    @ApiModelProperty(value = "能源类型,通过/隔开,water/gas")
    private String energyType;
}
zhitan-system/src/main/java/com/zhitan/statisticalAnalysis/service/IEnergyConsumeDataService.java
@@ -32,4 +32,13 @@
     * @return
     */
    List<EnergyConsumeTrendDetailItem> listEnergyCostTrendDetail(String timeCode, String timeType, String modelCode, String energyType);
    /**
     * åŒæ¯”环比分析
     *
     * @param req            è¯·æ±‚参数
     * @param comparisonType å¯¹æ¯”类型
     * @return
     */
    public List<EnergyTypeValueContrastedVO> listEnergyTypeYoyInfo(QueryCompareRequest req, String comparisonType);
}
zhitan-system/src/main/java/com/zhitan/statisticalAnalysis/service/impl/EnergyConsumeDataServiceImpl.java
@@ -1,5 +1,6 @@
package com.zhitan.statisticalAnalysis.service.impl;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zhitan.basicdata.domain.SysEnergy;
@@ -20,6 +21,7 @@
import org.apache.commons.lang3.ObjectUtils;
import com.zhitan.statisticalAnalysis.domain.vo.*;
import com.zhitan.statisticalAnalysis.service.IEnergyConsumeDataService;
import org.jetbrains.annotations.NotNull;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
@@ -312,4 +314,185 @@
        costValueList.add(totalCost);
        accumulationValueList.add(totalAccumulation);
    }
    /**
     * åŒæ­¥çŽ¯æ¯”åˆ†æž
     *
     * @param req            è¯·æ±‚参数
     * @param comparisonType å¯¹æ¯”类型
     * @return
     */
    @Override
    public List<EnergyTypeValueContrastedVO> listEnergyTypeYoyInfo(QueryCompareRequest req, String comparisonType) {
        String energyType = req.getEnergyType();
        String timeType = req.getTimeType();
        String timeCode = req.getTimeCode();
        String nodeId = req.getNodeId();
        //能源类型信息
        SysEnergy sysEnergy = new SysEnergy();
        sysEnergy.setEnersno(energyType);
        List<SysEnergy> sysEnergies = sysEnergyMapper.selectSysEnergyList(sysEnergy);
        if (sysEnergies.isEmpty()) {
            throw new RuntimeException("未查询到能源信息");
        }
        SysEnergy sysEnergyInfo = sysEnergies.get(0);
        // èƒ½è€—信息
        Date startTime = DateTimeUtil.getTime(timeType, timeCode);
        Date endTime = DateTimeUtil.getEndTimeByType(timeType, startTime);
        //是否同比
        boolean isYoy = comparisonType.equals(CommonConst.ENERGY_COMPARISON_YOY);
        // è®¡ç®—上一年的同期时间
        Date lastBeginTime = DateUtil.offset(startTime, DateField.YEAR, CommonConst.DIGIT_MINUS_1);
        Date lastEndTime = DateUtil.offset(endTime, DateField.YEAR, CommonConst.DIGIT_MINUS_1);
        if (!isYoy) {
            switch (timeType) {
                case TimeTypeConst.TIME_TYPE_DAY:
                    lastBeginTime = DateUtil.offsetDay(startTime, CommonConst.DIGIT_MINUS_1);
                    lastEndTime = DateUtil.offsetDay(endTime, CommonConst.DIGIT_MINUS_1);
                    break;
                case TimeTypeConst.TIME_TYPE_MONTH:
                    lastBeginTime = DateUtil.offsetMonth(startTime, CommonConst.DIGIT_MINUS_1);
                    lastEndTime = DateUtil.offsetMonth(endTime, CommonConst.DIGIT_MINUS_1);
                    break;
            }
        }
        //电:只有HOUR数据有效;其他能源类型:HOUR、DAY有数据
        String queryTimeType = TimeTypeConst.TIME_TYPE_HOUR;
        List<EnergyConsumeVO> energyConsumeVOList = new ArrayList<>();
        switch (sysEnergyInfo.getEnersno()) {
            case "electric":
                List<ElectricityDataItem> electricityDataItems = peakValleyMapper.getCostTrends(startTime, endTime, queryTimeType, nodeId, sysEnergyInfo.getEnersno());
                List<ElectricityDataItem> lastDataItemList = peakValleyMapper.getCostTrends(lastBeginTime, lastEndTime, queryTimeType, nodeId, sysEnergyInfo.getEnersno());
                if (!lastDataItemList.isEmpty()) {
                    electricityDataItems.addAll(lastDataItemList);
                }
                if (!electricityDataItems.isEmpty()) {
                    electricityDataItems.forEach(electricityDataItem -> {
                        EnergyConsumeVO temp = new EnergyConsumeVO();
                        temp.setDataTime(electricityDataItem.getDataTime());
                        temp.setAccumulationValue(electricityDataItem.getElectricity());
                        energyConsumeVOList.add(temp);
                    });
                }
                break;
            default:
                if (timeType.equals(TimeTypeConst.TIME_TYPE_MONTH) || timeType.equals(TimeTypeConst.TIME_TYPE_YEAR)) {
                    queryTimeType = TimeTypeConst.TIME_TYPE_DAY;
                }
                List<CarbonEmission> dataItems = dataItemMapper.getMiddleCarbonEmission(startTime, endTime, queryTimeType, nodeId, sysEnergyInfo.getEnersno());
                List<CarbonEmission> lastDataItems = dataItemMapper.getMiddleCarbonEmission(lastBeginTime, lastEndTime, queryTimeType, nodeId, sysEnergyInfo.getEnersno());
                if (!lastDataItems.isEmpty()) {
                    dataItems.addAll(lastDataItems);
                }
                dataItems.addAll(lastDataItems);
                if (!dataItems.isEmpty()) {
                    dataItems.forEach(dataItem -> {
                        EnergyConsumeVO temp = new EnergyConsumeVO();
                        temp.setDataTime(dataItem.getDataTime());
                        temp.setAccumulationValue(new BigDecimal(dataItem.getValue()));
                        energyConsumeVOList.add(temp);
                    });
                }
                break;
        }
        // ç»„装统计图信息
        return getEnergyTypeValueContrastedVOList(startTime, timeType, energyConsumeVOList, sysEnergyInfo.getEnersno(), isYoy);
    }
    /**
     * ç»„装成本趋势分析-统计图信息
     *
     * @param bsTime     æ—¶é—´
     * @param timeType   æ—¶é—´ç±»åž‹
     * @param dataItems  èƒ½è€—
     * @param energyType èƒ½æºç±»åž‹
     * @param isYoy      æ˜¯å¦åŒæ¯”
     */
    private List<EnergyTypeValueContrastedVO> getEnergyTypeValueContrastedVOList(Date bsTime, String timeType,
                                                                                 List<EnergyConsumeVO> dataItems, String energyType, boolean isYoy) {
        Map<String, List<EnergyConsumeVO>> energyConsumeVOMap;
        Map<String, List<EnergyConsumeVO>> lastEnergyConsumeVOMap;
        List<EnergyTypeValueContrastedVO> itemList = new ArrayList<>();
        //按时间类型组织返回数据
        switch (timeType) {
            case TimeTypeConst.TIME_TYPE_DAY:
                energyConsumeVOMap = dataItems.stream().collect(Collectors.groupingBy(li -> DateUtil.formatDateTime(li.getDataTime())));
                for (int i = 0; i < CommonConst.DIGIT_24; i++) {
                    Date currentTime = DateUtil.offsetHour(bsTime, i);
                    Date compareTime = isYoy ? DateUtil.offset(currentTime, DateField.YEAR, CommonConst.DIGIT_MINUS_1) : DateUtil.offsetDay(currentTime, CommonConst.DIGIT_MINUS_1);
                    String keyCurrentTime = DateUtil.formatDateTime(currentTime);
                    String keyCompareTime = DateUtil.formatDateTime(compareTime);
                    EnergyTypeValueContrastedVO item = getEnergyTypeValueContrastedVO(energyType, energyConsumeVOMap, keyCurrentTime, keyCompareTime, currentTime, compareTime);
                    itemList.add(item);
                }
                break;
            case TimeTypeConst.TIME_TYPE_MONTH:
                energyConsumeVOMap = dataItems.stream().collect(Collectors.groupingBy(li -> DateUtil.formatDate(li.getDataTime())));
                Date endTime = DateTimeUtil.getEndTimeByType(timeType, bsTime);
                while (bsTime.before(endTime)) {
                    Date currentTime = bsTime;
                    Date compareTime = isYoy ? DateUtil.offset(currentTime, DateField.YEAR, CommonConst.DIGIT_MINUS_1) : DateUtil.offsetMonth(currentTime, CommonConst.DIGIT_MINUS_1);
                    String keyCurrentTime = DateUtil.formatDate(currentTime);
                    String keyCompareTime = DateUtil.formatDate(compareTime);
                    EnergyTypeValueContrastedVO item = getEnergyTypeValueContrastedVO(energyType, energyConsumeVOMap, keyCurrentTime, keyCompareTime, currentTime, compareTime);
                    itemList.add(item);
                    bsTime = DateUtil.offsetDay(bsTime, CommonConst.DIGIT_1);
                }
                break;
            case TimeTypeConst.TIME_TYPE_YEAR:
                SimpleDateFormat formatter = new SimpleDateFormat(DateTimeUtil.COMMON_PATTERN_TO_MONTH_ZH);
                energyConsumeVOMap = dataItems.stream().collect(Collectors.groupingBy(li -> formatter.format(li.getDataTime())));
                for (int i = 0; i < CommonConst.DIGIT_12; i++) {
                    Date currentTime = DateUtil.offsetMonth(bsTime, i);
                    Date compareTime = DateUtil.offset(currentTime, DateField.YEAR, CommonConst.DIGIT_MINUS_1);
                    String keyCurrentTime = formatter.format(currentTime);
                    String keyCompareTime = formatter.format(compareTime);
                    EnergyTypeValueContrastedVO item = getEnergyTypeValueContrastedVO(energyType, energyConsumeVOMap, keyCurrentTime, keyCompareTime, currentTime, compareTime);
                    itemList.add(item);
                }
                break;
            default:
                break;
        }
        return itemList;
    }
    private @NotNull EnergyTypeValueContrastedVO getEnergyTypeValueContrastedVO(String energyType, Map<String, List<EnergyConsumeVO>> energyConsumeVOMap,
                                                                                String keyCurrentTime, String keyCompareTime, Date currentTime, Date compareTime) {
        List<EnergyConsumeVO> energyConsumeList = Optional.ofNullable(energyConsumeVOMap.get(keyCurrentTime))
                .orElse(Collections.emptyList());
        BigDecimal currentValue = calculateSum(energyConsumeList);
        List<EnergyConsumeVO> lastEnergyConsumeList = Optional.ofNullable(energyConsumeVOMap.get(keyCompareTime))
                .orElse(Collections.emptyList());
        BigDecimal contrastValues = calculateSum(lastEnergyConsumeList);
        BigDecimal multiple = BigDecimal.valueOf(CommonConst.DIGIT_100);
        BigDecimal ratio = calculateRatio(currentValue, contrastValues, multiple);
        EnergyTypeValueContrastedVO item = new EnergyTypeValueContrastedVO();
        item.setEnergyType(energyType);
        item.setCurrentTime(DateUtil.formatDateTime(currentTime));
        item.setCompareTime(DateUtil.formatDateTime(compareTime));
        item.setCurrentValue(currentValue);
        item.setContrastValues(contrastValues);
        item.setRatio(ratio);
        return item;
    }
    private BigDecimal calculateSum(List<EnergyConsumeVO> dataItemList) {
        return dataItemList.stream()
                .map(EnergyConsumeVO::getAccumulationValue)
                .reduce(BigDecimal.ZERO, BigDecimal::add)
                .setScale(CommonConst.DIGIT_2, RoundingMode.HALF_UP);
    }
    private BigDecimal calculateRatio(BigDecimal currentSum, BigDecimal lastSum, BigDecimal multiple) {
        if (lastSum.compareTo(BigDecimal.ZERO) == 0) {
            return BigDecimal.ZERO;
        }
        return currentSum.subtract(lastSum)
                .divide(lastSum, CommonConst.DIGIT_2, RoundingMode.HALF_UP)
                .multiply(multiple)
                .setScale(CommonConst.DIGIT_2, RoundingMode.HALF_UP);
    }
}
zhitan-vue/.env.development
@@ -5,11 +5,7 @@
VITE_APP_ENV = 'development'
# ç³»ç»Ÿ/开发环境
# wangxiang
# VITE_APP_BASE_API = 'http://127.0.0.1:8080'
# hangmingjun
# VITE_APP_BASE_API = 'http://127.0.0.1:8080'
# weishuaishuai
# VITE_APP_BASE_API = 'https://demo-ems.zhitancloud.com'
# test
VITE_APP_BASE_API = 'http://139.159.201.118:8201'
VITE_APP_BASE_API = 'http://127.0.0.1:8080'
# hangmingjun
zhitan-vue/.gitignore
@@ -1,4 +1,4 @@
.DS_Store
*/.DS_Store
node_modules/
dist/
npm-debug.log*
@@ -6,6 +6,7 @@
yarn-error.log*
**/*.log
tests/**/coverage/
tests/e2e/reports
selenium-debug.log
zhitan-vue/src/api/energyAnalysis/energyAnalysis.js
@@ -60,3 +60,19 @@
    params: query,
  })
}
// å¯¹æ¯”分析同比
export function querySameCompareList(query) {
  return request({
    url: "/statisticsAnalysis/querySameCompareList",
    method: "get",
    params: query,
  })
}
// å¯¹æ¯”分析环比
export function queryLoopCompareList(query) {
  return request({
    url: "/statisticsAnalysis/queryLoopCompareList",
    method: "get",
    params: query,
  })
}
zhitan-vue/src/views/energyconservation/policyrule/components/EditModal copy.vue
ÎļþÒÑɾ³ý
zhitan-vue/src/views/poweranalysis/pariPassu/index.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,592 @@
<template>
  <div class="page">
    <div class="page-container">
      <div class="page-container-left">
        <LeftTree ref="leftTreeRef" @handleNodeClick="handleNodeClick" />
      </div>
      <div class="page-container-right">
        <div class="form-card">
          <el-form :model="queryParams" ref="queryRef" :inline="true">
            <el-form-item label="期间" prop="timeType">
              <el-select v-model="queryParams.timeType" placeholder="期间" clearable style="width: 120px"
                @change="handleTimeType">
                <el-option v-for="dict in period" :key="dict.value" :label="dict.label" :value="dict.value" />
              </el-select>
            </el-form-item>
            <el-form-item label="时间">
              <el-date-picker v-model="queryParams.dataTime" :type="queryParams.timeType == 'YEAR'
                ? 'year'
                : queryParams.timeType == 'MONTH'
                  ? 'month'
                  : 'date'
                " :format="queryParams.timeType == 'YEAR'
                  ? 'YYYY'
                  : queryParams.timeType == 'MONTH'
                    ? 'YYYY-MM'
                    : 'YYYY-MM-DD'
                  " value-format="YYYY-MM-DD" placeholder="时间" style="width: 100%" />
            </el-form-item>
            <el-form-item label="能源类型" prop="energyType">
              <el-select v-model="queryParams.energyType" placeholder="能源类型" clearable style="width: 120px">
                <el-option :label="item.enername" :value="item.enersno" v-for="item in energyTypeList"
                  :key="item.enersno" @click="handleEnergyType(item)" />
              </el-select>
            </el-form-item>
            <el-form-item>
              <el-button type="primary" icon="Search" @click="handleQuery">
                æœç´¢
              </el-button>
              <el-button icon="Refresh" @click="resetQuery">重置</el-button>
            </el-form-item>
            <!-- <el-form-item>
              <el-button :type="queryParams.analysisType == 'YOY' ? 'primary' : ''" @click="handleAnalysisType('YOY')">
                åŒæ¯”
              </el-button>
              <el-button :type="queryParams.analysisType == 'MOM' ? 'primary' : ''" @click="handleAnalysisType('MOM')">
                çŽ¯æ¯”
              </el-button>
            </el-form-item> -->
            <!-- <el-form-item>
              <el-button type="primary" icon="Download" @click="handleExport">
                å¯¼å‡º
              </el-button>
            </el-form-item> -->
          </el-form>
        </div>
        <div style="
            height: calc(100vh - 220px) !important;
            max-height: calc(100vh - 220px) !important;
            overflow-y: auto;
          " v-loading="loading">
          <BaseCard :title="queryParams.nodeName + '-能耗对比分析'">
            <div class="chart-box">
              <div id="Chart1" />
            </div>
          </BaseCard>
          <BaseCard :title="queryParams.nodeName +
            '-能耗对比分析同比分析表-' +
            queryParams.enername
            ">
            <div class="table-box">
              <el-table :data="departmentList" show-summary>
                <el-table-column label="本期时间" align="center" key="currentTime" prop="currentTime"
                  :show-overflow-tooltip="true" />
                <el-table-column :label="'本期耗' +
                  queryParams.enername +
                  '(' +
                  queryParams.muid +
                  ')'
                  " align="center" key="currentValue" prop="currentValue" :show-overflow-tooltip="true" />
                <el-table-column label="同期时间" align="center" key="compareTime" prop="compareTime"
                  :show-overflow-tooltip="true" />
                <el-table-column :label="'同期耗' +
                  queryParams.enername +
                  '(' +
                  queryParams.muid +
                  ')'
                  " align="center" key="contrastValues" prop="contrastValues" :show-overflow-tooltip="true" />
                <el-table-column :label="(queryParams.analysisType == 'YOY' ? '同' : '环') + '比(%)'
                  " align="center" key="ratio" prop="ratio" :show-overflow-tooltip="true" width="200" />
              </el-table>
            </div>
          </BaseCard>
          <!-- </el-col>
          </el-row> -->
        </div>
      </div>
    </div>
  </div>
</template>
<script setup name="department">
import {
  listRegion,
  listDepartment,
  querySameCompareList,
} from "@/api/energyAnalysis/energyAnalysis";
import { listEnergyTypeList } from "@/api/modelConfiguration/energyType";
import * as echarts from "echarts";
const { proxy } = getCurrentInstance();
const { period } = proxy.useDict("period");
import { useRoute } from "vue-router";
import useSettingsStore from "@/store/modules/settings";
const settingsStore = useSettingsStore();
watch(
  () => settingsStore.sideTheme,
  (val) => {
    getList();
  }
);
const energyTypeList = ref(undefined);
const departmentList = ref([]);
const loading = ref(false);
const data = reactive({
  queryParams: {
    nodeId: null,
    timeType: null,
    dataTime: null,
    timeCode: null,
    analysisType: "YOY",
    energyType: null,
  },
  query: {
    modelCode: null,
  },
});
const { queryParams, query } = toRefs(data);
/** èŠ‚ç‚¹å•å‡»äº‹ä»¶ */
function handleNodeClick(data) {
  queryParams.value.nodeId = data.id;
  queryParams.value.nodeName = data.label;
  handleTimeType(period.value[1].value);
  listEnergyTypeList().then((res) => {
    energyTypeList.value = res.data;
    queryParams.value.energyType = energyTypeList.value[0].enersno;
    queryParams.value.enername = energyTypeList.value[0].enername;
    queryParams.value.muid = energyTypeList.value[0].muid;
    handleQuery();
  });
}
function handleTimeType(e) {
  queryParams.value.timeType = e;
  if(e=='MONTH'){
    queryParams.value.timeCode = proxy.dayjs(new Date()).format("YYYY-MM");
  }else if(e=='YEAR'){
    queryParams.value.timeCode = proxy.dayjs(new Date()).format("YYYY");
  }else{
    queryParams.value.timeCode = proxy.dayjs(new Date()).format("YYYY-MM-DD");
  }
}
function handleEnergyType(item) {
  queryParams.value.enername = item.enername;
  queryParams.value.muid = item.muid;
  handleQuery();
}
function handleAnalysisType(analysisType) {
  queryParams.value.analysisType = analysisType;
  getList();
}
// èƒ½è€—对比分析-列表
function getList() {
  loading.value = true;
  // åœ¨åˆå§‹åŒ–之前,先dispose旧的实例
  if (echarts.getInstanceByDom(document.getElementById("Chart1"))) {
    echarts.dispose(document.getElementById("Chart1"));
  }
  // if (echarts.getInstanceByDom(document.getElementById("Chart2"))) {
  //   echarts.dispose(document.getElementById("Chart2"));
  // }
  const myChart1 = echarts.init(document.getElementById("Chart1"));
  // const myChart2 = echarts.init(document.getElementById("Chart2"));
  querySameCompareList(
    proxy.addDateRange({
      ...queryParams.value,
      ...query.value,
    })
  ).then((res) => {
    if (!!res.code && res.code == 200) {
      loading.value = false;
      let xdata = [];
      let yvalue = [];
      let ycompareValue = [];
      let yqoq = [];
      if (!!res.data) {
        res.data.map((item) => {
          xdata.push(
            proxy
              .dayjs(item.currentTime)
              .format(
                queryParams.value.timeType == "YEAR"? "MM月": queryParams.value.timeType =="MONTH"? "DD日": "HH时"
              )
          );
          yvalue.push(!!item.currentValue ? item.currentValue : 0);
          ycompareValue.push(!!item.contrastValues? item.contrastValues : 0);
          yqoq.push(!!item.ratio ? item.ratio : 0);
        });
       console.log(xdata)
      }
      setTimeout(() => {
        myChart1.setOption({
          color: ["#2979ff", "#19be6b", "#ff9900", "#fa3534"],
          grid: {
            top: "45",
            left: "7%",
            right: "5%",
            bottom: "10",
            containLabel: true,
          },
          tooltip: {
            trigger: "axis",
            axisPointer: {
              type: "shadow",
            },
          },
          legend: {
            icon: "rect",
            itemWidth: 14,
            itemHeight: 10,
            textStyle: {
              color:
                settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222",
            },
          },
          xAxis: {
            type: "category",
            axisPointer: {
              type: "shadow",
            },
            axisLine: {
              show: true,
              lineStyle: {
                color:
                  settingsStore.sideTheme == "theme-dark"
                    ? "#FFFFFF"
                    : "#222222",
              },
            },
            axisTick: {
              show: false,
            },
            splitArea: {
              show: false,
            },
            splitLine: {
              show: false,
            },
            axisLabel: {
              color:
                settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222",
              fontSize: 14,
              padding: [5, 0, 0, 0],
              //   formatter: '{value} ml'
            },
            data: xdata,
          },
          yAxis: [
            {
              type: "value",
              name:
                "耗" +
                queryParams.value.enername +
                "量(" +
                queryParams.value.muid +
                ")",
              nameTextStyle: {
                color:
                  settingsStore.sideTheme == "theme-dark"
                    ? "#FFFFFF"
                    : "#222222",
                fontSize: 14,
                padding: [0, 0, 5, 0],
              },
              axisLine: {
                show: false,
              },
              splitLine: {
                show: true,
                lineStyle: {
                  type: "dashed",
                  color:
                    settingsStore.sideTheme == "theme-dark"
                      ? "#FFFFFF"
                      : "#222222",
                },
              },
              axisTick: {
                show: false,
              },
              splitArea: {
                show: false,
              },
              axisLabel: {
                color:
                  settingsStore.sideTheme == "theme-dark"
                    ? "#FFFFFF"
                    : "#222222",
                fontSize: 14,
              },
            },
            {
              type: "value",
              name: queryParams.value.analysisType == "YOY" ? "同比(%)" : "环比(%)",
              alignTicks: true,
              nameTextStyle: {
                color:
                  settingsStore.sideTheme == "theme-dark"
                    ? "#FFFFFF"
                    : "#222222",
                fontSize: 14,
                padding: [0, 0, 5, 0],
              },
              axisLine: {
                show: false,
              },
              axisTick: {
                show: false,
              },
              splitLine: {
                show: true,
                lineStyle: {
                  type: "dashed",
                  color:
                    settingsStore.sideTheme == "theme-dark"
                      ? "#FFFFFF"
                      : "#222222",
                },
              },
              splitArea: {
                show: false,
              },
              axisLabel: {
                color:
                  settingsStore.sideTheme == "theme-dark"
                    ? "#FFFFFF"
                    : "#222222",
                fontSize: 14,
              },
            },
          ],
          series: [
            {
              name: "本期值",
              type: "bar",
              barWidth: "8",
              tooltip: {
                valueFormatter: function (value) {
                  return value + queryParams.value.muid;
                },
              },
              itemStyle: {
                borderRadius: [15, 15, 0, 0],
              },
              data: yvalue,
              markPoint: {
                data: [
                  { type: "max", name: "Max" },
                  { type: "min", name: "Min" },
                ],
              },
            },
            {
              name: "同期值",
              type: "bar",
              barWidth: "8",
              tooltip: {
                valueFormatter: function (value) {
                  return value + queryParams.value.muid;
                },
              },
              itemStyle: {
                borderRadius: [15, 15, 0, 0],
              },
              data: ycompareValue,
              markPoint: {
                data: [
                  { type: "max", name: "Max" },
                  { type: "min", name: "Min" },
                ],
              },
            },
            {
              name: queryParams.value.analysisType == "YOY" ? "同比" : "环比",
              type: "line",
              yAxisIndex: 1,
              symbol: "none", // è®¾ç½®ä¸º 'none' åŽ»æŽ‰åœ†ç‚¹
              tooltip: {
                valueFormatter: function (value) {
                  return value + "%";
                },
              },
              data: yqoq,
            },
          ],
        });
      }, 100);
      departmentList.value = !!res.data ? res.data : [];
      window.addEventListener(
        "resize",
        () => {
          myChart1.resize();
        },
        { passive: true }
      );
    }
  });
  // listDepartment(
  //   proxy.addDateRange({
  //     ...queryParams.value,
  //     ...query.value,
  //   })
  // ).then((res) => {
  //   if (!!res.code && res.code == 200) {
  //     loading.value = false;
  //     let seriesdata = [];
  //     let xdata = [];
  //     if (!!energyTypeList.value) {
  //       energyTypeList.value.map((item) => {
  //         seriesdata.push({
  //           name: item.enername,
  //           type: "bar",
  //           barWidth: "16",
  //           stack: "total",
  //           data: [],
  //         });
  //       });
  //     }
  //     if (!!res.data) {
  //       res.data.map((dataItem) => {
  //         xdata.push(dataItem.nodeName)
  //         seriesdata.forEach((seriesdataItem) => {
  //           if (
  //             dataItem.data.find(
  //               (dataItemItem) =>
  //                 dataItemItem.energyTypeName == seriesdataItem.name
  //             ) == undefined
  //           ) {
  //             dataItem.data.push({
  //               nodeId: dataItem.nodeId,
  //               nodeName: dataItem.nodeName,
  //               energyTypeNo: null,
  //               energyTypeName: seriesdataItem.name,
  //               energyConsumption: 0,
  //             });
  //           }
  //           dataItem.data.map(dataItemItem => {
  //             if (seriesdataItem.name == dataItemItem.energyTypeName) {
  //               seriesdataItem.data.push(dataItemItem.energyConsumption)
  //             }
  //           })
  //         });
  //       });
  //     }
  //     setTimeout(() => {
  //       myChart2.setOption({
  //         color: ["#2979ff", "#19be6b", "#ff9900", "#fa3534"],
  //         grid: {
  //           top: "45",
  //           left: "17%",
  //           right: "5%",
  //           bottom: "10",
  //           containLabel: true,
  //         },
  //         tooltip: {
  //           trigger: "axis",
  //           axisPointer: {
  //             type: "shadow",
  //           },
  //         },
  //         legend: {
  //           icon: "rect",
  //           itemWidth: 14,
  //           itemHeight: 10,
  //           right: 0,
  //           textStyle: {
  //             color:
  //               settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222",
  //           },
  //         },
  //         xAxis: {
  //           nameLocation: "start",
  //           type: "value",
  //           name: "单位tce",
  //           nameTextStyle: {
  //             color:
  //               settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222",
  //             fontSize: 14,
  //             padding: [0, 0, 5, 0],
  //           },
  //           axisLine: {
  //             show: false,
  //           },
  //           splitLine: {
  //             show: true,
  //             lineStyle: {
  //               type: "dashed",
  //               color:
  //                 settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222",
  //             },
  //           },
  //           axisTick: {
  //             show: false,
  //           },
  //           splitArea: {
  //             show: false,
  //           },
  //           axisLabel: {
  //             color:
  //               settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222",
  //             fontSize: 14,
  //             //   formatter: '{value} ml'
  //           },
  //         },
  //         yAxis: {
  //           type: "category",
  //           axisPointer: {
  //             type: "shadow",
  //           },
  //           axisLine: {
  //             show: true,
  //             lineStyle: {
  //               color:
  //                 settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222",
  //             },
  //           },
  //           axisTick: {
  //             show: false,
  //           },
  //           splitArea: {
  //             show: false,
  //           },
  //           splitLine: {
  //             show: false,
  //           },
  //           axisLabel: {
  //             color:
  //               settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222",
  //             fontSize: 14,
  //             padding: [5, 0, 0, 0],
  //             //   formatter: '{value} ml'
  //           },
  //           data: xdata.splice(0, 6),
  //         },
  //         series: seriesdata,
  //       });
  //     }, 100);
  //     window.addEventListener("resize", () => {
  //       myChart2.resize();
  //     },{passive: true});
  //   }
  // });
}
// èƒ½è€—对比分析-科室能耗分析-搜索
function handleQuery() {
  getList();
}
// èƒ½è€—对比分析-重置
function resetQuery() {
  proxy.resetForm("queryRef");
  handleTimeType(period.value[1].value);
  queryParams.value.energyType = energyTypeList.value[0].enersno;
  queryParams.value.enername = energyTypeList.value[0].enername;
  queryParams.value.muid = energyTypeList.value[0].muid;
  queryParams.value.analysisType = "YOY";
  handleQuery();
}
// èƒ½è€—对比分析-科室能耗分析-导出
function handleExport() {
  proxy.download(
    "consumptionanalysis/energyExport",
    {
      ...queryParams.value,
      ...query.value,
    },
    `${queryParams.value.nodeName}-厂区能耗分析_${new Date().getTime()}.xlsx`
  );
}
</script>
<style scoped lang="scss">
@import "@/assets/styles/page.scss";
</style>
zhitan-vue/src/views/poweranalysis/perPassu/index.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,594 @@
<template>
  <div class="page">
    <div class="page-container">
      <div class="page-container-left">
        <LeftTree ref="leftTreeRef" @handleNodeClick="handleNodeClick" />
      </div>
      <div class="page-container-right">
        <div class="form-card">
          <el-form :model="queryParams" ref="queryRef" :inline="true">
            <el-form-item label="期间" prop="timeType">
              <el-select v-model="queryParams.timeType" placeholder="期间" clearable style="width: 120px"
                @change="handleTimeType">
                <el-option v-for="dict in period" :key="dict.value" :label="dict.label" :value="dict.value" />
              </el-select>
            </el-form-item>
            <el-form-item label="时间">
              <el-date-picker v-model="queryParams.dataTime" :type="queryParams.timeType == 'YEAR'
                ? 'year'
                : queryParams.timeType == 'MONTH'
                  ? 'month'
                  : 'date'
                " :format="queryParams.timeType == 'YEAR'
                  ? 'YYYY'
                  : queryParams.timeType == 'MONTH'
                    ? 'YYYY-MM'
                    : 'YYYY-MM-DD'
                  " value-format="YYYY-MM-DD" placeholder="时间" style="width: 100%" />
            </el-form-item>
            <el-form-item label="能源类型" prop="energyType">
              <el-select v-model="queryParams.energyType" placeholder="能源类型" clearable style="width: 120px">
                <el-option :label="item.enername" :value="item.enersno" v-for="item in energyTypeList"
                  :key="item.enersno" @click="handleEnergyType(item)" />
              </el-select>
            </el-form-item>
            <el-form-item>
              <el-button type="primary" icon="Search" @click="handleQuery">
                æœç´¢
              </el-button>
              <el-button icon="Refresh" @click="resetQuery">重置</el-button>
            </el-form-item>
            <!-- <el-form-item>
              <el-button :type="queryParams.analysisType == 'YOY' ? 'primary' : ''" @click="handleAnalysisType('YOY')">
                åŒæ¯”
              </el-button>
              <el-button :type="queryParams.analysisType == 'MOM' ? 'primary' : ''" @click="handleAnalysisType('MOM')">
                çŽ¯æ¯”
              </el-button>
            </el-form-item> -->
            <!-- <el-form-item>
              <el-button type="primary" icon="Download" @click="handleExport">
                å¯¼å‡º
              </el-button>
            </el-form-item> -->
          </el-form>
        </div>
        <div style="
            height: calc(100vh - 220px) !important;
            max-height: calc(100vh - 220px) !important;
            overflow-y: auto;
          " v-loading="loading">
          <BaseCard :title="queryParams.nodeName + '-能耗对比分析'">
            <div class="chart-box">
              <div id="Chart1" />
            </div>
          </BaseCard>
          <BaseCard :title="queryParams.nodeName +
            '-能耗对比分析环比分析表-' +
            queryParams.enername
            ">
            <div class="table-box">
              <el-table :data="departmentList" show-summary>
                <el-table-column label="本期时间" align="center" key="currentTime" prop="currentTime"
                  :show-overflow-tooltip="true" />
                <el-table-column :label="'本期耗' +
                  queryParams.enername +
                  '(' +
                  queryParams.muid +
                  ')'
                  " align="center" key="currentValue" prop="currentValue" :show-overflow-tooltip="true" />
                <el-table-column label="同期时间" align="center" key="compareTime" prop="compareTime"
                  :show-overflow-tooltip="true" />
                <el-table-column :label="'同期耗' +
                  queryParams.enername +
                  '(' +
                  queryParams.muid +
                  ')'
                  " align="center" key="contrastValues" prop="contrastValues" :show-overflow-tooltip="true" />
                <el-table-column :label="(queryParams.analysisType == 'YOY' ? '同' : '环') + '比(%)'
                  " align="center" key="ratio" prop="ratio" :show-overflow-tooltip="true" width="200" />
              </el-table>
            </div>
          </BaseCard>
          <!-- </el-col>
          </el-row> -->
        </div>
      </div>
    </div>
  </div>
</template>
<script setup name="department">
import {
  listRegion,
  listDepartment,
  queryLoopCompareList,
} from "@/api/energyAnalysis/energyAnalysis";
import { listEnergyTypeList } from "@/api/modelConfiguration/energyType";
import * as echarts from "echarts";
const { proxy } = getCurrentInstance();
const { period } = proxy.useDict("period");
import { useRoute } from "vue-router";
import useSettingsStore from "@/store/modules/settings";
const settingsStore = useSettingsStore();
watch(
  () => settingsStore.sideTheme,
  (val) => {
    getList();
  }
);
const energyTypeList = ref(undefined);
const departmentList = ref([]);
const loading = ref(false);
const data = reactive({
  queryParams: {
    nodeId: null,
    timeType: null,
    dataTime: null,
    analysisType: "MOM",
    timeCode: null,
    energyType: null,
  },
  query: {
    modelCode: null,
  },
});
const { queryParams, query } = toRefs(data);
/** èŠ‚ç‚¹å•å‡»äº‹ä»¶ */
function handleNodeClick(data) {
  queryParams.value.nodeId = data.id;
  queryParams.value.nodeName = data.label;
  handleTimeType(period.value[1].value);
  listEnergyTypeList().then((res) => {
    energyTypeList.value = res.data;
    queryParams.value.energyType = energyTypeList.value[0].enersno;
    queryParams.value.enername = energyTypeList.value[0].enername;
    queryParams.value.muid = energyTypeList.value[0].muid;
    handleQuery();
  });
}
function handleTimeType(e) {
  queryParams.value.timeType = e;
  if(e=='MONTH'){
    queryParams.value.timeCode = proxy.dayjs(new Date()).format("YYYY-MM");
  }else if(e=='YEAR'){
    queryParams.value.timeCode = proxy.dayjs(new Date()).format("YYYY");
  }else{
    queryParams.value.timeCode = proxy.dayjs(new Date()).format("YYYY-MM-DD");
  }
}
function handleEnergyType(item) {
  queryParams.value.enername = item.enername;
  queryParams.value.muid = item.muid;
  handleQuery();
}
function handleAnalysisType(analysisType) {
  queryParams.value.analysisType = analysisType;
  getList();
}
// èƒ½è€—对比分析-列表
function getList() {
  loading.value = true;
  // åœ¨åˆå§‹åŒ–之前,先dispose旧的实例
  if (echarts.getInstanceByDom(document.getElementById("Chart1"))) {
    echarts.dispose(document.getElementById("Chart1"));
  }
  // if (echarts.getInstanceByDom(document.getElementById("Chart2"))) {
  //   echarts.dispose(document.getElementById("Chart2"));
  // }
  const myChart1 = echarts.init(document.getElementById("Chart1"));
  // const myChart2 = echarts.init(document.getElementById("Chart2"));
  queryLoopCompareList(
    proxy.addDateRange({
      ...queryParams.value,
      ...query.value,
    })
  ).then((res) => {
    if (!!res.code && res.code == 200) {
      loading.value = false;
      let xdata = [];
      let yvalue = [];
      let ycompareValue = [];
      let yqoq = [];
      if (!!res.data) {
        res.data.map((item) => {
          xdata.push(
            proxy
              .dayjs(item.currentTime)
              .format(
                queryParams.value.timeType == "YEAR"
                  ? "MM月"
                  : queryParams.value.timeType == "MONTH"
                    ? "DD日"
                    : "HH时"
              )
          );
          yvalue.push(!!item.currentValue ? item.currentValue : 0);
          ycompareValue.push(!!item.contrastValues ? item.contrastValues : 0);
          yqoq.push(!!item.ratio ? item.ratio : 0);
        });
      }
      setTimeout(() => {
        myChart1.setOption({
          color: ["#2979ff", "#19be6b", "#ff9900", "#fa3534"],
          grid: {
            top: "45",
            left: "7%",
            right: "5%",
            bottom: "10",
            containLabel: true,
          },
          tooltip: {
            trigger: "axis",
            axisPointer: {
              type: "shadow",
            },
          },
          legend: {
            icon: "rect",
            itemWidth: 14,
            itemHeight: 10,
            textStyle: {
              color:
                settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222",
            },
          },
          xAxis: {
            type: "category",
            axisPointer: {
              type: "shadow",
            },
            axisLine: {
              show: true,
              lineStyle: {
                color:
                  settingsStore.sideTheme == "theme-dark"
                    ? "#FFFFFF"
                    : "#222222",
              },
            },
            axisTick: {
              show: false,
            },
            splitArea: {
              show: false,
            },
            splitLine: {
              show: false,
            },
            axisLabel: {
              color:
                settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222",
              fontSize: 14,
              padding: [5, 0, 0, 0],
              //   formatter: '{value} ml'
            },
            data: xdata,
          },
          yAxis: [
            {
              type: "value",
              name:
                "耗" +
                queryParams.value.enername +
                "量(" +
                queryParams.value.muid +
                ")",
              nameTextStyle: {
                color:
                  settingsStore.sideTheme == "theme-dark"
                    ? "#FFFFFF"
                    : "#222222",
                fontSize: 14,
                padding: [0, 0, 5, 0],
              },
              axisLine: {
                show: false,
              },
              splitLine: {
                show: true,
                lineStyle: {
                  type: "dashed",
                  color:
                    settingsStore.sideTheme == "theme-dark"
                      ? "#FFFFFF"
                      : "#222222",
                },
              },
              axisTick: {
                show: false,
              },
              splitArea: {
                show: false,
              },
              axisLabel: {
                color:
                  settingsStore.sideTheme == "theme-dark"
                    ? "#FFFFFF"
                    : "#222222",
                fontSize: 14,
              },
            },
            {
              type: "value",
              name: queryParams.value.analysisType == "YOY" ? "同比(%)" : "环比(%)",
              alignTicks: true,
              nameTextStyle: {
                color:
                  settingsStore.sideTheme == "theme-dark"
                    ? "#FFFFFF"
                    : "#222222",
                fontSize: 14,
                padding: [0, 0, 5, 0],
              },
              axisLine: {
                show: false,
              },
              axisTick: {
                show: false,
              },
              splitLine: {
                show: true,
                lineStyle: {
                  type: "dashed",
                  color:
                    settingsStore.sideTheme == "theme-dark"
                      ? "#FFFFFF"
                      : "#222222",
                },
              },
              splitArea: {
                show: false,
              },
              axisLabel: {
                color:
                  settingsStore.sideTheme == "theme-dark"
                    ? "#FFFFFF"
                    : "#222222",
                fontSize: 14,
              },
            },
          ],
          series: [
            {
              name: "本期值",
              type: "bar",
              barWidth: "8",
              tooltip: {
                valueFormatter: function (value) {
                  return value + queryParams.value.muid;
                },
              },
              itemStyle: {
                borderRadius: [15, 15, 0, 0],
              },
              data: yvalue,
              markPoint: {
                data: [
                  { type: "max", name: "Max" },
                  { type: "min", name: "Min" },
                ],
              },
            },
            {
              name: "同期值",
              type: "bar",
              barWidth: "8",
              tooltip: {
                valueFormatter: function (value) {
                  return value + queryParams.value.muid;
                },
              },
              itemStyle: {
                borderRadius: [15, 15, 0, 0],
              },
              data: ycompareValue,
              markPoint: {
                data: [
                  { type: "max", name: "Max" },
                  { type: "min", name: "Min" },
                ],
              },
            },
            {
              name: queryParams.value.analysisType == "YOY" ? "同比" : "环比",
              type: "line",
              yAxisIndex: 1,
              symbol: "none", // è®¾ç½®ä¸º 'none' åŽ»æŽ‰åœ†ç‚¹
              tooltip: {
                valueFormatter: function (value) {
                  return value + "%";
                },
              },
              data: yqoq,
            },
          ],
        });
      }, 100);
      departmentList.value = !!res.data ? res.data : [];
      window.addEventListener(
        "resize",
        () => {
          myChart1.resize();
        },
        { passive: true }
      );
    }
  });
  // listDepartment(
  //   proxy.addDateRange({
  //     ...queryParams.value,
  //     ...query.value,
  //   })
  // ).then((res) => {
  //   if (!!res.code && res.code == 200) {
  //     loading.value = false;
  //     let seriesdata = [];
  //     let xdata = [];
  //     if (!!energyTypeList.value) {
  //       energyTypeList.value.map((item) => {
  //         seriesdata.push({
  //           name: item.enername,
  //           type: "bar",
  //           barWidth: "16",
  //           stack: "total",
  //           data: [],
  //         });
  //       });
  //     }
  //     if (!!res.data) {
  //       res.data.map((dataItem) => {
  //         xdata.push(dataItem.nodeName)
  //         seriesdata.forEach((seriesdataItem) => {
  //           if (
  //             dataItem.data.find(
  //               (dataItemItem) =>
  //                 dataItemItem.energyTypeName == seriesdataItem.name
  //             ) == undefined
  //           ) {
  //             dataItem.data.push({
  //               nodeId: dataItem.nodeId,
  //               nodeName: dataItem.nodeName,
  //               energyTypeNo: null,
  //               energyTypeName: seriesdataItem.name,
  //               energyConsumption: 0,
  //             });
  //           }
  //           dataItem.data.map(dataItemItem => {
  //             if (seriesdataItem.name == dataItemItem.energyTypeName) {
  //               seriesdataItem.data.push(dataItemItem.energyConsumption)
  //             }
  //           })
  //         });
  //       });
  //     }
  //     setTimeout(() => {
  //       myChart2.setOption({
  //         color: ["#2979ff", "#19be6b", "#ff9900", "#fa3534"],
  //         grid: {
  //           top: "45",
  //           left: "17%",
  //           right: "5%",
  //           bottom: "10",
  //           containLabel: true,
  //         },
  //         tooltip: {
  //           trigger: "axis",
  //           axisPointer: {
  //             type: "shadow",
  //           },
  //         },
  //         legend: {
  //           icon: "rect",
  //           itemWidth: 14,
  //           itemHeight: 10,
  //           right: 0,
  //           textStyle: {
  //             color:
  //               settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222",
  //           },
  //         },
  //         xAxis: {
  //           nameLocation: "start",
  //           type: "value",
  //           name: "单位tce",
  //           nameTextStyle: {
  //             color:
  //               settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222",
  //             fontSize: 14,
  //             padding: [0, 0, 5, 0],
  //           },
  //           axisLine: {
  //             show: false,
  //           },
  //           splitLine: {
  //             show: true,
  //             lineStyle: {
  //               type: "dashed",
  //               color:
  //                 settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222",
  //             },
  //           },
  //           axisTick: {
  //             show: false,
  //           },
  //           splitArea: {
  //             show: false,
  //           },
  //           axisLabel: {
  //             color:
  //               settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222",
  //             fontSize: 14,
  //             //   formatter: '{value} ml'
  //           },
  //         },
  //         yAxis: {
  //           type: "category",
  //           axisPointer: {
  //             type: "shadow",
  //           },
  //           axisLine: {
  //             show: true,
  //             lineStyle: {
  //               color:
  //                 settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222",
  //             },
  //           },
  //           axisTick: {
  //             show: false,
  //           },
  //           splitArea: {
  //             show: false,
  //           },
  //           splitLine: {
  //             show: false,
  //           },
  //           axisLabel: {
  //             color:
  //               settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222",
  //             fontSize: 14,
  //             padding: [5, 0, 0, 0],
  //             //   formatter: '{value} ml'
  //           },
  //           data: xdata.splice(0, 6),
  //         },
  //         series: seriesdata,
  //       });
  //     }, 100);
  //     window.addEventListener("resize", () => {
  //       myChart2.resize();
  //     },{passive: true});
  //   }
  // });
}
// èƒ½è€—对比分析-搜索
function handleQuery() {
  getList();
}
// èƒ½è€—对比分析-重置
function resetQuery() {
  proxy.resetForm("queryRef");
  handleTimeType(period.value[1].value);
  queryParams.value.energyType = energyTypeList.value[0].enersno;
  queryParams.value.enername = energyTypeList.value[0].enername;
  queryParams.value.muid = energyTypeList.value[0].muid;
  queryParams.value.analysisType = "MOM";
  handleQuery();
}
// èƒ½è€—对比分析-导出
function handleExport() {
  proxy.download(
    "consumptionanalysis/energyExport",
    {
      ...queryParams.value,
      ...query.value,
    },
    `${queryParams.value.nodeName}-厂区能耗分析_${new Date().getTime()}.xlsx`
  );
}
</script>
<style scoped lang="scss">
@import "@/assets/styles/page.scss";
</style>
zhitan-vue/vite.config.js
@@ -4,7 +4,9 @@
// https://vitejs.dev/config/
export default defineConfig(({ mode, command }) => {
  mode='production'
  const env = loadEnv(mode, process.cwd())
  console.log(mode,'==========env')
  const { VITE_APP_ENV } = env
  return {
    // éƒ¨ç½²ç”Ÿäº§çŽ¯å¢ƒå’Œå¼€å‘çŽ¯å¢ƒä¸‹çš„URL。