Merge remote-tracking branch 'origin/develop1.0' into dyl_dev
已添加127个文件
已重命名1个文件
已删除4个文件
已修改211个文件
| | |
| | | |
| | | ###################################################################### |
| | | # 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 |
| | |
| | | !*/build/*.html |
| | | !*/build/*.xml |
| | | |
| | | */.DS_Store |
| | | |
| | | uploadPath |
| | |
| | | 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. |
| | |
| | | <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">åºäºSpringBootåè¥ä¾æ¡æ¶å¼å</p> |
| | | <p align="center">è½ç¢³å¹³å°åå°å±ç¤º&æ¥å£å·²å®å
¨å¼æºï¼ä»£ç å®å¤ï¼åè½é½å
¨ï¼è¿è¡æ£å¸¸</p> |
| | | <p align="center"><span style="color: red;">éè¿æ¬é¡¹ç®ï¼å¦ä¹ è
å¯ä»¥ææ¡è½æºç®¡çè¡ä¸çåè½åä¸å¡ï¼ä»¥åææ¯æ¶æã</span></p> |
| | | |
| | | <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> |
| | | <a href='https://gitee.com/liulingling1993/zhitan-ems/stargazers'><img src='https://gitee.com/liulingling1993/zhitan-ems/badge/star.svg?theme=dark' alt='star'></img></a> |
| | | <a href='https://gitee.com/liulingling1993/zhitan-ems/members'><img src='https://gitee.com/liulingling1993/zhitan-ems/badge/fork.svg?theme=dark' alt='fork'></img></a> |
| | | </p> |
| | | |
| | | ## ä»ç» |
| | | éè¿ç©èç½ææ¯ï¼ééä¼ä¸æ°´ãçµãæ°ãççè½èæ°æ®ï¼å¸®ä¼ä¸å»ºç«è½æºç®¡çä½ç³»ï¼æ¾å°è·åæ»´æ¼ï¼ä»è为ä¼ä¸èè½æä¾ä¾æ®ã |
| | | è¿ä¸æ¥ä¸ºä¼ä¸å®ç°ç¢³è·è¸ªãç¢³çæ¥ã碳交æãè°æ±æ¥çå
¨çå½è¿ç¨ã 为ä¸å½ç¢³è¾¾å³°-碳ä¸åååºè´¡ç®ã |
| | | è½æºç®¡çç³»ç»ï¼ééä¼ä¸æ°´ãçµãæ°ãççè½èæ°æ®ï¼å¸®ä¼ä¸å»ºç«è½æºç®¡çä½ç³»ï¼æ¾å°è·åæ»´æ¼ï¼ä»è为ä¼ä¸èè½æä¾ä¾æ®ã |
| | | è¿ä¸æ¥ä¸ºä¼ä¸å®ç°ç¢³è·è¸ªãç¢³çæ¥ã碳交æãç¢³æ±æ¥çå
¨çå½è¿ç¨ã 为ä¸å½ç¢³è¾¾å³°-碳ä¸åååºè´¡ç®ã |
| | | |
| | | é对客æ·åºæ¯ï¼æ¿åºãååºãä¼ä¸ãå·¥ç¿ãå
Œ
±å»ºççã |
| | | |
| | | ## ãæ³¨æã宿´è½ç¢³ç®¡çå¹³å°å
å«ä¸ä¸ªé¨åï¼<span style="color: red;">æ¬ä»åºåªå
å«è½ç¢³å¹³å°åå°ç®¡ç端</span> |
| | | ##### 1. è½ç¢³å¹³å°åå°ç®¡ç端ï¼<span style="color: red;">ä¹å³æ¬é¡¹ç®è½ç¢³å¹³å°åå°å±ç¤ºé¨åï¼ä»£ç å®å¤ï¼è¿è¡æ£å¸¸ãéè¿æ¬é¡¹ç®ï¼å¦ä¹ è
å¯ä»¥ææ¡è½æºç®¡çè¡ä¸çåè½åä¸å¡ï¼ä»¥åææ¯æ¶æã</span> |
| | | ##### 2. æ°æ®ééç¨åºï¼ä¹å³mqttâ¡ï¸æ¶åºåºåè½ï¼è¯·åè[æä»¬å¦ä¸ä¸ªä»åºï¼ç¹å»è¶
龿¥ï¼ï¼MQTTééç½å
³](https://github.com/zhitan-cloud/zhitan-gateway)ï¼æè
å¯åèthingsjsçç¥å项ç®ï¼æè
èªå·±ç¨nettyèªå·±å®ç°ã |
| | | ##### 3. æ°æ®æ¸
æ´æå¡ï¼ä¹å³æ¶åºåºâ¡ï¸å
³ç³»åºï¼å¦ä¹ è
å¯ä»¥ä½¿ç¨javaèªå¸¦çXXL jobç计åä»»å¡å·¥å
·èªå·±æç
§ä¸å¡åè½ï¼æ¥å®ç°æ°æ®æ¸
æ´æå¡ã |
| | | |
| | | å¢å
ä»åºå°åï¼ç äºï¼ï¼https://gitee.com/ustcyc/zhitan-ems |
| | | ## ææ¡£--åå¨wikiç®å½ |
| | | ### github wikiå°åï¼https://github.com/zhitan-cloud/zhitan-ems/wiki |
| | | ### gitee wikiå°åï¼https://gitee.com/liulingling1993/zhitan-ems/wikis/ |
| | | |
| | | |
| | | å·²åæ¥æ´æ°å°githubä»åºï¼https://github.com/Andy-Yin/zhitan-ems |
| | | |
| | | ## æ¡æ¶ï¼ |
| | | |
| | | åºäºSpringBootçè¥ä¾æ¡æ¶ æè¯»ææãçé¢ç®æ´ç¾è§ã |
| | | å
³ç³»æ°æ®åºï¼mysql æè
postgredb |
| | | æ¶åºæ°æ®åºï¼influxdb 2.7+ |
| | | ä¸é´ä»¶ï¼redisï¼mq |
| | | VUEçæ¬ï¼VUE 3 |
| | | |
| | | ## æ°æ®é©±å¨çè®¡ç®æ¨¡ååä¸å¡æ¨¡åé
ç½® |
| | | æ¯æå¨æç¹ä½é
ç½®ãæ°æ®æ¨¡åãä¸å¡æ¨¡åçã |
| | | |
| | | ## å¨çº¿ä½éª |
| | | |
| | | - guestUser/guestUser |
| | | #### guestUser/guest@123456 |
| | | #### æ¼ç¤ºå°åï¼https://demo-ems.zhitancloud.com/ |
| | | |
| | | æ¼ç¤ºå°åï¼https://demo-ems.zhitancloud.com/ |
| | | |
| | | ## 社åºç-åè½å表 |
| | | 1. é¦é¡µçæ¿ **已宿** |
| | | 2. 宿¶æ°æ®çæµ **已宿** |
| | | 2.1. 宿¶æ°æ®æ¥ç **已宿** |
| | | 2.2. ç»æå¾åæï¼svg å¾ç»å®ï¼**已宿** |
| | | 3. åå²ç¹ä½åæ **已宿** |
| | | 4. ç»¼åææ åæ **已宿** |
| | | 4.1. ç»¼åææ åæï¼æ¥ï¼**已宿** |
| | | 4.2. ç»¼åææ åæï¼æï¼**已宿** |
| | | 4.3. ç»¼åææ åæï¼å¹´ï¼**已宿** |
| | | 5. éç¹è®¾å¤åæ **已宿** |
| | | 5.1. éç¹è®¾å¤åæï¼æ¥ï¼**已宿** |
| | | 5.2. éç¹è®¾å¤åæï¼æï¼**已宿** |
| | | 5.3. éç¹è®¾å¤åæï¼å¹´ï¼**已宿** |
| | | 6. å·¥åºè½èåæ **已宿** |
| | | 6.1. å·¥åºè½èåæï¼æ¥ï¼**已宿** |
| | | 6.2. å·¥åºè½èåæï¼æï¼**已宿** |
| | | 6.3. å·¥åºè½èåæï¼å¹´ï¼**已宿** |
| | | 7. å°å³°å¹³è°·åæ **已宿** |
| | | 7.1. å°å³°å¹³è°·é
ç½® **已宿** |
| | | 7.2. å°å³°å¹³è°·æ°æ® **已宿** |
| | | 8. è½è对æ¯åæï¼åè½æºåç§ï¼**已宿** |
| | | 8.1. çµåç¯æ¯åæ **已宿** |
| | | 8.2. æ°´åç¯æ¯åæ **已宿** |
| | | 8.3. å
¶ä»è½æºåç§åæ **已宿** |
| | | 9. æºè½æ¥è¦ **已宿** |
| | | 9.1. æ¥è¦åæ **已宿** |
| | | 9.2. æ¥è¦é
ç½® **已宿** |
| | | 10. æ°æ®è¡¥å½ **已宿** |
| | | 11. èè½é¡¹ç®ç®¡ç **已宿** |
| | | 12. ç¥è¯åº **已宿** |
| | | 13. è®¾å¤æ¡£æ¡ç®¡ç **已宿** |
| | | 14. 模åé
置管çï¼è®¡ç®æ¨¡åçï¼ **已宿** |
| | | 15. åºç¡æ°æ®ç®¡çï¼åå
¸ãè½æºç±»åçï¼ **已宿** |
| | | 16. ç³»ç»ç®¡çï¼ç¨æ·ãè§è²ãæéçï¼ **已宿** |
| | | 17. 建çè½èåæï¼æ¯è·¯ãåé¡¹ï¼ **已宿** |
| | | |
| | | ## å¢å¼ºç-åè½å表 |
| | | 1. åèåæ |
| | | 2. 计åä¸å®ç»© |
| | | 3. ç¨è½èæ ¸ |
| | | 4. ç¨è½å¯¹æ |
| | | 5. 建çè½è空è°èè½ |
| | | 6. è½æºå¹³è¡¡åæ |
| | | 7. è½æºå¯¹æ åæ |
| | | 8. ç©ºåæºéç¹è®¾å¤èè½å
容 |
| | | 9. ç¢³çæ¥ã碳路å¾ãç¢³ææ¾å åå åç¸å
³å
容 |
| | | 10. æºç½è·å¨ï¼å¾®çµç½ï¼ç¸å
³åè½ |
| | | 11. ä½ç¢³ååºç¸å
³ |
| | | 12. èªå®ä¹æ¥è¡¨ |
| | | 13. è½æºææ¬åæ |
| | | 14. å
ä¼è¿ç»´çæ§ |
| | | 15. å
çµè¿è¥å¹³å° |
| | | |
| | | |
| | | |
| | | ## æ¡æ¶ï¼ |
| | | |
| | | åºäºSpringBootçè¥ä¾æ¡æ¶ æè¯»ææãçé¢ç®æ´ç¾è§ãæ¯ææ·±è²&æµ
è²ä¸¤ç§é£æ ¼åæ¢ï¼æ¼ç¤ºç³»ç»å³ä¸è§ï¼ |
| | | å
³ç³»æ°æ®åºï¼postgresqlï¼mysqléèªè¡éé
ï¼mysqlæ§è½å¤ªå·®äºï¼ |
| | | æ¶åºæ°æ®åºï¼influxdb 2.7+ |
| | | ä¸é´ä»¶ï¼redis |
| | | VUEçæ¬ï¼VUE 3 |
| | | |
| | | ## ç¹è²ï¼æ°æ®é©±å¨çè®¡ç®æ¨¡ååä¸å¡æ¨¡åé
ç½® |
| | | 1. æ¯æå¨æç¹ä½é
ç½®ã |
| | |  |
| | | 2. æ¯æè®¡ç®å
¬å¼ã |
| | |  |
| | | 3. æ¯ææ¨¡åé
ç½®ãå
æ¬æ°æ®æ¨¡åãä¸å¡æ¨¡åã |
| | |  |
| | | 4. 夿项ç®åºå±ä»£ç &æ°æ®ç»æå®å
¨ä¸éè¦ååï¼å¯å¿«é交ä»å®æ½ã |
| | | 5. 已宿æ ååçç½å
³&çµè¡¨çéé设å¤å¯¹æ¥ï¼å¿«é为客æ·è½¯ç¡¬ä»¶ä¸ä½å交ä»ã |
| | | |
| | | |
| | | ## 亮ç¹åè½ |
| | |  |
| | | |
| | | ## åè½å表 |
| | | 1. é¦é¡µçæ¿ |
| | | 2. 宿¶æ°æ®çæµ |
| | | 2.1. 宿¶æ°æ®æ¥ç |
| | | 2.2. ç»æå¾åæï¼svg å¾ç»å®ï¼ |
| | | 3. å岿°æ®åæ |
| | | 4. ç»¼åææ åæ |
| | | 4.1. ç»¼åææ åæï¼æ¥ï¼ |
| | | 4.2. ç»¼åææ åæï¼æï¼ |
| | | 4.3. ç»¼åææ åæï¼å¹´ï¼ |
| | | 5. éç¹è®¾å¤åæ |
| | | 5.1. éç¹è®¾å¤åæï¼æ¥ï¼ |
| | | 5.2. éç¹è®¾å¤åæï¼æï¼ |
| | | 5.3. éç¹è®¾å¤åæï¼å¹´ï¼ |
| | | 6. å·¥åºè½èåæ |
| | | 6.1. å·¥åºè½èåæï¼æ¥ï¼ |
| | | 6.2. å·¥åºè½èåæï¼æï¼ |
| | | 6.3. å·¥åºè½èåæï¼å¹´ï¼ |
| | | 7. å°å³°å¹³è°·åæ |
| | | 7.1. å°å³°å¹³è°·é
ç½® |
| | | 7.2. å°å³°å¹³è°·æ°æ® |
| | | 8. è½è对æ¯åæï¼åè½æºåç§ï¼ |
| | | 8.1. çµåç¯æ¯åæ |
| | | 8.2. æ°´åç¯æ¯åæ |
| | | 9. æºè½æ¥è¦ |
| | | 9.1. æ¥è¦åæ |
| | | 9.2. æ¥è¦é
ç½® |
| | | 10. åèåæ |
| | | 11. 计åä¸å®ç»© |
| | | 12. ç¨è½èæ ¸ |
| | | 13. ç¨è½å¯¹æ |
| | | 14. æ°æ®è¡¥å½ |
| | | 15. èè½é¡¹ç®ç®¡ç |
| | | 16. è½æºå¹³è¡¡åæ |
| | | 17. è½æºå¯¹æ åæ |
| | | 18. 模åé
置管çï¼è®¡ç®æ¨¡åçï¼ |
| | | 19. åºç¡æ°æ®ç®¡çï¼åå
¸ãè½æºç±»åçï¼ |
| | | 20. ç³»ç»ç®¡çï¼ç¨æ·ãè§è²ãæéçï¼ |
| | | |
| | | ## UIå±ç¤ºï¼å¹³å°åæ·±è²åæµ
è²ä¸¤ç§é£æ ¼åæ¢ï¼ |
| | | |
| | |
| | | |
| | | ## ä¸å¡æ¶æ |
| | |  |
| | | |
| | | ## ææ¯æ¶æ |
| | |  |
| | |  |
| | | |
| | | ## æ²éäº¤æµ |
| | | |
| | | åºå¾å¤å¼åè
ç§ä¿¡ï¼æå建äºQQ群交æµï¼ç¾¤å·ï¼ï¼è¯·å¤æ³¨ï¼ems+å§åã |
| | | <p align="center"> |
| | | <img src="readme/img/qq.png" width=50% height=50%> |
| | | </p> |
| | | |
| | | æ«ç æ·»å 微信交æµï¼å å¾®ä¿¡è¯·å¤æ³¨ï¼ems+å§åã |
| | | |
| | | <p align="center"> |
| | | <img src="readme/img/image-wxm.png" width=50% height=50%> |
| | | </p> |
| | | |
| | | ## åä¸è´¡ç® |
| | | |
| | | 1. Fork æ¬ä»åº |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "name": "zhitan-ems", |
| | | "lockfileVersion": 3, |
| | | "requires": true, |
| | | "packages": {} |
| | | } |
| | |
| | | |
| | | <groupId>com.zhitan</groupId> |
| | | <artifactId>BaseAdminAPI</artifactId> |
| | | <version>3.8.7</version> |
| | | <version>2.5.2</version> |
| | | |
| | | <name>BaseAdminAPI</name> |
| | | <description>管çç³»ç»</description> |
| | |
| | | <packaging>pom</packaging> |
| | | |
| | | <properties> |
| | | <zhitan.version>3.8.7</zhitan.version> |
| | | <zhitan.version>2.5.2</zhitan.version> |
| | | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| | | <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> |
| | | <java.version>1.8</java.version> |
| | |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>BaseAdminAPI</artifactId> |
| | | <version>2.5.2</version> |
| | | <groupId>com.zhitan</groupId> |
| | | <version>3.8.7</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | <packaging>jar</packaging> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.web.controller.branchanalysis; |
| | | |
| | | import com.zhitan.branchanalysis.domain.BranchAnalysisVO; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.branchanalysis.service.IBranchAnalysisService; |
| | | |
| | | import com.zhitan.realtimedata.domain.dto.BranchAnalysisDTO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | *æ¯è·¯ç¨è½åæ |
| | | * |
| | | * @author zt |
| | | * @date 2025-03-26 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/branchanalysis") |
| | | @Api(value = "æ¯è·¯ç¨è½è½èç»è®¡",tags = {"æ¯è·¯ç¨è½åæ"}) |
| | | public class BranchEnergyAnalysisController extends BaseController { |
| | | |
| | | @Autowired |
| | | private IBranchAnalysisService branchAnalysisService; |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "æ¯è·¯ç¨è½è½èç»è®¡å表") |
| | | public AjaxResult list(BranchAnalysisDTO dataItem) { |
| | | BranchAnalysisVO vo = branchAnalysisService.getBranchAnalysisService(dataItem); |
| | | return success(vo); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.zhitan.keyequipment.service.IDailyKeyEquipmentService; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.model.service.IModelNodeService; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | i++; |
| | | } |
| | | List<DailyComprehensive> list = dailyComprehensiveService.getDailyComprehensiveList(modelNode.getNodeId(), |
| | | dataList, dataItem.getBeginTime(), dataItem.getEndTime(), dataItem.getTimeType(), dataItem.getIndexStorageId()); |
| | | dataList, dataItem.getBeginTime(), dataItem.getEndTime(), dataItem.getTimeType(), dataItem.getEnergyType()); |
| | | return AjaxResult.success(list); |
| | | } catch (Exception ex) { |
| | | logger.error("è·ååºéï¼", ex); |
| | |
| | | dataItem.setBeginTime(dataItem.getDataTime()); |
| | | String endTime=aa+" 24:00:00"; |
| | | dataItem.setEndTime(sf.parse(endTime)); |
| | | List<DailyComprehensive> list = dailyComprehensiveService.getListChart(dataItem.getIndexId(),dataItem.getBeginTime(),dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getIndexStorageId()); |
| | | List<DailyComprehensive> list = dailyComprehensiveService.getListChart(dataItem.getIndexId(),dataItem.getBeginTime(),dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getEnergyType()); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.web.controller.comprehensivestatistics; |
| | | |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.common.utils.poi.ExcelUtil; |
| | | import com.zhitan.comprehensivestatistics.domain.MonthlyComprehensive; |
| | | import com.zhitan.comprehensivestatistics.service.ImonthlyComprehensive; |
| | | import com.zhitan.model.domain.ModelNode; |
| | | import com.zhitan.model.service.IModelNodeService; |
| | | import com.zhitan.realtimedata.domain.DataItem; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.text.DateFormat; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * electricityPriceController |
| | | * |
| | | * @author sys |
| | | * @date 2020-02-18 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/comprehensive/monthlyComprehensive") |
| | | @Api(value = "ç»¼åææ åæï¼æï¼controller",tags = {"ç»¼åææ åæ"}) |
| | | public class MonthlyComprehensiveController extends BaseController { |
| | | |
| | | @Autowired |
| | | private IModelNodeService modelNodeService; |
| | | @Autowired |
| | | private ImonthlyComprehensive monthlyComprehensive; |
| | | |
| | | /*å
¨åè½èç»è®¡*/ |
| | | @ApiOperation(value = "è·åç»¼åææ åæï¼æï¼å表") |
| | | @GetMapping("/list") |
| | | public AjaxResult list(DataItem dataItem) { |
| | | try { |
| | | |
| | | Map tableColumn =new HashMap<>();//è¡¨æ°æ® |
| | | List<MonthlyComprehensive> dataList=new ArrayList<>(); |
| | | DateFormat df = new SimpleDateFormat("yyyy-MM"); |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String aa= df.format(dataItem.getDataTime()); |
| | | String bb=""; |
| | | int i = 1; |
| | | String beginTime=aa+"-01 00:00:00"; |
| | | dataItem.setBeginTime(sf.parse(beginTime)); |
| | | String endTime=aa+"-"+Integer.valueOf(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length()-2))+" 00:00:00"; |
| | | dataItem.setEndTime(sf.parse(endTime)); |
| | | while (i <= Integer.parseInt(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length() - 2))) { |
| | | if (i > 9) { |
| | | bb = aa + "-" + i + " 00:00:00"; |
| | | } else { |
| | | bb = aa + "-0" + i + " 00:00:00"; |
| | | } |
| | | MonthlyComprehensive report = new MonthlyComprehensive(); |
| | | report.setDataTime(sf.parse(bb)); |
| | | report.setValue("value" + i); |
| | | dataList.add(report); |
| | | tableColumn.put("value" + i, String.valueOf(i) + "æ¥"); |
| | | i++; |
| | | } |
| | | |
| | | MonthlyComprehensive reportList = new MonthlyComprehensive(); |
| | | List<Map> table = new ArrayList<>(); |
| | | table.add(tableColumn); |
| | | reportList.setTablehead(table); |
| | | |
| | | ModelNode modelNode = modelNodeService.getModelNodeByModelCodeByIndexCode(dataItem.getIndexCode()); |
| | | if (ObjectUtils.isEmpty(modelNode)) { |
| | | return AjaxResult.success(reportList); |
| | | } |
| | | List<MonthlyComprehensive> list = monthlyComprehensive.getMonthlyComprehensiveList(modelNode.getNodeId(), |
| | | dataList, dataItem.getBeginTime(), dataItem.getEndTime(), dataItem.getTimeType(), dataItem.getEnergyType()); |
| | | int count = Integer.parseInt(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length() - 2)); |
| | | list.forEach(monthlyReport -> monthlyReport.setCount(count)); |
| | | reportList.setTabledata(list); |
| | | |
| | | return AjaxResult.success(reportList); |
| | | } catch (Exception ex) { |
| | | logger.error("è·ååºéï¼", ex); |
| | | return AjaxResult.error("è·ååºé!"); |
| | | } |
| | | } |
| | | /**/ |
| | | /** |
| | | * å
¨å综åè½èç»è®¡å¾ |
| | | */ |
| | | @GetMapping("/listChart") |
| | | @ApiOperation(value = "è·åç»¼åææ åæå¾è¡¨ï¼æï¼æ°æ®") |
| | | public AjaxResult listChart(DataItem dataItem) throws ParseException { |
| | | DateFormat df = new SimpleDateFormat("yyyy-MM"); |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String aa= df.format(dataItem.getDataTime()); |
| | | String beginTime=aa+"-01 00:00:00"; |
| | | dataItem.setBeginTime(sf.parse(beginTime)); |
| | | String endTime=aa+"-"+Integer.valueOf(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length()-2))+" 00:00:00"; |
| | | dataItem.setEndTime(sf.parse(endTime)); |
| | | List<MonthlyComprehensive> list = monthlyComprehensive.getListChart(dataItem.getIndexId(),dataItem.getBeginTime(),dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getEnergyType()); |
| | | return AjaxResult.success(list); |
| | | } |
| | | public static String getLastDayOfMonth(String yearMonth) { |
| | | int year = Integer.parseInt(yearMonth.split("-")[0]); //å¹´ |
| | | int month = Integer.parseInt(yearMonth.split("-")[1]); //æ |
| | | Calendar cal = Calendar.getInstance(); |
| | | // 设置年份 |
| | | cal.set(Calendar.YEAR, year); |
| | | // 设置æä»½ |
| | | // cal.set(Calendar.MONTH, month - 1); |
| | | cal.set(Calendar.MONTH, month); //设置å½åæçä¸ä¸ä¸ªæ |
| | | // è·åæææå¤§å¤©æ° |
| | | //int lastDay = cal.getActualMaximum(Calendar.DATE); |
| | | int lastDay = cal.getMinimum(Calendar.DATE); //è·åæä»½ä¸çæå°å¼ï¼å³ç¬¬ä¸å¤© |
| | | // 设置æ¥å䏿份çæå¤§å¤©æ° |
| | | //cal.set(Calendar.DAY_OF_MONTH, lastDay); |
| | | cal.set(Calendar.DAY_OF_MONTH, lastDay - 1); //䏿ç第ä¸å¤©åå»1å°±æ¯å½æçæåä¸å¤© |
| | | // æ ¼å¼åæ¥æ |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | return sdf.format(cal.getTime()); |
| | | } |
| | | /*ç»¼åææ¥è¡¨å¯¼åº*/ |
| | | // @Log(title = "ç»¼åææ¥è¡¨å¯¼åº", businessType = BusinessType.EXPORT) |
| | | @GetMapping("/export") |
| | | @ApiOperation(value = "ç»¼åææ¥è¡¨å¯¼åº") |
| | | public AjaxResult export(DataItem dataItem) { |
| | | try { |
| | | |
| | | Map tableColumn =new HashMap<>();//è¡¨æ°æ® |
| | | List<MonthlyComprehensive> dataList=new ArrayList<>(); |
| | | DateFormat df = new SimpleDateFormat("yyyy-MM"); |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String aa= df.format(dataItem.getDataTime()); |
| | | String bb=""; |
| | | int i = 1; |
| | | String beginTime=aa+"-01 00:00:00"; |
| | | dataItem.setBeginTime(sf.parse(beginTime)); |
| | | String endTime=aa+"-"+Integer.valueOf(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length()-2))+" 00:00:00"; |
| | | dataItem.setEndTime(sf.parse(endTime)); |
| | | while (i <= Integer.parseInt(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length() - 2))) { |
| | | if (i > 9) { |
| | | bb = aa + "-" + i + " 00:00:00"; |
| | | } else { |
| | | bb = aa + "-0" + i + " 00:00:00"; |
| | | } |
| | | MonthlyComprehensive report = new MonthlyComprehensive(); |
| | | report.setDataTime(sf.parse(bb)); |
| | | report.setValue("value" + i); |
| | | dataList.add(report); |
| | | tableColumn.put("value" + i, i + "æ¥"); |
| | | i++; |
| | | } |
| | | |
| | | MonthlyComprehensive reportList = new MonthlyComprehensive(); |
| | | List<Map> table = new ArrayList<>(); |
| | | table.add(tableColumn); |
| | | reportList.setTablehead(table); |
| | | |
| | | ModelNode modelNode = modelNodeService.getModelNodeByModelCodeByIndexCode(dataItem.getIndexCode()); |
| | | if (ObjectUtils.isEmpty(modelNode)) { |
| | | return AjaxResult.success(reportList); |
| | | } |
| | | List<MonthlyComprehensive> list = monthlyComprehensive.getMonthlyComprehensiveList(modelNode.getNodeId(), dataList, |
| | | dataItem.getBeginTime(), dataItem.getEndTime(), dataItem.getTimeType(), dataItem.getEnergyType()); |
| | | int count = Integer.parseInt(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length() - 2)); |
| | | list.forEach(monthlyReport -> monthlyReport.setCount(count)); |
| | | if (CollectionUtils.isNotEmpty(list)) { |
| | | list.forEach(this::valueRep); |
| | | } |
| | | ExcelUtil<MonthlyComprehensive> util = new ExcelUtil<>(MonthlyComprehensive.class); |
| | | return util.exportExcel(list, "ç»¼åææ åææ"); |
| | | } catch (Exception ex) { |
| | | logger.error("è·ååºéï¼", ex); |
| | | return AjaxResult.error("è·ååºé!"); |
| | | } |
| | | } |
| | | public void valueRep(Object dr){ |
| | | Field[] fields = dr.getClass().getDeclaredFields(); |
| | | for(Field field:fields){ |
| | | field.setAccessible(true); |
| | | Object obj = field.getType(); |
| | | if(field.getType().getName().equals("java.lang.Double")){ |
| | | String name = field.getName(); |
| | | try { |
| | | if(ObjectUtils.isEmpty(field.get(dr))) |
| | | { |
| | | field.set(dr,0.00); |
| | | } |
| | | } catch (IllegalAccessException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.web.controller.comprehensivestatistics; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.zhitan.common.annotation.Log; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.common.enums.BusinessType; |
| | | import com.zhitan.common.utils.poi.ExcelUtil; |
| | | import com.zhitan.comprehensivestatistics.domain.YearComperhensive; |
| | | import com.zhitan.comprehensivestatistics.service.IyearComprehensive; |
| | | import com.zhitan.model.domain.ModelNode; |
| | | import com.zhitan.model.service.IModelNodeService; |
| | | import com.zhitan.realtimedata.domain.DataItem; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.text.DateFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * electricityPriceController |
| | | * |
| | | * @author sys |
| | | * @date 2020-02-18 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/comprehensive/yearComprehensive") |
| | | @Api(value = "ç»¼åææ åæï¼å¹´ï¼controller",tags = {"ç»¼åææ åæ"}) |
| | | public class YearComprehensiveController extends BaseController { |
| | | |
| | | @Autowired |
| | | private IModelNodeService modelNodeService; |
| | | @Autowired |
| | | private IyearComprehensive yearComprehensive; |
| | | |
| | | /*å
¨åè½èç»è®¡*/ |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "è·åç»¼åææ åæï¼å¹´ï¼å表") |
| | | public AjaxResult list(DataItem dataItem) { |
| | | try { |
| | | ModelNode modelNode = modelNodeService.getModelNodeByModelCodeByIndexCode(dataItem.getIndexCode()); |
| | | if (ObjectUtils.isEmpty(modelNode)) { |
| | | return AjaxResult.success("ææ æ°æ®"); |
| | | } |
| | | List<YearComperhensive> dataList = new ArrayList<>(); |
| | | |
| | | dataItem.setBeginTime(DateUtil.beginOfYear(dataItem.getDataTime())); |
| | | dataItem.setEndTime(DateUtil.endOfYear(dataItem.getDataTime())); |
| | | |
| | | DateFormat df = new SimpleDateFormat("yyyy"); |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String aa = df.format(dataItem.getDataTime()); |
| | | String bb = ""; |
| | | int i = 1; |
| | | while (i <= 12) { |
| | | if(i > 9){ |
| | | bb = aa + "-" + i + "-01 00:00:00"; |
| | | }else{ |
| | | bb = aa + "-0" + i + "-01 00:00:00"; |
| | | } |
| | | YearComperhensive report = new YearComperhensive(); |
| | | report.setDataTime(sf.parse(bb)); |
| | | report.setValue("value" + i); |
| | | dataList.add(report); |
| | | i++; |
| | | } |
| | | List<YearComperhensive> list = yearComprehensive.getYearComprehensiveList(modelNode.getNodeId(), |
| | | dataList,dataItem.getBeginTime(), dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getEnergyType()); |
| | | return AjaxResult.success(list); |
| | | } catch (Exception ex) { |
| | | logger.error("è·ååºéï¼", ex); |
| | | return AjaxResult.error("è·ååºé!"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å
¨å综åè½èç»è®¡å¾ |
| | | */ |
| | | @GetMapping("/listChart") |
| | | @ApiOperation(value = "è·åç»¼åææ åæå¾è¡¨ï¼å¹´ï¼æ°æ®") |
| | | public AjaxResult listChart(DataItem dataItem){ |
| | | |
| | | dataItem.setBeginTime(DateUtil.beginOfYear(dataItem.getDataTime())); |
| | | dataItem.setEndTime(DateUtil.endOfYear(dataItem.getDataTime())); |
| | | |
| | | List<YearComperhensive> list = yearComprehensive.getListChart(dataItem.getIndexId(),dataItem.getBeginTime(),dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getEnergyType()); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | /** |
| | | * 导åºå·¥åºåèç»è®¡ææ 设置åè½å表 |
| | | */ |
| | | @Log(title = "ç»¼åæ¥è¡¨", businessType = BusinessType.EXPORT) |
| | | @GetMapping("/export") |
| | | @ApiOperation(value = "综åå¹´æ¥è¡¨å¯¼åº") |
| | | public AjaxResult export(DataItem dataItem) { |
| | | try { |
| | | ModelNode modelNode = modelNodeService.getModelNodeByModelCodeByIndexCode(dataItem.getIndexCode()); |
| | | if (ObjectUtils.isEmpty(modelNode)) { |
| | | return AjaxResult.success("ææ æ°æ®"); |
| | | } |
| | | List<YearComperhensive> dataList = new ArrayList<>(); |
| | | DateFormat df = new SimpleDateFormat("yyyy"); |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String aa = df.format(dataItem.getBeginTime()); |
| | | String bb = ""; |
| | | int i = 1; |
| | | while (i <= 12) { |
| | | if(i>9){ |
| | | bb=aa+"-"+i+"-01 00:00:00"; |
| | | }else{ |
| | | bb=aa+"-0"+i+"-01 00:00:00"; |
| | | } |
| | | YearComperhensive report=new YearComperhensive(); |
| | | report.setDataTime(sf.parse(bb)); |
| | | report.setValue("value"+i); |
| | | dataList.add(report); |
| | | i++; |
| | | } |
| | | List<YearComperhensive> list = yearComprehensive.getYearComprehensiveList(modelNode.getNodeId(), |
| | | dataList,dataItem.getBeginTime(),dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getEnergyType()); |
| | | if(CollectionUtils.isNotEmpty(list)){ |
| | | list.forEach(this::valueRep); |
| | | } |
| | | ExcelUtil<YearComperhensive> util = new ExcelUtil<>(YearComperhensive.class); |
| | | return util.exportExcel(list, "ç»¼åææ åæå¹´"); |
| | | } catch (Exception ex) { |
| | | logger.error("è·ååºéï¼", ex); |
| | | return AjaxResult.error("è·ååºé!"); |
| | | } |
| | | } |
| | | |
| | | public void valueRep(Object dr){ |
| | | Field[] fields = dr.getClass().getDeclaredFields(); |
| | | for(Field field:fields){ |
| | | field.setAccessible(true); |
| | | Object obj = field.getType(); |
| | | if(field.getType().getName().equals("java.lang.Double")){ |
| | | String name = field.getName(); |
| | | try { |
| | | if(ObjectUtils.isEmpty(field.get(dr))) |
| | | { |
| | | field.set(dr,0.00); |
| | | } |
| | | } catch (IllegalAccessException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | import com.zhitan.consumptionanalysis.domain.vo.RankingDataVO; |
| | | import com.zhitan.consumptionanalysis.domain.vo.RankingEnergyData; |
| | | import com.zhitan.consumptionanalysis.service.IConsumptionAnalysisService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.usermodel.Cell; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | |
| | | * @Author: Zhujw |
| | | * @Date: 2023/3/1 |
| | | */ |
| | | @Api(tags = "综åè½èåæ") |
| | | @RestController |
| | | @RequestMapping("/consumptionanalysis") |
| | | public class ConsumptionAnalysisController extends BaseController { |
| | |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.energyMonitor.domain.vo.ListElectricLoadVO; |
| | | import com.zhitan.energyMonitor.domain.vo.ListElectricityMeterVO; |
| | | import com.zhitan.energyMonitor.service.IElectricLoadService; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.model.service.IEnergyIndexService; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: è´è·åæ |
| | |
| | | @RequestParam(name = "timeCode") String timeCode) { |
| | | EnergyIndex energyIndex = energyIndexService.getDeviceIndexByCode(nodeId, meterId, CommonConst.TAG_CODE_ZYGGL); |
| | | |
| | | ListElectricLoadVO vo = electricLoadService.list(timeType, timeCode, energyIndex); |
| | | ListElectricLoadVO vo = electricLoadService.list(timeType, timeCode, energyIndex, meterId); |
| | | return AjaxResult.success(vo); |
| | | } |
| | | |
| | | @Log(title = "è·åèç¹ä¸ææçµè¡¨") |
| | | @ApiOperation(value = "è·åèç¹ä¸ææçµè¡¨", notes = "è·åèç¹ä¸ææçµè¡¨") |
| | | @GetMapping(value = "/listElectricMeter") |
| | | public AjaxResult listElectricMeter(@RequestParam(name = "nodeId") String nodeId) { |
| | | List<ListElectricityMeterVO> vo = electricLoadService.listElectricMeter(nodeId); |
| | | return AjaxResult.success(vo); |
| | | } |
| | | |
| | |
| | | if (ObjectUtils.isEmpty(meterId)){ |
| | | return AjaxResult.error("çµè¡¨idä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | List<EnergyIndex> energyIndexList = energyIndexService.listDeviceIndex(nodeId, meterId); |
| | | |
| | | return AjaxResult.success(electricThreePhaseService.list(timeType, timeCode, energyIndexList, requestType, meterId)); |
| | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æé¦è½æºæ°æ®ç»¼ååæ |
| | | * è½æºæ°æ®ç»¼ååæ |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-10-30 |
| | |
| | | import com.zhitan.basicdata.domain.MeterImplement; |
| | | import com.zhitan.basicdata.services.IMeterImplementService; |
| | | import com.zhitan.common.annotation.Log; |
| | | import com.zhitan.common.constant.CommonConst; |
| | | import com.zhitan.common.constant.TimeTypeConst; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.common.enums.BusinessType; |
| | | import com.zhitan.common.enums.RetrievalModes; |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.common.utils.ChartUtils; |
| | | import com.zhitan.common.utils.DateTimeUtil; |
| | | import com.zhitan.common.utils.poi.ExcelUtil; |
| | | import com.zhitan.history.domain.dto.HistoricalDataDTO; |
| | | import com.zhitan.history.domain.vo.HistoricalDataExcel; |
| | |
| | | import com.zhitan.model.service.IEnergyIndexService; |
| | | import com.zhitan.realtimedata.domain.TagValue; |
| | | import com.zhitan.realtimedata.service.RealtimeDatabaseService; |
| | | import io.swagger.annotations.Api; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 设å¤å¯å宿¶çæµController |
| | | * å岿°æ®è¶å¿Controller |
| | | * |
| | | * @author sys |
| | | * @date 2020-03-30 |
| | | */ |
| | | @Api(tags = "å岿°æ®è¶å¿") |
| | | @RestController |
| | | @RequestMapping("/dataMonitoring/historyDataTrend") |
| | | public class HistoryDataTrendController extends BaseController { |
| | |
| | | public AjaxResult getSettingIndex(EnergyIndex energyIndex) { |
| | | try { |
| | | List<EnergyIndex> infoList = energyIndexService.selectEnergyIndexList(energyIndex); |
| | | // List<String> codeList= infoList.stream().map(EnergyIndex::getCode).collect(Collectors.toList()); |
| | | // List<TagValue> valList = realtimeDatabaseService.retrieve(codeList); |
| | | // List resultList = new ArrayList(); |
| | | return AjaxResult.success(infoList); |
| | | } catch (Exception ex) { |
| | | logger.error("è·åå
³èééææ åºéï¼", ex); |
| | |
| | | if (ObjectUtils.isEmpty(energyIndex)) { |
| | | return AjaxResult.error("æªæ¾å°ç¹ä½ä¿¡æ¯"); |
| | | } |
| | | Date beginTime = dto.getDataTime(); |
| | | Date endTime; |
| | | // æ¥è¯¢æ¡æ° |
| | | int count = 1440; |
| | | if ("DAY".equals(dto.getTimeType())) { |
| | | endTime = DateUtil.endOfDay(beginTime); |
| | | List<Date> dateList = new ArrayList<>(); |
| | | if (TimeType.DAY.name().equals(dto.getTimeType())) { |
| | | String timeCode = DateTimeUtil.getDateTime(dto.getDataTime(), DateTimeUtil.COMMON_PATTERN_TO_DAY); |
| | | ChartUtils.generateDateList(TimeTypeConst.TIME_TYPE_DAY, timeCode, dateList); |
| | | } else if (TimeType.HOUR.name().equals(dto.getTimeType())) { |
| | | String timeCode = DateTimeUtil.getDateTime(dto.getDataTime(), DateTimeUtil.COMMON_PATTERN_TO_HOUR); |
| | | ChartUtils.generateDateList(TimeTypeConst.TIME_TYPE_HOUR, timeCode, dateList); |
| | | } else { |
| | | count = 3600; |
| | | endTime = DateUtil.offsetSecond(DateUtil.offsetHour(beginTime, 1), -1); |
| | | return AjaxResult.error("æ¶é´é´éç±»å䏿£ç¡®"); |
| | | } |
| | | // æ¥è¯¢è®¡éå¨å
· |
| | | MeterImplement info = meterImplementService.selectMeterImplementById(energyIndex.getMeterId()); |
| | | List<TagValue> tagValueList = realtimeDatabaseService.retrieve(energyIndex.getCode(), beginTime, endTime, |
| | | RetrievalModes.BestFit, count); |
| | | MeterImplement meterInfo = meterImplementService.selectMeterImplementById(energyIndex.getMeterId()); |
| | | if (ObjectUtils.isEmpty(meterInfo)) { |
| | | return AjaxResult.error("æªæ¾å°è®¡éå¨å
·ä¿¡æ¯"); |
| | | } |
| | | List<HistoricalDataVO> voList = new ArrayList<>(); |
| | | Date date = DateUtil.date(); |
| | | for (int i = 0; i < count + 1; i++) { |
| | | for (Date date : dateList) { |
| | | List<TagValue> tagValues = new ArrayList<>(); |
| | | if(TimeType.DAY.name().equals(dto.getTimeType())){ |
| | | Date beginTime = date; |
| | | Date endTime = DateUtil.offsetHour(DateUtil.offsetMinute(date, CommonConst.DIGIT_MINUS_1), CommonConst.DIGIT_1); |
| | | tagValues = realtimeDatabaseService.retrieve(energyIndex.getCode(), beginTime,endTime,CommonConst.DIGIT_1); |
| | | } |
| | | if(TimeType.HOUR.name().equals(dto.getTimeType())){ |
| | | Date beginTime = date; |
| | | Date endTime = DateUtil.offsetMinute(DateUtil.offsetSecond(date, CommonConst.DIGIT_MINUS_1), CommonConst.DIGIT_1); |
| | | tagValues = realtimeDatabaseService.retrieve(energyIndex.getCode(), beginTime,endTime,CommonConst.DIGIT_1); |
| | | } |
| | | |
| | | HistoricalDataVO vo = new HistoricalDataVO(); |
| | | vo.setDataTime(DateUtil.formatDateTime(date)); |
| | | vo.setIndexId(energyIndex.getIndexId()); |
| | | String indexName = energyIndex.getName(); |
| | | if (ObjectUtils.isNotEmpty(info)) { |
| | | indexName = info.getInstallactionLocation() + "_" + info.getMeterName() + "_" + indexName; |
| | | } |
| | | vo.setIndexName(indexName); |
| | | // åå¼ |
| | | String value = "--"; |
| | | String usedValue = "--"; |
| | | if (beginTime.getTime() <= date.getTime()) { |
| | | try { |
| | | TagValue tagValue = tagValueList.get(i); |
| | | BigDecimal cumulative = BigDecimal.valueOf(tagValue.getValue()); |
| | | |
| | | if ("SWWSDJ_SD".equals(energyIndex.getCode()) || "SWWSDJ_WD".equals(energyIndex.getCode())) { |
| | | cumulative = cumulative.multiply(BigDecimal.valueOf(0.1)); |
| | | } |
| | | if (i > 0) { |
| | | TagValue previousTagValue = tagValueList.get(i - 1); |
| | | BigDecimal previousValue = BigDecimal.ZERO; |
| | | if (ObjectUtils.isNotEmpty(previousTagValue.getValue())) { |
| | | previousValue = BigDecimal.valueOf(previousTagValue.getValue()); |
| | | } |
| | | if ("SWWSDJ_SD".equals(energyIndex.getCode()) || "SWWSDJ_WD".equals(energyIndex.getCode())) { |
| | | previousValue = previousValue.multiply(BigDecimal.valueOf(0.1)); |
| | | |
| | | } |
| | | usedValue = String.valueOf(cumulative.subtract(previousValue).setScale(2, RoundingMode.HALF_UP)); |
| | | vo.setIndexName(meterInfo.getInstallactionLocation() + "_" + meterInfo.getMeterName() + "_" + energyIndex.getName()); |
| | | vo.setValue(CommonConst.DOUBLE_MINUS_SIGN); |
| | | if(ObjectUtils.isNotEmpty(tagValues)){ |
| | | vo.setValue(tagValues.get(0).getValue().toString()); |
| | | } |
| | | |
| | | value = String.valueOf(cumulative.setScale(2, RoundingMode.HALF_UP)); |
| | | } catch (Exception ignored) { |
| | | } |
| | | } |
| | | // æ¶é´ |
| | | String timeName = DateUtil.formatDateTime(beginTime); |
| | | vo.setDataTime(timeName); |
| | | if ("DAY".equals(dto.getTimeType())) { |
| | | beginTime = DateUtil.offsetMinute(beginTime, 1); |
| | | } else { |
| | | beginTime = DateUtil.offsetSecond(beginTime, 1); |
| | | } |
| | | vo.setUsedValue(String.valueOf(usedValue)); |
| | | vo.setValue(String.valueOf(value)); |
| | | voList.add(vo); |
| | | } |
| | | return AjaxResult.success(voList); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.web.controller.itemizedenergyanalysis; |
| | | |
| | | import com.zhitan.Itemizedenergyanalysis.domain.VO.ItemizedEnergyAnalysisVO; |
| | | import com.zhitan.Itemizedenergyanalysis.dto.ItemizedEnergyAnalysisDTO; |
| | | import com.zhitan.Itemizedenergyanalysis.service.IItemizedEnergyAnalysisService; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import static com.zhitan.common.core.domain.AjaxResult.success; |
| | | |
| | | /** |
| | | * å项ç¨è½åæ æ¥å£ |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/itemizedEnergyAnalysis") |
| | | @Api(value = "å项ç¨è½åæ", tags = {"å项ç¨è½åæ"}) |
| | | public class ItemizedEnergyAnalysisController { |
| | | |
| | | @Autowired |
| | | private IItemizedEnergyAnalysisService itemizedEnergyAnalysisService; |
| | | |
| | | /** |
| | | * |
| | | * @param dataItem |
| | | * @return |
| | | */ |
| | | @GetMapping("/list") |
| | | private AjaxResult list(ItemizedEnergyAnalysisDTO dataItem) { |
| | | ItemizedEnergyAnalysisVO list = itemizedEnergyAnalysisService.getItemizedEnergyAnalysisService(dataItem); |
| | | return success(list); |
| | | } |
| | | } |
| | |
| | | import com.zhitan.basicdata.domain.FacilityArchives; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.common.core.page.TableDataInfo; |
| | | import com.zhitan.keyequipment.domain.DailyKeyEquipment; |
| | | import com.zhitan.keyequipment.service.IDailyKeyEquipmentService; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "éç¹è®¾å¤è½èåæï¼æ¥ï¼å表") |
| | | public TableDataInfo list(DataItem dataItem) throws ParseException { |
| | | public AjaxResult list(DataItem dataItem) throws ParseException { |
| | | List<ModelNode> nodeId = modelNodeService.getModelNodeByModelCode(dataItem.getIndexCode()); |
| | | if(CollectionUtils.isEmpty(nodeId)){ |
| | | return getDataTable(new ArrayList<>()); |
| | | return success(new ArrayList<>()); |
| | | } |
| | | List<EnergyIndex> energyList = modelNodeService.getSettingIndex(nodeId.get(0).getNodeId()); |
| | | if(CollectionUtils.isEmpty(energyList)){ |
| | | return getDataTable(new ArrayList<>()); |
| | | return success(new ArrayList<>()); |
| | | } |
| | | List<String> indexIds = energyList.stream().map(EnergyIndex::getIndexId).collect(Collectors.toList()); |
| | | List<DailyKeyEquipment> dataList=new ArrayList<>(); |
| | |
| | | dataList.add(report); |
| | | i++; |
| | | }; |
| | | startPage(); |
| | | List<DailyKeyEquipment> list = dailykeyEquipment.getdailyKeyEquipmentList(indexIds, dataList,dataItem.getBeginTime(),dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getIndexStorageId()); |
| | | return getDataTable(list); |
| | | |
| | | List<DailyKeyEquipment> list = dailykeyEquipment.getdailyKeyEquipmentList(indexIds, dataList,dataItem.getBeginTime(),dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getEnergyType()); |
| | | |
| | | return success(list); |
| | | } |
| | | |
| | | @GetMapping("/listChart") |
| | |
| | | dataItem.setBeginTime(dataItem.getDataTime()); |
| | | String endTime=aa+" 24:00:00"; |
| | | dataItem.setEndTime(sf.parse(endTime)); |
| | | List<DailyKeyEquipment> list = dailykeyEquipment.getListChart(dataItem.getIndexId(),dataItem.getBeginTime(),dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getIndexStorageId()); |
| | | List<DailyKeyEquipment> list = dailykeyEquipment.getListChart(dataItem.getIndexId(),dataItem.getBeginTime(),dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getEnergyType()); |
| | | return AjaxResult.success(list); |
| | | } |
| | | /*ææè®¾å¤*/ |
| | | @GetMapping("/getFacilityArchives") |
| | | @ApiOperation(value = "æ¥è¯¢ææè®¾å¤å表") |
| | | @ApiOperation(value = "æ¥è¯¢éç¹è®¾å¤å表") |
| | | public AjaxResult getFacilityArchives() { |
| | | try { |
| | | List<FacilityArchives> list=dailykeyEquipment.getFacilityArchives(); |
| | |
| | | package com.zhitan.web.controller.keyequipment; |
| | | |
| | | |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.keyequipment.domain.MonthlyKeyEquipment; |
| | |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "éç¹è®¾å¤è½èç»è®¡ï¼æï¼å表") |
| | | public AjaxResult list(DataItem dataItem) { |
| | | try { |
| | | public AjaxResult list(DataItem dataItem) throws ParseException { |
| | | List<MonthlyKeyEquipment> dataList=new ArrayList<>(); |
| | | |
| | | Map tableColumn =new HashMap<>();//è¡¨æ°æ® |
| | |
| | | reportList.setTablehead(table); |
| | | List<ModelNode> nodeId = modelNodeService.getModelNodeByModelCode(dataItem.getIndexCode()); |
| | | if(CollectionUtils.isEmpty(nodeId)){ |
| | | return AjaxResult.success(reportList); |
| | | return success(new ArrayList<>()); |
| | | } |
| | | List<EnergyIndex> energyList = modelNodeService.getSettingIndex(nodeId.get(0).getNodeId()); |
| | | if(CollectionUtils.isEmpty(energyList)){ |
| | | return AjaxResult.success(reportList); |
| | | return success(new ArrayList<>()); |
| | | } |
| | | List<String> indexIds = energyList.stream().map(EnergyIndex::getIndexId).collect(Collectors.toList()); |
| | | |
| | | startPage(); |
| | | List<MonthlyKeyEquipment> list = monthlyKeyEquipmentService.getMonthlyKeyEquipmentList(indexIds, dataList,dataItem.getBeginTime(),dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getIndexStorageId()); |
| | | int count=Integer.valueOf(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length()-2)); |
| | | list.forEach(monthlyReport -> monthlyReport.setCount(count)); |
| | | reportList.setTabledata(list); |
| | | reportList.setTotal(new PageInfo(list).getTotal()); |
| | | List<MonthlyKeyEquipment> list = monthlyKeyEquipmentService.getMonthlyKeyEquipmentList(indexIds, dataList, dataItem.getBeginTime(), dataItem.getEndTime(), dataItem.getTimeType(), dataItem.getEnergyType()); |
| | | |
| | | return AjaxResult.success(reportList); |
| | | } catch (Exception ex) { |
| | | logger.error("è·ååºéï¼", ex); |
| | | return AjaxResult.error("è·ååºé!"); |
| | | } |
| | | return success(list); |
| | | } |
| | | |
| | | @GetMapping("/listChart") |
| | |
| | | dataItem.setBeginTime(sf.parse(beginTime)); |
| | | String endTime=aa+"-"+Integer.valueOf(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length()-2))+" 00:00:00"; |
| | | dataItem.setEndTime(sf.parse(endTime)); |
| | | List<MonthlyKeyEquipment> list = monthlyKeyEquipmentService.getListChart(dataItem.getIndexId(),dataItem.getBeginTime(),dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getIndexStorageId()); |
| | | List<MonthlyKeyEquipment> list = monthlyKeyEquipmentService.getListChart(dataItem.getIndexId(), dataItem.getBeginTime(), dataItem.getEndTime(), dataItem.getTimeType(), dataItem.getEnergyType()); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | public static String getLastDayOfMonth(String yearMonth) { |
| | | int year = Integer.parseInt(yearMonth.split("-")[0]); //å¹´ |
| | | int month = Integer.parseInt(yearMonth.split("-")[1]); //æ |
| | |
| | | package com.zhitan.web.controller.keyequipment; |
| | | |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.common.core.page.TableDataInfo; |
| | | import com.zhitan.common.utils.DateTimeUtil; |
| | | import com.zhitan.common.utils.TypeTime; |
| | | import com.zhitan.keyequipment.domain.YearKeyEquipment; |
| | | import com.zhitan.keyequipment.service.IYearKeyEquipmentService; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.model.domain.ModelNode; |
| | | import com.zhitan.model.service.IModelNodeService; |
| | | import com.zhitan.realtimedata.domain.DataItem; |
| | | import com.zhitan.realtimedata.domain.dto.DataItemQueryDTO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.text.DateFormat; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | *éç¹è®¾å¤è½èç»è®¡ å¹´ |
| | | * |
| | |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "éç¹è®¾å¤è½èç»è®¡ï¼å¹´ï¼å表") |
| | | public TableDataInfo list(DataItem dataItem) throws ParseException { |
| | | public AjaxResult list(DataItem dataItem) throws ParseException { |
| | | List<ModelNode> nodeId = modelNodeService.getModelNodeByModelCode(dataItem.getIndexCode()); |
| | | if(CollectionUtils.isEmpty(nodeId)){ |
| | | return getDataTable(new ArrayList<>()); |
| | | return success(new ArrayList<>()); |
| | | } |
| | | List<EnergyIndex> energyList = modelNodeService.getSettingIndex(nodeId.get(0).getNodeId()); |
| | | if(CollectionUtils.isEmpty(energyList)){ |
| | | return getDataTable(new ArrayList<>()); |
| | | return success(new ArrayList<>()); |
| | | } |
| | | List<String> indexIds = energyList.stream().map(EnergyIndex::getIndexId).collect(Collectors.toList()); |
| | | List<YearKeyEquipment> dataList=new ArrayList<>(); |
| | | DateFormat df = new SimpleDateFormat("yyyy"); |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String aa= df.format(dataItem.getBeginTime()); |
| | | String bb=""; |
| | | int i = 1; |
| | | while (i <= 12) { |
| | | if(i>9){ |
| | | bb=aa+"-"+i+"-01 00:00:00"; |
| | | }else{ |
| | | bb=aa+"-0"+i+"-01 00:00:00"; |
| | | } |
| | | YearKeyEquipment report=new YearKeyEquipment(); |
| | | report.setDataTime(sf.parse(bb)); |
| | | report.setValue("value"+i); |
| | | dataList.add(report); |
| | | i++; |
| | | } |
| | | startPage(); |
| | | List<YearKeyEquipment> list = yearKeyEquipmentService.getYearKeyEquipmentList(indexIds, dataList,dataItem.getBeginTime(),dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getIndexStorageId()); |
| | | return getDataTable(list); |
| | | |
| | | |
| | | Date convertTime = DateTimeUtil.getEndTimeByType(dataItem.getTimeType(),dataItem.getDataTime()); |
| | | DateTime beginTime = DateUtil.beginOfYear(convertTime); |
| | | DateTime endTime = DateUtil.endOfYear(convertTime); |
| | | List<TypeTime> typeTimeList = DateTimeUtil.getDateTimeList(dataItem.getTimeType(),convertTime); |
| | | List<YearKeyEquipment> list = yearKeyEquipmentService.getYearKeyEquipmentList(indexIds, typeTimeList,beginTime,endTime, dataItem.getTimeType(),dataItem.getEnergyType()); |
| | | return success(list); |
| | | } |
| | | |
| | | @GetMapping("/listChart") |
| | | @ApiOperation(value = "éç¹è®¾å¤è½èç»è®¡ï¼å¹´ï¼å¾è¡¨") |
| | | public AjaxResult listChart(DataItem dataItem){ |
| | | List<YearKeyEquipment> list = yearKeyEquipmentService.getListChart(dataItem.getIndexId(),dataItem.getBeginTime(),dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getIndexStorageId()); |
| | | public AjaxResult listChart(DataItemQueryDTO queryDto){ |
| | | |
| | | List<YearKeyEquipment> list = yearKeyEquipmentService.getListChart(queryDto); |
| | | return AjaxResult.success(list); |
| | | } |
| | | } |
| | |
| | | * @Version: 1.0 |
| | | * @Since: JDK1.8 |
| | | */ |
| | | |
| | | @Slf4j |
| | | @Api("éé计éè¡¨æ°æ®ç®¡ç") |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/meters") |
| | | public class MeterController extends BaseController { |
| | |
| | | boolean isExist = daqTemplateService.dapHasExist(daqTemplate.getCode(), daqTemplate.getDeviceType()); |
| | | if (isExist) { |
| | | return AjaxResult.error("ç¸å设å¤ç±»åä¸çåæ°ç¼ç ä¸è½éå¤ï¼"); |
| | | } else { |
| | | return toAjax(daqTemplateService.insertDaqTemplate(daqTemplate)); |
| | | } |
| | | boolean isCodeExist = daqTemplateService.dapCodeHasExist(daqTemplate.getGatewayKey(), daqTemplate.getDeviceType()); |
| | | if (isCodeExist) { |
| | | return AjaxResult.error("ç¸å设å¤ç±»åä¸çééåæ°ç¼ç ä¸è½éå¤ï¼"); |
| | | } |
| | | return toAjax(daqTemplateService.insertDaqTemplate(daqTemplate)); |
| | | } |
| | | |
| | | /** |
| | |
| | | boolean isExist = daqTemplateService.dapHasExist(daqTemplate); |
| | | if (isExist) { |
| | | return AjaxResult.error("ç¸å设å¤ç±»åä¸çåæ°ç¼ç ä¸è½éå¤ï¼"); |
| | | } else { |
| | | } |
| | | boolean isCodeExist = daqTemplateService.dapCodeHasExist(daqTemplate); |
| | | if (isCodeExist) { |
| | | return AjaxResult.error("ç¸å设å¤ç±»åä¸çééåæ°ç¼ç ä¸è½éå¤ï¼"); |
| | | } |
| | | return toAjax(daqTemplateService.updateDaqTemplate(daqTemplate)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å é¤ééåæ°æ¨¡æ¿ |
| | | */ |
| | |
| | | import com.zhitan.common.utils.poi.ExcelUtil; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.model.domain.EnergyIndexQuery; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfo; |
| | | import com.zhitan.model.service.IEnergyIndexService; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | /** |
| | | * ææ ä¿¡æ¯Controller |
| | |
| | | } |
| | | |
| | | /** |
| | | * å 餿æ ä¿¡æ¯ |
| | | * å é¤ééææ ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('energyindex:energyindex:remove')") |
| | | @Log(title = "ææ ä¿¡æ¯", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{nodeId}/{indexIds}") |
| | | public AjaxResult remove(@PathVariable String nodeId, @PathVariable String[] indexIds) { |
| | | List<EnergyIndex> energyIndexList = energyIndexService.getEnergyIndexByIds( |
| | | Arrays.asList(indexIds)); |
| | | List<String> deleteIds = energyIndexList.stream() |
| | | .filter(f -> StringUtils.isBlank(f.getMeterId())) |
| | | .map(EnergyIndex::getIndexId) |
| | | .collect(Collectors.toList()); |
| | | List<String> removeLink = energyIndexList.stream() |
| | | .filter(f -> StringUtils.isNotBlank(f.getMeterId())) |
| | | .map(EnergyIndex::getIndexId) |
| | | .collect(Collectors.toList()); |
| | | if (!removeLink.isEmpty()) { |
| | | energyIndexService.removeNodeIndex(nodeId, removeLink); |
| | | @DeleteMapping("/{indexIds}") |
| | | public AjaxResult remove(@PathVariable String[] indexIds) { |
| | | |
| | | List<String> indexIdList = Arrays.asList(indexIds); |
| | | if (ObjectUtils.isEmpty(indexIdList)) { |
| | | return AjaxResult.success(); |
| | | } |
| | | // æ¥è¯¢æ¨¡åèç¹ç¹ä½ä¿¡æ¯ |
| | | List<ModelNodeIndexInfo> modelNodeIndexInfoList = energyIndexService.getModelNodeIndexInfoListByIndexIds(indexIds); |
| | | if (ObjectUtils.isNotEmpty(modelNodeIndexInfoList)) { |
| | | ModelNodeIndexInfo modelNodeIndexInfo = modelNodeIndexInfoList.stream().findFirst().get(); |
| | | return AjaxResult.error("ééææ " + modelNodeIndexInfo.getIndexName() + " 已被模å " + modelNodeIndexInfo.getModelName() + " å
³èï¼ä¸è½å é¤ï¼"); |
| | | } |
| | | |
| | | if (!deleteIds.isEmpty()) { |
| | | energyIndexService.deleteEnergyIndexByIds(nodeId, deleteIds.toArray(new String[0])); |
| | | energyIndexService.removeEnergyIndex(indexIdList); |
| | | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ç»è®¡ææ ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('energyindex:energyindex:remove')") |
| | | @Log(title = "ææ ä¿¡æ¯", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("{nodeId}/{indexIds}") |
| | | public AjaxResult remove(@PathVariable String nodeId, @PathVariable String[] indexIds) { |
| | | |
| | | List<String> indexIdList = Arrays.asList(indexIds); |
| | | if (ObjectUtils.isEmpty(indexIdList)) { |
| | | return AjaxResult.success(); |
| | | } |
| | | // æ¥è¯¢æ¨¡åèç¹ç¹ä½ä¿¡æ¯ |
| | | List<ModelNodeIndexInfo> modelNodeIndexInfoList = energyIndexService.getModelNodeIndexInfoListByIndexIds(indexIds); |
| | | if (ObjectUtils.isNotEmpty(modelNodeIndexInfoList)) { |
| | | if(modelNodeIndexInfoList.size() > 1){ |
| | | return AjaxResult.error("该ç»è®¡ææ 已被å
¶ä»æ¨¡åå
³èï¼ä¸è½å é¤ï¼"); |
| | | } |
| | | } |
| | | |
| | | energyIndexService.removeEnergyIndex(indexIdList); |
| | | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | import com.zhitan.model.domain.vo.PointDataVO; |
| | | import com.zhitan.model.service.IEnergyIndexService; |
| | | import com.zhitan.model.service.IModelInfoService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | * @author fanxinfu |
| | | * @date 2020-02-17 |
| | | */ |
| | | @Api(tags = "模åç¸å
³") |
| | | @RestController |
| | | @RequestMapping("/basicsetting/model") |
| | | public class ModelInfoController extends BaseController { |
| | |
| | | @ApiOperation(value = "è·åå°å³°å¹³è°·åæ¶ç»è®¡") |
| | | public AjaxResult segmentAnalysisDay(PeakValleyDTO dto) { |
| | | return AjaxResult.success(rulesService.segmentAnalysisDay(dto)); |
| | | // return AjaxResult.success(rulesService.segmentAnalysisDayCustomize(dto)); |
| | | } |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.web.controller.processenergy; |
| | | |
| | | import com.zhitan.basicdata.domain.FacilityArchives; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.model.domain.ModelNode; |
| | | import com.zhitan.model.service.IModelNodeService; |
| | | import com.zhitan.processenergy.domain.DailyProcessEnergy; |
| | | import com.zhitan.processenergy.service.IDailyProcessEnergyService; |
| | | import com.zhitan.realtimedata.domain.DataItem; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.text.DateFormat; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * å·¥åºè½è æ¥ |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/processEnergy/dailyProcessEnergy") |
| | | @Api(value = "å·¥åºè½èç»è®¡ï¼æ¥ï¼", tags = {"å·¥åºè½èç»è®¡"}) |
| | | public class DailyProcessEnergyController extends BaseController { |
| | | |
| | | @Autowired |
| | | private IModelNodeService modelNodeService; |
| | | |
| | | @Autowired |
| | | private IDailyProcessEnergyService dailyProcessEnergy; |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "å·¥åºè½èç»è®¡ï¼æ¥ï¼å表") |
| | | public AjaxResult list(DataItem dataItem) throws ParseException{ |
| | | List<ModelNode> nodeId = modelNodeService.getModelNodeByModelCode(dataItem.getIndexCode()); |
| | | if(CollectionUtils.isEmpty(nodeId)){ |
| | | return success(new ArrayList<>()); |
| | | } |
| | | List<EnergyIndex> energyList = modelNodeService.getSettingIndex(nodeId.get(0).getNodeId()); |
| | | if(CollectionUtils.isEmpty(energyList)){ |
| | | return success(new ArrayList<>()); |
| | | } |
| | | List<String> indexIds = energyList.stream().map(EnergyIndex::getIndexId).collect(Collectors.toList()); |
| | | List<DailyProcessEnergy> dataList = new ArrayList<>(); |
| | | DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String aa= df.format(dataItem.getDataTime()); |
| | | String bb=""; |
| | | int i = 0; |
| | | dataItem.setBeginTime(dataItem.getDataTime()); |
| | | String endTime=aa+" 24:00:00"; |
| | | dataItem.setEndTime(sf.parse(endTime)); |
| | | while (i < 24) { |
| | | if(i>9){ |
| | | bb=aa+" "+i+":00:00"; |
| | | }else{ |
| | | bb=aa+" 0"+i+":00:00"; |
| | | } |
| | | DailyProcessEnergy report=new DailyProcessEnergy(); |
| | | report.setDataTime(sf.parse(bb)); |
| | | report.setValue("value"+i); |
| | | dataList.add(report); |
| | | i++; |
| | | } |
| | | List<DailyProcessEnergy> list = dailyProcessEnergy.getDailyProcessEnergyList(indexIds, dataList,dataItem.getBeginTime(),dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getEnergyType()); |
| | | return success(list); |
| | | } |
| | | |
| | | @GetMapping("/listChart") |
| | | @ApiOperation(value = "å·¥åºè½èï¼æ¥ï¼å¾è¡¨") |
| | | public AjaxResult listChart(DataItem dataItem) throws ParseException { |
| | | DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String aa= df.format(dataItem.getDataTime()); |
| | | dataItem.setBeginTime(dataItem.getDataTime()); |
| | | String endTime=aa+" 24:00:00"; |
| | | dataItem.setEndTime(sf.parse(endTime)); |
| | | List<DailyProcessEnergy> list = dailyProcessEnergy.getListChart(dataItem.getIndexId(),dataItem.getBeginTime(),dataItem.getEndTime(), dataItem.getTimeType(),dataItem.getEnergyType()); |
| | | return AjaxResult.success(list); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.web.controller.processenergy; |
| | | |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.model.domain.ModelNode; |
| | | import com.zhitan.model.service.IModelNodeService; |
| | | import com.zhitan.processenergy.domain.MonthlyProcessEnergy; |
| | | import com.zhitan.processenergy.service.IMonthlyProcessEnergyService; |
| | | import com.zhitan.realtimedata.domain.DataItem; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.text.DateFormat; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * å·¥åºè½è æ |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/processEnergy/monthlyProcessEnergy") |
| | | @Api(value = "å·¥åºè½èç»è®¡ï¼æï¼", tags = {"å·¥åºè½èç»è®¡"}) |
| | | public class MonthlyProcessEnergyController extends BaseController { |
| | | |
| | | @Autowired |
| | | private IModelNodeService modelNodeService; |
| | | @Autowired |
| | | private IMonthlyProcessEnergyService monthlyProcessEnergyService; |
| | | |
| | | /** |
| | | * |
| | | * @param dataItem |
| | | * @return |
| | | * @throws ParseException |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "å·¥åºè½èç»è®¡ï¼æï¼") |
| | | public AjaxResult list(DataItem dataItem) throws ParseException { |
| | | List<MonthlyProcessEnergy> dataList = new ArrayList<>(); |
| | | |
| | | Map tableColumn = new HashMap<>();//è¡¨æ°æ® |
| | | DateFormat df = new SimpleDateFormat("yyyy-MM"); |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String aa = df.format(dataItem.getDataTime()); |
| | | String bb = ""; |
| | | int i = 1; |
| | | String beginTime = aa + "-01 00:00:00"; |
| | | dataItem.setBeginTime(sf.parse(beginTime)); |
| | | String endTime = aa + "-" + Integer.valueOf(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length() - 2)) + " 00:00:00"; |
| | | dataItem.setEndTime(sf.parse(endTime)); |
| | | while (i <= Integer.valueOf(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length() - 2))) { |
| | | if (i > 9) { |
| | | bb = aa + "-" + i + " 00:00:00"; |
| | | } else { |
| | | bb = aa + "-0" + i + " 00:00:00"; |
| | | } |
| | | MonthlyProcessEnergy report = new MonthlyProcessEnergy(); |
| | | report.setDataTime(sf.parse(bb)); |
| | | report.setValue("value" + i); |
| | | dataList.add(report); |
| | | tableColumn.put("value" + i, String.valueOf(i) + "æ¥"); |
| | | i++; |
| | | } |
| | | List<Map> table = new ArrayList<>(); |
| | | MonthlyProcessEnergy reportList = new MonthlyProcessEnergy(); |
| | | table.add(tableColumn); |
| | | reportList.setTablehead(table); |
| | | List<ModelNode> nodeId = modelNodeService.getModelNodeByModelCode(dataItem.getIndexCode()); |
| | | if (CollectionUtils.isEmpty(nodeId)) { |
| | | return success(new ArrayList<>()); |
| | | } |
| | | List<EnergyIndex> energyList = modelNodeService.getSettingIndex(nodeId.get(0).getNodeId()); |
| | | if (CollectionUtils.isEmpty(energyList)) { |
| | | return success(new ArrayList<>()); |
| | | } |
| | | List<String> indexIds = energyList.stream().map(EnergyIndex::getIndexId).collect(Collectors.toList()); |
| | | |
| | | List<MonthlyProcessEnergy> list = monthlyProcessEnergyService.getMonthlyProcessEnergy(indexIds, dataList, dataItem.getBeginTime(), dataItem.getEndTime(), dataItem.getTimeType(), dataItem.getEnergyType()); |
| | | |
| | | return success(list); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param dataItem |
| | | * @return |
| | | * @throws ParseException |
| | | */ |
| | | @GetMapping("/listChart") |
| | | @ApiOperation(value = "éç¹è®¾å¤è½èç»è®¡ï¼æï¼å¾è¡¨") |
| | | public AjaxResult listChart(DataItem dataItem) throws ParseException { |
| | | DateFormat df = new SimpleDateFormat("yyyy-MM"); |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String aa = df.format(dataItem.getDataTime()); |
| | | String beginTime = aa + "-01 00:00:00"; |
| | | dataItem.setBeginTime(sf.parse(beginTime)); |
| | | String endTime = aa + "-" + Integer.valueOf(getLastDayOfMonth(aa).substring(getLastDayOfMonth(aa).length() - 2)) + " 00:00:00"; |
| | | dataItem.setEndTime(sf.parse(endTime)); |
| | | List<MonthlyProcessEnergy> list = monthlyProcessEnergyService.getListChart(dataItem.getIndexId(), dataItem.getBeginTime(), dataItem.getEndTime(), dataItem.getTimeType(), dataItem.getEnergyType()); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param yearMonth |
| | | * @return |
| | | */ |
| | | public static String getLastDayOfMonth(String yearMonth) { |
| | | int year = Integer.parseInt(yearMonth.split("-")[0]); //å¹´ |
| | | int month = Integer.parseInt(yearMonth.split("-")[1]); //æ |
| | | Calendar cal = Calendar.getInstance(); |
| | | // 设置年份 |
| | | cal.set(Calendar.YEAR, year); |
| | | // 设置æä»½ |
| | | // cal.set(Calendar.MONTH, month - 1); |
| | | cal.set(Calendar.MONTH, month); //设置å½åæçä¸ä¸ä¸ªæ |
| | | // è·åæææå¤§å¤©æ° |
| | | //int lastDay = cal.getActualMaximum(Calendar.DATE); |
| | | int lastDay = cal.getMinimum(Calendar.DATE); //è·åæä»½ä¸çæå°å¼ï¼å³ç¬¬ä¸å¤© |
| | | // 设置æ¥å䏿份çæå¤§å¤©æ° |
| | | //cal.set(Calendar.DAY_OF_MONTH, lastDay); |
| | | cal.set(Calendar.DAY_OF_MONTH, lastDay - 1); //䏿ç第ä¸å¤©åå»1å°±æ¯å½æçæåä¸å¤© |
| | | // æ ¼å¼åæ¥æ |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | return sdf.format(cal.getTime()); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.web.controller.processenergy; |
| | | |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.common.utils.DateTimeUtil; |
| | | import com.zhitan.common.utils.TypeTime; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.model.domain.ModelNode; |
| | | import com.zhitan.model.service.IModelNodeService; |
| | | import com.zhitan.processenergy.domain.YearProcessEnergy; |
| | | import com.zhitan.processenergy.service.IYearProcessEnergyService; |
| | | import com.zhitan.realtimedata.domain.dto.DataItemQueryDTO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.text.ParseException; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * å·¥åºè½è å¹´ |
| | | * |
| | | * |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/processEnergy/YearProcessEnergy") |
| | | @Api(value = "å·¥åºè½èç»è®¡ï¼å¹´ï¼", tags = {"å·¥åºè½èç»è®¡"}) |
| | | public class YearProcessEnergyController extends BaseController { |
| | | |
| | | @Autowired |
| | | private IModelNodeService modelNodeService; |
| | | |
| | | @Autowired |
| | | private IYearProcessEnergyService yearProcessEnergyService; |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "å·¥åºè½èç»è®¡ï¼å¹´ï¼å表") |
| | | private AjaxResult list(DataItemQueryDTO dataItem) throws ParseException{ |
| | | List<ModelNode> nodeId = modelNodeService.getModelNodeByModelCode(dataItem.getIndexCode()); |
| | | if(CollectionUtils.isEmpty(nodeId)){ |
| | | return success(new ArrayList<>()); |
| | | } |
| | | List<EnergyIndex> energyList = modelNodeService.getSettingIndex(nodeId.get(0).getNodeId()); |
| | | if(CollectionUtils.isEmpty(energyList)){ |
| | | return success(new ArrayList<>()); |
| | | } |
| | | List<String> indexIds = energyList.stream().map(EnergyIndex::getIndexId).collect(Collectors.toList()); |
| | | |
| | | Date convertTime = DateTimeUtil.getTypeTime(dataItem.getTimeType(), dataItem.getDataTime()); |
| | | DateTime beginTime = DateUtil.beginOfYear(convertTime); |
| | | DateTime endTime = DateUtil.endOfYear(convertTime); |
| | | |
| | | List<TypeTime> typeTimeList = DateTimeUtil.getDateTimeList(dataItem.getTimeType(),convertTime); |
| | | |
| | | List<YearProcessEnergy> list = yearProcessEnergyService.getYearProcessEnergy(indexIds, typeTimeList,beginTime,endTime, dataItem.getTimeType(),dataItem.getEnergyType()); |
| | | return success(list); |
| | | } |
| | | |
| | | @GetMapping("/listChart") |
| | | @ApiOperation(value = "å·¥åºè½èï¼å¹´ï¼å¾è¡¨") |
| | | public AjaxResult listChart(DataItemQueryDTO queryDto) { |
| | | List<YearProcessEnergy> list = yearProcessEnergyService.getListChart(queryDto); |
| | | return AjaxResult.success(list); |
| | | } |
| | | } |
| | |
| | | * å表 |
| | | */ |
| | | @GetMapping("/page") |
| | | @PreAuthorize("@ss.hasPermi('energySavingProject:list')") |
| | | @PreAuthorize("@ss.hasPermi('energySavingProject:Project:list')") |
| | | @ApiOperation(value = "å页å表") |
| | | public TableDataInfo list(EnergySavingProgram energySavingProgram) { |
| | | Page<EnergySavingProgramVO> list = energySavingProgramService.selectEnergySavingProgramList(energySavingProgram); |
| | |
| | | * 详ç»ä¿¡æ¯ |
| | | */ |
| | | @ApiOperation(value = "æ¥è¯¢è¯¦æ
") |
| | | @PreAuthorize("@ss.hasPermi('energySavingProject')") |
| | | @GetMapping(value = "getById") |
| | | public AjaxResult getInfo(@RequestParam("id") Long id) { |
| | | return success(energySavingProgramService.selectEnergySavingProgramById(id)); |
| | |
| | | * èè½é¡¹ç®ç®¡ç |
| | | */ |
| | | @ApiOperation(value = "æ°å¢") |
| | | @PreAuthorize("@ss.hasPermi('energySavingProject:Project:add')") |
| | | @PostMapping("add") |
| | | public AjaxResult add( @RequestBody EnergySavingProgramDTO dto) { |
| | | return energySavingProgramService.insertEnergySavingProgram(dto); |
| | |
| | | * èè½é¡¹ç®ç®¡ç |
| | | */ |
| | | @ApiOperation(value = "æ´æ°") |
| | | @PreAuthorize("@ss.hasPermi('energySavingProject:Project:edit')") |
| | | @PostMapping("edit") |
| | | public AjaxResult edit(@RequestBody EnergySavingProgramDTO dto) { |
| | | return energySavingProgramService.updateEnergySavingProgram(dto); |
| | |
| | | * èè½é¡¹ç®ç®¡ç |
| | | */ |
| | | @DeleteMapping("del/{id}") |
| | | @PreAuthorize("@ss.hasPermi('energySavingProject:Project:del')") |
| | | @ApiOperation(value = "å é¤") |
| | | public AjaxResult remove(@PathVariable Long id) { |
| | | return energySavingProgramService.deleteEnergySavingProgramById(id); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.web.controller.statisticalAnalysis; |
| | | |
| | | import com.zhitan.common.annotation.Log; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import com.zhitan.statisticalAnalysis.service.IEnergyConsumeDataService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | |
| | | /** |
| | | * @Description: è½æºæ¶èç»è®¡åæ |
| | | * @author: yxw |
| | | * @date: 2022å¹´04æ12æ¥ 14:11 |
| | | */ |
| | | @Api(tags = "è½èç»è®¡åæ") |
| | | @RestController |
| | | @RequestMapping("/energyTypeAnalysis") |
| | | @Slf4j |
| | | public class EnergyConsumeDataController { |
| | | @Autowired |
| | | private IEnergyConsumeDataService energyConsumeDataService; |
| | | |
| | | /** |
| | | * ææ¬è¶å¿åæï¼è½æºæ¶èææ¬ï¼- è·åè¡¨æ ¼åè¡¨æ°æ® |
| | | * |
| | | * @param pageNo é¡µç æ° |
| | | * @param pageSize æ¯é¡µæ°æ®å¤å° |
| | | * @param timeCode æ¶é´å¼ 䏿¶é´ç±»å对åºï¼2022-03-21/2022-03/2022 |
| | | * @param timeType æ¶é´ç±»å DAY/MONTH/YEAR |
| | | * @param energyType è½æºç±»å |
| | | * @param modelCode 模åCode |
| | | * @return |
| | | */ |
| | | @Log(title = "è½èç»è®¡åæ-ææ¬è¶å¿åæï¼è½æºæ¶èææ¬ï¼- è·åè¡¨æ ¼åè¡¨æ°æ®") |
| | | @ApiOperation(value = "è½èç»è®¡åæ-ææ¬è¶å¿åæï¼è½æºæ¶èææ¬ï¼- è·åè¡¨æ ¼åè¡¨æ°æ®", notes = "è½èç»è®¡åæ-ææ¬è¶å¿åæï¼è½æºæ¶èææ¬ï¼- è·åè¡¨æ ¼åè¡¨æ°æ®") |
| | | @GetMapping(value = "/listEnergyCostTrend") |
| | | public AjaxResult listEnergyCostTrend(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
| | | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
| | | @RequestParam(name = "timeCode") String timeCode, |
| | | @RequestParam(name = "timeType") String timeType, |
| | | @RequestParam(name = "energyType",required = false) String energyType, |
| | | @RequestParam(name = "modelCode") String modelCode) { |
| | | return AjaxResult.success(energyConsumeDataService.listEnergyCostTrend(pageNo, pageSize, timeCode, timeType,energyType, |
| | | modelCode)); |
| | | } |
| | | |
| | | /** |
| | | * ææ¬è¶å¿åæï¼è½æºæ¶èææ¬ï¼ |
| | | * |
| | | * @param timeCode æ¶é´å¼ 䏿¶é´ç±»å对åºï¼2022-03-21/2022-03/2022 |
| | | * @param timeType æ¶é´ç±»å DAY/MONTH/YEAR |
| | | * @param modelCode 模åCode |
| | | * @param energyType è½æºç±»å |
| | | * @return |
| | | */ |
| | | @Log(title = "è½èç»è®¡åæ-ææ¬è¶å¿åæï¼è½æºæ¶èææ¬ï¼") |
| | | @ApiOperation(value = "è½èç»è®¡åæ-ææ¬è¶å¿åæï¼è½æºæ¶èææ¬ï¼", notes = "è½èç»è®¡åæ-ææ¬è¶å¿åæï¼è½æºæ¶èææ¬ï¼") |
| | | @GetMapping(value = "/listEnergyCostTrendDetail") |
| | | public AjaxResult listEnergyCostTrendDetail(@RequestParam(name = "timeCode") String timeCode, |
| | | @RequestParam(name = "timeType") String timeType, |
| | | @RequestParam(name = "modelCode") String modelCode, |
| | | @RequestParam(name = "energyType",required = false) String energyType) { |
| | | return AjaxResult.success(energyConsumeDataService.listEnergyCostTrendDetail(timeCode, timeType, modelCode, energyType)); |
| | | } |
| | | |
| | | } |
| | |
| | | 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; |
| | |
| | | @Autowired |
| | | private IDataItemService dataItemService; |
| | | |
| | | @Autowired |
| | | private IEnergyConsumeDataService energyConsumeDataService; |
| | | |
| | | /** |
| | | * è·åè½æµå¾å½¢åæ |
| | | * |
| | |
| | | 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)); |
| | | } |
| | | } |
| | |
| | | import com.zhitan.statisticalAnalysis.domain.vo.DataAnalysisYoYExcel; |
| | | import com.zhitan.statisticalAnalysis.domain.vo.DataAnalysisYoYVO; |
| | | import com.zhitan.statisticalAnalysis.service.IStatisticalAnalysisService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | /** |
| | | * ç»è®¡åæ æ§å¶å± |
| | | */ |
| | | @Api(tags = "ç»è®¡åæ") |
| | | @RestController |
| | | @RequestMapping("/statisticalAnalysis") |
| | | public class StatisticalAnalysisController extends BaseController { |
| | |
| | | package com.zhitan.web.controller.system; |
| | | |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | |
| | | * ä¸ªäººä¿¡æ¯ |
| | | */ |
| | | @GetMapping |
| | | @PreAuthorize("@ss.hasPermi('system:user:message')") |
| | | public AjaxResult profile() |
| | | { |
| | | LoginUser loginUser = getLoginUser(); |
| | |
| | | * ä¿®æ¹ç¨æ· |
| | | */ |
| | | @Log(title = "个人信æ¯", businessType = BusinessType.UPDATE) |
| | | @PreAuthorize("@ss.hasPermi('system:user:edit')") |
| | | @PutMapping |
| | | public AjaxResult updateProfile(@RequestBody SysUser user) |
| | | { |
| | |
| | | * éç½®å¯ç |
| | | */ |
| | | @Log(title = "个人信æ¯", businessType = BusinessType.UPDATE) |
| | | @PreAuthorize("@ss.hasPermi('system:user:edit')") |
| | | @PutMapping("/updatePwd") |
| | | public AjaxResult updatePwd(String oldPassword, String newPassword) |
| | | { |
| | |
| | | // ç¨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(); |
| | |
| | | druid: |
| | | # ä¸»åºæ°æ®æº |
| | | master: |
| | | url: jdbc:postgresql://127.0.0.1:5432/energy |
| | | username: root |
| | | password: 123456 |
| | | url: jdbc:postgresql://127.0.0.1:5432/zhitan_ems |
| | | username: postgres |
| | | password: postgres |
| | | # ä»åºæ°æ®æº |
| | | slave: |
| | | # 仿°æ®æºå¼å
³/é»è®¤å
³é |
| | |
| | | # åç§° |
| | | name: admin |
| | | # çæ¬ |
| | | version: 3.8.7 |
| | | version: 2.5.2 |
| | | # çæå¹´ä»½ |
| | | copyrightYear: 2024 |
| | | profile: ./uploadPath |
| | |
| | | token: == |
| | | org: org |
| | | bucket: bucket |
| | | measurement: data |
| | | |
| | | ###################### MQTT ################################# |
| | | mqtt: |
| | |
| | | <parent> |
| | | <artifactId>BaseAdminAPI</artifactId> |
| | | <groupId>com.zhitan</groupId> |
| | | <version>3.8.7</version> |
| | | <version>2.5.2</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | |
| | | /** |
| | | * æ»æååçç¹ä½æ¨¡æ¿code |
| | | */ |
| | | public static final String TAG_CODE_ZYGGL = "\\_ActivePower_Total"; |
| | | public static final String TAG_CODE_ZYGGL = "ActivePow"; |
| | | /** |
| | | * æ»æååçç¹ä½æ¨¡æ¿code |
| | | */ |
| | |
| | | /** |
| | | * æ»åçå æ° ç¹ä½æ¨¡æ¿code |
| | | */ |
| | | public static final String TAG_CODE_GLYS = "PowerFactor_Total"; |
| | | public static final String TAG_CODE_GLYS = "PowFactorT"; |
| | | /** |
| | | * çµæµ |
| | | */ |
| | | public static final String TAG_CODE_CURRENT = "Current_"; |
| | | public static final String TAG_CODE_CURRENT = "Current"; |
| | | /** |
| | | * çµå |
| | | */ |
| | | public static final String TAG_CODE_VOLTAGE = "Voltage_"; |
| | | public static final String TAG_CODE_VOLTAGE = "Voltage"; |
| | | /** |
| | | * åçå æ° |
| | | */ |
| | | public static final String TAG_CODE_FACTOR = "PowerFactor_"; |
| | | public static final String TAG_CODE_FACTOR = "PowerFactor"; |
| | | /** |
| | | * åçå æ° |
| | | */ |
| | |
| | | /** |
| | | * Aç¸çµæµ |
| | | */ |
| | | public static final String TAG_CODE_CURRENT_A = "Current_A"; |
| | | public static final String TAG_CODE_CURRENT_A = "CurrentA"; |
| | | /** |
| | | * Bç¸çµæµ |
| | | */ |
| | | public static final String TAG_CODE_CURRENT_B = "Current_B"; |
| | | public static final String TAG_CODE_CURRENT_B = "CurrentB"; |
| | | /** |
| | | * Cç¸çµæµ |
| | | */ |
| | | public static final String TAG_CODE_CURRENT_C = "Current_C"; |
| | | public static final String TAG_CODE_CURRENT_C = "CurrentC"; |
| | | /** |
| | | * Aç¸çµå |
| | | */ |
| | | public static final String TAG_CODE_VOLTAGE_A = "Voltage_A"; |
| | | public static final String TAG_CODE_VOLTAGE_A = "VoltageA"; |
| | | /** |
| | | * Bç¸çµå |
| | | */ |
| | | public static final String TAG_CODE_VOLTAGE_B = "Voltage_B"; |
| | | public static final String TAG_CODE_VOLTAGE_B = "VoltageB"; |
| | | /** |
| | | * Cç¸çµå |
| | | */ |
| | | public static final String TAG_CODE_VOLTAGE_C = "Voltage_C"; |
| | | public static final String TAG_CODE_VOLTAGE_C = "VoltageC"; |
| | | /** |
| | | * Aç¸åçå æ° |
| | | */ |
| | |
| | | /** ç¶æï¼0æ£å¸¸ 1åç¨ï¼ */ |
| | | @Excel(name = "ç¶æ", readConverterExp = "0=æ£å¸¸,1=åç¨") |
| | | private String status; |
| | | private String remark; |
| | | |
| | | public Long getDictId() |
| | | { |
| | |
| | | .append("remark", getRemark()) |
| | | .toString(); |
| | | } |
| | | |
| | | @Override |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | @Override |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | } |
| | |
| | | /** |
| | | * ééææ |
| | | */ |
| | | COLLECT, |
| | | COLLECT("COLLECT"), |
| | | /** |
| | | * ç»è®¡ææ |
| | | */ |
| | | STATISTIC |
| | | STATISTIC("STATISTIC"); |
| | | |
| | | private final String description; |
| | | |
| | | IndexType(String description) |
| | | { |
| | | this.description = description; |
| | | } |
| | | |
| | | |
| | | public String getDescription() |
| | | { |
| | | return description; |
| | | } |
| | | } |
| | |
| | | * è·å宿¶æ°æ®æ¹å¼. |
| | | */ |
| | | public enum RetrievalModes { |
| | | Full, BestFit |
| | | |
| | | Full, |
| | | |
| | | BestFit |
| | | } |
| | |
| | | public static void generateDateList(String timeType, String timeCode, List<Date> dateList) { |
| | | Date now = new Date(); |
| | | switch (timeType) { |
| | | case TimeTypeConst.TIME_TYPE_HOUR: |
| | | if (!timeCode.contains(CommonConst.SINGLE_MINUS_SIGN)) { |
| | | timeCode = DateTimeUtil.toDateTimeStr(timeCode, DateTimeUtil.COMMON_PATTERN_HOUR, DateTimeUtil.COMMON_PATTERN_TO_HOUR); |
| | | } |
| | | int minute = 59; |
| | | for (int i = CommonConst.DIGIT_0; i <= minute; i++) { |
| | | String tempCode = timeCode + ":0" + i; |
| | | if(i>9){ |
| | | tempCode = timeCode + ":" + i; |
| | | } |
| | | Date tempD = DateTimeUtil.toDateTime(tempCode, DateTimeUtil.COMMON_PATTERN_END_WITH_MINUTE); |
| | | dateList.add(tempD); |
| | | } |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | if (!timeCode.contains(CommonConst.SINGLE_MINUS_SIGN)) { |
| | | timeCode = DateTimeUtil.toDateTimeStr(timeCode, DateTimeUtil.COMMON_PATTERN_DAY, DateTimeUtil.COMMON_PATTERN_TO_DAY); |
| | |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.GregorianCalendar; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @Description: æ¶é´å·¥å
·ç±» |
| | |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®æ¶é´ç±»åæå符串转æå¯¹åºçæ¶é´ |
| | | * timeType="HOUR",time="2025-02-01"ï¼è¿å"2025-02-01 01:00:00" |
| | | * timeType="DAY",time="2025-02"ï¼è¿å"2025-02-01 01:00:00" |
| | | * timeType="MONTH",time="2025"ï¼è¿å"2025-02-01 01:00:00" |
| | | * |
| | | * @param timeType æ¶é´ç±»å |
| | | * @param time æ¶é´å符串 |
| | | * @return |
| | | */ |
| | | public static Date getTypeTime(String timeType, String time) { |
| | | Date dt = null; |
| | | timeType = StringUtil.ifEmptyOrNullReturnValue(timeType).toUpperCase(); |
| | | switch (timeType) { |
| | | case TimeTypeConst.TIME_TYPE_HOUR: |
| | | dt = toDateTime(time, COMMON_PATTERN_TO_DAY); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | dt = toDateTime(time, COMMON_PATTERN_TO_MONTH); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | dt = toDateTime(time, COMMON_PATTERN_YEAR); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return dt; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®æ¶é´ç±»åæè¿ç»çæ¥æå符串转æå¯¹åºçæ¶é´ ï¼202303ã20230303ã2023030301ã202303030101ï¼ |
| | | * |
| | | * @param timeType æ¶é´ç±»å |
| | |
| | | } |
| | | return momDate; |
| | | } |
| | | |
| | | /** |
| | | * éè¿æ¶é´ç±»åè¿å对åºçæ¶é´list |
| | | * <p> |
| | | * åæ°ï¼ |
| | | * timeType="YEAR",dataTime="2025-01-01 00:00:00" |
| | | * timeType="MONTH",dataTime="2025-01-01 00:00:00" |
| | | * timeType="DAY",dataTime="2025-01-01 00:00:00" |
| | | * è¿åæ ¼å¼ï¼ |
| | | * [ |
| | | * {"datatime":"2025-01-01 00:00:00","value":"value1"}, |
| | | * {"datatime":"2025-02-01 00:00:00","value":"value2"}, |
| | | * {"datatime":"2025-03-01 00:00:00","value":"value3"}, |
| | | * {"datatime":"2025-04-01 00:00:00","value":"value4"}, |
| | | * {"datatime":"2025-05-01 00:00:00","value":"value5"}, |
| | | * {"datatime":"2025-06-01 00:00:00","value":"value6"}, |
| | | * {"datatime":"2025-07-01 00:00:00","value":"value7"}, |
| | | * {"datatime":"2025-08-01 00:00:00","value":"value8"}, |
| | | * {"datatime":"2025-09-01 00:00:00","value":"value9"}, |
| | | * {"datatime":"2025-10-01 00:00:00","value":"value10"}, |
| | | * {"datatime":"2025-11-01 00:00:00","value":"value11"}, |
| | | * {"datatime":"2025-12-01 00:00:00","value":"value12"} |
| | | * ] |
| | | * |
| | | * @param timeType |
| | | * @param dataTime |
| | | * @return |
| | | */ |
| | | public static List<TypeTime> getDateTimeList(String timeType, Date dataTime) { |
| | | |
| | | List<TypeTime> resultList = new ArrayList<>(); |
| | | Date beginTime; |
| | | switch (timeType) { |
| | | case TimeTypeConst.TIME_TYPE_HOUR: |
| | | beginTime = DateUtil.beginOfDay(dataTime); |
| | | for (int i = 1; i <= 24; i++) { |
| | | TypeTime typeTime = new TypeTime(); |
| | | typeTime.setDataTime(DateUtil.format(beginTime, COMMON_PATTERN)); |
| | | typeTime.setTimeCode(CommonConst.WORD_H + DateUtil.format(beginTime, COMMON_PATTERN_HOUR)); |
| | | typeTime.setDateTime(beginTime); |
| | | typeTime.setValue("value" + i); |
| | | resultList.add(typeTime); |
| | | beginTime = addHours(beginTime, 1); |
| | | } |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | beginTime = DateUtil.beginOfMonth(dataTime); |
| | | for (int i = 1; i <= 31; i++) { |
| | | TypeTime typeTime = new TypeTime(); |
| | | typeTime.setDataTime(DateUtil.format(beginTime, COMMON_PATTERN)); |
| | | typeTime.setTimeCode(CommonConst.WORD_D + DateUtil.format(beginTime, COMMON_PATTERN_DAY)); |
| | | typeTime.setDateTime(beginTime); |
| | | typeTime.setValue("value" + i); |
| | | resultList.add(typeTime); |
| | | beginTime = addDays(beginTime, 1); |
| | | } |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | beginTime = DateUtil.beginOfYear(dataTime); |
| | | for (int i = 1; i <= 12; i++) { |
| | | TypeTime typeTime = new TypeTime(); |
| | | typeTime.setDataTime(DateUtil.format(beginTime, COMMON_PATTERN)); |
| | | typeTime.setTimeCode(CommonConst.WORD_M + DateUtil.format(beginTime, COMMON_PATTERN_MONTH)); |
| | | typeTime.setDateTime(beginTime); |
| | | typeTime.setValue("value" + i); |
| | | resultList.add(typeTime); |
| | | beginTime = addMonths(beginTime, 1); |
| | | } |
| | | break; |
| | | } |
| | | return resultList; |
| | | } |
| | | |
| | | /** |
| | | * éè¿æ¶é´ç±»åè¿å对åºçæ¶é´list |
| | | * <p> |
| | | * åæ°ï¼ |
| | | * timeType="YEAR",dataTime="2025-01-01 00:00:00" |
| | | * timeType="MONTH",dataTime="2025-01-01 00:00:00" |
| | | * timeType="DAY",dataTime="2025-01-01 00:00:00" |
| | | * è¿åæ ¼å¼ï¼ |
| | | * [ |
| | | * {"datatime":"2025-01-01 00:00:00","value":"value1"}, |
| | | * {"datatime":"2025-02-01 00:00:00","value":"value2"}, |
| | | * {"datatime":"2025-03-01 00:00:00","value":"value3"}, |
| | | * {"datatime":"2025-04-01 00:00:00","value":"value4"}, |
| | | * {"datatime":"2025-05-01 00:00:00","value":"value5"}, |
| | | * {"datatime":"2025-06-01 00:00:00","value":"value6"}, |
| | | * {"datatime":"2025-07-01 00:00:00","value":"value7"}, |
| | | * {"datatime":"2025-08-01 00:00:00","value":"value8"}, |
| | | * {"datatime":"2025-09-01 00:00:00","value":"value9"}, |
| | | * {"datatime":"2025-10-01 00:00:00","value":"value10"}, |
| | | * {"datatime":"2025-11-01 00:00:00","value":"value11"}, |
| | | * {"datatime":"2025-12-01 00:00:00","value":"value12"} |
| | | * ] |
| | | * |
| | | * @param timeType |
| | | * @param dataTime |
| | | * @return |
| | | */ |
| | | public static List<TypeTime> getDateTimeListSame(String timeType, Date dataTime) { |
| | | |
| | | List<TypeTime> resultList = new ArrayList<>(); |
| | | Date beginTime; |
| | | switch (timeType) { |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | beginTime = DateUtil.beginOfDay(dataTime); |
| | | for (int i = 1; i <= 24; i++) { |
| | | TypeTime typeTime = new TypeTime(); |
| | | typeTime.setDataTime(DateUtil.format(beginTime, COMMON_PATTERN)); |
| | | typeTime.setTimeCode(CommonConst.WORD_H + DateUtil.format(beginTime, COMMON_PATTERN_HOUR)); |
| | | typeTime.setDateTime(beginTime); |
| | | typeTime.setValue("value" + i); |
| | | resultList.add(typeTime); |
| | | beginTime = addHours(beginTime, 1); |
| | | } |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | beginTime = DateUtil.beginOfMonth(dataTime); |
| | | for (int i = 1; i <= 31; i++) { |
| | | TypeTime typeTime = new TypeTime(); |
| | | typeTime.setDataTime(DateUtil.format(beginTime, COMMON_PATTERN)); |
| | | typeTime.setTimeCode(CommonConst.WORD_D + DateUtil.format(beginTime, COMMON_PATTERN_DAY)); |
| | | typeTime.setDateTime(beginTime); |
| | | typeTime.setValue("value" + i); |
| | | resultList.add(typeTime); |
| | | beginTime = addDays(beginTime, 1); |
| | | } |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_YEAR: |
| | | beginTime = DateUtil.beginOfYear(dataTime); |
| | | for (int i = 1; i <= 12; i++) { |
| | | TypeTime typeTime = new TypeTime(); |
| | | typeTime.setDataTime(DateUtil.format(beginTime, COMMON_PATTERN)); |
| | | typeTime.setTimeCode(CommonConst.WORD_M + DateUtil.format(beginTime, COMMON_PATTERN_MONTH)); |
| | | typeTime.setDateTime(beginTime); |
| | | typeTime.setValue("value" + i); |
| | | resultList.add(typeTime); |
| | | beginTime = addMonths(beginTime, 1); |
| | | } |
| | | break; |
| | | } |
| | | return resultList; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.common.utils; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.zhitan.common.constant.CommonConst; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: 屿§å¼æä½å·¥å
·ç±» |
| | | * @author: yxw |
| | | * @date: 2022å¹´03æ07æ¥ 9:57 |
| | | */ |
| | | public class PropUtils { |
| | | /** |
| | | * 为å®ä½èµå¼ |
| | | * |
| | | * @param obj |
| | | * @param propName |
| | | * @param value |
| | | * @return |
| | | */ |
| | | public static Object setValue(Object obj, String propName, Object value) { |
| | | try { |
| | | Field field = obj.getClass().getDeclaredField(propName); |
| | | field.setAccessible(true); |
| | | String nameTypeName = field.getType().getTypeName(); |
| | | nameTypeName = StringUtil.ifEmptyOrNullReturnValue(nameTypeName).toLowerCase(); |
| | | if (nameTypeName.contains("float")) { |
| | | float num = (float) DoubleUtil.toDouble(value); |
| | | field.set(obj, num); |
| | | } else if (nameTypeName.contains("double")) { |
| | | field.set(obj, DoubleUtil.toDouble(value)); |
| | | } else if (nameTypeName.contains("bigdecimal")) { |
| | | BigDecimal valueOf = BigDecimal.valueOf(Double.parseDouble(String.valueOf(value))) |
| | | .setScale(CommonConst.DIGIT_2, BigDecimal.ROUND_HALF_UP); |
| | | |
| | | field.set(obj, valueOf); |
| | | } else { |
| | | field.set(obj, value); |
| | | } |
| | | } catch (Exception e) { |
| | | return null; |
| | | } |
| | | return obj; |
| | | } |
| | | |
| | | /** |
| | | * è·å对象çæå®å段çå¼ |
| | | * |
| | | * @param obj |
| | | * @param propName |
| | | * @return |
| | | */ |
| | | public static String getPropValue(Object obj, String propName) { |
| | | String propValue = ""; |
| | | try { |
| | | if (null != obj) { |
| | | JSONObject jsonObject = StringUtil.toJsonObject(obj); |
| | | if (!StringUtil.isEmptyOrNull(propName)) { |
| | | propValue = jsonObject.getString(propName); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | } |
| | | return propValue; |
| | | } |
| | | |
| | | /** |
| | | * è·å对象çæå®å段çç±»å |
| | | * è¿å屿§çç±»åå符串ï¼å°åï¼ä¾å¦:string/integer/double/dateï¼ |
| | | * |
| | | * @param obj å®ä½ |
| | | * @param propName 屿§å |
| | | * @return ï¼å°åï¼ä¾å¦:string/integer/double/dateï¼ |
| | | */ |
| | | public static String getPropType(Object obj, String propName) { |
| | | String propType = ""; |
| | | try { |
| | | if (null != obj && !StringUtil.isEmptyOrNull(propName)) { |
| | | Field[] fields = obj.getClass().getDeclaredFields(); |
| | | for (Field field : fields) { |
| | | String name = field.getName().toLowerCase(); |
| | | if (name.equals(propName.toLowerCase())) { |
| | | propType = field.getType().getSimpleName().toLowerCase(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | return propType; |
| | | } |
| | | |
| | | /** |
| | | * è¡è½¬å |
| | | * @param clazz ç»æç±»ï¼å¦ UserInfo.class |
| | | * @param list æ°æ®é |
| | | * @return |
| | | * @param <T> |
| | | */ |
| | | public static <T> List rowToColumn(Class<T> clazz, List<T> list){ |
| | | List<List> result; |
| | | Field[] fields = clazz.getDeclaredFields(); |
| | | result = new ArrayList<>(fields.length); |
| | | for (int i = 0; i < fields.length; i++) { |
| | | result.add(new ArrayList()); |
| | | } |
| | | for (T t : list) { |
| | | for (int i = 0; i < fields.length; i++) { |
| | | List l = result.get(i); |
| | | Field field = fields[i]; |
| | | field.setAccessible(true); |
| | | try { |
| | | l.add(field.get(t)); |
| | | } catch (IllegalAccessException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.common.utils; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * [ |
| | | * {"dataTime":"2025-01-01 00:00:00","value":"value0"} |
| | | * {"dataTime":"2025-02-01 00:00:00","value":"value1"} |
| | | * {"dataTime":"2025-03-01 00:00:00","value":"value2"} |
| | | * {"dataTime":"2025-04-01 00:00:00","value":"value3"} |
| | | * {"dataTime":"2025-05-01 00:00:00","value":"value4"} |
| | | * {"dataTime":"2025-06-01 00:00:00","value":"value5"} |
| | | * {"dataTime":"2025-07-01 00:00:00","value":"value6"} |
| | | * {"dataTime":"2025-08-01 00:00:00","value":"value7"} |
| | | * {"dataTime":"2025-09-01 00:00:00","value":"value8"} |
| | | * {"dataTime":"2025-10-01 00:00:00","value":"value9"} |
| | | * {"dataTime":"2025-11-01 00:00:00","value":"value10"} |
| | | * {"dataTime":"2025-12-01 00:00:00","value":"value11"} |
| | | * } |
| | | */ |
| | | @Data |
| | | public class TypeTime { |
| | | private String dataTime; |
| | | private String value; |
| | | private String timeCode; |
| | | |
| | | private Date dateTime; |
| | | } |
| | |
| | | <parent> |
| | | <artifactId>BaseAdminAPI</artifactId> |
| | | <groupId>com.zhitan</groupId> |
| | | <version>3.8.7</version> |
| | | <version>2.5.2</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | |
| | | <parent> |
| | | <artifactId>BaseAdminAPI</artifactId> |
| | | <groupId>com.zhitan</groupId> |
| | | <version>3.8.7</version> |
| | | <version>2.5.2</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | |
| | | <parent> |
| | | <artifactId>BaseAdminAPI</artifactId> |
| | | <groupId>com.zhitan</groupId> |
| | | <version>3.8.7</version> |
| | | <version>2.5.2</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | |
| | | <parent> |
| | | <artifactId>BaseAdminAPI</artifactId> |
| | | <groupId>com.zhitan</groupId> |
| | | <version>3.8.7</version> |
| | | <version>2.5.2</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.Itemizedenergyanalysis.domain.VO; |
| | | |
| | | import com.zhitan.common.annotation.Excel; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @Data |
| | | public class ItemizedEnergyAnalysisItemVO { |
| | | /** |
| | | * èç¹id |
| | | */ |
| | | private String nodeId; |
| | | /** |
| | | * èç¹åç§° |
| | | */ |
| | | private String nodeName; |
| | | /** |
| | | * å计 |
| | | */ |
| | | private Double total; |
| | | @Excel(name = "1æ¶/1æ¥/1æ") |
| | | private Double value0; |
| | | @Excel(name = "2æ¶/2æ¥/2æ") |
| | | private Double value1; |
| | | @Excel(name = "3æ¶/3æ¥/3æ") |
| | | private Double value2; |
| | | @Excel(name = "4æ¶/4æ¥/4æ") |
| | | private Double value3; |
| | | @Excel(name = "5æ¶/5æ¥/5ææ¥") |
| | | private Double value4; |
| | | @Excel(name = "6æ¶/6æ¥/6ææ¥") |
| | | private Double value5; |
| | | @Excel(name = "7æ¶/7æ¥/7ææ¥") |
| | | private Double value6; |
| | | @Excel(name = "8æ¶/8æ¥/8ææ¥") |
| | | private Double value7; |
| | | @Excel(name = "9æ¶/9æ¥/9ææ¥") |
| | | private Double value8; |
| | | @Excel(name = "10æ¶/10æ¥/10ææ¥") |
| | | private Double value9; |
| | | @Excel(name = "11æ¶/11æ¥/11ææ¥") |
| | | private Double value10; |
| | | @Excel(name = "12æ¶/12æ¥/12æ") |
| | | private Double value11; |
| | | @Excel(name = "13æ¶/13æ¥") |
| | | private Double value12; |
| | | @Excel(name = "14æ¶/14æ¥") |
| | | private Double value13; |
| | | @Excel(name = "15æ¶/15æ¥") |
| | | private Double value14; |
| | | @Excel(name = "16æ¶/16æ¥") |
| | | private Double value15; |
| | | @Excel(name = "17æ¶/17æ¥") |
| | | private Double value16; |
| | | @Excel(name = "18æ¶/18æ¥") |
| | | private Double value17; |
| | | @Excel(name = "19æ¶/19æ¥") |
| | | private Double value18; |
| | | @Excel(name = "20æ¶/20æ¥") |
| | | private Double value19; |
| | | @Excel(name = "21æ¶/21æ¥") |
| | | private Double value20; |
| | | @Excel(name = "22æ¶/22æ¥") |
| | | private Double value21; |
| | | @Excel(name = "23æ¶/23æ¥") |
| | | private Double value22; |
| | | @Excel(name = "24æ¶/24æ¥") |
| | | private Double value23; |
| | | @Excel(name = "25æ¥") |
| | | private Double value24; |
| | | @Excel(name = "26æ¥") |
| | | private Double value25; |
| | | @Excel(name = "27æ¥") |
| | | private Double value26; |
| | | @Excel(name = "28æ¥") |
| | | private Double value27; |
| | | @Excel(name = "29æ¥") |
| | | private Double value28; |
| | | @Excel(name = "30æ¥") |
| | | private Double value29; |
| | | @Excel(name = "31æ¥") |
| | | private Double value30; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.Itemizedenergyanalysis.domain.VO; |
| | | |
| | | import com.zhitan.common.annotation.Excel; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å项ç¨è½åæè¿åç±» |
| | | * |
| | | * @author å¼ |
| | | */ |
| | | @Data |
| | | public class ItemizedEnergyAnalysisVO { |
| | | |
| | | /** |
| | | * å计 |
| | | */ |
| | | private String total; |
| | | /** |
| | | * æå¤§å¼ |
| | | */ |
| | | private String max; |
| | | /** |
| | | * æå°å¼ |
| | | */ |
| | | private String min; |
| | | /** |
| | | * å¹³åå¼ |
| | | */ |
| | | private String avg; |
| | | /** |
| | | * åä½ |
| | | */ |
| | | private String unit; |
| | | |
| | | private List<ItemizedEnergyAnalysisItemVO> dataList; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.Itemizedenergyanalysis.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * å¨ææ°æ®é¡¹. |
| | | */ |
| | | @Data |
| | | public class ItemizedEnergyAnalysisDTO { |
| | | |
| | | @ApiModelProperty(value = "æ¶é´å符串") |
| | | private String dataTime; |
| | | |
| | | @ApiModelProperty(value = "æ¶é´ç±»å") |
| | | private String timeType; |
| | | |
| | | @ApiModelProperty(value = "è½æºç±»å") |
| | | private String energyType; |
| | | |
| | | @ApiModelProperty(value = "èç¹Id") |
| | | private String nodeId; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.Itemizedenergyanalysis.service; |
| | | |
| | | import com.zhitan.Itemizedenergyanalysis.domain.VO.ItemizedEnergyAnalysisVO; |
| | | import com.zhitan.Itemizedenergyanalysis.dto.ItemizedEnergyAnalysisDTO; |
| | | |
| | | public interface IItemizedEnergyAnalysisService { |
| | | /** |
| | | * å项ç¨è½åæ |
| | | * @param dto 请æ±åæ° |
| | | * @return ç»æ |
| | | */ |
| | | ItemizedEnergyAnalysisVO getItemizedEnergyAnalysisService(ItemizedEnergyAnalysisDTO dto); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.Itemizedenergyanalysis.service.impl; |
| | | |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.zhitan.Itemizedenergyanalysis.domain.VO.ItemizedEnergyAnalysisItemVO; |
| | | import com.zhitan.Itemizedenergyanalysis.domain.VO.ItemizedEnergyAnalysisVO; |
| | | import com.zhitan.Itemizedenergyanalysis.dto.ItemizedEnergyAnalysisDTO; |
| | | import com.zhitan.Itemizedenergyanalysis.service.IItemizedEnergyAnalysisService; |
| | | import com.zhitan.common.constant.TimeTypeConst; |
| | | import com.zhitan.common.exception.ServiceException; |
| | | import com.zhitan.common.utils.DateTimeUtil; |
| | | import com.zhitan.common.utils.PropUtils; |
| | | import com.zhitan.common.utils.TypeTime; |
| | | import com.zhitan.dataitem.service.IDataItemService; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfo; |
| | | import com.zhitan.model.mapper.ModelNodeMapper; |
| | | import com.zhitan.realtimedata.domain.DataItem; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | /** |
| | | * å项ç¨è½åæ |
| | | * |
| | | * @author sys |
| | | * @date 2025-03-25 |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class ItemizedEnergyAnalysisServiceImpl implements IItemizedEnergyAnalysisService { |
| | | |
| | | @Resource |
| | | private final ModelNodeMapper modelNodeMapper; |
| | | @Resource |
| | | private final IDataItemService dataItemService; |
| | | |
| | | /** |
| | | * @param dto 请æ±åæ° |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public ItemizedEnergyAnalysisVO getItemizedEnergyAnalysisService(ItemizedEnergyAnalysisDTO dto) { |
| | | |
| | | String timeType = dto.getTimeType(); |
| | | String dataTime = dto.getDataTime(); |
| | | Date beginTime = DateTimeUtil.getTime(timeType, dataTime); |
| | | DateTime endTime = null; |
| | | |
| | | // è·åèç¹ä¿¡æ¯ |
| | | List<ModelNodeIndexInfo> nodeIndexInfo = modelNodeMapper.getModelNodeIndexIdByNodeId(dto.getNodeId(), dto.getEnergyType()); |
| | | List<String> indexList = nodeIndexInfo.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toList()); |
| | | |
| | | if(ObjectUtil.isEmpty(indexList)){ |
| | | return new ItemizedEnergyAnalysisVO(); |
| | | } |
| | | |
| | | ModelNodeIndexInfo info = nodeIndexInfo.stream().findFirst().get(); |
| | | |
| | | List<TypeTime> dateTimeList; |
| | | // æ ¹æ®æ¶é´ç±»åè°æ´æ¶é´èå´ |
| | | switch (dto.getTimeType()) { |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | timeType = TimeTypeConst.TIME_TYPE_HOUR; |
| | | endTime = DateUtil.endOfDay(beginTime); |
| | | dateTimeList = DateTimeUtil.getDateTimeListSame(TimeTypeConst.TIME_TYPE_DAY, beginTime); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | timeType = TimeTypeConst.TIME_TYPE_DAY; |
| | | endTime = DateUtil.endOfMonth(beginTime); |
| | | dateTimeList = DateTimeUtil.getDateTimeListSame(TimeTypeConst.TIME_TYPE_MONTH, beginTime); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_YEAR: |
| | | timeType = TimeTypeConst.TIME_TYPE_MONTH; |
| | | endTime = DateUtil.endOfYear(beginTime); |
| | | dateTimeList = DateTimeUtil.getDateTimeListSame(TimeTypeConst.TIME_TYPE_YEAR, beginTime); |
| | | break; |
| | | default: |
| | | throw new ServiceException("æ¶é´æ ¼å¼é误"); |
| | | } |
| | | // è·åæ°æ®é¡¹å表 |
| | | List<DataItem> dataItemList = dataItemService.getDataItemTimeRangeInforByIndexIds(beginTime, endTime, timeType, indexList); |
| | | |
| | | // è·åæå¤§å¼ãæå°å¼ãå计ãå¹³åå¼ |
| | | ItemizedEnergyAnalysisVO vo = new ItemizedEnergyAnalysisVO(); |
| | | double sum = dataItemList.stream().mapToDouble(DataItem::getValue).sum(); |
| | | double max = dataItemList.stream().mapToDouble(DataItem::getValue).max().getAsDouble(); |
| | | double min = dataItemList.stream().mapToDouble(DataItem::getValue).min().getAsDouble(); |
| | | double avg = dataItemList.stream().mapToDouble(DataItem::getValue).average().getAsDouble(); |
| | | |
| | | vo.setTotal(BigDecimal.valueOf(sum).setScale(2, RoundingMode.HALF_UP).toString()); |
| | | vo.setMax(BigDecimal.valueOf(max).setScale(2, RoundingMode.HALF_UP).toString()); |
| | | vo.setMin(BigDecimal.valueOf(min).setScale(2, RoundingMode.HALF_UP).toString()); |
| | | vo.setAvg(BigDecimal.valueOf(avg).setScale(2, RoundingMode.HALF_UP).toString()); |
| | | if(ObjectUtil.isNotEmpty(info.getUnitId())){ |
| | | vo.setUnit(info.getUnitId()); |
| | | } |
| | | |
| | | List<ItemizedEnergyAnalysisItemVO> voList = new ArrayList<>(); |
| | | ItemizedEnergyAnalysisItemVO itemVO = new ItemizedEnergyAnalysisItemVO(); |
| | | itemVO.setNodeId(info.getNodeId()); |
| | | itemVO.setNodeName(info.getName()); |
| | | itemVO.setTotal(sum); |
| | | |
| | | Map<Date, List<DataItem>> dateListMap = dataItemList.stream().collect(Collectors.groupingBy(DataItem::getDataTime)); |
| | | List<DataItem> results = new ArrayList<>(); |
| | | dateListMap.forEach((key, value) -> { |
| | | DataItem dataItem = new DataItem(); |
| | | dataItem.setDataTime(key); |
| | | //ä¿çåä½å°æ° |
| | | double totalValue = value.stream().map(data -> BigDecimal.valueOf(data.getValue())) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add).setScale(4, RoundingMode.HALF_UP).doubleValue(); |
| | | dataItem.setValue(totalValue); |
| | | results.add(dataItem); |
| | | }); |
| | | //æ ¹æ®æ¶é´æåº |
| | | results.sort(Comparator.comparing(DataItem::getDataTime)); |
| | | for (int i = 0; i < dateTimeList.size(); i++) { |
| | | TypeTime typeTime = dateTimeList.get(i); |
| | | Optional<DataItem> dataItem = results.stream().filter(result -> result.getDataTime().equals(typeTime.getDateTime())).findFirst(); |
| | | if (dataItem.isPresent()) { |
| | | DataItem item = dataItem.get(); |
| | | PropUtils.setValue(itemVO, "value" + i, item.getValue()); |
| | | } else { |
| | | PropUtils.setValue(itemVO, "value" + i, null); |
| | | } |
| | | } |
| | | |
| | | voList.add(itemVO); |
| | | vo.setDataList(voList); |
| | | |
| | | return vo; |
| | | } |
| | | } |
| | |
| | | import com.zhitan.consumptionanalysis.domain.vo.ChartData; |
| | | import com.zhitan.consumptionanalysis.domain.vo.EnergyProportion; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfor; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfo; |
| | | import com.zhitan.model.mapper.EnergyIndexMapper; |
| | | import com.zhitan.model.mapper.ModelNodeMapper; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | /** |
| | | * æ¥è¯¢ç¹ä½ä¸ç¨è½åå
ä¿¡æ¯ |
| | | */ |
| | | List<ModelNodeIndexInfor> nodeIndexInforList = modelNodeMapper.getModelNodeIndexIdByNodeId(nodeId,null); |
| | | List<String> indexIds = nodeIndexInforList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | List<ModelNodeIndexInfo> nodeIndexInforList = modelNodeMapper.getModelNodeIndexIdByNodeId(nodeId,null); |
| | | List<String> indexIds = nodeIndexInforList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toList()); |
| | | |
| | | Integer monthCount = historyAlarmMapper.selectCountByTime(beginOfMonth,endOfMonth); |
| | | Integer yearCount = historyAlarmMapper.selectCountByTime(beginOfYear,endOfYear); |
| | |
| | | MeterImplement selectByNodeIdIndexId(@Param("nodeId") String nodeId, @Param("indexId") String indexId); |
| | | |
| | | List<MeterImplement> listMeterImplByInstallLocation(@Param("installactionLocation") String installactionLocation); |
| | | |
| | | /** |
| | | * æ ¹æ®èç¹idæ¥è¯¢è®¡éå¨å
·ä¿¡æ¯ |
| | | * |
| | | * @param nodeId |
| | | * @return |
| | | */ |
| | | List<MeterImplement> selectByNodeId(@Param("nodeId") String nodeId); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.branchanalysis.domain; |
| | | import com.zhitan.common.annotation.Excel; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class BranchAnalysisVO { |
| | | private String until; |
| | | private double total; |
| | | @Excel(name = "èç¹id") |
| | | private String nodeId; |
| | | @Excel(name = "åèåç§°") |
| | | private String nodeName; |
| | | @Excel(name = "1æ¶/1æ¥/1æ") |
| | | private Double value0; |
| | | @Excel(name = "2æ¶/2æ¥/2æ") |
| | | private Double value1; |
| | | @Excel(name = "3æ¶/3æ¥/3æ") |
| | | private Double value2; |
| | | @Excel(name = "4æ¶/4æ¥/4æ") |
| | | private Double value3; |
| | | @Excel(name = "5æ¶/5æ¥/5æ") |
| | | private Double value4; |
| | | @Excel(name = "6æ¶/6æ¥/6æ") |
| | | private Double value5; |
| | | @Excel(name = "7æ¶/7æ¥/7æ") |
| | | private Double value6; |
| | | @Excel(name = "8æ¶/8æ¥/8æ") |
| | | private Double value7; |
| | | @Excel(name = "9æ¶/9æ¥/9æ") |
| | | private Double value8; |
| | | @Excel(name = "10æ¶/10æ¥/10æ") |
| | | private Double value9; |
| | | @Excel(name = "11æ¶/11æ¥/11æ") |
| | | private Double value10; |
| | | @Excel(name = "12æ¶/12æ¥/12æ") |
| | | private Double value11; |
| | | @Excel(name = "13æ¶/13æ¥") |
| | | private Double value12; |
| | | @Excel(name = "14æ¶/14æ¥") |
| | | private Double value13; |
| | | @Excel(name = "15æ¶/15æ¥") |
| | | private Double value14; |
| | | @Excel(name = "16æ¶/16æ¥") |
| | | private Double value15; |
| | | @Excel(name = "17æ¶/17æ¥") |
| | | private Double value16; |
| | | @Excel(name = "18æ¶18æ¥") |
| | | private Double value17; |
| | | @Excel(name = "19æ¶/19æ¥") |
| | | private Double value18; |
| | | @Excel(name = "20æ¶/20æ¥") |
| | | private Double value19; |
| | | @Excel(name = "21æ¶/21æ¥") |
| | | private Double value20; |
| | | @Excel(name = "22æ¶/22æ¥") |
| | | private Double value21; |
| | | @Excel(name = "23æ¶/23æ¥") |
| | | private Double value22; |
| | | @Excel(name = "24æ¶/24æ¥") |
| | | private Double value23; |
| | | @Excel(name = "25æ¥") |
| | | private Double value24; |
| | | @Excel(name = "26æ¥") |
| | | private Double value25; |
| | | @Excel(name = "27æ¥") |
| | | private Double value26; |
| | | @Excel(name = "28æ¥") |
| | | private Double value27; |
| | | @Excel(name = "29æ¥") |
| | | private Double value28; |
| | | @Excel(name = "30æ¥") |
| | | private Double value29; |
| | | @Excel(name = "31æ¥") |
| | | private Double value30; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.branchanalysis.mapper; |
| | | |
| | | import com.zhitan.branchanalysis.domain.BranchAnalysisVO; |
| | | import com.zhitan.common.utils.TypeTime; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | *æ¯è·¯ç¨è½åæ |
| | | * |
| | | * @author sys |
| | | * @date 2021-01-11 |
| | | */ |
| | | public interface BranchAnalysisMapper { |
| | | public List<BranchAnalysisVO> getBranchAnalysisList(@Param("indexIds") List<String> indexIds, |
| | | @Param("dataList") List<TypeTime> dataList, |
| | | @Param("beginTime") Date beginTime, |
| | | @Param("endTime") Date endTime, |
| | | @Param("timeType") String timeType, |
| | | @Param("indexStorageId") String indexStorageId); |
| | | |
| | | |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.branchanalysis.service; |
| | | |
| | | |
| | | import com.zhitan.branchanalysis.domain.BranchAnalysisVO; |
| | | import com.zhitan.realtimedata.domain.dto.BranchAnalysisDTO; |
| | | |
| | | |
| | | public interface IBranchAnalysisService { |
| | | /** |
| | | * æ¯è·¯ç¨è½åæ |
| | | * |
| | | * @author sys |
| | | * @date 2021-01-11 |
| | | */ |
| | | BranchAnalysisVO getBranchAnalysisService(BranchAnalysisDTO dataItem); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.branchanalysis.service.impl; |
| | | |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.zhitan.branchanalysis.domain.BranchAnalysisVO; |
| | | import com.zhitan.branchanalysis.service.IBranchAnalysisService; |
| | | import com.zhitan.common.constant.TimeTypeConst; |
| | | import com.zhitan.common.exception.ServiceException; |
| | | import com.zhitan.common.utils.DateTimeUtil; |
| | | import com.zhitan.common.utils.PropUtils; |
| | | import com.zhitan.common.utils.TypeTime; |
| | | import com.zhitan.dataitem.mapper.DataItemMapper; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfo; |
| | | import com.zhitan.model.mapper.ModelNodeMapper; |
| | | import com.zhitan.realtimedata.domain.DataItem; |
| | | import com.zhitan.realtimedata.domain.dto.BranchAnalysisDTO; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * æ¯è·¯ç¨è½åæ |
| | | * |
| | | * @author zt |
| | | * @date 2025-03-27 |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class BranchAnalysisServiceImpl implements IBranchAnalysisService { |
| | | |
| | | private ModelNodeMapper modelNodeMapper; |
| | | private DataItemMapper dataItemMapper; |
| | | |
| | | @Override |
| | | public BranchAnalysisVO getBranchAnalysisService(BranchAnalysisDTO dto) { |
| | | String timeType = dto.getTimeType(); |
| | | String dataTime = dto.getDataTime(); |
| | | Date beginTime = DateTimeUtil.getTime(timeType, dataTime); |
| | | DateTime endTime = null; |
| | | |
| | | List<ModelNodeIndexInfo> nodeIndexInfo = modelNodeMapper.getModelNodeIndexIdByNodeId(dto.getNodeId(), dto.getEnergyType()); |
| | | List<String> indexlist = nodeIndexInfo.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toList()); |
| | | |
| | | if (ObjectUtil.isEmpty(indexlist)) { |
| | | return new BranchAnalysisVO(); |
| | | } |
| | | |
| | | List<TypeTime> dateTimeList; |
| | | //æ ¹æ®æ¶é´ç±»åè°æ´æ¶é´èå´ |
| | | switch (dto.getTimeType()) { |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | timeType = TimeTypeConst.TIME_TYPE_HOUR; |
| | | endTime = DateUtil.endOfDay(beginTime); |
| | | dateTimeList = DateTimeUtil.getDateTimeListSame(TimeTypeConst.TIME_TYPE_DAY, beginTime); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | timeType = TimeTypeConst.TIME_TYPE_DAY; |
| | | endTime = DateUtil.endOfMonth(beginTime); |
| | | dateTimeList = DateTimeUtil.getDateTimeListSame(TimeTypeConst.TIME_TYPE_MONTH, beginTime); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_YEAR: |
| | | timeType = TimeTypeConst.TIME_TYPE_MONTH; |
| | | endTime = DateUtil.endOfYear(beginTime); |
| | | dateTimeList = DateTimeUtil.getDateTimeListSame(TimeTypeConst.TIME_TYPE_YEAR, beginTime); |
| | | break; |
| | | default: |
| | | throw new ServiceException("æ¶é´æ ¼å¼é误"); |
| | | } |
| | | BranchAnalysisVO vo = new BranchAnalysisVO(); |
| | | if (ObjectUtil.isEmpty(indexlist)) { |
| | | return vo; |
| | | } |
| | | List<DataItem> dataItemlist = dataItemMapper.getDataItemTimeRangeInforByIndexIds(beginTime, endTime, timeType, indexlist); |
| | | |
| | | double sum = dataItemlist.stream().mapToDouble(DataItem::getValue).sum(); |
| | | vo.setTotal(sum); |
| | | vo.setNodeId(dto.getNodeId()); |
| | | vo.setNodeName(nodeIndexInfo.get(0).getName()); |
| | | Map<Date, List<DataItem>> dateListMap = dataItemlist.stream().collect(Collectors.groupingBy(DataItem::getDataTime)); |
| | | |
| | | List<DataItem> results = new ArrayList<>(); |
| | | dateListMap.forEach((key, value) -> { |
| | | DataItem dataItem = new DataItem(); |
| | | dataItem.setDataTime(key); |
| | | //ä¿çåä½å°æ° |
| | | double totalValue = value.stream().map(data -> BigDecimal.valueOf(data.getValue())) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add).setScale(4, RoundingMode.HALF_UP).doubleValue(); |
| | | dataItem.setValue(totalValue); |
| | | results.add(dataItem); |
| | | }); |
| | | //æ ¹æ®æ¶é´æåº |
| | | results.sort(Comparator.comparing(DataItem::getDataTime)); |
| | | for (int i = 0; i < dateTimeList.size(); i++) { |
| | | TypeTime typeTime = dateTimeList.get(i); |
| | | Optional<DataItem> dataItem = results.stream().filter(result -> result.getDataTime().equals(typeTime.getDateTime())).findFirst(); |
| | | if (dataItem.isPresent()) { |
| | | DataItem item = dataItem.get(); |
| | | PropUtils.setValue(vo, "value" + i, item.getValue()); |
| | | } else { |
| | | PropUtils.setValue(vo, "value" + i, null); |
| | | } |
| | | } |
| | | return vo; |
| | | } |
| | | } |
| | |
| | | |
| | | // è®¡ç®æ¯ç§è½æºçå½åå¼åå»å¹´çå¼ |
| | | for (String s : energyType) { |
| | | final double value = getValues(energyMap, upCarbonEmission,energyType); |
| | | final double lastYearValueNum = getValues(energyMap, upLastCarbonEmission,energyType); |
| | | final double value = getValues(energyMap, upCarbonEmission, s); |
| | | final double lastYearValueNum = getValues(energyMap, upLastCarbonEmission, s); |
| | | allValue += value; |
| | | allLastValue += lastYearValueNum; |
| | | final CarbonEmissionRankVO carbonEmissionRankVO = new CarbonEmissionRankVO(); |
| | |
| | | } |
| | | |
| | | |
| | | public static double getValues(Map<String, SysEnergy> energyMap, List<CarbonEmission> carbonEmissions,List<String> energyType) { |
| | | public static double getValues(Map<String, SysEnergy> energyMap, List<CarbonEmission> carbonEmissions, List<String> energyTypeList) { |
| | | if (CollectionUtils.isEmpty(carbonEmissions)) { |
| | | return 0.0; |
| | | } |
| | | |
| | | // åå§åæ»å¼ |
| | | double allValue = 0.0; |
| | | |
| | | // æè½æºIDåç» |
| | | final Map<String, List<CarbonEmission>> energyValueMap = carbonEmissions.stream() |
| | | .collect(Collectors.groupingBy(CarbonEmission::getEnergyId)); |
| | | // final List<String> energyType = sysEnergies.stream().map(SysEnergy::getEnersno).collect(Collectors.toList()); |
| | | |
| | | for (String energyType : energyTypeList) { |
| | | // è®¡ç®æ¯ç§è½æºçå½åå¼ |
| | | for (String s : energyType) { |
| | | SysEnergy sysEnergy = energyMap.get(s); |
| | | SysEnergy sysEnergy = energyMap.get(energyType); |
| | | |
| | | // ç¡®ä¿è½æºåå¨ä¸ç³»æ°ä¸ä¸ºç©º |
| | | if (sysEnergy == null || sysEnergy.getCoefficient() == null) { |
| | | throw new RuntimeException("è·åç¢³ææ¾è½¬æ¢çæ¶åºé: ç³»ç»è½æºæ°æ®ä¸ä¸åå¨æç³»æ°ä¸ºç©º" + s + "è½æºç±»å"); |
| | | throw new RuntimeException("è·åç¢³ææ¾è½¬æ¢çæ¶åºé: ç³»ç»è½æºæ°æ®ä¸ä¸åå¨æç³»æ°ä¸ºç©º" + energyType + "è½æºç±»å"); |
| | | } |
| | | |
| | | // è·å对åºè½æºçå¼ |
| | | double value = energyValueMap.getOrDefault(s, Collections.emptyList()).stream() |
| | | double value = energyValueMap.getOrDefault(energyType, Collections.emptyList()).stream() |
| | | .mapToDouble(CarbonEmission::getValue) |
| | | .sum(); |
| | | |
| | | // ç´æ¥è®¡ç®æ»å¼ï¼é¿å
åä½çè½¬æ¢ |
| | | allValue += sysEnergy.getCoefficient().doubleValue() * value; |
| | | } |
| | | // æ ¼å¼åæç»ç»æ |
| | | return Double.parseDouble(new DecimalFormat("#.00").format(allValue)); |
| | | } |
| | | |
| | | public static double getValues(Map<String, SysEnergy> energyMap, List<CarbonEmission> carbonEmissions, String energyType) { |
| | | if (CollectionUtils.isEmpty(carbonEmissions)) { |
| | | return 0.0; |
| | | } |
| | | // åå§åæ»å¼ |
| | | double allValue = 0.0; |
| | | // æè½æºIDåç» |
| | | final Map<String, List<CarbonEmission>> energyValueMap = carbonEmissions.stream() |
| | | .collect(Collectors.groupingBy(CarbonEmission::getEnergyId)); |
| | | // è®¡ç®æ¯ç§è½æºçå½åå¼ |
| | | SysEnergy sysEnergy = energyMap.get(energyType); |
| | | |
| | | // ç¡®ä¿è½æºåå¨ä¸ç³»æ°ä¸ä¸ºç©º |
| | | if (sysEnergy == null || sysEnergy.getCoefficient() == null) { |
| | | throw new RuntimeException("è·åç¢³ææ¾è½¬æ¢çæ¶åºé: ç³»ç»è½æºæ°æ®ä¸ä¸åå¨æç³»æ°ä¸ºç©º" + energyType + "è½æºç±»å"); |
| | | } |
| | | |
| | | // è·å对åºè½æºçå¼ |
| | | double value = energyValueMap.getOrDefault(energyType, Collections.emptyList()).stream() |
| | | .mapToDouble(CarbonEmission::getValue) |
| | | .sum(); |
| | | |
| | | // ç´æ¥è®¡ç®æ»å¼ï¼é¿å
åä½çè½¬æ¢ |
| | | allValue += sysEnergy.getCoefficient().doubleValue() * value; |
| | | |
| | | // æ ¼å¼åæç»ç»æ |
| | | return Double.parseDouble(new DecimalFormat("#.00").format(allValue)); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.comprehensivestatistics.domain; |
| | | |
| | | |
| | | import com.zhitan.common.annotation.Excel; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * |
| | | * @author sys |
| | | * @date 2020-03-25 |
| | | */ |
| | | public class DailyReport implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | private String indexId; |
| | | @Excel(name = "ææ åç§°") |
| | | private String indexName; |
| | | private String value; |
| | | private Date dataTime; |
| | | private String timeType; |
| | | @Excel(name = "0æ¶") |
| | | private Double value0; |
| | | @Excel(name = "1æ¶") |
| | | private Double value1; |
| | | @Excel(name = "2æ¶") |
| | | private Double value2; |
| | | @Excel(name = "3æ¶") |
| | | private Double value3; |
| | | @Excel(name = "4æ¶") |
| | | private Double value4; |
| | | @Excel(name = "5æ¶") |
| | | private Double value5; |
| | | @Excel(name = "6æ¶") |
| | | private Double value6; |
| | | @Excel(name = "7æ¶") |
| | | private Double value7; |
| | | @Excel(name = "8æ¶") |
| | | private Double value8; |
| | | @Excel(name = "9æ¶") |
| | | private Double value9; |
| | | @Excel(name = "10æ¶") |
| | | private Double value10; |
| | | @Excel(name = "11æ¶") |
| | | private Double value11; |
| | | @Excel(name = "12æ¶") |
| | | private Double value12; |
| | | @Excel(name = "13æ¶") |
| | | private Double value13; |
| | | @Excel(name = "14æ¶") |
| | | private Double value14; |
| | | @Excel(name = "15æ¶") |
| | | private Double value15; |
| | | @Excel(name = "16æ¶") |
| | | private Double value16; |
| | | @Excel(name = "17æ¶") |
| | | private Double value17; |
| | | @Excel(name = "18æ¶") |
| | | private Double value18; |
| | | @Excel(name = "19æ¶") |
| | | private Double value19; |
| | | @Excel(name = "20æ¶") |
| | | private Double value20; |
| | | @Excel(name = "21æ¶") |
| | | private Double value21; |
| | | @Excel(name = "22æ¶") |
| | | private Double value22; |
| | | @Excel(name = "23æ¶") |
| | | private Double value23; |
| | | private List<Map> tablehead =new ArrayList<>(); |
| | | private List<DailyReport> tabledata =new ArrayList<>(); |
| | | public String getIndexId() { |
| | | return indexId; |
| | | } |
| | | |
| | | public void setIndexId(String indexId) { |
| | | this.indexId = indexId; |
| | | } |
| | | |
| | | public String getIndexName() { |
| | | return indexName; |
| | | } |
| | | |
| | | public void setIndexName(String indexName) { |
| | | this.indexName = indexName; |
| | | } |
| | | |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public void setValue(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | public String getTimeType() { |
| | | return timeType; |
| | | } |
| | | |
| | | public void setTimeType(String timeType) { |
| | | this.timeType = timeType; |
| | | } |
| | | |
| | | public Date getDataTime() { |
| | | return dataTime; |
| | | } |
| | | |
| | | public void setDataTime(Date dataTime) { |
| | | this.dataTime = dataTime; |
| | | } |
| | | |
| | | public Double getValue1() { |
| | | return value1; |
| | | } |
| | | |
| | | public void setValue1(Double value1) { |
| | | this.value1 = value1; |
| | | } |
| | | |
| | | public Double getValue2() { |
| | | return value2; |
| | | } |
| | | |
| | | public void setValue2(Double value2) { |
| | | this.value2 = value2; |
| | | } |
| | | |
| | | public Double getValue3() { |
| | | return value3; |
| | | } |
| | | |
| | | public void setValue3(Double value3) { |
| | | this.value3 = value3; |
| | | } |
| | | |
| | | public Double getValue4() { |
| | | return value4; |
| | | } |
| | | |
| | | public void setValue4(Double value4) { |
| | | this.value4 = value4; |
| | | } |
| | | |
| | | public Double getValue5() { |
| | | return value5; |
| | | } |
| | | |
| | | public void setValue5(Double value5) { |
| | | this.value5 = value5; |
| | | } |
| | | |
| | | public Double getValue6() { |
| | | return value6; |
| | | } |
| | | |
| | | public void setValue6(Double value6) { |
| | | this.value6 = value6; |
| | | } |
| | | |
| | | public Double getValue7() { |
| | | return value7; |
| | | } |
| | | |
| | | public void setValue7(Double value7) { |
| | | this.value7 = value7; |
| | | } |
| | | |
| | | public Double getValue8() { |
| | | return value8; |
| | | } |
| | | |
| | | public void setValue8(Double value8) { |
| | | this.value8 = value8; |
| | | } |
| | | |
| | | public Double getValue9() { |
| | | return value9; |
| | | } |
| | | |
| | | public void setValue9(Double value9) { |
| | | this.value9 = value9; |
| | | } |
| | | |
| | | public Double getValue10() { |
| | | return value10; |
| | | } |
| | | |
| | | public void setValue10(Double value10) { |
| | | this.value10 = value10; |
| | | } |
| | | |
| | | public Double getValue11() { |
| | | return value11; |
| | | } |
| | | |
| | | public void setValue11(Double value11) { |
| | | this.value11 = value11; |
| | | } |
| | | |
| | | public Double getValue12() { |
| | | return value12; |
| | | } |
| | | |
| | | public void setValue12(Double value12) { |
| | | this.value12 = value12; |
| | | } |
| | | |
| | | public Double getValue13() { |
| | | return value13; |
| | | } |
| | | |
| | | public void setValue13(Double value13) { |
| | | this.value13 = value13; |
| | | } |
| | | |
| | | public Double getValue14() { |
| | | return value14; |
| | | } |
| | | |
| | | public void setValue14(Double value14) { |
| | | this.value14 = value14; |
| | | } |
| | | |
| | | public Double getValue15() { |
| | | return value15; |
| | | } |
| | | |
| | | public void setValue15(Double value15) { |
| | | this.value15 = value15; |
| | | } |
| | | |
| | | public Double getValue16() { |
| | | return value16; |
| | | } |
| | | |
| | | public void setValue16(Double value16) { |
| | | this.value16 = value16; |
| | | } |
| | | |
| | | public Double getValue17() { |
| | | return value17; |
| | | } |
| | | |
| | | public void setValue17(Double value17) { |
| | | this.value17 = value17; |
| | | } |
| | | |
| | | public Double getValue18() { |
| | | return value18; |
| | | } |
| | | |
| | | public void setValue18(Double value18) { |
| | | this.value18 = value18; |
| | | } |
| | | |
| | | public Double getValue19() { |
| | | return value19; |
| | | } |
| | | |
| | | public void setValue19(Double value19) { |
| | | this.value19 = value19; |
| | | } |
| | | |
| | | public Double getValue20() { |
| | | return value20; |
| | | } |
| | | |
| | | public void setValue20(Double value20) { |
| | | this.value20 = value20; |
| | | } |
| | | |
| | | public Double getValue21() { |
| | | return value21; |
| | | } |
| | | |
| | | public void setValue21(Double value21) { |
| | | this.value21 = value21; |
| | | } |
| | | |
| | | public Double getValue22() { |
| | | return value22; |
| | | } |
| | | |
| | | public void setValue22(Double value22) { |
| | | this.value22 = value22; |
| | | } |
| | | |
| | | public Double getValue23() { |
| | | return value23; |
| | | } |
| | | |
| | | public void setValue23(Double value23) { |
| | | this.value23 = value23; |
| | | } |
| | | |
| | | public Double getValue0() { |
| | | return value0; |
| | | } |
| | | |
| | | public void setValue0(Double value0) { |
| | | this.value0 = value0; |
| | | } |
| | | |
| | | public List<Map> getTablehead() { |
| | | return tablehead; |
| | | } |
| | | |
| | | public void setTablehead(List<Map> tablehead) { |
| | | this.tablehead = tablehead; |
| | | } |
| | | public List<DailyReport> getTabledata() { |
| | | return tabledata; |
| | | } |
| | | |
| | | public void setTabledata(List<DailyReport> tabledata) { |
| | | this.tabledata = tabledata; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.comprehensivestatistics.domain; |
| | | |
| | | import com.zhitan.common.annotation.Excel; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * |
| | | * @author sys |
| | | * @date 2020-12-31 |
| | | */ |
| | | public class MonthlyComprehensive implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | private String indexId; |
| | | @Excel(name = "ææ åç§°") |
| | | private String indexName; |
| | | private String value; |
| | | private Date dataTime; |
| | | private String timeType; |
| | | private String unitId; |
| | | @Excel(name = "1æ¥") |
| | | private Double value1; |
| | | @Excel(name = "2æ¥") |
| | | private Double value2; |
| | | @Excel(name = "3æ¥") |
| | | private Double value3; |
| | | @Excel(name = "4æ¥") |
| | | private Double value4; |
| | | @Excel(name = "5æ¥") |
| | | private Double value5; |
| | | @Excel(name = "6æ¥") |
| | | private Double value6; |
| | | @Excel(name = "7æ¥") |
| | | private Double value7; |
| | | @Excel(name = "8æ¥") |
| | | private Double value8; |
| | | @Excel(name = "9æ¥") |
| | | private Double value9; |
| | | @Excel(name = "10æ¥") |
| | | private Double value10; |
| | | @Excel(name = "11æ¥") |
| | | private Double value11; |
| | | @Excel(name = "12æ¥") |
| | | private Double value12; |
| | | @Excel(name = "13æ¥") |
| | | private Double value13; |
| | | @Excel(name = "14æ¥") |
| | | private Double value14; |
| | | @Excel(name = "15æ¥") |
| | | private Double value15; |
| | | @Excel(name = "16æ¥") |
| | | private Double value16; |
| | | @Excel(name = "17æ¥") |
| | | private Double value17; |
| | | @Excel(name = "18æ¥") |
| | | private Double value18; |
| | | @Excel(name = "19æ¥") |
| | | private Double value19; |
| | | @Excel(name = "20æ¥") |
| | | private Double value20; |
| | | @Excel(name = "21æ¥") |
| | | private Double value21; |
| | | @Excel(name = "22æ¥") |
| | | private Double value22; |
| | | @Excel(name = "23æ¥") |
| | | private Double value23; |
| | | @Excel(name = "24æ¥") |
| | | private Double value24; |
| | | @Excel(name = "25æ¥") |
| | | private Double value25; |
| | | @Excel(name = "26æ¥") |
| | | private Double value26; |
| | | @Excel(name = "27æ¥") |
| | | private Double value27; |
| | | @Excel(name = "28æ¥") |
| | | private Double value28; |
| | | @Excel(name = "29æ¥") |
| | | private Double value29; |
| | | @Excel(name = "30æ¥") |
| | | private Double value30; |
| | | @Excel(name = "31æ¥") |
| | | private Double value31; |
| | | private String timeCode; |
| | | private Integer count; |
| | | private List<Map> tablehead =new ArrayList<>(); |
| | | private List<MonthlyComprehensive> tabledata =new ArrayList<>(); |
| | | public String getIndexId() { |
| | | return indexId; |
| | | } |
| | | |
| | | public void setIndexId(String indexId) { |
| | | this.indexId = indexId; |
| | | } |
| | | |
| | | public String getIndexName() { |
| | | return indexName; |
| | | } |
| | | |
| | | public void setIndexName(String indexName) { |
| | | this.indexName = indexName; |
| | | } |
| | | public String getUnitId() { |
| | | return unitId; |
| | | } |
| | | |
| | | public void setUnitId(String unitId) { |
| | | this.unitId = unitId; |
| | | } |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public void setValue(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | public String getTimeType() { |
| | | return timeType; |
| | | } |
| | | |
| | | public void setTimeType(String timeType) { |
| | | this.timeType = timeType; |
| | | } |
| | | |
| | | public Date getDataTime() { |
| | | return dataTime; |
| | | } |
| | | |
| | | public void setDataTime(Date dataTime) { |
| | | this.dataTime = dataTime; |
| | | } |
| | | |
| | | public Double getValue1() { |
| | | return value1; |
| | | } |
| | | |
| | | public void setValue1(Double value1) { |
| | | this.value1 = value1; |
| | | } |
| | | |
| | | public Double getValue2() { |
| | | return value2; |
| | | } |
| | | |
| | | public void setValue2(Double value2) { |
| | | this.value2 = value2; |
| | | } |
| | | |
| | | public Double getValue3() { |
| | | return value3; |
| | | } |
| | | |
| | | public void setValue3(Double value3) { |
| | | this.value3 = value3; |
| | | } |
| | | |
| | | public Double getValue4() { |
| | | return value4; |
| | | } |
| | | |
| | | public void setValue4(Double value4) { |
| | | this.value4 = value4; |
| | | } |
| | | |
| | | public Double getValue5() { |
| | | return value5; |
| | | } |
| | | |
| | | public void setValue5(Double value5) { |
| | | this.value5 = value5; |
| | | } |
| | | |
| | | public Double getValue6() { |
| | | return value6; |
| | | } |
| | | |
| | | public void setValue6(Double value6) { |
| | | this.value6 = value6; |
| | | } |
| | | |
| | | public Double getValue7() { |
| | | return value7; |
| | | } |
| | | |
| | | public void setValue7(Double value7) { |
| | | this.value7 = value7; |
| | | } |
| | | |
| | | public Double getValue8() { |
| | | return value8; |
| | | } |
| | | |
| | | public void setValue8(Double value8) { |
| | | this.value8 = value8; |
| | | } |
| | | |
| | | public Double getValue9() { |
| | | return value9; |
| | | } |
| | | |
| | | public void setValue9(Double value9) { |
| | | this.value9 = value9; |
| | | } |
| | | |
| | | public Double getValue10() { |
| | | return value10; |
| | | } |
| | | |
| | | public void setValue10(Double value10) { |
| | | this.value10 = value10; |
| | | } |
| | | |
| | | public Double getValue11() { |
| | | return value11; |
| | | } |
| | | |
| | | public void setValue11(Double value11) { |
| | | this.value11 = value11; |
| | | } |
| | | |
| | | public Double getValue12() { |
| | | return value12; |
| | | } |
| | | |
| | | public void setValue12(Double value12) { |
| | | this.value12 = value12; |
| | | } |
| | | |
| | | public Double getValue13() { |
| | | return value13; |
| | | } |
| | | |
| | | public void setValue13(Double value13) { |
| | | this.value13 = value13; |
| | | } |
| | | |
| | | public Double getValue14() { |
| | | return value14; |
| | | } |
| | | |
| | | public void setValue14(Double value14) { |
| | | this.value14 = value14; |
| | | } |
| | | |
| | | public Double getValue15() { |
| | | return value15; |
| | | } |
| | | |
| | | public void setValue15(Double value15) { |
| | | this.value15 = value15; |
| | | } |
| | | |
| | | public Double getValue16() { |
| | | return value16; |
| | | } |
| | | |
| | | public void setValue16(Double value16) { |
| | | this.value16 = value16; |
| | | } |
| | | |
| | | public Double getValue17() { |
| | | return value17; |
| | | } |
| | | |
| | | public void setValue17(Double value17) { |
| | | this.value17 = value17; |
| | | } |
| | | |
| | | public Double getValue18() { |
| | | return value18; |
| | | } |
| | | |
| | | public void setValue18(Double value18) { |
| | | this.value18 = value18; |
| | | } |
| | | |
| | | public Double getValue19() { |
| | | return value19; |
| | | } |
| | | |
| | | public void setValue19(Double value19) { |
| | | this.value19 = value19; |
| | | } |
| | | |
| | | public Double getValue20() { |
| | | return value20; |
| | | } |
| | | |
| | | public void setValue20(Double value20) { |
| | | this.value20 = value20; |
| | | } |
| | | |
| | | public Double getValue21() { |
| | | return value21; |
| | | } |
| | | |
| | | public void setValue21(Double value21) { |
| | | this.value21 = value21; |
| | | } |
| | | |
| | | public Double getValue22() { |
| | | return value22; |
| | | } |
| | | |
| | | public void setValue22(Double value22) { |
| | | this.value22 = value22; |
| | | } |
| | | |
| | | public Double getValue23() { |
| | | return value23; |
| | | } |
| | | |
| | | public void setValue23(Double value23) { |
| | | this.value23 = value23; |
| | | } |
| | | |
| | | public Double getValue24() { |
| | | return value24; |
| | | } |
| | | |
| | | public void setValue24(Double value24) { |
| | | this.value24 = value24; |
| | | } |
| | | |
| | | public Double getValue25() { |
| | | return value25; |
| | | } |
| | | |
| | | public void setValue25(Double value25) { |
| | | this.value25 = value25; |
| | | } |
| | | |
| | | public Double getValue26() { |
| | | return value26; |
| | | } |
| | | |
| | | public void setValue26(Double value26) { |
| | | this.value26 = value26; |
| | | } |
| | | |
| | | public Double getValue27() { |
| | | return value27; |
| | | } |
| | | |
| | | public void setValue27(Double value27) { |
| | | this.value27 = value27; |
| | | } |
| | | |
| | | public Double getValue28() { |
| | | return value28; |
| | | } |
| | | |
| | | public void setValue28(Double value28) { |
| | | this.value28 = value28; |
| | | } |
| | | |
| | | public Double getValue29() { |
| | | return value29; |
| | | } |
| | | |
| | | public void setValue29(Double value29) { |
| | | this.value29 = value29; |
| | | } |
| | | |
| | | public Double getValue30() { |
| | | return value30; |
| | | } |
| | | |
| | | public void setValue30(Double value30) { |
| | | this.value30 = value30; |
| | | } |
| | | |
| | | public Double getValue31() { |
| | | return value31; |
| | | } |
| | | |
| | | public void setValue31(Double value31) { |
| | | this.value31 = value31; |
| | | } |
| | | |
| | | public List<Map> getTablehead() { |
| | | return tablehead; |
| | | } |
| | | |
| | | public void setTablehead(List<Map> tablehead) { |
| | | this.tablehead = tablehead; |
| | | } |
| | | public List<MonthlyComprehensive> getTabledata() { |
| | | return tabledata; |
| | | } |
| | | |
| | | public void setTabledata(List<MonthlyComprehensive> tabledata) { |
| | | this.tabledata = tabledata; |
| | | } |
| | | |
| | | public String getTimeCode() { |
| | | return timeCode; |
| | | } |
| | | |
| | | public void setTimeCode(String timeCode) { |
| | | this.timeCode = timeCode; |
| | | } |
| | | |
| | | public Integer getCount() { |
| | | return count; |
| | | } |
| | | |
| | | public void setCount(Integer count) { |
| | | this.count = count; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.comprehensivestatistics.domain; |
| | | |
| | | import com.zhitan.common.annotation.Excel; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * |
| | | * @author sys |
| | | * @date 2020-03-25 |
| | | */ |
| | | public class YearComperhensive implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | private String indexId; |
| | | @Excel(name = "ææ åç§°") |
| | | private String indexName; |
| | | private String value; |
| | | private Date dataTime; |
| | | private String timeType; |
| | | private String unitId; |
| | | @Excel(name = "1æ") |
| | | private Double value1; |
| | | @Excel(name = "2æ") |
| | | private Double value2; |
| | | @Excel(name = "3æ") |
| | | private Double value3; |
| | | @Excel(name = "4æ") |
| | | private Double value4; |
| | | @Excel(name = "5æ") |
| | | private Double value5; |
| | | @Excel(name = "6æ") |
| | | private Double value6; |
| | | @Excel(name = "7æ") |
| | | private Double value7; |
| | | @Excel(name = "8æ") |
| | | private Double value8; |
| | | @Excel(name = "9æ") |
| | | private Double value9; |
| | | @Excel(name = "10æ") |
| | | private Double value10; |
| | | @Excel(name = "11æ") |
| | | private Double value11; |
| | | @Excel(name = "12æ") |
| | | private Double value12; |
| | | private String timeCode; |
| | | private List<Map> tablehead =new ArrayList<>(); |
| | | private List<DailyReport> tabledata =new ArrayList<>(); |
| | | public String getIndexId() { |
| | | return indexId; |
| | | } |
| | | |
| | | public void setIndexId(String indexId) { |
| | | this.indexId = indexId; |
| | | } |
| | | |
| | | public String getIndexName() { |
| | | return indexName; |
| | | } |
| | | |
| | | public void setIndexName(String indexName) { |
| | | this.indexName = indexName; |
| | | } |
| | | public String getUnitId() { |
| | | return unitId; |
| | | } |
| | | |
| | | public void setUnitId(String unitId) { |
| | | this.unitId = unitId; |
| | | } |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public void setValue(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | public String getTimeType() { |
| | | return timeType; |
| | | } |
| | | |
| | | public void setTimeType(String timeType) { |
| | | this.timeType = timeType; |
| | | } |
| | | |
| | | public Date getDataTime() { |
| | | return dataTime; |
| | | } |
| | | |
| | | public void setDataTime(Date dataTime) { |
| | | this.dataTime = dataTime; |
| | | } |
| | | |
| | | public Double getValue1() { |
| | | return value1; |
| | | } |
| | | |
| | | public void setValue1(Double value1) { |
| | | this.value1 = value1; |
| | | } |
| | | |
| | | public Double getValue2() { |
| | | return value2; |
| | | } |
| | | |
| | | public void setValue2(Double value2) { |
| | | this.value2 = value2; |
| | | } |
| | | |
| | | public Double getValue3() { |
| | | return value3; |
| | | } |
| | | |
| | | public void setValue3(Double value3) { |
| | | this.value3 = value3; |
| | | } |
| | | |
| | | public Double getValue4() { |
| | | return value4; |
| | | } |
| | | |
| | | public void setValue4(Double value4) { |
| | | this.value4 = value4; |
| | | } |
| | | |
| | | public Double getValue5() { |
| | | return value5; |
| | | } |
| | | |
| | | public void setValue5(Double value5) { |
| | | this.value5 = value5; |
| | | } |
| | | |
| | | public Double getValue6() { |
| | | return value6; |
| | | } |
| | | |
| | | public void setValue6(Double value6) { |
| | | this.value6 = value6; |
| | | } |
| | | |
| | | public Double getValue7() { |
| | | return value7; |
| | | } |
| | | |
| | | public void setValue7(Double value7) { |
| | | this.value7 = value7; |
| | | } |
| | | |
| | | public Double getValue8() { |
| | | return value8; |
| | | } |
| | | |
| | | public void setValue8(Double value8) { |
| | | this.value8 = value8; |
| | | } |
| | | |
| | | public Double getValue9() { |
| | | return value9; |
| | | } |
| | | |
| | | public void setValue9(Double value9) { |
| | | this.value9 = value9; |
| | | } |
| | | |
| | | public Double getValue10() { |
| | | return value10; |
| | | } |
| | | |
| | | public void setValue10(Double value10) { |
| | | this.value10 = value10; |
| | | } |
| | | |
| | | public Double getValue11() { |
| | | return value11; |
| | | } |
| | | |
| | | public void setValue11(Double value11) { |
| | | this.value11 = value11; |
| | | } |
| | | |
| | | public Double getValue12() { |
| | | return value12; |
| | | } |
| | | |
| | | public void setValue12(Double value12) { |
| | | this.value12 = value12; |
| | | } |
| | | public String getTimeCode() { |
| | | return timeCode; |
| | | } |
| | | |
| | | public void setTimeCode(String timeCode) { |
| | | this.timeCode = timeCode; |
| | | } |
| | | public List<Map> getTablehead() { |
| | | return tablehead; |
| | | } |
| | | |
| | | public void setTablehead(List<Map> tablehead) { |
| | | this.tablehead = tablehead; |
| | | } |
| | | public List<DailyReport> getTabledata() { |
| | | return tabledata; |
| | | } |
| | | |
| | | public void setTabledata(List<DailyReport> tabledata) { |
| | | this.tabledata = tabledata; |
| | | } |
| | | } |
| | |
| | | package com.zhitan.comprehensivestatistics.mapper; |
| | | |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.comprehensivestatistics.domain.DailyComprehensive; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | @Param("dataList") List<DailyComprehensive> dataList, |
| | | @Param("beginTime") Date beginTime, |
| | | @Param("endTime") Date endTime, |
| | | @Param("timeType") TimeType timeType, |
| | | @Param("timeType") String timeType, |
| | | @Param("indexStorageId") String indexStorageId); |
| | | |
| | | List<DailyComprehensive> getListChart(@Param("indexId") String indexId, |
| | | @Param("beginTime") Date beginTime, |
| | | @Param("endTime") Date endTime, |
| | | @Param("timeType") TimeType timeType, |
| | | @Param("timeType") String timeType, |
| | | @Param("indexStorageId") String indexStorageId); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.comprehensivestatistics.mapper; |
| | | |
| | | import com.zhitan.comprehensivestatistics.domain.MonthlyComprehensive; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å
¨å综åè½èç»è®¡ æ |
| | | * |
| | | * @author sys |
| | | * @date 2020-03-25 |
| | | */ |
| | | public interface MonthlyComprehensiveMapper { |
| | | /** |
| | | * è·åç»¼åææ åæï¼æï¼å表 |
| | | * |
| | | * @param nodeId |
| | | * @param dataList |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @param indexStorageId |
| | | * @return |
| | | */ |
| | | public List<MonthlyComprehensive> getMonthlyComprehensiveList(@Param("nodeId") String nodeId, |
| | | @Param("dataList") List<MonthlyComprehensive> dataList, |
| | | @Param("beginTime") Date beginTime, |
| | | @Param("endTime") Date endTime, |
| | | @Param("timeType") String timeType, |
| | | @Param("indexStorageId") String indexStorageId); |
| | | |
| | | /** |
| | | * è·åç»¼åææ åæå¾è¡¨ï¼æï¼æ°æ® |
| | | * |
| | | * @param indexId |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @param indexStorageId |
| | | * @return |
| | | */ |
| | | List<MonthlyComprehensive> getListChart(@Param("indexId") String indexId, |
| | | @Param("beginTime") Date beginTime, |
| | | @Param("endTime") Date endTime, |
| | | @Param("timeType") String timeType, |
| | | @Param("indexStorageId") String indexStorageId); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.comprehensivestatistics.mapper; |
| | | |
| | | import com.zhitan.comprehensivestatistics.domain.YearComperhensive; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å
¨å综åè½èç»è®¡ å¹´ |
| | | * |
| | | * @author sys |
| | | * @date 2020-03-25 |
| | | */ |
| | | public interface YearComprehensiveMapper { |
| | | /** |
| | | * è·åå¹´æ°æ® |
| | | * |
| | | * @param nodeId |
| | | * @param dataList |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @param indexStorageId |
| | | * @return |
| | | */ |
| | | public List<YearComperhensive> getYearComprehensiveList(@Param("nodeId") String nodeId, |
| | | @Param("dataList") List<YearComperhensive> dataList, |
| | | @Param("beginTime") Date beginTime, |
| | | @Param("endTime") Date endTime, |
| | | @Param("timeType") String timeType, |
| | | @Param("indexStorageId") String indexStorageId); |
| | | |
| | | /** |
| | | * è·åå¹´æ°æ®-chart |
| | | * |
| | | * @param indexId |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @param indexStorageId |
| | | * @return |
| | | */ |
| | | List<YearComperhensive> getListChart(@Param("indexId") String indexId, |
| | | @Param("beginTime") Date beginTime, |
| | | @Param("endTime") Date endTime, |
| | | @Param("timeType") String timeType, |
| | | @Param("indexStorageId") String indexStorageId); |
| | | |
| | | } |
| | |
| | | package com.zhitan.comprehensivestatistics.service; |
| | | |
| | | |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.comprehensivestatistics.domain.DailyComprehensive; |
| | | |
| | | import java.util.Date; |
| | |
| | | * @date 2020-03-25 |
| | | */ |
| | | public interface IDailyComprehensiveService { |
| | | public List<DailyComprehensive> getDailyComprehensiveList(String nodeId, List<DailyComprehensive> dataList, Date beginTime, Date endTime, TimeType timeType, String indexStorageId); |
| | | List<DailyComprehensive> getListChart(String indexId, Date beginTime, Date endTime, TimeType timeType, String indexStorageId); |
| | | public List<DailyComprehensive> getDailyComprehensiveList(String nodeId, List<DailyComprehensive> dataList, Date beginTime, Date endTime, String timeType, String indexStorageId); |
| | | List<DailyComprehensive> getListChart(String indexId, Date beginTime, Date endTime, String timeType, String indexStorageId); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.comprehensivestatistics.service; |
| | | |
| | | |
| | | import com.zhitan.comprehensivestatistics.domain.MonthlyComprehensive; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å
¨å综åè½èç»è®¡ æ |
| | | * |
| | | * @author sys |
| | | * @date 2020-03-25 |
| | | */ |
| | | public interface ImonthlyComprehensive { |
| | | /** |
| | | * å
¨å综åè½èç»è®¡ æ |
| | | * |
| | | * @param nodeId |
| | | * @param dataList |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @param indexStorageId |
| | | * @return |
| | | */ |
| | | List<MonthlyComprehensive> getMonthlyComprehensiveList(String nodeId, List<MonthlyComprehensive> dataList, Date beginTime, Date endTime, String timeType, String indexStorageId); |
| | | |
| | | /** |
| | | * å
¨å综åè½èç»è®¡ æ |
| | | * |
| | | * @param indexId |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @param indexStorageId |
| | | * @return |
| | | */ |
| | | List<MonthlyComprehensive> getListChart(String indexId, Date beginTime, Date endTime, String timeType, String indexStorageId); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.comprehensivestatistics.service; |
| | | |
| | | |
| | | import com.zhitan.comprehensivestatistics.domain.YearComperhensive; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å
¨å综åè½èç»è®¡ å¹´ |
| | | * |
| | | * @author sys |
| | | * @date 2020-03-25 |
| | | */ |
| | | public interface IyearComprehensive { |
| | | /** |
| | | * è·åç»¼åææ åæï¼å¹´ï¼å表 |
| | | * |
| | | * @param nodeId |
| | | * @param dataList |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @param indexStorageId |
| | | * @return |
| | | */ |
| | | List<YearComperhensive> getYearComprehensiveList(String nodeId, List<YearComperhensive> dataList, |
| | | Date beginTime, Date endTime, String timeType, String indexStorageId); |
| | | |
| | | /** |
| | | * è·åç»¼åææ åæï¼å¹´ï¼å¾è¡¨æ°æ® |
| | | * |
| | | * @param indexId |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @param indexStorageId |
| | | * @return |
| | | */ |
| | | List<YearComperhensive> getListChart(String indexId, Date beginTime, Date endTime, String timeType, String indexStorageId); |
| | | } |
| | |
| | | package com.zhitan.comprehensivestatistics.service.impl; |
| | | |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.comprehensivestatistics.domain.DailyComprehensive; |
| | | import com.zhitan.comprehensivestatistics.mapper.DailyComprehensiveMapper; |
| | | import com.zhitan.comprehensivestatistics.service.IDailyComprehensiveService; |
| | |
| | | private DailyComprehensiveMapper dailyMapper; |
| | | |
| | | public List<DailyComprehensive> getDailyComprehensiveList(String nodeId, List<DailyComprehensive> dataList, |
| | | Date beginTime, Date endTime, TimeType timeType, String indexStorageId){ |
| | | Date beginTime, Date endTime, String timeType, String indexStorageId){ |
| | | |
| | | if (StringUtils.isNotEmpty(nodeId)) { |
| | | return dailyMapper.getDailyComprehensiveList(nodeId, dataList, beginTime, endTime, timeType, indexStorageId); |
| | |
| | | return Collections.emptyList(); |
| | | } |
| | | @Override |
| | | public List<DailyComprehensive> getListChart(String indexId, Date beginTime, Date endTime, TimeType timeType, String indexStorageId){ |
| | | public List<DailyComprehensive> getListChart(String indexId, Date beginTime, Date endTime, String timeType, String indexStorageId){ |
| | | if (indexId != null && !indexId.isEmpty()) { |
| | | return dailyMapper.getListChart(indexId,beginTime,endTime,timeType,indexStorageId); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.comprehensivestatistics.service.impl; |
| | | |
| | | import com.zhitan.comprehensivestatistics.domain.MonthlyComprehensive; |
| | | import com.zhitan.comprehensivestatistics.mapper.MonthlyComprehensiveMapper; |
| | | import com.zhitan.comprehensivestatistics.service.ImonthlyComprehensive; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ä¸å¡å±å¤ç |
| | | * |
| | | * @author sys |
| | | * @date 2020-03-25 |
| | | */ |
| | | @Service |
| | | public class MonthlyComprehensiveServiceImpl implements ImonthlyComprehensive { |
| | | @Resource |
| | | private MonthlyComprehensiveMapper monthMapper; |
| | | |
| | | public List<MonthlyComprehensive> getMonthlyComprehensiveList(String nodeId, List<MonthlyComprehensive> dataList, |
| | | Date beginTime, Date endTime, String timeType, String indexStorageId){ |
| | | if (StringUtils.isNotEmpty(nodeId)) { |
| | | return monthMapper.getMonthlyComprehensiveList(nodeId, dataList, beginTime, endTime, timeType, indexStorageId); |
| | | } |
| | | return Collections.emptyList(); |
| | | } |
| | | |
| | | @Override |
| | | public List<MonthlyComprehensive> getListChart(String indexId, Date beginTime, Date endTime, String timeType, String indexStorageId){ |
| | | if (indexId != null && !indexId.isEmpty()) { |
| | | return monthMapper.getListChart(indexId,beginTime,endTime,timeType,indexStorageId); |
| | | } |
| | | return Collections.emptyList(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.comprehensivestatistics.service.impl; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.zhitan.common.constant.CommonConst; |
| | | import com.zhitan.common.utils.DateTimeUtil; |
| | | import com.zhitan.comprehensivestatistics.domain.YearComperhensive; |
| | | import com.zhitan.comprehensivestatistics.mapper.YearComprehensiveMapper; |
| | | import com.zhitan.comprehensivestatistics.service.IyearComprehensive; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * ä¸å¡å±å¤ç |
| | | * |
| | | * @author sys |
| | | * @date 2020-03-25 |
| | | */ |
| | | @Service |
| | | public class YearComprehensiveServiceImpl implements IyearComprehensive { |
| | | @Resource |
| | | private YearComprehensiveMapper yearMapper; |
| | | |
| | | @Override |
| | | public List<YearComperhensive> getYearComprehensiveList(String nodeId, List<YearComperhensive> dataList, |
| | | Date beginTime, Date endTime, String timeType, String indexStorageId){ |
| | | if (StringUtils.isNotEmpty(nodeId)) { |
| | | return yearMapper.getYearComprehensiveList(nodeId, dataList, beginTime, endTime, timeType, indexStorageId); |
| | | } |
| | | return Collections.emptyList(); |
| | | } |
| | | @Override |
| | | public List<YearComperhensive> getListChart(String indexId, Date beginTime, Date endTime, String timeType, String indexStorageId){ |
| | | List<YearComperhensive> dataList = new ArrayList<>(); |
| | | if (StringUtils.isNotEmpty(indexId)) { |
| | | List<YearComperhensive> listChart = yearMapper.getListChart(indexId, beginTime, endTime, timeType, indexStorageId); |
| | | if (CollectionUtils.isNotEmpty(listChart)) { |
| | | Date date = new Date(); |
| | | YearComperhensive first = listChart.get(CommonConst.DIGIT_0); |
| | | Map<String, YearComperhensive> listChartMap = yearMapper.getListChart(indexId, beginTime, endTime, timeType, indexStorageId) |
| | | .stream().collect(Collectors.toMap(YearComperhensive::getTimeCode, prot -> prot)); |
| | | while (beginTime.before(date)) { |
| | | YearComperhensive yearComperhensive = new YearComperhensive(); |
| | | String format = CommonConst.WORD_M + DateUtil.format(beginTime, DateTimeUtil.COMMON_PATTERN_MONTH); |
| | | YearComperhensive item = listChartMap.get(format); |
| | | if (ObjectUtils.isNotEmpty(item)) { |
| | | yearComperhensive = item; |
| | | } else { |
| | | yearComperhensive.setTimeCode(format); |
| | | yearComperhensive.setIndexId(indexId); |
| | | yearComperhensive.setTimeType(timeType); |
| | | yearComperhensive.setUnitId(first.getUnitId()); |
| | | yearComperhensive.setIndexName(first.getIndexName()); |
| | | } |
| | | dataList.add(yearComperhensive); |
| | | beginTime = DateUtil.offsetMonth(beginTime, CommonConst.DIGIT_1); |
| | | } |
| | | } |
| | | } |
| | | return dataList; |
| | | } |
| | | } |
| | |
| | | package com.zhitan.consumptionanalysis.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | @Getter |
| | | @Setter |
| | | @Data |
| | | public class RankingEnergyData { |
| | | |
| | | public String nodeId; |
| | | |
| | | public String nodeName; |
| | | public String energyTypeNo; |
| | | public String energyTypeName; |
| | |
| | | import com.zhitan.dataitem.service.IDataItemService; |
| | | import com.zhitan.energyIndicators.domain.EnergyIndicators; |
| | | import com.zhitan.energyIndicators.mapper.EnergyIndicatorsMapper; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfor; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfo; |
| | | import com.zhitan.model.mapper.ModelNodeMapper; |
| | | import com.zhitan.model.service.IModelNodeService; |
| | | import com.zhitan.productoutput.domain.ProductOutput; |
| | |
| | | /** |
| | | * æ¥è¯¢ç¹ä½ä¸ç¨è½åå
ä¿¡æ¯ |
| | | */ |
| | | List<ModelNodeIndexInfor> nodeIndexInforList = modelNodeMapper.getModelNodeIndexIdByNodeId(nodeId, energyType); |
| | | List<ModelNodeIndexInfo> nodeIndexInforList = modelNodeMapper.getModelNodeIndexIdByNodeId(nodeId, energyType); |
| | | |
| | | // if (CollectionUtils.isEmpty(nodeIndexInforList)) { |
| | | // return consumptionAnalysisVO; |
| | | // } |
| | | List<String> indexIds = nodeIndexInforList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | List<String> indexIds = nodeIndexInforList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toList()); |
| | | Date beginTime; |
| | | Date endTime; |
| | | Date lastTime; |
| | |
| | | final String parentId = dto.getNodeId(); |
| | | |
| | | //æ ¹æ®æ»ç»ç¹æ¥è¯¢ |
| | | final List<ModelNodeIndexInfor> nodeIndexInforList = modelNodeMapper.getModelNodeByParentId(parentId); |
| | | final List<ModelNodeIndexInfo> nodeIndexInforList = modelNodeMapper.getModelNodeByParentId(parentId); |
| | | |
| | | final List<String> eneryIdList = nodeIndexInforList.stream().map(ModelNodeIndexInfor::getEnergyId).distinct().collect(Collectors.toList()); |
| | | final List<String> eneryIdList = nodeIndexInforList.stream().map(ModelNodeIndexInfo::getEnergyId).distinct().collect(Collectors.toList()); |
| | | final LambdaQueryWrapper<SysEnergy> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(CollectionUtils.isNotEmpty(eneryIdList), SysEnergy::getEnersno, eneryIdList); |
| | | final List<SysEnergy> sysEnergies = sysEnergyMapper.selectList(queryWrapper); |
| | |
| | | }); |
| | | |
| | | // æç
§ç¹ä½è¿è¡åç» |
| | | Map<String, List<ModelNodeIndexInfor>> nodeIndexMap = nodeIndexInforList.stream().collect( |
| | | Collectors.groupingBy(ModelNodeIndexInfor::getNodeId)); |
| | | Map<String, List<ModelNodeIndexInfo>> nodeIndexMap = nodeIndexInforList.stream().collect( |
| | | Collectors.groupingBy(ModelNodeIndexInfo::getNodeId)); |
| | | |
| | | // æ ¹æ®nodeIdè·åè½æºç±»å |
| | | // ææç¹ä½ä¿¡æ¯ |
| | | List<String> indexIds = nodeIndexInforList.stream().map(ModelNodeIndexInfor::getIndexId).distinct().collect(Collectors.toList()); |
| | | List<String> indexIds = nodeIndexInforList.stream().map(ModelNodeIndexInfo::getIndexId).distinct().collect(Collectors.toList()); |
| | | |
| | | Date beginTime; |
| | | Date endTime; |
| | |
| | | * @param nodeId |
| | | * @return |
| | | */ |
| | | private List<ModelNodeIndexInfor> listModelNodeIndexIdRelationInfor(String nodeId) { |
| | | List<ModelNodeIndexInfor> nodeInforList = modelNodeService.listModelNodeIndexIdRelationInforByParentId(nodeId); |
| | | private List<ModelNodeIndexInfo> listModelNodeIndexIdRelationInfor(String nodeId) { |
| | | List<ModelNodeIndexInfo> nodeInforList = modelNodeService.listModelNodeIndexIdRelationInforByParentId(nodeId); |
| | | // 妿æ¯ç©ºåå¨ä¸¤ç§æ
åµï¼1ï¼idæé®é¢ï¼2ï¼æåºå± |
| | | if (CollectionUtils.isEmpty(nodeInforList)) { |
| | | List<ModelNodeIndexInfor> inforList = modelNodeService.getModelNodeIndexIdRelationInforByNodeId(nodeId); |
| | | List<ModelNodeIndexInfo> inforList = modelNodeService.getModelNodeIndexIdRelationInforByNodeId(nodeId); |
| | | if (CollectionUtils.isNotEmpty(inforList)) { |
| | | nodeInforList.addAll(inforList); |
| | | } |
| | |
| | | /** |
| | | * æ¥è¯¢ç¹ä½ä¸ç¨è½åå
ä¿¡æ¯ |
| | | */ |
| | | List<ModelNodeIndexInfor> nodeIndexInforList = modelNodeMapper.getModelNodeIndexIdByNodeId(nodeId, energyType); |
| | | List<ModelNodeIndexInfo> nodeIndexInforList = modelNodeMapper.getModelNodeIndexIdByNodeId(nodeId, energyType); |
| | | |
| | | // if (CollectionUtils.isEmpty(nodeIndexInforList)) { |
| | | // return consumptionAnalysisVO; |
| | | // } |
| | | //ä¿®æ¹è¿æ»¤ç»è®¡ç¹ä½ |
| | | nodeIndexInforList = nodeIndexInforList.stream().filter(x -> "STATISTIC".equals(x.getIndexType())).collect(Collectors.toList()); |
| | | final List<String> eneryIdList = nodeIndexInforList.stream().map(ModelNodeIndexInfor::getEnergyId).distinct().collect(Collectors.toList()); |
| | | final List<String> eneryIdList = nodeIndexInforList.stream().map(ModelNodeIndexInfo::getEnergyId).distinct().collect(Collectors.toList()); |
| | | final LambdaQueryWrapper<SysEnergy> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(CollectionUtils.isNotEmpty(eneryIdList), SysEnergy::getEnersno, eneryIdList); |
| | | final List<SysEnergy> sysEnergies = sysEnergyMapper.selectList(queryWrapper); |
| | |
| | | indexIdEnergyIdMap.put(indexId, energyId); |
| | | } |
| | | }); |
| | | List<String> indexIds = nodeIndexInforList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | List<String> indexIds = nodeIndexInforList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toList()); |
| | | Date beginTime; |
| | | Date endTime; |
| | | Date lastTime; |
| | |
| | | /** |
| | | * æ¥è¯¢ç¹ä½ä¸ç¨è½åå
ä¿¡æ¯ |
| | | */ |
| | | List<ModelNodeIndexInfor> nodeIndexInforList = modelNodeMapper.getModelNodeIndexIdByNodeId(nodeId, energyType); |
| | | List<ModelNodeIndexInfo> nodeIndexInforList = modelNodeMapper.getModelNodeIndexIdByNodeId(nodeId, energyType); |
| | | |
| | | // if (CollectionUtils.isEmpty(nodeIndexInforList)) { |
| | | // return consumptionAnalysisVO; |
| | | // } |
| | | nodeIndexInforList = nodeIndexInforList.stream().filter(x -> "STATISTIC".equals(x.getIndexType())).collect(Collectors.toList()); |
| | | final List<String> eneryIdList = nodeIndexInforList.stream().map(ModelNodeIndexInfor::getEnergyId).distinct().collect(Collectors.toList()); |
| | | final List<String> eneryIdList = nodeIndexInforList.stream().map(ModelNodeIndexInfo::getEnergyId).distinct().collect(Collectors.toList()); |
| | | final LambdaQueryWrapper<SysEnergy> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(CollectionUtils.isNotEmpty(eneryIdList), SysEnergy::getEnersno, eneryIdList); |
| | | final List<SysEnergy> sysEnergies = sysEnergyMapper.selectList(queryWrapper); |
| | |
| | | indexIdEnergyIdMap.put(indexId, energyId); |
| | | } |
| | | }); |
| | | List<String> indexIds = nodeIndexInforList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | List<String> indexIds = nodeIndexInforList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toList()); |
| | | Date beginTime; |
| | | Date endTime; |
| | | String queryTimeType = dto.getTimeType(); |
| | |
| | | /** |
| | | * æ¥è¯¢ç¹ä½ä¸ç¨è½åå
ä¿¡æ¯ |
| | | */ |
| | | List<ModelNodeIndexInfor> nodeIndexInforList = modelNodeMapper.getModelNodeByParentId(nodeId); |
| | | List<ModelNodeIndexInfo> nodeIndexInforList = modelNodeMapper.getModelNodeByParentId(nodeId); |
| | | final Map<String, String> nodeNameMap = new HashMap<>(); |
| | | nodeIndexInforList.forEach(n -> { |
| | | final String id = n.getNodeId(); |
| | |
| | | } |
| | | }); |
| | | // æç
§ç¹ä½è¿è¡åç» |
| | | Map<String, List<ModelNodeIndexInfor>> nodeIndexMap = nodeIndexInforList.stream().collect( |
| | | Collectors.groupingBy(ModelNodeIndexInfor::getNodeId)); |
| | | final List<String> eneryIdList = nodeIndexInforList.stream().map(ModelNodeIndexInfor::getEnergyId).distinct().collect(Collectors.toList()); |
| | | Map<String, List<ModelNodeIndexInfo>> nodeIndexMap = nodeIndexInforList.stream().collect( |
| | | Collectors.groupingBy(ModelNodeIndexInfo::getNodeId)); |
| | | final List<String> eneryIdList = nodeIndexInforList.stream().map(ModelNodeIndexInfo::getEnergyId).distinct().collect(Collectors.toList()); |
| | | final LambdaQueryWrapper<SysEnergy> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(CollectionUtils.isNotEmpty(eneryIdList), SysEnergy::getEnersno, eneryIdList); |
| | | final List<SysEnergy> sysEnergies = sysEnergyMapper.selectList(queryWrapper); |
| | |
| | | indexIdEnergyIdMap.put(indexId, energyId); |
| | | } |
| | | }); |
| | | List<String> indexIds = nodeIndexInforList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | List<String> indexIds = nodeIndexInforList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toList()); |
| | | Date beginTime; |
| | | Date endTime; |
| | | String queryTimeType = dto.getTimeType(); |
| | |
| | | Map<String, BigDecimal> resultMap = new HashMap<>(); |
| | | nodeIndexMap.forEach((key, value) -> { |
| | | // æ¾åºindexIds |
| | | List<String> indexIdList = value.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | List<String> indexIdList = value.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toList()); |
| | | |
| | | indexIdList.forEach(indexId -> { |
| | | final List<DataItem> dataItems = dataItemMap.get(indexId); |
| | |
| | | /** |
| | | * æ¥è¯¢ç¹ä½ä¸ç¨è½åå
ä¿¡æ¯ |
| | | */ |
| | | List<ModelNodeIndexInfor> nodeIndexInforList = modelNodeMapper.getModelNodeIndexIdByNodeId(nodeId, energyType); |
| | | List<ModelNodeIndexInfo> nodeIndexInforList = modelNodeMapper.getModelNodeIndexIdByNodeId(nodeId, energyType); |
| | | |
| | | final List<String> eneryIdList = nodeIndexInforList.stream().map(ModelNodeIndexInfor::getEnergyId).distinct().collect(Collectors.toList()); |
| | | final List<String> eneryIdList = nodeIndexInforList.stream().map(ModelNodeIndexInfo::getEnergyId).distinct().collect(Collectors.toList()); |
| | | final LambdaQueryWrapper<SysEnergy> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(CollectionUtils.isNotEmpty(eneryIdList), SysEnergy::getEnersno, eneryIdList); |
| | | final List<SysEnergy> sysEnergies = sysEnergyMapper.selectList(queryWrapper); |
| | |
| | | indexIdEnergyIdMap.put(indexId, energyId); |
| | | } |
| | | }); |
| | | List<String> indexIds = nodeIndexInforList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | List<String> indexIds = nodeIndexInforList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toList()); |
| | | Date beginTime; |
| | | Date endTime; |
| | | String queryTimeType = dto.getTimeType(); |
| | |
| | | import com.zhitan.costmanagement.mapper.CostPriceRelevancyMapper; |
| | | import com.zhitan.costmanagement.service.DeviationAnalysisService; |
| | | import com.zhitan.model.domain.ModelNode; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfor; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfo; |
| | | import com.zhitan.model.mapper.ModelInfoMapper; |
| | | import com.zhitan.model.mapper.ModelNodeMapper; |
| | | import com.zhitan.peakvalley.domain.ElectricityDataItem; |
| | |
| | | }else{ |
| | | out.setNodeId(nodeId); |
| | | List<StatisticsInfoListOut> child = new ArrayList<>(); |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), nodeId); |
| | | List<ModelNodeIndexInfo> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), nodeId); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList)) { |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toSet()); |
| | | List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatisticsDeviationAnalysis(indexSet, dto.getTimeType()); |
| | | StatisticsDataOutItem nowData = compute(dto.getTimeType(),dto.getDate(),nodeId,dataItemList); |
| | | BeanUtil.copyProperties(nowData,out); |
| | |
| | | for(ModelNode modelNode:modelNodeList){ |
| | | StatisticsInfoListOut out = new StatisticsInfoListOut(); |
| | | String nodeId = modelNode.getNodeId(); |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), nodeId); |
| | | List<ModelNodeIndexInfo> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), nodeId); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList)) { |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toSet()); |
| | | List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatisticsDeviationAnalysis(indexSet, dto.getTimeType()); |
| | | StatisticsDataOutItem nowData = compute(dto.getTimeType(),dto.getDate(),nodeId,dataItemList); |
| | | BeanUtil.copyProperties(nowData,out); |
| | |
| | | List<String>xData2 = new ArrayList<>(); |
| | | List<BigDecimal>yData = new ArrayList<>(); |
| | | Map<String, Object>result = new HashMap<>(); |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), dto.getNodeId()); |
| | | List<ModelNodeIndexInfo> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), dto.getNodeId()); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList)) { |
| | | |
| | | String dateStr = dto.getDate(); |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toSet()); |
| | | |
| | | List<ElectricityDataItem> dataItemList = new ArrayList<>(); |
| | | |
| | |
| | | StatisticsDataOutItem result = new StatisticsDataOutItem(); |
| | | |
| | | // // æ¥è¯¢ç¹ä½ä¿¡æ¯ |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), dto.getNodeId()); |
| | | List<ModelNodeIndexInfo> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), dto.getNodeId()); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList)) { |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toSet()); |
| | | List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatisticsDeviationAnalysis(indexSet, dto.getTimeType()); |
| | | StatisticsDataOutItem nowData = compute(dto.getTimeType(),dto.getDate(),dto.getNodeId(),dataItemList); |
| | | BeanUtil.copyProperties(nowData,result); |
| | |
| | | private StatisticsInfoListOut computeInfoList(DeviationAnalysisDTO dto,List<String>nodes,List<ModelNode>modelNodeList,String nodeId){ |
| | | StatisticsInfoListOut out = new StatisticsInfoListOut(); |
| | | List<StatisticsInfoListOut> child = new ArrayList<>(); |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), nodeId); |
| | | List<ModelNodeIndexInfo> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), nodeId); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList)) { |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toSet()); |
| | | List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatisticsDeviationAnalysis(indexSet, dto.getTimeType()); |
| | | StatisticsDataOutItem nowData = compute(dto.getTimeType(),dto.getDate(),nodeId,dataItemList); |
| | | BeanUtil.copyProperties(nowData,out); |
| | |
| | | |
| | | StatisticsInfoListOut out2 = new StatisticsInfoListOut(); |
| | | out2.setNodeId(node); |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList2 = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), node); |
| | | List<ModelNodeIndexInfo> nodeIndexInfoList2 = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), node); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList2)) { |
| | | Set<String> indexSet2 = nodeIndexInfoList2.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | Set<String> indexSet2 = nodeIndexInfoList2.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toSet()); |
| | | List<ElectricityDataItem> dataItemList2 = electricityDataItemMapper.getDataStatisticsDeviationAnalysis(indexSet2, dto.getTimeType()); |
| | | StatisticsDataOutItem nowData2 = compute(dto.getTimeType(),dto.getDate(),node,dataItemList2); |
| | | BeanUtil.copyProperties(nowData2,out2); |
| | |
| | | }else{ |
| | | out.setNodeId(nodeId); |
| | | List<StatisticsInfoListOut> child = new ArrayList<>(); |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), nodeId); |
| | | List<ModelNodeIndexInfo> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), nodeId); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList)) { |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toSet()); |
| | | List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatisticsDeviationAnalysis(indexSet, dto.getTimeType()); |
| | | StatisticsDataOutItem nowData = compute(dto.getTimeType(),dto.getDate(),nodeId,dataItemList); |
| | | BeanUtil.copyProperties(nowData,out); |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zhitan.carbonemission.domain.CarbonEmission; |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.consumptionanalysis.domain.vo.RankingEnergyData; |
| | | import com.zhitan.dataitem.domain.StagseDataEntry; |
| | | import com.zhitan.realtimedata.domain.DataItem; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | |
| | | /** |
| | | * æ ¹æ®indexId䏿¶é´èå´æ¥è¯¢ç¢³ææ¾æ°æ®ï¼ä¸åé¨å |
| | | * |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | |
| | | |
| | | /** |
| | | * æ ¹æ®indexId䏿¶é´èå´æ¥è¯¢ç¢³ææ¾æ°æ®ï¼ä¸é´é¨å |
| | | * |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | |
| | | |
| | | /** |
| | | * æ ¹æ®indexId䏿¶é´èå´æ¥è¯¢ç¢³ææ¾æ°æ®ï¼ä¸åé¨å |
| | | * |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | |
| | | */ |
| | | List<DataItem> getDataItemHourInforByIndexIds(@Param("beginTime") Date beginTime, @Param("endTime") Date endTime, |
| | | @Param("timeType") String timeType, @Param("indexIds") List<String> indexIds); |
| | | |
| | | /** |
| | | * æ¥è¯¢è½æºç±»åéçµçç¨é |
| | | * |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType æ¶é´ç±»å |
| | | * @param nodeId èç¹Id |
| | | * @param energyType è½æºç±»å |
| | | * @return |
| | | */ |
| | | BigDecimal getDataItemTimeRangeValueByNodeId(@Param("beginTime") Date beginTime, @Param("endTime") Date endTime, |
| | | @Param("timeType") String timeType, @Param("nodeId") String nodeId, @Param("energyType") String energyType); |
| | | |
| | | /** |
| | | * è½æºæ¶èæå |
| | | * |
| | | * @param nodeIds |
| | | * @param timeType |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | List<RankingEnergyData> getHomePageConsumptionRanking(@Param("nodeIds") List<String> nodeIds, |
| | | @Param("timeType") String timeType, |
| | | @Param("beginTime") Date beginTime, |
| | | @Param("endTime") Date endTime); |
| | | } |
| | |
| | | |
| | | |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.consumptionanalysis.domain.vo.RankingEnergyData; |
| | | import com.zhitan.dataitem.domain.StagseDataEntry; |
| | | import com.zhitan.realtimedata.domain.DataItem; |
| | | import com.zhitan.statisticalAnalysis.domain.dto.FlowChartsDTO; |
| | |
| | | * @return ç»æ |
| | | */ |
| | | FlowChartsVO getFlowCharts(FlowChartsDTO dto); |
| | | |
| | | /** |
| | | * è·åé¦é¡µè½èæå |
| | | * @param nodeIds |
| | | * @param timeType |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | List<RankingEnergyData> getHomePageConsumptionRanking(List<String> nodeIds, String timeType, Date beginTime, Date endTime); |
| | | } |
| | |
| | | package com.zhitan.dataitem.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.consumptionanalysis.domain.vo.RankingEnergyData; |
| | | import com.zhitan.dataitem.domain.StagseDataEntry; |
| | | import com.zhitan.dataitem.domain.vo.NodeIndexValueVO; |
| | | import com.zhitan.dataitem.mapper.DataItemMapper; |
| | |
| | | public FlowChartsVO getFlowCharts(FlowChartsDTO dto) { |
| | | FlowChartsVO flowChartsVO = new FlowChartsVO(); |
| | | // ç¶èç¹id |
| | | String nodeId = dto.getNodeId(); |
| | | LambdaQueryWrapper<ModelNode> wrapper = Wrappers.<ModelNode>lambdaQuery() |
| | | .eq(ModelNode::getModelCode, dto.getModelCode()) |
| | | .isNull(ModelNode::getParentId); |
| | | List<ModelNode> modelNodes = modelNodeMapper.selectList(wrapper); |
| | | if (ObjectUtils.isEmpty(modelNodes)) { |
| | | throw new RuntimeException("æªæ¥è¯¢å°æ¨¡åä¿¡æ¯"); |
| | | } |
| | | ModelNode modelNode = modelNodes.stream().findFirst().get(); |
| | | String nodeId = modelNode.getNodeId(); |
| | | dto.setNodeId(nodeId); |
| | | String energyType = dto.getEnergyType(); |
| | | LocalDate queryTime = dto.getQueryTime(); |
| | | TimeType timeType = dto.getTimeType(); |
| | | |
| | | // è·åèç¹ä¿¡æ¯ |
| | | ModelNode modelNode = modelNodeMapper.selectModelNodeById(nodeId); |
| | | if (ObjectUtils.isEmpty(modelNode)) { |
| | | return flowChartsVO; |
| | | } |
| | | // è·åæ¥è¯¢æ¶é´ |
| | | Map<String, LocalDateTime> dateTimeMap = getDataItemByIndexId(timeType, queryTime); |
| | | |
| | |
| | | return flowChartsVO; |
| | | } |
| | | |
| | | @Override |
| | | public List<RankingEnergyData> getHomePageConsumptionRanking(List<String> nodeIds, String timeType, Date beginTime, Date endTime) { |
| | | return dataItemMapper.getHomePageConsumptionRanking(nodeIds, timeType, beginTime, endTime); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®indexIdæ¥è¯¢è½èæ°æ® |
| | | */ |
| | |
| | | package com.zhitan.energyMonitor.service; |
| | | |
| | | import com.zhitan.energyMonitor.domain.vo.ListElectricLoadVO; |
| | | import com.zhitan.energyMonitor.domain.vo.ListElectricityMeterVO; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: |
| | |
| | | /** |
| | | * è·åè´è·åææ°æ® |
| | | */ |
| | | ListElectricLoadVO list(String timeType, String timeCode, EnergyIndex energyIndex); |
| | | ListElectricLoadVO list(String timeType, String timeCode, EnergyIndex energyIndex, String meterId); |
| | | |
| | | /** |
| | | * è·åèç¹ä¸ææçµè¡¨ |
| | | * @param nodeId |
| | | * @return |
| | | */ |
| | | List<ListElectricityMeterVO> listElectricMeter(String nodeId); |
| | | } |
| | |
| | | import com.zhitan.energyMonitor.domain.vo.ListElectricLoadDetail; |
| | | import com.zhitan.energyMonitor.domain.vo.ListElectricLoadItem; |
| | | import com.zhitan.energyMonitor.domain.vo.ListElectricLoadVO; |
| | | import com.zhitan.energyMonitor.domain.vo.ListElectricityMeterVO; |
| | | import com.zhitan.energyMonitor.service.IElectricLoadService; |
| | | import com.zhitan.knowledgeBase.domain.enums.EnergyTypeEnum; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.realtimedata.domain.TagValue; |
| | | import com.zhitan.realtimedata.service.RealtimeDatabaseService; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @Description: sensor_alarm_item |
| | |
| | | private MeterImplementMapper meterImplementMapper; |
| | | |
| | | @Override |
| | | public ListElectricLoadVO list(String timeType, String timeCode, EnergyIndex energyIndex) { |
| | | public ListElectricLoadVO list(String timeType, String timeCode, EnergyIndex energyIndex, String meterId) { |
| | | ListElectricLoadVO vo = new ListElectricLoadVO(); |
| | | List<ListElectricLoadItem> itemList = new ArrayList<>(); |
| | | vo.setItemList(itemList); |
| | |
| | | detail.setRate(CommonConst.DOUBLE_MINUS_SIGN); |
| | | vo.setDetail(detail); |
| | | |
| | | MeterImplement meterImplement = meterImplementMapper.selectById(energyIndex.getMeterId()); |
| | | MeterImplement meterImplement = meterImplementMapper.selectById(meterId); |
| | | |
| | | if (ObjectUtil.isEmpty(meterImplement)) { |
| | | return vo; |
| | |
| | | List<TagValue> minList = new ArrayList<>(); |
| | | List<TagValue> avgList = new ArrayList<>(); |
| | | if (TimeTypeConst.TIME_TYPE_DAY.equals(timeType)) { |
| | | |
| | | } else { |
| | | String tempTimeCode = StringUtil.ifEmptyOrNullReturnValue(timeCode).replace(CommonConst.SINGLE_MINUS_SIGN, CommonConst.EMPTY); |
| | | Date start = DateTimeUtil.toDateTime(tempTimeCode, DateTimeUtil.COMMON_PATTERN_MONTH); |
| | |
| | | TagValue rt3 = realtimeDatabaseService.statistics(code, date, endTime, CollectionModes.max); |
| | | TagValue rt4 = realtimeDatabaseService.statistics(code, date, endTime, CollectionModes.min); |
| | | TagValue rt2 = realtimeDatabaseService.statistics(code, date, endTime, CollectionModes.mean); |
| | | if (ObjectUtils.isNotEmpty(rt2.getValue())) { |
| | | if (ObjectUtils.isNotEmpty(rt2)) { |
| | | temp.setAvg(String.valueOf(DoubleUtil.formatDouble(rt2.getValue()))); |
| | | } |
| | | if (ObjectUtils.isNotEmpty(rt3.getValue())) { |
| | | if (ObjectUtils.isNotEmpty(rt3)) { |
| | | temp.setMax(String.valueOf(DoubleUtil.formatDouble(rt3.getValue()))); |
| | | } |
| | | if (ObjectUtils.isNotEmpty(rt4.getValue())) { |
| | | if (ObjectUtils.isNotEmpty(rt4)) { |
| | | temp.setMin(String.valueOf(DoubleUtil.formatDouble(rt4.getValue()))); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * è·åçµè¡¨å表 |
| | | */ |
| | | @Override |
| | | public List<ListElectricityMeterVO> listElectricMeter(String nodeId) { |
| | | List<MeterImplement> meterImplements = meterImplementMapper.selectByNodeId(nodeId); |
| | | meterImplements = meterImplements.stream().filter(x -> "electric".equals(x.getEnergyType())).collect(Collectors.toList()); |
| | | List<ListElectricityMeterVO> list = new ArrayList<>(); |
| | | for (MeterImplement meterImplement : meterImplements) { |
| | | ListElectricityMeterVO vo = new ListElectricityMeterVO(); |
| | | vo.setCode(meterImplement.getId()); |
| | | vo.setLabel(meterImplement.getMeterName()); |
| | | list.add(vo); |
| | | } |
| | | return list; |
| | | } |
| | | } |
| | |
| | | @Override |
| | | public ElectricThreePhaseVO list(String timeType, String timeCode, List<EnergyIndex> energyIndexList, String requestType, String meterId) { |
| | | ElectricThreePhaseVO vo = new ElectricThreePhaseVO(); |
| | | if (ObjectUtil.isEmpty(energyIndexList)) { |
| | | return vo; |
| | | } |
| | | |
| | | // è·åçµåä¸å¹³è¡¡æ°æ® |
| | | if (CommonConst.STR_NUMBER_0.equals(requestType)) { |
| | | energyIndexList = energyIndexList.stream() |
| | |
| | | || StringUtil.ifEmptyOrNullReturnValue(x.getCode()).trim().endsWith(CommonConst.TAG_CODE_CURRENT_C)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | if (ObjectUtil.isEmpty(energyIndexList)) { |
| | | return vo; |
| | | } |
| | | List<String> tagCodeList = energyIndexList.stream().map(EnergyIndex::getCode).collect(Collectors.toList()); |
| | | if(ObjectUtil.isEmpty(tagCodeList)){ |
| | | tagCodeList.add(CommonConst.STR_NUMBER_MINUS_ONE); |
| | | String tagCodes = String.join(StrUtil.COMMA, tagCodeList); |
| | | } |
| | | |
| | | Date start = ChartUtils.getDateTime(timeType, timeCode); |
| | | Date end = getEndTime(timeType, start); |
| | |
| | | long millis = new Duration(begin, finish).getMillis(); |
| | | int pointCount = IntegerUtil.toInt(millis / CommonConst.DIGIT_3600 / CommonConst.DIGIT_1000); |
| | | |
| | | List<TagValue> tagValueList = realtimeDatabaseService.retrieve(tagCodes, start, end, pointCount); |
| | | List<TagValue> tagValueList = realtimeDatabaseService.retrieve(tagCodeList, start, end, pointCount); |
| | | List<ElectricThreePhaseItem> itemList = new ArrayList<>(); |
| | | List<Date> dateList = new ArrayList<>(); |
| | | ChartUtils.generateDateList(timeType, timeCode, dateList); |
| | |
| | | */ |
| | | private void listDayData(Date date, List<TagValue> tagValueList, ElectricThreePhaseItem temp, ElectricThreePhaseTempModel tempModel) { |
| | | Date endTime = DateTimeUtil.addHours(date, CommonConst.DIGIT_1); |
| | | List<TagValue> currentTagValueList = tagValueList.stream().filter(x -> DateTimeUtil.compareDateDiff(date, x.getDataTime()) <= 0 && DateTimeUtil.compareDateDiff(endTime, x.getDataTime()) > 0).collect(Collectors.toList()); |
| | | List<TagValue> currentATagValueList = currentTagValueList.stream().filter(x -> StringUtil.ifEmptyOrNullReturnValue(x.getTagCode()).trim().endsWith("_A")).collect(Collectors.toList()); |
| | | List<TagValue> currentBTagValueList = currentTagValueList.stream().filter(x -> StringUtil.ifEmptyOrNullReturnValue(x.getTagCode()).trim().endsWith("_B")).collect(Collectors.toList()); |
| | | List<TagValue> currentCTagValueList = currentTagValueList.stream().filter(x -> StringUtil.ifEmptyOrNullReturnValue(x.getTagCode()).trim().endsWith("_C")).collect(Collectors.toList()); |
| | | List<TagValue> currentTagValueList = tagValueList.stream() |
| | | .filter(x -> DateTimeUtil.compareDateDiff(date, x.getDataTime()) <= 0 && DateTimeUtil.compareDateDiff(endTime, x.getDataTime()) > 0).collect(Collectors.toList()); |
| | | List<TagValue> currentATagValueList = currentTagValueList.stream() |
| | | .filter(x -> StringUtil.ifEmptyOrNullReturnValue(x.getTagCode()).trim().endsWith(CommonConst.A_PHASE)).collect(Collectors.toList()); |
| | | List<TagValue> currentBTagValueList = currentTagValueList.stream() |
| | | .filter(x -> StringUtil.ifEmptyOrNullReturnValue(x.getTagCode()).trim().endsWith(CommonConst.B_PHASE)).collect(Collectors.toList()); |
| | | List<TagValue> currentCTagValueList = currentTagValueList.stream() |
| | | .filter(x -> StringUtil.ifEmptyOrNullReturnValue(x.getTagCode()).trim().endsWith(CommonConst.C_PHASE)).collect(Collectors.toList()); |
| | | TagValue tagValueA = currentATagValueList.stream().filter(x -> DateTimeUtil.compareDateDiff(date, x.getDataTime()) == 0).findAny().orElse(null); |
| | | TagValue tagValueB = currentBTagValueList.stream().filter(x -> DateTimeUtil.compareDateDiff(date, x.getDataTime()) == 0).findAny().orElse(null); |
| | | TagValue tagValueC = currentCTagValueList.stream().filter(x -> DateTimeUtil.compareDateDiff(date, x.getDataTime()) == 0).findAny().orElse(null); |
| | |
| | | package com.zhitan.energydata.mapper; |
| | | |
| | | import com.zhitan.model.domain.CalcFunction; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfor; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | public interface EnergyDataStatisticMapper |
| | | { |
| | | List<ModelNodeIndexInfor> getModelNodeIndexIdByFixedNodeIds(@Param("modelCode")String modelCode,@Param("fixedNodeIds") List<String> fixedNodeIds); |
| | | List<ModelNodeIndexInfo> getModelNodeIndexIdByFixedNodeIds(@Param("modelCode")String modelCode, @Param("fixedNodeIds") List<String> fixedNodeIds); |
| | | } |
| | |
| | | import com.zhitan.home.domain.vo.HomeEnergyStatisticsVO; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.model.domain.ModelNode; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfor; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfo; |
| | | import com.zhitan.model.mapper.EnergyIndexMapper; |
| | | import com.zhitan.model.mapper.ModelNodeMapper; |
| | | import com.zhitan.model.service.IEnergyIndexService; |
| | |
| | | import com.zhitan.peakvalley.domain.vo.peakvalley.*; |
| | | import com.zhitan.peakvalley.mapper.PeakValleyMapper; |
| | | import com.zhitan.realtimedata.domain.DataItem; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * æé¦ç»¼åæ²»ç大屿¥å£å®ç°ç±» |
| | | * ç»¼åæ²»ç大屿¥å£å®ç°ç±» |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class EnergyDataStatisticServiceImpl implements IEnergyDataStatisticService { |
| | | |
| | | @Autowired |
| | | private ModelNodeMapper modelNodeMapper; |
| | | @Autowired |
| | | private PeakValleyMapper electricityDataItemMapper; |
| | | @Autowired |
| | | CostPriceRelevancyMapper costPriceRelevancyMapper; |
| | | |
| | | @Autowired |
| | | CostElectricityInputMapper electricityInputMapper; |
| | | @Autowired |
| | | private IDataItemService dataItemService; |
| | | |
| | | @Autowired |
| | | private SysEnergyMapper sysEnergyMapper; |
| | | @Autowired |
| | | private IModelNodeService modelNodeService; |
| | | @Autowired |
| | | private IEnergyIndexService energyIndexService; |
| | | |
| | | @Autowired |
| | | private EnergyDataStatisticMapper statisticMapper; |
| | | |
| | | @Autowired |
| | | private EnergyIndexMapper energyIndexMapper; |
| | | |
| | | @Autowired |
| | | private MeterImplementMapper meterImplementMapper; |
| | | |
| | | @Override |
| | |
| | | |
| | | Map<String, List<ElectricityDataItem>> electricityDataMap = new HashMap<>(); |
| | | // æ¥è¯¢ç¹ä½ä¿¡æ¯ |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), dto.getNodeId()); |
| | | List<ModelNodeIndexInfo> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), dto.getNodeId()); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList)) { |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toSet()); |
| | | List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatistics(indexSet, startTime, endTime, timeType); |
| | | |
| | | electricityDataMap = dataItemList.stream() |
| | |
| | | |
| | | Map<String, List<ElectricityDataItem>> electricityDataMap = new HashMap<>(); |
| | | // æ¥è¯¢ç¹ä½ä¿¡æ¯ |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), dto.getNodeId()); |
| | | List<ModelNodeIndexInfo> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), dto.getNodeId()); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList)) { |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toSet()); |
| | | List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatistics(indexSet, startTime, endTime, timeType); |
| | | |
| | | electricityDataMap = dataItemList.stream() |
| | |
| | | |
| | | Map<String, List<ElectricityDataItem>> electricityDataMap = new HashMap<>(); |
| | | // æ¥è¯¢ç¹ä½ä¿¡æ¯ |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), dto.getNodeId()); |
| | | List<ModelNodeIndexInfo> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), dto.getNodeId()); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList)) { |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toSet()); |
| | | List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatistics(indexSet, startTime, endTime, timeType); |
| | | |
| | | electricityDataMap = dataItemList.stream() |
| | |
| | | return energyDataList; |
| | | } |
| | | final List<String> nodeIds = modelNodeList.stream().map(ModelNode::getNodeId).collect(Collectors.toList()); |
| | | List<ModelNodeIndexInfor> nodeIndexInforList = modelNodeMapper.selectIndexByNodeIds(modelCode ,nodeIds); |
| | | List<ModelNodeIndexInfo> nodeIndexInforList = modelNodeMapper.selectIndexByNodeIds(modelCode ,nodeIds); |
| | | |
| | | final Map<String, String> nodeNameMap = new HashMap<>(); |
| | | nodeIndexInforList.forEach(n->{ |
| | |
| | | }); |
| | | |
| | | // æç
§ç¹ä½è¿è¡åç» |
| | | Map<String, List<ModelNodeIndexInfor>> nodeIndexMap = nodeIndexInforList.stream().collect( |
| | | Collectors.groupingBy(ModelNodeIndexInfor::getNodeId)); |
| | | final List<String> eneryIdList = nodeIndexInforList.stream().map(ModelNodeIndexInfor::getEnergyId).distinct().collect(Collectors.toList()); |
| | | Map<String, List<ModelNodeIndexInfo>> nodeIndexMap = nodeIndexInforList.stream().collect( |
| | | Collectors.groupingBy(ModelNodeIndexInfo::getNodeId)); |
| | | final List<String> eneryIdList = nodeIndexInforList.stream().map(ModelNodeIndexInfo::getEnergyId).distinct().collect(Collectors.toList()); |
| | | final LambdaQueryWrapper<SysEnergy> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(CollectionUtils.isNotEmpty(eneryIdList),SysEnergy::getEnersno,eneryIdList); |
| | | final List<SysEnergy> sysEnergies = sysEnergyMapper.selectList(queryWrapper); |
| | |
| | | indexIdEnergyIdMap.put(indexId,energyId); |
| | | } |
| | | }); |
| | | List<String> indexIds = nodeIndexInforList.stream().filter(l -> StringUtils.isNotEmpty(l.getIndexId())).map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | List<String> indexIds = nodeIndexInforList.stream().filter(l -> StringUtils.isNotEmpty(l.getIndexId())).map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toList()); |
| | | Date queryTime = new Date(); |
| | | Date beginTime; |
| | | Date endTime; |
| | |
| | | Map<String,BigDecimal> resultMap = new HashMap<>(); |
| | | nodeIndexMap.forEach((key, value) -> { |
| | | // æ¾åºindexIds |
| | | List<String> indexIdList = value.stream().map(ModelNodeIndexInfor::getIndexId).filter(Objects::nonNull).collect(Collectors.toList()); |
| | | List<String> indexIdList = value.stream().map(ModelNodeIndexInfo::getIndexId).filter(Objects::nonNull).collect(Collectors.toList()); |
| | | if (null!=indexIdList &&!indexIdList.isEmpty()){ |
| | | indexIdList.forEach(indexId -> { |
| | | final List<DataItem> dataItems = dataItemMap.get(indexId); |
| | |
| | | |
| | | Map<String, List<ElectricityDataItem>> electricityDataMap = new HashMap<>(); |
| | | // æ¥è¯¢ç¹ä½ä¿¡æ¯ |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(modelCode, nodeId); |
| | | List<ModelNodeIndexInfo> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(modelCode, nodeId); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList)) { |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toSet()); |
| | | List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatistics(indexSet, startTime,endTime , timeType); |
| | | |
| | | electricityDataMap = dataItemList.stream() |
| | |
| | | fixedNodeIds.add("dca20897-5977-40ae-a28a-88a6acdee335");//å¶ä¸ |
| | | fixedNodeIds.add("4912c751-0611-4f4b-afce-0f58629512b7");//ç²¾ç¼ |
| | | fixedNodeIds.add("8eef471f-880c-4636-a428-620a4d2ccd5d");//ç¿ä¸ |
| | | fixedNodeIds.add("6d6a0412-7c6d-4654-9cb3-0079655e23e5");//æé¦æ°ææ |
| | | fixedNodeIds.add("6d6a0412-7c6d-4654-9cb3-0079655e23e5");//æ°ææ |
| | | |
| | | LambdaQueryWrapper<ModelNode> nodeLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | nodeLambdaQueryWrapper.eq(ModelNode::getModelCode,modelCode); |
| | |
| | | |
| | | Map<String,ModelNode> nodeMap=nodeList.stream().collect(Collectors.toMap(ModelNode::getNodeId,x->x)); |
| | | |
| | | List<ModelNodeIndexInfor> indexList=statisticMapper.getModelNodeIndexIdByFixedNodeIds(modelCode,fixedNodeIds); |
| | | List<ModelNodeIndexInfo> indexList=statisticMapper.getModelNodeIndexIdByFixedNodeIds(modelCode,fixedNodeIds); |
| | | |
| | | |
| | | // æ ¹æ®ååºåç» |
| | | Map<String, List<ModelNodeIndexInfor>> nodeIndexMap = indexList.stream().collect( |
| | | Collectors.groupingBy(ModelNodeIndexInfor::getNodeId)); |
| | | Map<String, List<ModelNodeIndexInfo>> nodeIndexMap = indexList.stream().collect( |
| | | Collectors.groupingBy(ModelNodeIndexInfo::getNodeId)); |
| | | //æ¥è¯¢ææè½æºç±»å |
| | | final List<String> eneryIdList = indexList.stream().map(ModelNodeIndexInfor::getEnergyId).distinct().collect(Collectors.toList()); |
| | | final List<String> eneryIdList = indexList.stream().map(ModelNodeIndexInfo::getEnergyId).distinct().collect(Collectors.toList()); |
| | | final LambdaQueryWrapper<SysEnergy> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(CollectionUtils.isNotEmpty(eneryIdList),SysEnergy::getEnersno,eneryIdList); |
| | | |
| | |
| | | indexIdEnergyIdMap.put(indexId,energyId); |
| | | } |
| | | }); |
| | | List<String> indexIds = indexList.stream().filter(l -> StringUtils.isNotEmpty(l.getIndexId())).map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | List<String> indexIds = indexList.stream().filter(l -> StringUtils.isNotEmpty(l.getIndexId())).map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toList()); |
| | | // Date queryTime = new Date(); |
| | | Date queryTime = new Date(); |
| | | Date beginTime; |
| | |
| | | } |
| | | |
| | | //nodeåindexå
³èéå |
| | | List<ModelNodeIndexInfor> value=nodeIndexMap.get(key); |
| | | List<ModelNodeIndexInfo> value=nodeIndexMap.get(key); |
| | | |
| | | List<HomeEnergyStatisticsVO> itemVo=new ArrayList<>(); |
| | | //æ ¹æ®è½æºç±»ååç» |
| | | Map<String, List<ModelNodeIndexInfor>> sysEnergyIds = value.stream().collect( |
| | | Collectors.groupingBy(ModelNodeIndexInfor::getEnergyId)); |
| | | Map<String, List<ModelNodeIndexInfo>> sysEnergyIds = value.stream().collect( |
| | | Collectors.groupingBy(ModelNodeIndexInfo::getEnergyId)); |
| | | |
| | | if (!sysEnergyIds.isEmpty()) { |
| | | //éå |
| | | for (Map.Entry<String, List<ModelNodeIndexInfor>> entry : sysEnergyIds.entrySet()) { |
| | | for (Map.Entry<String, List<ModelNodeIndexInfo>> entry : sysEnergyIds.entrySet()) { |
| | | String energyIndex = entry.getKey(); |
| | | List<ModelNodeIndexInfor> energyValue = entry.getValue(); |
| | | List<ModelNodeIndexInfo> energyValue = entry.getValue(); |
| | | if (energyCoefficientMap.containsKey(energyIndex)) { |
| | | SysEnergy sysEnergy = energyCoefficientMap.get(energyIndex); |
| | | HomeEnergyStatisticsVO item = new HomeEnergyStatisticsVO(); |
| | |
| | | BigDecimal totalConsumption = BigDecimal.ZERO; |
| | | BigDecimal totalCount = BigDecimal.ZERO; |
| | | //åè®¡å¼ |
| | | for (ModelNodeIndexInfor valueItem:entry.getValue()){ |
| | | for (ModelNodeIndexInfo valueItem:entry.getValue()){ |
| | | List<DataItem> dataItems = dataItemMap.get(valueItem.getIndexId()); |
| | | if (CollectionUtils.isNotEmpty(dataItems)) { |
| | | BigDecimal sum = BigDecimal.valueOf(dataItems.stream() |
| | |
| | | if (ObjectUtils.isEmpty(modelNode)) { |
| | | return voList; |
| | | } |
| | | List<ModelNodeIndexInfor> inforList = modelNodeService.getModelNodeIndexIdRelationInforByNodeId(modelNode.getNodeId()); |
| | | List<String> indexIds = inforList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | List<ModelNodeIndexInfo> inforList = modelNodeService.getModelNodeIndexIdRelationInforByNodeId(modelNode.getNodeId()); |
| | | List<String> indexIds = inforList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toList()); |
| | | // éè¿indexIdsæ¾data_Itemæ°æ® |
| | | List<DataItem> itemList = dataItemService.getDataItemTimeRangeInforByIndexIds(beginTime, endTime, shixuTimeType, indexIds); |
| | | // æ¥è¯¢ç¹ä½è¯¦ç»ä¿¡æ¯ |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zhitan.basicdata.domain.SysEnergy; |
| | | import com.zhitan.basicdata.mapper.SysEnergyMapper; |
| | | import com.zhitan.common.constant.CommonConst; |
| | | import com.zhitan.common.core.domain.entity.SysDictData; |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.consumptionanalysis.domain.vo.RankingEnergyData; |
| | |
| | | import com.zhitan.home.service.impl.IHomePageService; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.model.domain.ModelNode; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfor; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfo; |
| | | import com.zhitan.model.mapper.ModelNodeMapper; |
| | | import com.zhitan.model.service.IEnergyIndexService; |
| | | import com.zhitan.model.service.IModelNodeService; |
| | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.DecimalFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | public class HomePageServiceImpl implements IHomePageService { |
| | | |
| | | private final SysEnergyMapper sysEnergyMapper; |
| | | |
| | | private final IModelNodeService modelNodeService; |
| | | |
| | | private final IDataItemService dataItemService; |
| | | |
| | | private final IEnergyIndexService energyIndexService; |
| | | |
| | | private final ISysDictDataService sysDictDataService; |
| | | |
| | | @Resource |
| | | private ModelNodeMapper modelNodeMapper; |
| | | @Resource |
| | | private PeakValleyMapper electricityDataItemMapper; |
| | | |
| | | |
| | |
| | | if (ObjectUtils.isEmpty(modelNode)) { |
| | | return voList; |
| | | } |
| | | List<ModelNodeIndexInfor> inforList = modelNodeService.getModelNodeIndexIdRelationInforByNodeId(modelNode.getNodeId()); |
| | | List<String> indexIds = inforList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | List<ModelNodeIndexInfo> inforList = modelNodeService.getModelNodeIndexIdRelationInforByNodeId(modelNode.getNodeId()); |
| | | List<String> indexIds = inforList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toList()); |
| | | // éè¿indexIdsæ¾data_Itemæ°æ® |
| | | List<DataItem> itemList = dataItemService.getDataItemTimeRangeInforByIndexIds(beginTime, endTime, shixuTimeType, indexIds); |
| | | // æ¥è¯¢ç¹ä½è¯¦ç»ä¿¡æ¯ |
| | |
| | | |
| | | double totalElectric; |
| | | // æ¥è¯¢ç¹ä½ä¿¡æ¯ |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(modelcode, firstModeNodeInfo.getNodeId()); |
| | | List<ModelNodeIndexInfo> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(modelcode, firstModeNodeInfo.getNodeId()); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList)) { |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toSet()); |
| | | List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatistics(indexSet, beginTime, endTime, shixuTimeType); |
| | | if(null != dataItemList){ |
| | | totalElectric = dataItemList.stream().map(ElectricityDataItem::getElectricity).mapToDouble(BigDecimal::doubleValue).sum(); |
| | |
| | | List<String> xdataList = new ArrayList<>(); |
| | | // æ¥è¯¢ææè½æºç±»å |
| | | List<SysEnergy> sysEnergies = sysEnergyMapper.selectSysEnergyList(new SysEnergy()); |
| | | final Map<String, Object> energyCollectMap = sysEnergies.stream().collect(Collectors.toMap(SysEnergy::getEnersno, SysEnergy::getCoefficient)); |
| | | final Map<String, String> energyNameMap = sysEnergies.stream().collect(Collectors.toMap(SysEnergy::getEnersno, SysEnergy::getEnername)); |
| | | |
| | | |
| | | Date queryTime = new Date(); |
| | | // Date queryTime = DateUtil.parseDateTime("2023-03-28 00:00:00"); |
| | | Date beginTime; |
| | | Date endTime; |
| | | String shixuTimeType; |
| | |
| | | if (ObjectUtils.isEmpty(modelNode)) { |
| | | return vo; |
| | | } |
| | | List<ModelNodeIndexInfor> inforList = modelNodeService.getModelNodeIndexIdRelationInforByNodeId(modelNode.getNodeId()); |
| | | List<String> indexIds = inforList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | List<ModelNodeIndexInfo> inforList = modelNodeService.getModelNodeIndexIdRelationInforByNodeId(modelNode.getNodeId()); |
| | | List<String> indexIds = inforList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toList()); |
| | | // éè¿indexIdsæ¾data_Itemæ°æ® |
| | | List<DataItem> itemList = dataItemService.getDataItemTimeRangeInforByIndexIds(beginTime, endTime, shixuTimeType, indexIds); |
| | | final Map<String, List<DataItem>> dataItemMap = itemList.stream().collect(Collectors.groupingBy(li -> DateUtil.format(li.getDataTime(), timeFormat))); |
| | |
| | | .filter(l -> StringUtils.isNotEmpty(l.getEnergyId())).collect(Collectors.groupingBy( |
| | | EnergyIndex::getEnergyId, Collectors.mapping(EnergyIndex::getIndexId, Collectors.toList()) |
| | | )); |
| | | |
| | | List<String> lengList = new ArrayList<>(); |
| | | |
| | | while (!beginTime.after(endTime)) { |
| | | final String currentTime = DateUtil.format(beginTime, timeFormat); |
| | | xdataList.add(currentTime); |
| | | final List<DataItem> dataItems = dataItemMap.get(currentTime); |
| | | List<Double> energyCount = new ArrayList<>(); |
| | | energyTypeMap.forEach((energyType,IndexIdList)->{ |
| | | |
| | | sysEnergies.forEach(x -> { |
| | | if(!lengList.contains(x.getEnername())){ |
| | | lengList.add(x.getEnername()); |
| | | } |
| | | List<String> indexIdList = energyTypeMap.get(x.getEnersno()); |
| | | double sum; |
| | | if(null == dataItems){ |
| | | if (null == dataItems || CollectionUtils.isEmpty(indexIdList)) { |
| | | sum = 0; |
| | | }else { |
| | | sum = dataItems.stream().filter(li -> IndexIdList.contains(li.getIndexId())).mapToDouble(DataItem::getValue).sum(); |
| | | sum = dataItems.stream().filter(li -> indexIdList.contains(li.getIndexId())).mapToDouble(DataItem::getValue).sum(); |
| | | } |
| | | final BigDecimal coefficient = (BigDecimal) energyCollectMap.get(energyType); |
| | | energyCount.add(sum * coefficient.doubleValue()); |
| | | energyCount.add(sum * x.getCoefficient().doubleValue()); |
| | | }); |
| | | ydataList.add(energyCount); |
| | | |
| | | switch (TimeType.valueOf(timeType)) { |
| | | case DAY: |
| | | beginTime = DateUtil.offsetHour(beginTime, 1); |
| | |
| | | } |
| | | vo.setXdata(xdataList.toArray(new String[0])); |
| | | Double[][] array = new Double[sysEnergies.size()][xdataList.size()]; |
| | | List<String> lengList = new ArrayList<>(); |
| | | energyCollectMap.keySet().forEach(key->{ |
| | | final String name = energyNameMap.get(key); |
| | | lengList.add(name); |
| | | }); |
| | | |
| | | for(int i = 0; i < ydataList.size(); i++){ |
| | | final List<Double> doubleList = ydataList.get(i); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<RankingEnergyData> energyConsumptionRanking(String modelcode, String timeType) { |
| | | public List<RankingEnergyData> energyConsumptionRanking(String modelCode, String timeType) { |
| | | |
| | | List<RankingEnergyData> energyDataList = new ArrayList<>(); |
| | | String nodeCategory = "2"; |
| | | LambdaQueryWrapper<ModelNode> modelNodeLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | modelNodeLambdaQueryWrapper.eq(ModelNode::getModelCode,modelcode); |
| | | modelNodeLambdaQueryWrapper.eq(ModelNode::getNodeCategory,nodeCategory); |
| | | List<ModelNode> modelNodeList = modelNodeMapper.selectList(modelNodeLambdaQueryWrapper); |
| | | if(CollectionUtils.isEmpty(modelNodeList)){ |
| | | return energyDataList; |
| | | } |
| | | final List<String> nodeIds = modelNodeList.stream().map(ModelNode::getNodeId).collect(Collectors.toList()); |
| | | List<ModelNodeIndexInfor> nodeIndexInforList = modelNodeMapper.selectIndexByNodeIds(modelcode ,nodeIds); |
| | | |
| | | final Map<String, String> nodeNameMap = new HashMap<>(); |
| | | nodeIndexInforList.forEach(n->{ |
| | | final String id = n.getNodeId(); |
| | | final String name = n.getName(); |
| | | if(!nodeNameMap.containsKey(id)){ |
| | | nodeNameMap.put(id,name); |
| | | } |
| | | }); |
| | | |
| | | // æç
§ç¹ä½è¿è¡åç» |
| | | Map<String, List<ModelNodeIndexInfor>> nodeIndexMap = nodeIndexInforList.stream().collect( |
| | | Collectors.groupingBy(ModelNodeIndexInfor::getNodeId)); |
| | | final List<String> eneryIdList = nodeIndexInforList.stream().map(ModelNodeIndexInfor::getEnergyId).distinct().collect(Collectors.toList()); |
| | | final LambdaQueryWrapper<SysEnergy> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(CollectionUtils.isNotEmpty(eneryIdList),SysEnergy::getEnersno,eneryIdList); |
| | | final List<SysEnergy> sysEnergies = sysEnergyMapper.selectList(queryWrapper); |
| | | //è½æºç¼å·åè½æºææ ç³»æ° |
| | | final Map<String, Object> energyCoefficientMap = sysEnergies.stream().collect(Collectors.toMap(SysEnergy::getEnersno, SysEnergy::getCoefficient)); |
| | | //indexåè½æº |
| | | final Map<String, String> indexIdEnergyIdMap = new HashMap<>(); |
| | | nodeIndexInforList.forEach(n->{ |
| | | final String indexId = n.getIndexId(); |
| | | final String energyId = n.getEnergyId(); |
| | | if(!indexIdEnergyIdMap.containsKey(indexId)){ |
| | | indexIdEnergyIdMap.put(indexId,energyId); |
| | | } |
| | | }); |
| | | List<String> indexIds = nodeIndexInforList.stream().filter(l -> StringUtils.isNotEmpty(l.getIndexId())).map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | Date queryTime = new Date(); |
| | | // Date queryTime = DateUtil.parseDateTime("2023-03-28 00:00:00"); |
| | | Date beginTime; |
| | | Date endTime; |
| | | String shixuTimeType; |
| | | if (TimeType.DAY.name().equals(timeType)) { |
| | | beginTime = DateUtil.beginOfDay(queryTime); |
| | | endTime = DateUtil.endOfDay(queryTime); |
| | | shixuTimeType = TimeType.HOUR.name(); |
| | | timeType = TimeType.HOUR.name(); |
| | | // æ |
| | | } else if (TimeType.MONTH.name().equals(timeType)) { |
| | | beginTime = DateUtil.beginOfMonth(queryTime); |
| | | endTime = DateUtil.endOfMonth(queryTime); |
| | | shixuTimeType = TimeType.DAY.name(); |
| | | timeType = TimeType.DAY.name(); |
| | | |
| | | // å¹´ |
| | | } else { |
| | | } else if (TimeType.YEAR.name().equals(timeType)) { |
| | | beginTime = DateUtil.beginOfYear(queryTime); |
| | | endTime = DateUtil.endOfYear(queryTime); |
| | | shixuTimeType = TimeType.MONTH.name(); |
| | | } |
| | | // æ ¹æ®indexIdæ¥è¯¢dataItem |
| | | List<DataItem> dataItemList = new ArrayList<>(); |
| | | if(CollectionUtils.isNotEmpty(indexIds)) { |
| | | dataItemList = dataItemService.getDataItemTimeRangeInforByIndexIds(beginTime, endTime, shixuTimeType, indexIds); |
| | | } |
| | | Map<String, List<DataItem>> dataItemMap = dataItemList.stream().collect(Collectors.groupingBy(DataItem::getIndexId)); |
| | | timeType = TimeType.MONTH.name(); |
| | | |
| | | Map<String,BigDecimal> resultMap = new HashMap<>(); |
| | | nodeIndexMap.forEach((key, value) -> { |
| | | // æ¾åºindexIds |
| | | List<String> indexIdList = value.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | |
| | | indexIdList.forEach(indexId->{ |
| | | final List<DataItem> dataItems = dataItemMap.get(indexId); |
| | | final String energyId = indexIdEnergyIdMap.get(indexId); |
| | | final BigDecimal coefficient = (BigDecimal) energyCoefficientMap.get(energyId); |
| | | |
| | | if(CollectionUtils.isNotEmpty(dataItems) ){ |
| | | BigDecimal sum = BigDecimal.valueOf(dataItems.stream() |
| | | .mapToDouble(DataItem::getValue).sum()).setScale(CommonConst.DIGIT_2, RoundingMode.HALF_UP).multiply(coefficient); |
| | | |
| | | if (resultMap.containsKey(key)) { |
| | | resultMap.put(key, resultMap.get(key).add(sum)); |
| | | } else { |
| | | resultMap.put(key, sum); |
| | | return energyDataList; |
| | | } |
| | | |
| | | LambdaQueryWrapper<ModelNode> parentNodeLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | parentNodeLambdaQueryWrapper.eq(ModelNode::getModelCode, modelCode); |
| | | List<ModelNode> modelNodeList = modelNodeMapper.selectList(parentNodeLambdaQueryWrapper); |
| | | if (CollectionUtils.isEmpty(modelNodeList)) { |
| | | return energyDataList; |
| | | } |
| | | ModelNode parentNode = modelNodeList.stream().filter(x -> ObjectUtils.isEmpty(x.getParentId())).findFirst().orElse(null); |
| | | if (ObjectUtils.isEmpty(parentNode)) { |
| | | return energyDataList; |
| | | } |
| | | List<String> nodeIds = modelNodeList.stream().filter(x -> ObjectUtils.isNotEmpty(x.getParentId()) && parentNode.getNodeId().equals(x.getParentId())) |
| | | .map(ModelNode::getNodeId).collect(Collectors.toList()); |
| | | if (ObjectUtils.isEmpty(nodeIds)) { |
| | | return energyDataList; |
| | | } |
| | | energyDataList = dataItemService.getHomePageConsumptionRanking(nodeIds, timeType, beginTime, endTime); |
| | | energyDataList.forEach(x -> { |
| | | x.energyConsumption = new BigDecimal(x.energyConsumption).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
| | | }); |
| | | }); |
| | | |
| | | resultMap.forEach((key,value)->{ |
| | | RankingEnergyData rankingEnergyData = new RankingEnergyData(); |
| | | rankingEnergyData.setNodeId(key); |
| | | rankingEnergyData.setNodeName(nodeNameMap.get(key)); |
| | | rankingEnergyData.setEnergyConsumption(value.doubleValue()); |
| | | energyDataList.add(rankingEnergyData); |
| | | }); |
| | | Collections.sort(energyDataList, Comparator.comparingDouble((RankingEnergyData item) -> item.getEnergyConsumption()).reversed()); |
| | | // è·åå5æ¡è®°å½ |
| | | List<RankingEnergyData> top5Items = energyDataList.subList(0, Math.min(5, energyDataList.size())); |
| | | |
| | | return top5Items; |
| | | return energyDataList; |
| | | } |
| | | } |
| | |
| | | package com.zhitan.keyequipment.mapper; |
| | | |
| | | import com.zhitan.basicdata.domain.FacilityArchives; |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.keyequipment.domain.DailyKeyEquipment; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | @Param("dataList") List<DailyKeyEquipment> dataList, |
| | | @Param("beginTime") Date beginTime, |
| | | @Param("endTime") Date endTime, |
| | | @Param("timeType") TimeType timeType, |
| | | @Param("timeType") String timeType, |
| | | @Param("indexStorageId") String indexStorageId); |
| | | List<DailyKeyEquipment> getListChart(@Param("indexId") String indexId, |
| | | @Param("beginTime") Date beginTime, |
| | | @Param("endTime") Date endTime, |
| | | @Param("timeType") TimeType timeType, |
| | | @Param("timeType") String timeType, |
| | | @Param("indexStorageId") String indexStorageId); |
| | | List<FacilityArchives> getFacilityArchives(); |
| | | List<FacilityArchives> getPointFacility(); |
| | |
| | | package com.zhitan.keyequipment.mapper; |
| | | |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.keyequipment.domain.MonthlyKeyEquipment; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | @Param("dataList") List<MonthlyKeyEquipment> dataList, |
| | | @Param("beginTime") Date beginTime, |
| | | @Param("endTime") Date endTime, |
| | | @Param("timeType") TimeType timeType, |
| | | @Param("timeType") String timeType, |
| | | @Param("indexStorageId") String indexStorageId); |
| | | List<MonthlyKeyEquipment> getListChart(@Param("indexId") String indexId, |
| | | @Param("beginTime") Date beginTime, |
| | | @Param("endTime") Date endTime, |
| | | @Param("timeType") TimeType timeType, |
| | | @Param("timeType") String timeType, |
| | | @Param("indexStorageId") String indexStorageId); |
| | | |
| | | } |
| | |
| | | package com.zhitan.keyequipment.mapper; |
| | | |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.common.utils.TypeTime; |
| | | import com.zhitan.keyequipment.domain.YearKeyEquipment; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | */ |
| | | public interface YearKeyEquipmentMapper { |
| | | public List<YearKeyEquipment> getYearKeyEquipmentList(@Param("indexIds") List<String> indexIds, |
| | | @Param("dataList") List<YearKeyEquipment> dataList, |
| | | @Param("dataList") List<TypeTime> dataList, |
| | | @Param("beginTime") Date beginTime, |
| | | @Param("endTime") Date endTime, |
| | | @Param("timeType") TimeType timeType, |
| | | @Param("timeType") String timeType, |
| | | @Param("indexStorageId") String indexStorageId); |
| | | List<YearKeyEquipment> getListChart(@Param("indexId") String indexId, |
| | | @Param("beginTime") Date beginTime, |
| | | @Param("endTime") Date endTime, |
| | | @Param("timeType") TimeType timeType, |
| | | @Param("indexStorageId") String indexStorageId); |
| | | @Param("timeType") String timeType |
| | | ); |
| | | |
| | | } |
| | |
| | | package com.zhitan.keyequipment.service; |
| | | |
| | | import com.zhitan.basicdata.domain.FacilityArchives; |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.keyequipment.domain.DailyKeyEquipment; |
| | | |
| | | import java.util.Date; |
| | |
| | | * @date 2021-01-11 |
| | | */ |
| | | public interface IDailyKeyEquipmentService { |
| | | public List<DailyKeyEquipment> getdailyKeyEquipmentList(List<String> indexIds, List<DailyKeyEquipment> dataList, Date beginTime, Date endTime, TimeType timeType, String indexStorageId); |
| | | public List<DailyKeyEquipment> getListChart(String indexId, Date beginTime, Date endTime, TimeType timeType, String indexStorageId); |
| | | public List<DailyKeyEquipment> getdailyKeyEquipmentList(List<String> indexIds, List<DailyKeyEquipment> dataList, Date beginTime, Date endTime, String timeType, String indexStorageId); |
| | | public List<DailyKeyEquipment> getListChart(String indexId, Date beginTime, Date endTime, String timeType, String indexStorageId); |
| | | public List<FacilityArchives> getFacilityArchives(); |
| | | public List<FacilityArchives> getPointFacility(); |
| | | } |
| | |
| | | package com.zhitan.keyequipment.service; |
| | | |
| | | |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.keyequipment.domain.MonthlyKeyEquipment; |
| | | |
| | | import java.util.Date; |
| | |
| | | * @date 2021-01-11 |
| | | */ |
| | | public interface IMonthlyKeyEquipmentService { |
| | | public List<MonthlyKeyEquipment> getMonthlyKeyEquipmentList(List<String> indexIds, List<MonthlyKeyEquipment> dataList, Date beginTime, Date endTime, TimeType timeType, String indexStorageId); |
| | | List<MonthlyKeyEquipment> getListChart(String indexId, Date beginTime, Date endTime, TimeType timeType, String indexStorageId); |
| | | |
| | | List<MonthlyKeyEquipment> getMonthlyKeyEquipmentList(List<String> indexIds, List<MonthlyKeyEquipment> dataList, Date beginTime, Date endTime, String timeType, String indexStorageId); |
| | | |
| | | List<MonthlyKeyEquipment> getListChart(String indexId, Date beginTime, Date endTime, String timeType, String indexStorageId); |
| | | } |
| | |
| | | package com.zhitan.keyequipment.service; |
| | | |
| | | |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.common.utils.TypeTime; |
| | | import com.zhitan.keyequipment.domain.YearKeyEquipment; |
| | | import com.zhitan.realtimedata.domain.dto.DataItemQueryDTO; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | * @date 2021-01-11 |
| | | */ |
| | | public interface IYearKeyEquipmentService { |
| | | public List<YearKeyEquipment> getYearKeyEquipmentList(List<String> indexIds, List<YearKeyEquipment> dataList, Date beginTime, Date endTime, TimeType timeType, String indexStorageId); |
| | | List<YearKeyEquipment> getListChart(String indexId, Date beginTime, Date endTime, TimeType timeType, String indexStorageId); |
| | | List<YearKeyEquipment> getYearKeyEquipmentList(List<String> indexIds, List<TypeTime> dataList, Date beginTime, Date endTime, String timeType, String indexStorageId); |
| | | |
| | | List<YearKeyEquipment> getListChart(DataItemQueryDTO queryDto); |
| | | } |
| | |
| | | package com.zhitan.keyequipment.service.impl; |
| | | |
| | | import com.zhitan.basicdata.domain.FacilityArchives; |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.keyequipment.domain.DailyKeyEquipment; |
| | | import com.zhitan.keyequipment.mapper.DailyKeyEquipmentMapper; |
| | | import com.zhitan.keyequipment.service.IDailyKeyEquipmentService; |
| | |
| | | @Autowired |
| | | private DailyKeyEquipmentMapper dailyKeyEquipmentMapper; |
| | | |
| | | /** |
| | | * |
| | | * @param indexIds |
| | | * @param dataList |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @param indexStorageId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<DailyKeyEquipment> getdailyKeyEquipmentList(List<String> indexIds, List<DailyKeyEquipment> dataList, Date beginTime, Date endTime, TimeType timeType, String indexStorageId){ |
| | | public List<DailyKeyEquipment> getdailyKeyEquipmentList(List<String> indexIds, List<DailyKeyEquipment> dataList, Date beginTime, Date endTime, String timeType, String indexStorageId){ |
| | | if (indexIds != null && !indexIds.isEmpty()) { |
| | | return dailyKeyEquipmentMapper.getdailyKeyEquipmentList(indexIds, dataList, beginTime, endTime, timeType, indexStorageId); |
| | | } |
| | | return Collections.emptyList(); |
| | | } |
| | | @Override |
| | | public List<DailyKeyEquipment> getListChart(String indexId, Date beginTime, Date endTime, TimeType timeType, String indexStorageId){ |
| | | public List<DailyKeyEquipment> getListChart(String indexId, Date beginTime, Date endTime, String timeType, String indexStorageId){ |
| | | if (indexId != null && !indexId.isEmpty()) { |
| | | return dailyKeyEquipmentMapper.getListChart(indexId,beginTime,endTime,timeType,indexStorageId); |
| | | } |
| | |
| | | package com.zhitan.keyequipment.service.impl; |
| | | |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.keyequipment.domain.MonthlyKeyEquipment; |
| | | import com.zhitan.keyequipment.mapper.MonthlyKeyEquipmentMapper; |
| | | import com.zhitan.keyequipment.service.IMonthlyKeyEquipmentService; |
| | |
| | | private MonthlyKeyEquipmentMapper monthlyKeyEquipmentMapper; |
| | | |
| | | @Override |
| | | public List<MonthlyKeyEquipment> getMonthlyKeyEquipmentList(List<String> indexIds, List<MonthlyKeyEquipment> dataList, Date beginTime, Date endTime, TimeType timeType, String indexStorageId){ |
| | | public List<MonthlyKeyEquipment> getMonthlyKeyEquipmentList(List<String> indexIds, List<MonthlyKeyEquipment> dataList, Date beginTime, Date endTime, String timeType, String indexStorageId){ |
| | | if (indexIds != null && !indexIds.isEmpty()) { |
| | | return monthlyKeyEquipmentMapper.getMonthlyKeyEquipmentList(indexIds, dataList, beginTime, endTime, timeType, indexStorageId); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<MonthlyKeyEquipment> getListChart(String indexId, Date beginTime, Date endTime, TimeType timeType, String indexStorageId){ |
| | | public List<MonthlyKeyEquipment> getListChart(String indexId, Date beginTime, Date endTime, String timeType, String indexStorageId){ |
| | | if (indexId != null && !indexId.isEmpty()) { |
| | | return monthlyKeyEquipmentMapper.getListChart(indexId,beginTime,endTime,timeType,indexStorageId); |
| | | } |
| | |
| | | package com.zhitan.keyequipment.service.impl; |
| | | |
| | | import com.zhitan.common.enums.TimeType; |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.zhitan.common.utils.DateTimeUtil; |
| | | import com.zhitan.common.utils.TypeTime; |
| | | import com.zhitan.keyequipment.domain.YearKeyEquipment; |
| | | import com.zhitan.keyequipment.mapper.YearKeyEquipmentMapper; |
| | | import com.zhitan.keyequipment.service.IYearKeyEquipmentService; |
| | | import com.zhitan.realtimedata.domain.dto.DataItemQueryDTO; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | @Autowired |
| | | private YearKeyEquipmentMapper yearKeyEquipmentMapper; |
| | | |
| | | public List<YearKeyEquipment> getYearKeyEquipmentList(List<String> indexIds, List<YearKeyEquipment> dataList, Date beginTime, Date endTime, TimeType timeType, String indexStorageId){ |
| | | public List<YearKeyEquipment> getYearKeyEquipmentList(List<String> indexIds, List<TypeTime> dataList, Date beginTime, Date endTime, String timeType, String indexStorageId){ |
| | | if (indexIds != null && !indexIds.isEmpty()) { |
| | | return yearKeyEquipmentMapper.getYearKeyEquipmentList(indexIds, dataList, beginTime, endTime, timeType, indexStorageId); |
| | | } |
| | | return Collections.emptyList(); |
| | | } |
| | | @Override |
| | | public List<YearKeyEquipment> getListChart(String indexId, Date beginTime, Date endTime, TimeType timeType, String indexStorageId){ |
| | | if (indexId != null && !indexId.isEmpty()) { |
| | | return yearKeyEquipmentMapper.getListChart(indexId,beginTime,endTime,timeType,indexStorageId); |
| | | } |
| | | return Collections.emptyList(); |
| | | public List<YearKeyEquipment> getListChart(DataItemQueryDTO queryDto){ |
| | | if(ObjectUtils.isEmpty(queryDto.getIndexId())){ |
| | | return Collections.emptyList();} |
| | | Date convertTime = DateTimeUtil.getTime(queryDto.getTimeType(), queryDto.getDataTime()); |
| | | DateTime beginTime = DateUtil.beginOfYear(convertTime); |
| | | DateTime endTime = DateUtil.endOfYear(convertTime); |
| | | return yearKeyEquipmentMapper.getListChart(queryDto.getIndexId(),beginTime,endTime,queryDto.getTimeType()); |
| | | } |
| | | } |
| | |
| | | @Excel(name = "åæ°ç¼ç ") |
| | | private String code; |
| | | |
| | | @Excel(name = "ééç¼ç ") |
| | | private String gatewayKey; |
| | | /** |
| | | * åæ°åç§° |
| | | */ |
| | |
| | | public void setUnit(String unit) { |
| | | this.unit = unit; |
| | | } |
| | | |
| | | public String getGatewayKey() { |
| | | return gatewayKey; |
| | | } |
| | | |
| | | public void setGatewayKey(String gatewayKey) { |
| | | this.gatewayKey = gatewayKey; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.model.domain.vo; |
| | | |
| | | |
| | | import com.zhitan.common.core.domain.BaseEntity; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 模åèç¹ä¸ç¹ä½å
³ç³»å¯¹è±¡ |
| | | * |
| | | * @Author: Zhujw |
| | | * @Date: 2023/3/2 |
| | | */ |
| | | @Data |
| | | public class ModelNodeIndexInfo extends BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 模ååç§° |
| | | */ |
| | | private String modelName; |
| | | /** |
| | | * 模åç¼ç |
| | | */ |
| | | private String modelCode; |
| | | /** |
| | | * èç¹id |
| | | */ |
| | | private String nodeId; |
| | | /** |
| | | * èç¹åç§° |
| | | */ |
| | | private String name; |
| | | /** |
| | | * èç¹ç¼ç |
| | | */ |
| | | private String nodeCode; |
| | | /** |
| | | * åç§° |
| | | */ |
| | | private String nodeName; |
| | | /** |
| | | * ç¹ä½id |
| | | */ |
| | | private String indexId; |
| | | /** |
| | | * ç¹ä½åç§° |
| | | */ |
| | | private String indexName; |
| | | /** |
| | | * ç¹ä½ç¼ç |
| | | */ |
| | | private String indexCode; |
| | | |
| | | /** |
| | | * è½æºç±»å |
| | | */ |
| | | private String energyId; |
| | | /** |
| | | * ç¹ä½ç±»å |
| | | */ |
| | | private String indexType; |
| | | /** |
| | | * åä½ |
| | | */ |
| | | private String unitId; |
| | | } |
| | |
| | | |
| | | |
| | | import com.zhitan.common.core.domain.BaseEntity; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 模åèç¹ä¸ç¹ä½å
³ç³»å¯¹è±¡ |
| | |
| | | * @Author: Zhujw |
| | | * @Date: 2023/3/2 |
| | | */ |
| | | @Data |
| | | public class ModelNodeIndexInfor extends BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | |
| | | private String energyId; |
| | | |
| | | private String indexType; |
| | | |
| | | public String getNodeId() { |
| | | return nodeId; |
| | | } |
| | | |
| | | public void setNodeId(String nodeId) { |
| | | this.nodeId = nodeId; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getIndexId() { |
| | | return indexId; |
| | | } |
| | | |
| | | public void setIndexId(String indexId) { |
| | | this.indexId = indexId; |
| | | } |
| | | |
| | | public String getEnergyId() { |
| | | return energyId; |
| | | } |
| | | |
| | | public void setEnergyId(String energyId) { |
| | | this.energyId = energyId; |
| | | } |
| | | |
| | | public String getIndexType() { |
| | | return indexType; |
| | | } |
| | | |
| | | public void setIndexType(String indexType) { |
| | | this.indexType = indexType; |
| | | } |
| | | /** |
| | | * åä½ |
| | | */ |
| | | private String unitId; |
| | | } |
| | |
| | | |
| | | int dapHasExistWhenUpdate(@Param("id") String id, @Param("code") String code, @Param("deviceType") String deviceType); |
| | | |
| | | int dapCodeHasExist(@Param("kay") String key, @Param("deviceType") String deviceType); |
| | | |
| | | int dapCodeHasExistWhenUpdate(@Param("id") String id, @Param("key") String code, @Param("deviceType") String deviceType); |
| | | /** |
| | | * æ¥è¯¢ææ 模æ¿ä¿¡æ¯ |
| | | * |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.model.domain.EnergyIndexQuery; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | List<EnergyIndex> selectEnergyIndex(EnergyIndexQuery query); |
| | | |
| | | void removeNodeIndex(@Param("nodeId")String nodeId, @Param("indexIds")List<String> indexIds); |
| | | void removeEnergyIndex(@Param("indexIds")List<String> indexIds); |
| | | |
| | | void saveEnergyIndex(List<EnergyIndex> insertData); |
| | | |
| | |
| | | Page<EnergyIndex> selectEnergyIndexPage(@Param("page")Page<?> page, @Param("query") EnergyIndexQuery energyIndexQuery); |
| | | |
| | | List<EnergyIndex> getIndexByCode(@Param("code")String code, @Param("nodeId")String nodeId); |
| | | |
| | | List<EnergyIndex> getIndexByMeterIdIndexCode(@Param("meterId") String meterId, @Param("indexCode") String indexCode, @Param("nodeId") String nodeId); |
| | | |
| | | List<ModelNodeIndexInfo> getModelNodeIndexInfoListByIndexIds(@Param("indexIds") String[] indexIds); |
| | | } |
| | |
| | | import com.zhitan.dataitem.domain.vo.NodeIndexValueVO; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.model.domain.ModelNode; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfor; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.time.LocalDateTime; |
| | |
| | | * @param code |
| | | * @return |
| | | */ |
| | | List<ModelNodeIndexInfor> getModelNodeIndexIdRelationInforByCode(@Param("code") String code); |
| | | List<ModelNodeIndexInfo> getModelNodeIndexIdRelationInforByCode(@Param("code") String code); |
| | | |
| | | /** |
| | | * æ ¹æ®nodeIdæ¥è¯¢å¯¹åºè¯¦ç»ä¿¡æ¯ |
| | |
| | | * @param nodeId |
| | | * @return |
| | | */ |
| | | List<ModelNodeIndexInfor> getModelNodeIndexIdRelationInforByNodeId(@Param("nodeId") String nodeId); |
| | | List<ModelNodeIndexInfo> getModelNodeIndexIdRelationInforByNodeId(@Param("nodeId") String nodeId); |
| | | |
| | | /** |
| | | * æ ¹æ®ç¶idæ¥è¯¢è¯¦ç»ä¿¡æ¯ |
| | |
| | | * @param parentId |
| | | * @return |
| | | */ |
| | | List<ModelNodeIndexInfor> listModelNodeIndexIdRelationInforByParentId(@Param("parentId") String parentId); |
| | | List<ModelNodeIndexInfo> listModelNodeIndexIdRelationInforByParentId(@Param("parentId") String parentId); |
| | | |
| | | /** |
| | | * æ ¹æ®codeæ¥è¯¢ç¶çº§ä¿¡æ¯ |
| | |
| | | * @param nodeId èç¹id |
| | | * @return ç»æ |
| | | */ |
| | | List<ModelNodeIndexInfor> selectIndexByModelCodeAndNodeId(@Param("modelCode") String modelCode, @Param("nodeId") String nodeId); |
| | | List<ModelNodeIndexInfo> selectIndexByModelCodeAndNodeId(@Param("modelCode") String modelCode, @Param("nodeId") String nodeId); |
| | | |
| | | void delIndexNodeIdAndIndexType(@Param("nodeId")String nodeId, @Param("indexType")String indexType); |
| | | |
| | |
| | | * @author: hmj |
| | | * @date: 2024/10/16 19:16 |
| | | */ |
| | | List<ModelNodeIndexInfor> getModelNodeIndexIdByNodeId(@Param("nodeId")String nodeId, @Param("energyType")String energyType); |
| | | List<ModelNodeIndexInfo> getModelNodeIndexIdByNodeId(@Param("nodeId")String nodeId, @Param("energyType")String energyType); |
| | | |
| | | /** |
| | | * @description: æ ¹æ®nodeIdæ¥è¯¢åèç¹çææç»è®¡ææ |
| | |
| | | * @author: hmj |
| | | * @date: 2024/10/18 16:12 |
| | | */ |
| | | List<ModelNodeIndexInfor> getModelNodeByParentId(String parentId); |
| | | List<ModelNodeIndexInfo> getModelNodeByParentId(String parentId); |
| | | |
| | | ModelNode getFirstModeNodeInfo(String modelCode); |
| | | |
| | | List<ModelNodeIndexInfor> selectIndexByNodeIds(@Param("modelCode") String modelCode,@Param("nodeIds") List<String> nodeIds); |
| | | List<ModelNodeIndexInfo> selectIndexByNodeIds(@Param("modelCode") String modelCode, @Param("nodeIds") List<String> nodeIds); |
| | | |
| | | /** |
| | | * æ ¹æ®ç¶èç¹idåè½æºç±»åæ¥è¯¢ç¹ä½ä¸ç累积é |
| | |
| | | boolean dapHasExist(DaqTemplate daqTemplate); |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¸å设å¤ç±»å䏿¯å¦æéå¤çç¼ç |
| | | * |
| | | * @param code åæ°ç¼ç |
| | | * @param deviceType 设å¤ç±»å |
| | | * @return æ¯å¦åå¨ |
| | | */ |
| | | boolean dapCodeHasExist(String code, String deviceType); |
| | | boolean dapCodeHasExist(DaqTemplate daqTemplate); |
| | | /** |
| | | * æ¥è¯¢ææ æ¨¡æ¿ |
| | | * |
| | | * @return ç»æ |
| | |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.model.domain.EnergyIndexQuery; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | List<EnergyIndex> searchIndexByNodeAndChildrenNode(String nodeId, String filter); |
| | | |
| | | void removeNodeIndex(String nodeId, List<String> removeLink); |
| | | void removeEnergyIndex(List<String> removeLink); |
| | | |
| | | AjaxResult importEnergyIndex(List<EnergyIndex> energyIndexList, boolean updateSupport); |
| | | |
| | |
| | | * @return |
| | | */ |
| | | List<EnergyIndex> listDeviceIndex(String nodeId, String meterId); |
| | | |
| | | /** |
| | | * æ ¹æ®ç¹ä½idè·å模åèç¹ç¹ä½ä¿¡æ¯ |
| | | * @param indexIds |
| | | * @return |
| | | */ |
| | | List<ModelNodeIndexInfo> getModelNodeIndexInfoListByIndexIds(String[] indexIds); |
| | | } |
| | |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.model.domain.ModelNode; |
| | | import com.zhitan.model.domain.TreeObject; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfor; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @param code |
| | | * @return |
| | | */ |
| | | List<ModelNodeIndexInfor> getModelNodeIndexIdRelationInforByCode(String code); |
| | | List<ModelNodeIndexInfo> getModelNodeIndexIdRelationInforByCode(String code); |
| | | |
| | | /** |
| | | * æ ¹æ®nodeIdæ¥è¯¢å¯¹åºè¯¦ç»ä¿¡æ¯ |
| | |
| | | * @param nodeId |
| | | * @return |
| | | */ |
| | | List<ModelNodeIndexInfor> getModelNodeIndexIdRelationInforByNodeId(String nodeId); |
| | | List<ModelNodeIndexInfo> getModelNodeIndexIdRelationInforByNodeId(String nodeId); |
| | | |
| | | /** |
| | | * æ ¹æ®ç¶idæ¥è¯¢è¯¦ç»ä¿¡æ¯ |
| | |
| | | * @param parentId |
| | | * @return |
| | | */ |
| | | List<ModelNodeIndexInfor> listModelNodeIndexIdRelationInforByParentId(String parentId); |
| | | List<ModelNodeIndexInfo> listModelNodeIndexIdRelationInforByParentId(String parentId); |
| | | |
| | | /** |
| | | * æ ¹æ®codeæ¥è¯¢ç¶çº§ä¿¡æ¯ |
| | |
| | | return count > 0; |
| | | } |
| | | |
| | | @Override |
| | | public boolean dapCodeHasExist(String key, String deviceType) { |
| | | int count = daqTemplateMapper.dapHasExist(key, deviceType); |
| | | return count > 0; |
| | | } |
| | | @Override |
| | | public boolean dapCodeHasExist(DaqTemplate daqTemplate) { |
| | | int count = daqTemplateMapper.dapHasExistWhenUpdate(daqTemplate.getId(), daqTemplate.getGatewayKey(), daqTemplate.getDeviceType()); |
| | | return count > 0; |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ææ æ¨¡æ¿ |
| | | * |
| | |
| | | package com.zhitan.model.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zhitan.basicdata.domain.MeterImplement; |
| | | import com.zhitan.basicdata.services.IMeterImplementService; |
| | |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.model.domain.EnergyIndexQuery; |
| | | import com.zhitan.model.domain.ModelNode; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfo; |
| | | import com.zhitan.model.mapper.EnergyIndexMapper; |
| | | import com.zhitan.model.mapper.ModelNodeMapper; |
| | | import com.zhitan.model.service.IDaqTemplateService; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void removeNodeIndex(String nodeId, List<String> removeLink) { |
| | | energyIndexMapper.removeNodeIndex(nodeId, removeLink); |
| | | public void removeEnergyIndex(List<String> removeLink) { |
| | | energyIndexMapper.removeEnergyIndex(removeLink); |
| | | } |
| | | |
| | | @Override |
| | |
| | | * @return |
| | | */ |
| | | public List<EnergyIndex> listDeviceIndexByCode(String nodeId, String meterId, String indexCode) { |
| | | return energyIndexMapper.selectList(Wrappers.<EnergyIndex>lambdaQuery() |
| | | .eq(EnergyIndex::getNodeId, nodeId) |
| | | .eq(EnergyIndex::getMeterId, meterId) |
| | | .like(EnergyIndex::getCode, indexCode)); |
| | | List<EnergyIndex> energyIndexList = energyIndexMapper.getIndexByMeterIdIndexCode(meterId,indexCode,nodeId); |
| | | return energyIndexList; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public List<EnergyIndex> listDeviceIndex(String nodeId, String meterId) { |
| | | return energyIndexMapper.selectList(Wrappers.<EnergyIndex>lambdaQuery() |
| | | .eq(EnergyIndex::getNodeId, nodeId) |
| | | .eq(EnergyIndex::getMeterId, meterId)); |
| | | List<EnergyIndex> energyIndexList = energyIndexMapper.getIndexByMeterIdIndexCode(meterId,null,nodeId); |
| | | return energyIndexList; |
| | | } |
| | | |
| | | @Override |
| | | public List<ModelNodeIndexInfo> getModelNodeIndexInfoListByIndexIds(String[] indexIds) { |
| | | return energyIndexMapper.getModelNodeIndexInfoListByIndexIds(indexIds); |
| | | } |
| | | } |
| | |
| | | import com.zhitan.basicdata.services.IMeterImplementService; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.model.domain.ModelInfo; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfor; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfo; |
| | | import com.zhitan.model.domain.vo.PointDataVO; |
| | | import com.zhitan.model.mapper.ModelInfoMapper; |
| | | import com.zhitan.model.service.IEnergyIndexService; |
| | |
| | | public List<PointDataVO> listEnergyIndexByModelId(String modelId) { |
| | | List<PointDataVO> voList = new ArrayList<>(); |
| | | // æ ¹æ®idæ¥è¯¢ä¸çº§idä¸indexId |
| | | List<ModelNodeIndexInfor> inforList = modelNodeService.listModelNodeIndexIdRelationInforByParentId(modelId); |
| | | List<ModelNodeIndexInfo> inforList = modelNodeService.listModelNodeIndexIdRelationInforByParentId(modelId); |
| | | if (CollectionUtils.isEmpty(inforList)) { |
| | | List<ModelNodeIndexInfor> indexInforList = modelNodeService.getModelNodeIndexIdRelationInforByNodeId(modelId); |
| | | List<ModelNodeIndexInfo> indexInforList = modelNodeService.getModelNodeIndexIdRelationInforByNodeId(modelId); |
| | | if (CollectionUtils.isEmpty(indexInforList)) { |
| | | return voList; |
| | | } |
| | | inforList.addAll(indexInforList); |
| | | } |
| | | // å»é¤ææç¹ä½idä¿¡æ¯ |
| | | List<String> indexIds = inforList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | List<String> indexIds = inforList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toList()); |
| | | List<EnergyIndex> energyIndexList = energyIndexService.getEnergyIndexByIds(indexIds); |
| | | // æ ¹æ®indexidæ¥è¯¢å¯¹åºè®¡éå¨å
·ä¿¡æ¯ |
| | | List<String> meterIds = energyIndexList.stream().map(EnergyIndex::getMeterId).collect(Collectors.toList()); |
| | |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.model.domain.ModelNode; |
| | | import com.zhitan.model.domain.TreeObject; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfor; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfo; |
| | | import com.zhitan.model.mapper.ModelNodeMapper; |
| | | import com.zhitan.model.service.IEnergyIndexService; |
| | | import com.zhitan.model.service.IModelNodeService; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<ModelNodeIndexInfor> getModelNodeIndexIdRelationInforByCode(String code) { |
| | | public List<ModelNodeIndexInfo> getModelNodeIndexIdRelationInforByCode(String code) { |
| | | return modelNodeMapper.getModelNodeIndexIdRelationInforByCode(code); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<ModelNodeIndexInfor> getModelNodeIndexIdRelationInforByNodeId(String nodeId) { |
| | | public List<ModelNodeIndexInfo> getModelNodeIndexIdRelationInforByNodeId(String nodeId) { |
| | | return modelNodeMapper.getModelNodeIndexIdRelationInforByNodeId(nodeId); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<ModelNodeIndexInfor> listModelNodeIndexIdRelationInforByParentId(String parentId) { |
| | | public List<ModelNodeIndexInfo> listModelNodeIndexIdRelationInforByParentId(String parentId) { |
| | | return modelNodeMapper.listModelNodeIndexIdRelationInforByParentId(parentId); |
| | | } |
| | | |
| | |
| | | @Excel(name = "ç»ææ¶é´", width = 30, dateFormat = "yyyy-MM-dd") |
| | | private Date endDate; |
| | | |
| | | private String remark; |
| | | |
| | | |
| | | // /** æ¯å¦é¶æ¢¯ä»·æ ¼0å¦1æ¯ */ |
| | | // @Excel(name = "æ¯å¦é¶æ¢¯ä»·æ ¼0å¦1æ¯") |
| | | // private String type; |
| | |
| | | .append("remark", getRemark()) |
| | | .toString(); |
| | | } |
| | | |
| | | @Override |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | @Override |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | } |
| | |
| | | List<ElectricityDataItem> getDataStatisticsDeviationAnalysis(@Param("indexIdSet") Set<String> indexIdSet, |
| | | @Param("timeType") String timeType); |
| | | |
| | | /** |
| | | * æ¥è¯¢ææ¬è¶å¿ |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType æ¶é´ç±»å |
| | | * @param nodeId èç¹Id |
| | | * @param energyType è½æºç±»å |
| | | * @return |
| | | */ |
| | | List<ElectricityDataItem> getCostTrends(@Param("beginTime") Date beginTime, @Param("endTime") Date endTime, |
| | | @Param("timeType") String timeType, @Param("nodeId") String nodeId,@Param("energyType") String energyType); |
| | | |
| | | } |
| | |
| | | */ |
| | | PeakValleyHourVO segmentAnalysisHour(PeakValleyDTO dto); |
| | | |
| | | /** |
| | | * å°å³°å¹³è°·åæ¶ç»è®¡å¯¼åº |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | List<PeakValleyHourDataVO> segmentAnalysisHourExport(PeakValleyDTO dto); |
| | | |
| | | PeakValleyDayVO segmentAnalysisDayCustomize(PeakValleyDTO dto); |
| | |
| | | import com.zhitan.common.enums.ElectricityTypeEnum; |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.common.utils.DateUtils; |
| | | import com.zhitan.costmanagement.domain.vo.CostPriceRelevancyVo; |
| | | import com.zhitan.costmanagement.mapper.CostPriceRelevancyMapper; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfor; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfo; |
| | | import com.zhitan.model.mapper.ModelNodeMapper; |
| | | import com.zhitan.peakvalley.domain.ElectricityDataItem; |
| | | import com.zhitan.peakvalley.domain.dto.ElectricityDataItemListDTO; |
| | |
| | | |
| | | Map<String, List<ElectricityDataItem>> electricityDataMap = new HashMap<>(); |
| | | // æ¥è¯¢ç¹ä½ä¿¡æ¯ |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), dto.getNodeId()); |
| | | List<ModelNodeIndexInfo> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), dto.getNodeId()); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList)) { |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toSet()); |
| | | List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatistics(indexSet, startTime, endTime, timeType); |
| | | |
| | | electricityDataMap = dataItemList.stream() |
| | |
| | | |
| | | Map<String, List<ElectricityDataItem>> electricityDataMap = new HashMap<>(); |
| | | // æ¥è¯¢ç¹ä½ä¿¡æ¯ |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), dto.getNodeId()); |
| | | List<ModelNodeIndexInfo> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), dto.getNodeId()); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList)) { |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatistics(indexSet, startTime, endTime, timeType); |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toSet()); |
| | | // æ ¹æ®å°æ¶æ°æ®è®¡ç®å¤©çæ°æ® |
| | | List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatistics(indexSet, startTime, endTime, TimeType.HOUR.name()); |
| | | |
| | | electricityDataMap = dataItemList.stream() |
| | | .collect(Collectors.groupingBy(li -> DateUtil.formatDateTime(li.getDataTime()))); |
| | | } |
| | | while (!startTime.after(endTime)) { |
| | | String mapKey = DateUtil.formatDateTime(startTime); |
| | | List<ElectricityDataItem> dataItemList = electricityDataMap.get(mapKey); |
| | | |
| | | Date nextTime = DateUtil.offsetDay(startTime, 1); |
| | | List<ElectricityDataItem> dataItemList = new ArrayList<>(); |
| | | for (Map.Entry<String, List<ElectricityDataItem>> entry : electricityDataMap.entrySet()) { |
| | | String key = entry.getKey(); |
| | | if ((DateUtils.parseDate(key).after(startTime) || DateUtils.parseDate(key).equals(startTime)) && DateUtils.parseDate(key).before(nextTime)) { |
| | | List<ElectricityDataItem> list = entry.getValue(); |
| | | dataItemList.addAll(list); |
| | | } |
| | | } |
| | | |
| | | BigDecimal sharpFee = BigDecimal.ZERO; |
| | | BigDecimal sharpPower = BigDecimal.ZERO; |
| | |
| | | String electricityType = electricityDataItem.getElectricityType(); |
| | | |
| | | if (ElectricityTypeEnum.SHARP.name().equals(electricityType)) { |
| | | // sharpFee = sharpFee.add(electricityDataItem.getCost()); |
| | | |
| | | sharpFee = sharpFee.add(electricityDataItem.getCost()); |
| | | sharpPower = sharpPower.add(electricityDataItem.getElectricity()); |
| | | } else if (ElectricityTypeEnum.PEAK.name().equals(electricityType)) { |
| | | // peakFee = peakFee.add(electricityDataItem.getCost()); |
| | | peakFee = peakFee.add(electricityDataItem.getCost()); |
| | | peakPower = peakPower.add(electricityDataItem.getElectricity()); |
| | | } else if (ElectricityTypeEnum.FLAT.name().equals(electricityType)) { |
| | | // flatFee = flatFee.add(electricityDataItem.getCost()); |
| | | flatFee = flatFee.add(electricityDataItem.getCost()); |
| | | flatPower = flatPower.add(electricityDataItem.getElectricity()); |
| | | } else { |
| | | // valleyFee = valleyFee.add(electricityDataItem.getCost()); |
| | | valleyFee = valleyFee.add(electricityDataItem.getCost()); |
| | | valleyPower = valleyPower.add(electricityDataItem.getElectricity()); |
| | | } |
| | | } |
| | | //2024-11-12æ°å¢ |
| | | CostPriceRelevancyVo voS = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(),ElectricityTypeEnum.SHARP.name()); |
| | | if(voS!=null){ |
| | | sharpFee = voS.getPrice().multiply(sharpPower); |
| | | } |
| | | CostPriceRelevancyVo voP = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(),ElectricityTypeEnum.PEAK.name()); |
| | | if(voP!=null){ |
| | | peakFee = voP.getPrice().multiply(peakPower); |
| | | } |
| | | CostPriceRelevancyVo voF = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(),ElectricityTypeEnum.FLAT.name()); |
| | | if(voF!=null){ |
| | | flatFee = voF.getPrice().multiply(flatPower); |
| | | } |
| | | CostPriceRelevancyVo voV = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(), ElectricityTypeEnum.VALLEY.name()); |
| | | if(voV!=null){ |
| | | valleyFee = voV.getPrice().multiply(valleyPower); |
| | | } |
| | | // CostPriceRelevancyVo voD = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(), ElectricityTypeEnum.DEEP.name()); |
| | | // if(voV!=null){ |
| | | // DeepFee = voV.getPrice().multiply(valleyPower); |
| | | // } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | PeakValleyDayDataVO peakAndValleyReportVO = new PeakValleyDayDataVO(startTime, sharpFee, sharpPower, |
| | | peakFee, peakPower, flatFee, flatPower, valleyFee, valleyPower); |
| | |
| | | |
| | | Map<String, List<ElectricityDataItem>> electricityDataMap = new HashMap<>(); |
| | | // æ¥è¯¢ç¹ä½ä¿¡æ¯ |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), dto.getNodeId()); |
| | | List<ModelNodeIndexInfo> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), dto.getNodeId()); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList)) { |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toSet()); |
| | | List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatistics(indexSet, startTime, endTime, timeType); |
| | | |
| | | electricityDataMap = dataItemList.stream() |
| | |
| | | String electricityType = electricityDataItem.getElectricityType(); |
| | | |
| | | if (ElectricityTypeEnum.SHARP.name().equals(electricityType)) { |
| | | // sharpFee = sharpFee.add(electricityDataItem.getCost()); |
| | | sharpFee = sharpFee.add(electricityDataItem.getCost()); |
| | | sharpPower = sharpPower.add(electricityDataItem.getElectricity()); |
| | | } else if (ElectricityTypeEnum.PEAK.name().equals(electricityType)) { |
| | | // peakFee = peakFee.add(electricityDataItem.getCost()); |
| | | peakFee = peakFee.add(electricityDataItem.getCost()); |
| | | peakPower = peakPower.add(electricityDataItem.getElectricity()); |
| | | } else if (ElectricityTypeEnum.FLAT.name().equals(electricityType)) { |
| | | // flatFee = flatFee.add(electricityDataItem.getCost()); |
| | | flatFee = flatFee.add(electricityDataItem.getCost()); |
| | | flatPower = flatPower.add(electricityDataItem.getElectricity()); |
| | | } else { |
| | | // valleyFee = valleyFee.add(electricityDataItem.getCost()); |
| | | valleyFee = valleyFee.add(electricityDataItem.getCost()); |
| | | valleyPower = valleyPower.add(electricityDataItem.getElectricity()); |
| | | } |
| | | } |
| | | //2024-11-12æ°å¢ |
| | | CostPriceRelevancyVo voS = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(),ElectricityTypeEnum.SHARP.name()); |
| | | if(voS!=null){ |
| | | sharpFee = voS.getPrice().multiply(sharpPower); |
| | | } |
| | | CostPriceRelevancyVo voP = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(),ElectricityTypeEnum.PEAK.name()); |
| | | if(voP!=null){ |
| | | peakFee = voP.getPrice().multiply(peakPower); |
| | | } |
| | | CostPriceRelevancyVo voF = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(),ElectricityTypeEnum.FLAT.name()); |
| | | if(voF!=null){ |
| | | flatFee = voF.getPrice().multiply(flatPower); |
| | | } |
| | | CostPriceRelevancyVo voV = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(), ElectricityTypeEnum.VALLEY.name()); |
| | | if(voV!=null){ |
| | | valleyFee = voV.getPrice().multiply(valleyPower); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | PeakValleyHourDataVO peakAndValleyReportVO = new PeakValleyHourDataVO(startTime, sharpFee, sharpPower, |
| | | peakFee, peakPower, flatFee, flatPower, valleyFee, valleyPower); |
| | |
| | | |
| | | Map<String, List<ElectricityDataItem>> electricityDataMap = new HashMap<>(); |
| | | // æ¥è¯¢ç¹ä½ä¿¡æ¯ |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), dto.getNodeId()); |
| | | List<ModelNodeIndexInfo> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), dto.getNodeId()); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList)) { |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toSet()); |
| | | List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatistics(indexSet, startTime, endTime, timeType); |
| | | |
| | | electricityDataMap = dataItemList.stream() |
| | |
| | | * è´è´£äººçµè¯ |
| | | */ |
| | | private String principalsTel; |
| | | |
| | | private String remark; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.processenergy.domain; |
| | | |
| | | import com.zhitan.common.annotation.Excel; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | *å·¥åºè½è æ¥ |
| | | * |
| | | * @author sys |
| | | * @date 2021-01-11 |
| | | */ |
| | | @Data |
| | | public class DailyProcessEnergy implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | private String indexId; |
| | | @Excel(name = "ææ åç§°") |
| | | private String indexName; |
| | | private String value; |
| | | private Date dataTime; |
| | | private String timeType; |
| | | private String timeCode; |
| | | private String unitId; |
| | | @Excel(name = "1æ¶") |
| | | private Double value1; |
| | | @Excel(name = "2æ¶") |
| | | private Double value2; |
| | | @Excel(name = "3æ¶") |
| | | private Double value3; |
| | | @Excel(name = "4æ¶") |
| | | private Double value4; |
| | | @Excel(name = "5æ¶") |
| | | private Double value5; |
| | | @Excel(name = "6æ¶") |
| | | private Double value6; |
| | | @Excel(name = "7æ¶") |
| | | private Double value7; |
| | | @Excel(name = "8æ¶") |
| | | private Double value8; |
| | | @Excel(name = "9æ¶") |
| | | private Double value9; |
| | | @Excel(name = "10æ¶") |
| | | private Double value10; |
| | | @Excel(name = "11æ¶") |
| | | private Double value11; |
| | | @Excel(name = "12æ¶") |
| | | private Double value12; |
| | | @Excel(name = "13æ¶") |
| | | private Double value13; |
| | | @Excel(name = "14æ¶") |
| | | private Double value14; |
| | | @Excel(name = "15æ¶") |
| | | private Double value15; |
| | | @Excel(name = "16æ¶") |
| | | private Double value16; |
| | | @Excel(name = "17æ¶") |
| | | private Double value17; |
| | | @Excel(name = "18æ¶") |
| | | private Double value18; |
| | | @Excel(name = "19æ¶") |
| | | private Double value19; |
| | | @Excel(name = "20æ¶") |
| | | private Double value20; |
| | | @Excel(name = "21æ¶") |
| | | private Double value21; |
| | | @Excel(name = "22æ¶") |
| | | private Double value22; |
| | | @Excel(name = "23æ¶") |
| | | private Double value23; |
| | | @Excel(name = "0æ¶") |
| | | private Double value0; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.processenergy.domain; |
| | | |
| | | import com.zhitan.common.annotation.Excel; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | *å·¥åºè½è æ |
| | | * |
| | | * @author sys |
| | | * @date 2021-01-11 |
| | | */ |
| | | public class MonthlyProcessEnergy implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | private String indexId; |
| | | @Excel(name = "ææ åç§°") |
| | | private String indexName; |
| | | private String value; |
| | | private Date dataTime; |
| | | private String timeType; |
| | | private String timeCode; |
| | | @Excel(name = "1æ¥") |
| | | private Double value1; |
| | | @Excel(name = "2æ¥") |
| | | private Double value2; |
| | | @Excel(name = "3æ¥") |
| | | private Double value3; |
| | | @Excel(name = "4æ¥") |
| | | private Double value4; |
| | | @Excel(name = "5æ¥") |
| | | private Double value5; |
| | | @Excel(name = "6æ¥") |
| | | private Double value6; |
| | | @Excel(name = "7æ¥") |
| | | private Double value7; |
| | | @Excel(name = "8æ¥") |
| | | private Double value8; |
| | | @Excel(name = "9æ¥") |
| | | private Double value9; |
| | | @Excel(name = "10æ¥") |
| | | private Double value10; |
| | | @Excel(name = "11æ¥") |
| | | private Double value11; |
| | | @Excel(name = "12æ¥") |
| | | private Double value12; |
| | | @Excel(name = "13æ¥") |
| | | private Double value13; |
| | | @Excel(name = "14æ¥") |
| | | private Double value14; |
| | | @Excel(name = "15æ¥") |
| | | private Double value15; |
| | | @Excel(name = "16æ¥") |
| | | private Double value16; |
| | | @Excel(name = "17æ¥") |
| | | private Double value17; |
| | | @Excel(name = "18æ¥") |
| | | private Double value18; |
| | | @Excel(name = "19æ¥") |
| | | private Double value19; |
| | | @Excel(name = "20æ¥") |
| | | private Double value20; |
| | | @Excel(name = "21æ¥") |
| | | private Double value21; |
| | | @Excel(name = "22æ¥") |
| | | private Double value22; |
| | | @Excel(name = "23æ¥") |
| | | private Double value23; |
| | | @Excel(name = "24æ¥") |
| | | private Double value24; |
| | | @Excel(name = "25æ¥") |
| | | private Double value25; |
| | | @Excel(name = "26æ¥") |
| | | private Double value26; |
| | | @Excel(name = "27æ¥") |
| | | private Double value27; |
| | | @Excel(name = "28æ¥") |
| | | private Double value28; |
| | | @Excel(name = "29æ¥") |
| | | private Double value29; |
| | | @Excel(name = "30æ¥") |
| | | private Double value30; |
| | | @Excel(name = "31æ¥") |
| | | private Double value31; |
| | | private Integer count; |
| | | private String unitId; |
| | | /** æ»è®°å½æ° */ |
| | | private long total; |
| | | private List<Map> tablehead =new ArrayList<>(); |
| | | private List<MonthlyProcessEnergy> tabledata =new ArrayList<MonthlyProcessEnergy>(); |
| | | public String getIndexId() { |
| | | return indexId; |
| | | } |
| | | |
| | | public void setIndexId(String indexId) { |
| | | this.indexId = indexId; |
| | | } |
| | | |
| | | public String getIndexName() { |
| | | return indexName; |
| | | } |
| | | |
| | | public void setIndexName(String indexName) { |
| | | this.indexName = indexName; |
| | | } |
| | | public String getUnitId() { |
| | | return unitId; |
| | | } |
| | | |
| | | public void setUnitId(String unitId) { |
| | | this.unitId = unitId; |
| | | } |
| | | |
| | | public String getTimeCode() { |
| | | return timeCode; |
| | | } |
| | | |
| | | public void setTimeCode(String timeCode) { |
| | | this.timeCode = timeCode; |
| | | } |
| | | |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public void setValue(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | public String getTimeType() { |
| | | return timeType; |
| | | } |
| | | |
| | | public void setTimeType(String timeType) { |
| | | this.timeType = timeType; |
| | | } |
| | | |
| | | public Date getDataTime() { |
| | | return dataTime; |
| | | } |
| | | |
| | | public void setDataTime(Date dataTime) { |
| | | this.dataTime = dataTime; |
| | | } |
| | | |
| | | public Double getValue1() { |
| | | return value1; |
| | | } |
| | | |
| | | public void setValue1(Double value1) { |
| | | this.value1 = value1; |
| | | } |
| | | |
| | | public Double getValue2() { |
| | | return value2; |
| | | } |
| | | |
| | | public void setValue2(Double value2) { |
| | | this.value2 = value2; |
| | | } |
| | | |
| | | public Double getValue3() { |
| | | return value3; |
| | | } |
| | | |
| | | public void setValue3(Double value3) { |
| | | this.value3 = value3; |
| | | } |
| | | |
| | | public Double getValue4() { |
| | | return value4; |
| | | } |
| | | |
| | | public void setValue4(Double value4) { |
| | | this.value4 = value4; |
| | | } |
| | | |
| | | public Double getValue5() { |
| | | return value5; |
| | | } |
| | | |
| | | public void setValue5(Double value5) { |
| | | this.value5 = value5; |
| | | } |
| | | |
| | | public Double getValue6() { |
| | | return value6; |
| | | } |
| | | |
| | | public void setValue6(Double value6) { |
| | | this.value6 = value6; |
| | | } |
| | | |
| | | public Double getValue7() { |
| | | return value7; |
| | | } |
| | | |
| | | public void setValue7(Double value7) { |
| | | this.value7 = value7; |
| | | } |
| | | |
| | | public Double getValue8() { |
| | | return value8; |
| | | } |
| | | |
| | | public void setValue8(Double value8) { |
| | | this.value8 = value8; |
| | | } |
| | | |
| | | public Double getValue9() { |
| | | return value9; |
| | | } |
| | | |
| | | public void setValue9(Double value9) { |
| | | this.value9 = value9; |
| | | } |
| | | |
| | | public Double getValue10() { |
| | | return value10; |
| | | } |
| | | |
| | | public void setValue10(Double value10) { |
| | | this.value10 = value10; |
| | | } |
| | | |
| | | public Double getValue11() { |
| | | return value11; |
| | | } |
| | | |
| | | public void setValue11(Double value11) { |
| | | this.value11 = value11; |
| | | } |
| | | |
| | | public Double getValue12() { |
| | | return value12; |
| | | } |
| | | |
| | | public void setValue12(Double value12) { |
| | | this.value12 = value12; |
| | | } |
| | | |
| | | public Double getValue13() { |
| | | return value13; |
| | | } |
| | | |
| | | public void setValue13(Double value13) { |
| | | this.value13 = value13; |
| | | } |
| | | |
| | | public Double getValue14() { |
| | | return value14; |
| | | } |
| | | |
| | | public void setValue14(Double value14) { |
| | | this.value14 = value14; |
| | | } |
| | | |
| | | public Double getValue15() { |
| | | return value15; |
| | | } |
| | | |
| | | public void setValue15(Double value15) { |
| | | this.value15 = value15; |
| | | } |
| | | |
| | | public Double getValue16() { |
| | | return value16; |
| | | } |
| | | |
| | | public void setValue16(Double value16) { |
| | | this.value16 = value16; |
| | | } |
| | | |
| | | public Double getValue17() { |
| | | return value17; |
| | | } |
| | | |
| | | public void setValue17(Double value17) { |
| | | this.value17 = value17; |
| | | } |
| | | |
| | | public Double getValue18() { |
| | | return value18; |
| | | } |
| | | |
| | | public void setValue18(Double value18) { |
| | | this.value18 = value18; |
| | | } |
| | | |
| | | public Double getValue19() { |
| | | return value19; |
| | | } |
| | | |
| | | public void setValue19(Double value19) { |
| | | this.value19 = value19; |
| | | } |
| | | |
| | | public Double getValue20() { |
| | | return value20; |
| | | } |
| | | |
| | | public void setValue20(Double value20) { |
| | | this.value20 = value20; |
| | | } |
| | | |
| | | public Double getValue21() { |
| | | return value21; |
| | | } |
| | | |
| | | public void setValue21(Double value21) { |
| | | this.value21 = value21; |
| | | } |
| | | |
| | | public Double getValue22() { |
| | | return value22; |
| | | } |
| | | |
| | | public void setValue22(Double value22) { |
| | | this.value22 = value22; |
| | | } |
| | | |
| | | public Double getValue23() { |
| | | return value23; |
| | | } |
| | | |
| | | public void setValue23(Double value23) { |
| | | this.value23 = value23; |
| | | } |
| | | |
| | | public Double getValue24() { |
| | | return value24; |
| | | } |
| | | |
| | | public void setValue24(Double value24) { |
| | | this.value24 = value24; |
| | | } |
| | | |
| | | public Double getValue25() { |
| | | return value25; |
| | | } |
| | | |
| | | public void setValue25(Double value25) { |
| | | this.value25 = value25; |
| | | } |
| | | |
| | | public Double getValue26() { |
| | | return value26; |
| | | } |
| | | |
| | | public void setValue26(Double value26) { |
| | | this.value26 = value26; |
| | | } |
| | | |
| | | public Double getValue27() { |
| | | return value27; |
| | | } |
| | | |
| | | public void setValue27(Double value27) { |
| | | this.value27 = value27; |
| | | } |
| | | |
| | | public Double getValue28() { |
| | | return value28; |
| | | } |
| | | |
| | | public void setValue28(Double value28) { |
| | | this.value28 = value28; |
| | | } |
| | | |
| | | public Double getValue29() { |
| | | return value29; |
| | | } |
| | | |
| | | public void setValue29(Double value29) { |
| | | this.value29 = value29; |
| | | } |
| | | |
| | | public Double getValue30() { |
| | | return value30; |
| | | } |
| | | |
| | | public void setValue30(Double value30) { |
| | | this.value30 = value30; |
| | | } |
| | | |
| | | public Double getValue31() { |
| | | return value31; |
| | | } |
| | | |
| | | public void setValue31(Double value31) { |
| | | this.value31 = value31; |
| | | } |
| | | |
| | | public List<Map> getTablehead() { |
| | | return tablehead; |
| | | } |
| | | |
| | | public void setTablehead(List<Map> tablehead) { |
| | | this.tablehead = tablehead; |
| | | } |
| | | public List<MonthlyProcessEnergy> getTabledata() { |
| | | return tabledata; |
| | | } |
| | | |
| | | public void setTabledata(List<MonthlyProcessEnergy> tabledata) { |
| | | this.tabledata = tabledata; |
| | | } |
| | | |
| | | public Integer getCount() { |
| | | return count; |
| | | } |
| | | |
| | | public void setCount(Integer count) { |
| | | this.count = count; |
| | | } |
| | | |
| | | public long getTotal() { |
| | | return total; |
| | | } |
| | | |
| | | public void setTotal(long total) { |
| | | this.total = total; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.processenergy.domain; |
| | | |
| | | import com.zhitan.common.annotation.Excel; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | *å·¥åºè½è æ |
| | | * |
| | | * @author sys |
| | | * @date 2021-01-11 |
| | | */ |
| | | public class YearProcessEnergy implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | private String indexId; |
| | | @Excel(name = "ææ åç§°") |
| | | private String indexName; |
| | | private String value; |
| | | private Date dataTime; |
| | | private String timeType; |
| | | private String timeCode; |
| | | @Excel(name = "1æ") |
| | | private Double value1; |
| | | @Excel(name = "2æ") |
| | | private Double value2; |
| | | @Excel(name = "3æ") |
| | | private Double value3; |
| | | @Excel(name = "4æ") |
| | | private Double value4; |
| | | @Excel(name = "5æ") |
| | | private Double value5; |
| | | @Excel(name = "6æ") |
| | | private Double value6; |
| | | @Excel(name = "7æ") |
| | | private Double value7; |
| | | @Excel(name = "8æ") |
| | | private Double value8; |
| | | @Excel(name = "9æ") |
| | | private Double value9; |
| | | @Excel(name = "10æ") |
| | | private Double value10; |
| | | @Excel(name = "11æ") |
| | | private Double value11; |
| | | @Excel(name = "12æ") |
| | | private Double value12; |
| | | private Integer count; |
| | | private String unitId; |
| | | /** æ»è®°å½æ° */ |
| | | private long total; |
| | | private List<Map> tablehead =new ArrayList<>(); |
| | | private List<YearProcessEnergy> tabledata =new ArrayList<YearProcessEnergy>(); |
| | | public String getIndexId() { |
| | | return indexId; |
| | | } |
| | | |
| | | public void setIndexId(String indexId) { |
| | | this.indexId = indexId; |
| | | } |
| | | |
| | | public String getIndexName() { |
| | | return indexName; |
| | | } |
| | | |
| | | public void setIndexName(String indexName) { |
| | | this.indexName = indexName; |
| | | } |
| | | public String getUnitId() { |
| | | return unitId; |
| | | } |
| | | |
| | | public void setUnitId(String unitId) { |
| | | this.unitId = unitId; |
| | | } |
| | | |
| | | public String getTimeCode() { |
| | | return timeCode; |
| | | } |
| | | |
| | | public void setTimeCode(String timeCode) { |
| | | this.timeCode = timeCode; |
| | | } |
| | | |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public void setValue(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | public String getTimeType() { |
| | | return timeType; |
| | | } |
| | | |
| | | public void setTimeType(String timeType) { |
| | | this.timeType = timeType; |
| | | } |
| | | |
| | | public Date getDataTime() { |
| | | return dataTime; |
| | | } |
| | | |
| | | public void setDataTime(Date dataTime) { |
| | | this.dataTime = dataTime; |
| | | } |
| | | |
| | | public Double getValue1() { |
| | | return value1; |
| | | } |
| | | |
| | | public void setValue1(Double value1) { |
| | | this.value1 = value1; |
| | | } |
| | | |
| | | public Double getValue2() { |
| | | return value2; |
| | | } |
| | | |
| | | public void setValue2(Double value2) { |
| | | this.value2 = value2; |
| | | } |
| | | |
| | | public Double getValue3() { |
| | | return value3; |
| | | } |
| | | |
| | | public void setValue3(Double value3) { |
| | | this.value3 = value3; |
| | | } |
| | | |
| | | public Double getValue4() { |
| | | return value4; |
| | | } |
| | | |
| | | public void setValue4(Double value4) { |
| | | this.value4 = value4; |
| | | } |
| | | |
| | | public Double getValue5() { |
| | | return value5; |
| | | } |
| | | |
| | | public void setValue5(Double value5) { |
| | | this.value5 = value5; |
| | | } |
| | | |
| | | public Double getValue6() { |
| | | return value6; |
| | | } |
| | | |
| | | public void setValue6(Double value6) { |
| | | this.value6 = value6; |
| | | } |
| | | |
| | | public Double getValue7() { |
| | | return value7; |
| | | } |
| | | |
| | | public void setValue7(Double value7) { |
| | | this.value7 = value7; |
| | | } |
| | | |
| | | public Double getValue8() { |
| | | return value8; |
| | | } |
| | | |
| | | public void setValue8(Double value8) { |
| | | this.value8 = value8; |
| | | } |
| | | |
| | | public Double getValue9() { |
| | | return value9; |
| | | } |
| | | |
| | | public void setValue9(Double value9) { |
| | | this.value9 = value9; |
| | | } |
| | | |
| | | public Double getValue10() { |
| | | return value10; |
| | | } |
| | | |
| | | public void setValue10(Double value10) { |
| | | this.value10 = value10; |
| | | } |
| | | |
| | | public Double getValue11() { |
| | | return value11; |
| | | } |
| | | |
| | | public void setValue11(Double value11) { |
| | | this.value11 = value11; |
| | | } |
| | | |
| | | public Double getValue12() { |
| | | return value12; |
| | | } |
| | | |
| | | public void setValue12(Double value12) { |
| | | this.value12 = value12; |
| | | } |
| | | |
| | | public List<Map> getTablehead() { |
| | | return tablehead; |
| | | } |
| | | |
| | | public void setTablehead(List<Map> tablehead) { |
| | | this.tablehead = tablehead; |
| | | } |
| | | public List<YearProcessEnergy> getTabledata() { |
| | | return tabledata; |
| | | } |
| | | |
| | | public void setTabledata(List<YearProcessEnergy> tabledata) { |
| | | this.tabledata = tabledata; |
| | | } |
| | | |
| | | public Integer getCount() { |
| | | return count; |
| | | } |
| | | |
| | | public void setCount(Integer count) { |
| | | this.count = count; |
| | | } |
| | | |
| | | public long getTotal() { |
| | | return total; |
| | | } |
| | | |
| | | public void setTotal(long total) { |
| | | this.total = total; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.processenergy.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * å¨ææ°æ®é¡¹. |
| | | */ |
| | | @Data |
| | | public class DataItemQueryDTO { |
| | | |
| | | |
| | | @ApiModelProperty(value = "ææ id") |
| | | private String indexId; |
| | | |
| | | @ApiModelProperty(value = "模åcode") |
| | | private String indexCode; |
| | | |
| | | @ApiModelProperty(value = "æ¶é´å符串") |
| | | private String dataTime; |
| | | |
| | | @ApiModelProperty(value = "æ¶é´ç±»å") |
| | | private String timeType; |
| | | |
| | | @ApiModelProperty(value = "è½æºç±»å") |
| | | private String energyType; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.processenergy.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zhitan.processenergy.domain.DailyProcessEnergy; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | *å·¥åºè½è æ¥ |
| | | * |
| | | * @author sys |
| | | */ |
| | | public interface DailyProcessEnergyMapper extends BaseMapper<DailyProcessEnergy> { |
| | | |
| | | /** |
| | | * |
| | | * @param indexIds |
| | | * @param dataList |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @param indexStorageId |
| | | * @return |
| | | */ |
| | | List<DailyProcessEnergy> getDailyProcessEnergyList(@Param("indexIds") List<String> indexIds, |
| | | @Param("dataList") List<DailyProcessEnergy> dataList, |
| | | @Param("beginTime") Date beginTime, |
| | | @Param("endTime") Date endTime, |
| | | @Param("timeType") String timeType, |
| | | @Param("indexStorageId") String indexStorageId); |
| | | |
| | | /** |
| | | * |
| | | * @param indexId |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @param indexStorageId |
| | | * @return |
| | | */ |
| | | List<DailyProcessEnergy> getListChart(@Param("indexId") String indexId, |
| | | @Param("beginTime") Date beginTime, |
| | | @Param("endTime") Date endTime, |
| | | @Param("timeType") String timeType, |
| | | @Param("indexStorageId") String indexStorageId); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.processenergy.mapper; |
| | | |
| | | import com.zhitan.processenergy.domain.MonthlyProcessEnergy; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | *å·¥åºè½è æ¥ |
| | | * |
| | | * @author sys |
| | | */ |
| | | public interface MonthlyProcessEnergyMapper { |
| | | |
| | | /** |
| | | * |
| | | * @param indexIds |
| | | * @param dataList |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @param indexStorageId |
| | | * @return |
| | | */ |
| | | List<MonthlyProcessEnergy> getMonthlyProcessEnergy(@Param("indexIds") List<String> indexIds, |
| | | @Param("dataList") List<MonthlyProcessEnergy> dataList, |
| | | @Param("beginTime") Date beginTime, |
| | | @Param("endTime") Date endTime, |
| | | @Param("timeType") String timeType, |
| | | @Param("indexStorageId") String indexStorageId); |
| | | |
| | | /** |
| | | * |
| | | * @param indexId |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @param indexStorageId |
| | | * @return |
| | | */ |
| | | List<MonthlyProcessEnergy> getListChart(@Param("indexId") String indexId, |
| | | @Param("beginTime") Date beginTime, |
| | | @Param("endTime") Date endTime, |
| | | @Param("timeType") String timeType, |
| | | @Param("indexStorageId") String indexStorageId); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.processenergy.mapper; |
| | | |
| | | import com.zhitan.common.utils.TypeTime; |
| | | import com.zhitan.processenergy.domain.YearProcessEnergy; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | *å·¥åºè½è æ¥ |
| | | * |
| | | * @author sys |
| | | */ |
| | | public interface YearProcessEnergyMapper { |
| | | |
| | | /** |
| | | * |
| | | * @param indexIds |
| | | * @param dataList |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @param indexStorageId |
| | | * @return |
| | | */ |
| | | List<YearProcessEnergy> getYearProcessEnergy(@Param("indexIds") List<String> indexIds, |
| | | @Param("dataList") List<TypeTime> dataList, |
| | | @Param("beginTime") Date beginTime, |
| | | @Param("endTime") Date endTime, |
| | | @Param("timeType") String timeType, |
| | | @Param("indexStorageId") String indexStorageId); |
| | | |
| | | /** |
| | | * |
| | | * @param indexId |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @return |
| | | */ |
| | | List<YearProcessEnergy> getListChart(@Param("indexId") String indexId, |
| | | @Param("beginTime") Date beginTime, |
| | | @Param("endTime") Date endTime, |
| | | @Param("timeType") String timeType); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.processenergy.service; |
| | | |
| | | import com.zhitan.processenergy.domain.DailyProcessEnergy; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | *å·¥åºè½è æ¥ |
| | | * |
| | | * @author sys |
| | | * @date 2021-01-11 |
| | | */ |
| | | public interface IDailyProcessEnergyService { |
| | | |
| | | /** |
| | | * |
| | | * @param indexIds |
| | | * @param dataList |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @param indexStorageId |
| | | * @return |
| | | */ |
| | | List<DailyProcessEnergy> getDailyProcessEnergyList(List<String> indexIds, List<DailyProcessEnergy> dataList, Date beginTime, Date endTime, String timeType, String indexStorageId); |
| | | |
| | | /** |
| | | * |
| | | * @param indexId |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @param indexStorageId |
| | | * @return |
| | | */ |
| | | List<DailyProcessEnergy> getListChart(String indexId, Date beginTime, Date endTime, String timeType, String indexStorageId); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.processenergy.service; |
| | | |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.processenergy.domain.MonthlyProcessEnergy; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | *å·¥åºè½è æ¥ |
| | | * |
| | | * @author sys |
| | | * @date 2021-01-11 |
| | | */ |
| | | public interface IMonthlyProcessEnergyService { |
| | | public List<MonthlyProcessEnergy> getMonthlyProcessEnergy(List<String> indexIds, List<MonthlyProcessEnergy> dataList, Date beginTime, Date endTime, String timeType, String indexStorageId); |
| | | |
| | | List<MonthlyProcessEnergy> getListChart(String indexId, Date beginTime, Date endTime, String timeType, String indexStorageId); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.processenergy.service; |
| | | |
| | | import com.zhitan.common.utils.TypeTime; |
| | | import com.zhitan.processenergy.domain.YearProcessEnergy; |
| | | import com.zhitan.realtimedata.domain.dto.DataItemQueryDTO; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | *å·¥åºè½è æ¥ |
| | | * |
| | | * @author sys |
| | | * @date 2021-01-11 |
| | | */ |
| | | public interface IYearProcessEnergyService { |
| | | |
| | | List<YearProcessEnergy> getYearProcessEnergy(List<String> indexIds, List<TypeTime> dataList, Date beginTime, Date endTime, String timeType, String indexStorageId); |
| | | |
| | | /** |
| | | * |
| | | * @param queryDto |
| | | * @return |
| | | */ |
| | | List<YearProcessEnergy> getListChart(DataItemQueryDTO queryDto); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.processenergy.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zhitan.processenergy.domain.DailyProcessEnergy; |
| | | import com.zhitan.processenergy.mapper.DailyProcessEnergyMapper; |
| | | import com.zhitan.processenergy.service.IDailyProcessEnergyService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | *éç¹è®¾å¤è½èç»è®¡ æ¥ |
| | | * |
| | | * @author sys |
| | | * @date 2021-01-11 |
| | | */ |
| | | @Service |
| | | public class DailyProcessEnergyServiceImpl extends ServiceImpl<DailyProcessEnergyMapper,DailyProcessEnergy> implements IDailyProcessEnergyService { |
| | | |
| | | |
| | | @Override |
| | | public List<DailyProcessEnergy> getDailyProcessEnergyList(List<String> indexIds, List<DailyProcessEnergy> dataList, Date beginTime, Date endTime, String timeType, String indexStorageId){ |
| | | if (indexIds != null && !indexIds.isEmpty()){ |
| | | return baseMapper.getDailyProcessEnergyList(indexIds, dataList, beginTime, endTime, timeType, indexStorageId); |
| | | } |
| | | return Collections.emptyList(); |
| | | } |
| | | |
| | | @Override |
| | | public List<DailyProcessEnergy> getListChart(String indexId, Date beginTime, Date endTime, String timeType, String indexStorageId){ |
| | | if (indexId != null && !indexId.isEmpty()) { |
| | | return baseMapper.getListChart(indexId,beginTime,endTime,timeType,indexStorageId); |
| | | } |
| | | return Collections.emptyList(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.processenergy.service.impl; |
| | | |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.processenergy.domain.MonthlyProcessEnergy; |
| | | import com.zhitan.processenergy.mapper.MonthlyProcessEnergyMapper; |
| | | import com.zhitan.processenergy.service.IMonthlyProcessEnergyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | *éç¹è®¾å¤è½èç»è®¡ æ¥ |
| | | * |
| | | * @author sys |
| | | * @date 2021-01-11 |
| | | */ |
| | | @Service |
| | | public class MonthlyProcessEnergyServiceImpl implements IMonthlyProcessEnergyService { |
| | | |
| | | @Resource |
| | | private MonthlyProcessEnergyMapper monthlyProcessEnergyMapper; |
| | | |
| | | @Override |
| | | public List<MonthlyProcessEnergy> getMonthlyProcessEnergy(List<String> indexIds, List<MonthlyProcessEnergy> dataList, Date beginTime, Date endTime, String timeType, String indexStorageId){ |
| | | if (indexIds != null && !indexIds.isEmpty()){ |
| | | return monthlyProcessEnergyMapper.getMonthlyProcessEnergy(indexIds, dataList, beginTime, endTime, timeType, indexStorageId); |
| | | } |
| | | return Collections.emptyList(); |
| | | } |
| | | |
| | | @Override |
| | | public List<MonthlyProcessEnergy> getListChart(String indexId, Date beginTime, Date endTime, String timeType, String indexStorageId){ |
| | | if (indexId != null && !indexId.isEmpty()) { |
| | | return monthlyProcessEnergyMapper.getListChart(indexId,beginTime,endTime,timeType,indexStorageId); |
| | | } |
| | | return Collections.emptyList(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.processenergy.service.impl; |
| | | |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.zhitan.common.utils.DateTimeUtil; |
| | | import com.zhitan.common.utils.TypeTime; |
| | | import com.zhitan.processenergy.domain.YearProcessEnergy; |
| | | import com.zhitan.processenergy.mapper.YearProcessEnergyMapper; |
| | | import com.zhitan.processenergy.service.IYearProcessEnergyService; |
| | | import com.zhitan.realtimedata.domain.dto.DataItemQueryDTO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.annotation.Resources; |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | *éç¹è®¾å¤è½èç»è®¡ å¹´ |
| | | * |
| | | * @author sys |
| | | * @date 2021-01-11 |
| | | */ |
| | | @Service |
| | | public class YearProcessEnergyServiceImpl implements IYearProcessEnergyService { |
| | | |
| | | @Resource |
| | | private YearProcessEnergyMapper yearProcessEnergyMapper; |
| | | |
| | | @Override |
| | | public List<YearProcessEnergy> getYearProcessEnergy(List<String> indexIds, List<TypeTime> dataList, Date beginTime, Date endTime, String timeType, String indexStorageId){ |
| | | if (indexIds != null && !indexIds.isEmpty()) { |
| | | return yearProcessEnergyMapper.getYearProcessEnergy(indexIds, dataList, beginTime, endTime, timeType, indexStorageId); |
| | | } |
| | | return Collections.emptyList(); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param queryDto |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<YearProcessEnergy> getListChart(DataItemQueryDTO queryDto) { |
| | | |
| | | if(ObjectUtil.isEmpty(queryDto.getIndexId())) { |
| | | return Collections.emptyList(); |
| | | } |
| | | |
| | | Date convertTime = DateTimeUtil.getTypeTime(queryDto.getTimeType(), queryDto.getDataTime()); |
| | | DateTime beginTime = DateUtil.beginOfYear(convertTime); |
| | | DateTime endTime = DateUtil.endOfYear(convertTime); |
| | | return yearProcessEnergyMapper.getListChart(queryDto.getIndexId(),beginTime,endTime,queryDto.getTimeType()); |
| | | } |
| | | } |
| | |
| | | wrapper.like(StringUtils.isNotEmpty(productOutput.getDataTime()),ProductOutput::getDataTime,productOutput.getDataTime()); |
| | | wrapper.eq(StringUtils.isNotEmpty(productOutput.getProductType()),ProductOutput::getProductType,productOutput.getProductType()); |
| | | wrapper.eq(StringUtils.isNotEmpty(productOutput.getNodeId()),ProductOutput::getNodeId,productOutput.getNodeId()); |
| | | wrapper.eq(StringUtils.isNotEmpty(productOutput.getTimeType()),ProductOutput::getTimeType,productOutput.getTimeType()); |
| | | wrapper.orderByDesc(ProductOutput::getCreateTime); |
| | | Page<ProductOutput> page = productOutputMapper.selectPage(new Page<ProductOutput>(pageNum, pageSize), wrapper); |
| | | return page; |
| | |
| | | public String token; |
| | | |
| | | public String bucket; |
| | | |
| | | public String measurement; |
| | | } |
| | |
| | | StringBuilder fluxSql = new StringBuilder(); |
| | | fluxSql.append("from(bucket: \"").append(config.getBucket()).append("\")") |
| | | .append(timeRange).append("|> filter(fn: (r) => r[\"_measurement\"] == \"") |
| | | .append("meilin\")"); |
| | | .append(config.getMeasurement()).append("\")"); |
| | | fluxSql.append("|> filter(fn: (r) => r[\"_field\"] == \"value\")"); |
| | | if (!tagCodes.isEmpty()) { |
| | | fluxSql.append("|> filter(fn: (r) => r[\"tag\"] =~ /"); |
| | |
| | | package com.zhitan.realtimedata.domain; |
| | | |
| | | import com.zhitan.common.enums.Quality; |
| | | import com.zhitan.common.enums.TimeType; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | |
| | | |
| | | @ApiModelProperty(value = "ææ id") |
| | | private String indexId; |
| | | @ApiModelProperty(value = "ææ åºid") |
| | | private String indexStorageId; |
| | | @ApiModelProperty(value = "è½æºåç§") |
| | | private String energyType; |
| | | @ApiModelProperty(value = "ææ code") |
| | | private String indexCode; |
| | | @ApiModelProperty(value = "ææ åç§°") |
| | |
| | | @ApiModelProperty(value = "æ¶é´ç±»åç¼ç ") |
| | | private String timeCode; |
| | | @ApiModelProperty(value = "æ¶é´ç±»å") |
| | | private TimeType timeType; |
| | | private String timeType; |
| | | @ApiModelProperty(value = "å¼") |
| | | private Double value; |
| | | @ApiModelProperty(value = "è´¨é") |
| | |
| | | this.indexId = indexId; |
| | | } |
| | | |
| | | public String getIndexStorageId() { |
| | | return indexStorageId; |
| | | public String getEnergyType() { |
| | | return energyType; |
| | | } |
| | | |
| | | public void setIndexStorageId(String indexStorageId) { |
| | | this.indexStorageId = indexStorageId; |
| | | public void setEnergyType(String energyType) { |
| | | this.energyType = energyType; |
| | | } |
| | | |
| | | public String getIndexCode() { |
| | |
| | | this.timeCode = timeCode; |
| | | } |
| | | |
| | | public TimeType getTimeType() { |
| | | public String getTimeType() { |
| | | return timeType; |
| | | } |
| | | |
| | | public void setTimeType(TimeType timeType) { |
| | | public void setTimeType(String timeType) { |
| | | this.timeType = timeType; |
| | | } |
| | | |
| | |
| | | /** |
| | | * @author fanxinfu |
| | | */ |
| | | @Measurement(name = "meilin") |
| | | public class WritePoint { |
| | | |
| | | @Column(tag = true) |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.realtimedata.domain.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | @Data |
| | | public class BranchAnalysisDTO { |
| | | |
| | | |
| | | @ApiModelProperty(value="èç¹id") |
| | | private String nodeId; |
| | | @ApiModelProperty(value ="æ¶é´å符串") |
| | | private String dataTime; |
| | | @ApiModelProperty(value ="æ¶é´ç±»å") |
| | | private String timeType; |
| | | @ApiModelProperty(value = "è½æºç±»å") |
| | | private String energyType; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.realtimedata.domain.dto; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * å¨ææ°æ®é¡¹. |
| | | */ |
| | | @Data |
| | | public class DataItemQueryDTO { |
| | | @ApiModelProperty(value ="ææ id") |
| | | private String indexId; |
| | | |
| | | @ApiModelProperty(value="模åcode") |
| | | private String indexCode; |
| | | @ApiModelProperty(value ="æ¶é´å符串") |
| | | private String dataTime; |
| | | @ApiModelProperty(value ="æ¶é´ç±»å") |
| | | private String timeType; |
| | | @ApiModelProperty(value = "è½æºç±»å") |
| | | private String energyType; |
| | | } |
| | |
| | | import com.zhitan.common.enums.CollectionModes; |
| | | import com.zhitan.common.enums.GroupTimeType; |
| | | import com.zhitan.common.enums.RetrievalModes; |
| | | import com.zhitan.realtimedata.data.RealtimeDatabaseManager; |
| | | import com.zhitan.realtimedata.data.influxdb.InfluxDBRepository; |
| | | import com.zhitan.realtimedata.domain.TagValue; |
| | | import com.zhitan.realtimedata.service.RealtimeDatabaseService; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.joda.time.DateTime; |
| | | import org.joda.time.Seconds; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.*; |
| | |
| | | |
| | | private final InfluxDBRepository repository; |
| | | |
| | | private final RealtimeDatabaseManager realtimeDatabaseManager; |
| | | |
| | | public RealtimeDatabaseServiceImpl(InfluxDBRepository repository, RealtimeDatabaseManager realtimeDatabaseManager) { |
| | | public RealtimeDatabaseServiceImpl(InfluxDBRepository repository |
| | | ) { |
| | | this.repository = repository; |
| | | this.realtimeDatabaseManager = realtimeDatabaseManager; |
| | | } |
| | | |
| | | /** |
| | |
| | | @Override |
| | | public TagValue statistics(String tagCode, Date beginTime, Date endTime, CollectionModes collectionModes) { |
| | | List<TagValue> tagValues = repository.statistics(Collections.singletonList(tagCode), beginTime, endTime, collectionModes); |
| | | return CollectionUtils.isEmpty(tagValues) ? tagValues.get(0) : null; |
| | | return CollectionUtils.isNotEmpty(tagValues) ? tagValues.get(0) : null; |
| | | } |
| | | |
| | | /** |
| | |
| | | @Override |
| | | public List<TagValue> retrieve(String tagCode, Date beginTime, Date endTime, |
| | | RetrievalModes retrievalModes, int pointCount) { |
| | | return realtimeDatabaseManager.retrieve(tagCode, beginTime, endTime, retrievalModes, pointCount); |
| | | repository.getHistoryData(Collections.singletonList(tagCode), beginTime, endTime, pointCount); |
| | | pointCount = retrievalModes == RetrievalModes.Full ? 200 : pointCount; |
| | | int span = |
| | | Seconds.secondsBetween(new DateTime(beginTime), new DateTime(endTime)).getSeconds(); |
| | | int interval = span / pointCount; |
| | | List<String> tagCodes = new ArrayList<>(); |
| | | tagCodes.add(tagCode); |
| | | List<TagValue> historyData = repository.getHistoryData(tagCodes, beginTime, endTime, interval); |
| | | return historyData; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.statisticalAnalysis.common; |
| | | |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.zhitan.common.constant.CommonConst; |
| | | import com.zhitan.common.constant.TimeTypeConst; |
| | | import com.zhitan.common.utils.IntegerUtil; |
| | | import com.zhitan.common.utils.StringUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.time.DateUtils; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.GregorianCalendar; |
| | | |
| | | /** |
| | | * @Description: æ¶é´å·¥å
·ç±» |
| | | * @author: yxw |
| | | * @date: 2022å¹´02æ02æ¥ 12:23 |
| | | */ |
| | | @Slf4j |
| | | public class DateTimeUtil { |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ |
| | | */ |
| | | public static final String COMMON_PATTERN = "yyyy-MM-dd HH:mm:ss"; |
| | | /** |
| | | * æ ¼å¼åæ¥æå°åé |
| | | */ |
| | | public static final String COMMON_PATTERN_END_WITH_MINUTE = "yyyy-MM-dd HH:mm"; |
| | | /** |
| | | * æ¥ææ ¼å¼ - å°æ¶:åé |
| | | */ |
| | | public static final String COMMON_PATTERN_HOUR_MINUTE = "HH:mm"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - 年份 |
| | | */ |
| | | public static final String COMMON_PATTERN_YEAR = "yyyy"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - æä¸å¹´, |
| | | */ |
| | | public static final String COMMON_PATTERN_CERTAIN_YEAR = "yy"; |
| | | |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - æä»½ |
| | | */ |
| | | public static final String COMMON_PATTERN_MONTH = "yyyyMM"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - æä»½ |
| | | */ |
| | | public static final String COMMON_PATTERN_TO_MONTH = "yyyy-MM"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - æä»½ |
| | | */ |
| | | public static final String COMMON_PATTERN_TO_MONTH_WORD = "yyyy-MMæ"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - æä»½ |
| | | */ |
| | | public static final String COMMON_PATTERN_TO_MONTH_ZH = "yyyyå¹´MMæ"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - 天 |
| | | */ |
| | | public static final String COMMON_PATTERN_DAY = "yyyyMMdd"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - 天 |
| | | */ |
| | | public static final String COMMON_PATTERN_TO_DAY = "yyyy-MM-dd"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - 天 |
| | | */ |
| | | public static final String COMMON_PATTERN_TO_DAY_WORD = "yyyy-MM-ddæ¥"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - ææ¥ |
| | | */ |
| | | public static final String COMMON_PATTERN_MONTH_DAY = "MM-dd"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - 天æä¸å¤©, |
| | | */ |
| | | public static final String COMMON_PATTERN_DAY_OF_MONTH = "dd"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - å°æ¶ |
| | | */ |
| | | public static final String COMMON_PATTERN_HOUR = "yyyyMMddHH"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - å°æ¶ |
| | | */ |
| | | public static final String COMMON_PATTERN_TO_HOUR = "yyyy-MM-dd HH"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - å°æ¶ |
| | | */ |
| | | public static final String COMMON_PATTERN_TO_HOUR_WORD = "yyyy-MM-dd HHæ¶"; |
| | | /** |
| | | * æ¥æå¸¸ç¨æ ¼å¼ - å°æ¶ |
| | | */ |
| | | public static final String COMMON_PATTERN_TO_HOUR_TEXT = "yyyyå¹´MMæddæ¥ HHæ¶"; |
| | | |
| | | /** |
| | | * è·åå½åæ¶é´,æ¶é´æ ¼å¼ï¼yyyy-MM-dd HH:mm:ss |
| | | * |
| | | * @return |
| | | */ |
| | | public static String getNowDateTime() { |
| | | return getNowDateTime(COMMON_PATTERN); |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åæ¶é´ |
| | | * |
| | | * @param pattern æ¶é´æ ¼å¼ |
| | | * @return |
| | | */ |
| | | public static String getNowDateTime(String pattern) { |
| | | //è®¾ç½®æ¥ææ ¼å¼ |
| | | SimpleDateFormat df = new SimpleDateFormat(pattern); |
| | | String dateTime = df.format(new Date()); |
| | | return dateTime; |
| | | } |
| | | |
| | | /** |
| | | * è·åä»å¹´çå¹´ä»½å¼ |
| | | * |
| | | * @return |
| | | */ |
| | | public static String getNowYear() { |
| | | return getNowDateTime(COMMON_PATTERN_YEAR); |
| | | } |
| | | |
| | | /** |
| | | * è·åä»å¹´çæä»½å¼ |
| | | * |
| | | * @return |
| | | */ |
| | | public static String getNowMonth() { |
| | | return getNowDateTime(COMMON_PATTERN_MONTH); |
| | | } |
| | | |
| | | /** |
| | | * åç¬¦ä¸²è½¬ææ¶é´ç±»å,é»è®¤æ ¼å¼ï¼yyyy-MM-dd HH:mm:ss |
| | | * |
| | | * @param dateTimeStr |
| | | * @return |
| | | */ |
| | | public static Date toDateTime(String dateTimeStr) { |
| | | DateTime dt = null; |
| | | try { |
| | | dt = DateTime.of(dateTimeStr, COMMON_PATTERN); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | return dt; |
| | | } |
| | | |
| | | /** |
| | | * åç¬¦ä¸²è½¬ææ¶é´ç±»å |
| | | * |
| | | * @param dateTimeStr |
| | | * @return |
| | | */ |
| | | public static Date toDateTime(String dateTimeStr, String pattern) { |
| | | DateTime dt = null; |
| | | try { |
| | | dt = DateTime.of(dateTimeStr, pattern); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | return dt; |
| | | } |
| | | |
| | | /** |
| | | * å符串转æç¹å®æ ¼å¼çæ¶é´å符串类å |
| | | * |
| | | * @param dateTimeStr æ¶é´å符串 |
| | | * @param sourcePattern å符串æ¶é´æ ¼å¼ |
| | | * @param toPattern è¦è½¬æä»ä¹æ ¼å¼çæ¶é´ |
| | | * @return |
| | | */ |
| | | public static String toDateTimeStr(String dateTimeStr, String sourcePattern, String toPattern) { |
| | | String str = CommonConst.EMPTY; |
| | | try { |
| | | DateTime dt = DateTime.of(dateTimeStr, sourcePattern); |
| | | str = getDateTime(dt, toPattern); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * æ¶é´è½¬ææå®çæ ¼å¼ |
| | | * |
| | | * @param pattern æ¶é´æ ¼å¼ |
| | | * @return |
| | | */ |
| | | public static String getDateTime(Date dt, String pattern) { |
| | | //è®¾ç½®æ¥ææ ¼å¼ |
| | | SimpleDateFormat df = new SimpleDateFormat(pattern); |
| | | return df.format(dt); |
| | | } |
| | | |
| | | /** |
| | | * æ¶é´è½¬æyyyy-MM-dd HH:mm:ssæ ¼å¼ |
| | | * |
| | | * @return |
| | | */ |
| | | public static String getDateTime(Date dt) { |
| | | if (ObjectUtil.isEmpty(dt)) { |
| | | return CommonConst.EMPTY; |
| | | } |
| | | return getDateTime(dt, COMMON_PATTERN); |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åæ¶é´æå±æä»½çæåä¸å¤© |
| | | * |
| | | * @return |
| | | */ |
| | | public static int getDateTimeLastDay(Date dt) { |
| | | String month = getMonth(dt); |
| | | String firstDate = month + "01"; |
| | | Date nextMonthFirstDate = addMonths(toDateTime(firstDate, COMMON_PATTERN_DAY), CommonConst.DIGIT_1); |
| | | Date currentMonthLastDate = addDays(nextMonthFirstDate, CommonConst.DIGIT_MINUS_1); |
| | | int day = IntegerUtil.toInt(getDateTime(currentMonthLastDate, COMMON_PATTERN_DAY_OF_MONTH)); |
| | | return day; |
| | | } |
| | | |
| | | /** |
| | | * è·åå¹´ä»½å¼ |
| | | * |
| | | * @return |
| | | */ |
| | | public static String getYear(Date dt) { |
| | | return getDateTime(dt, COMMON_PATTERN_YEAR); |
| | | } |
| | | |
| | | /** |
| | | * è·åæä»½å¼ 202202 |
| | | * |
| | | * @return |
| | | */ |
| | | public static String getMonth(Date dt) { |
| | | return getDateTime(dt, COMMON_PATTERN_MONTH); |
| | | } |
| | | |
| | | /** |
| | | * è·å天,æ ¼å¼ï¼yyyyMMdd |
| | | * |
| | | * @return |
| | | */ |
| | | public static String toDay(Date dt) { |
| | | return getDateTime(dt, COMMON_PATTERN_DAY); |
| | | } |
| | | |
| | | /** |
| | | * è·åå°æ¶:yyyyMMddHH |
| | | * |
| | | * @return |
| | | */ |
| | | public static String toHour(Date dt) { |
| | | return getDateTime(dt, COMMON_PATTERN_HOUR); |
| | | } |
| | | |
| | | /** |
| | | * 转æå符串类åå¼ |
| | | * |
| | | * @return |
| | | */ |
| | | public static String toString(Date dt) { |
| | | return getDateTime(dt, COMMON_PATTERN); |
| | | } |
| | | |
| | | /** |
| | | * æ¶é´å¢å 对åºçå¹´æ° |
| | | * |
| | | * @param dateTime |
| | | * @param years |
| | | * @return |
| | | */ |
| | | public static Date addYears(Date dateTime, int years) { |
| | | return calcDate(dateTime, years, Calendar.YEAR); |
| | | } |
| | | |
| | | /** |
| | | * æ¶é´å¢å 对åºçææ° |
| | | * |
| | | * @param dateTime |
| | | * @param months |
| | | * @return |
| | | */ |
| | | public static Date addMonths(Date dateTime, int months) { |
| | | return calcDate(dateTime, months, Calendar.MONTH); |
| | | } |
| | | |
| | | /** |
| | | * æ¶é´å¢å 对åºçå¤©æ° |
| | | * |
| | | * @param dateTime |
| | | * @param days |
| | | * @return |
| | | */ |
| | | public static Date addDays(Date dateTime, int days) { |
| | | return calcDate(dateTime, days, Calendar.DATE); |
| | | } |
| | | |
| | | /** |
| | | * æ¶é´å¢å 对åºçå°æ¶æ° |
| | | * |
| | | * @param dateTime |
| | | * @param hours |
| | | * @return |
| | | */ |
| | | public static Date addHours(Date dateTime, int hours) { |
| | | return calcDate(dateTime, hours, Calendar.HOUR); |
| | | } |
| | | |
| | | /** |
| | | * æ¶é´å¢å 对åºçåéæ° |
| | | * |
| | | * @param dateTime |
| | | * @param minutes |
| | | * @return |
| | | */ |
| | | public static Date addMinutes(Date dateTime, int minutes) { |
| | | return calcDate(dateTime, minutes, Calendar.MINUTE); |
| | | } |
| | | |
| | | /** |
| | | * æ¶é´å¢å 对åºçå°æ¶æ° |
| | | * |
| | | * @param dateTime |
| | | * @param seconds |
| | | * @return |
| | | */ |
| | | public static Date addSeconds(Date dateTime, int seconds) { |
| | | return calcDate(dateTime, seconds, Calendar.SECOND); |
| | | } |
| | | |
| | | /** |
| | | * è®¡ç®æ¥æéç¨æ¹æ³ |
| | | * |
| | | * @param dateTime |
| | | * @param addValue |
| | | * @param calendarType 计ç®ç±»åï¼Calendar.YEARï¼Calendar.MONTH,Calendar.DAY |
| | | * @return |
| | | */ |
| | | private static Date calcDate(Date dateTime, int addValue, int calendarType) { |
| | | Date dt = null; |
| | | try { |
| | | Calendar calendar = new GregorianCalendar(); |
| | | calendar.setTime(dateTime); |
| | | //ææ¥æå¾åå¢å ä¸å¹´ï¼æ´æ°å¾åæ¨ï¼è´æ°å¾åç§» |
| | | calendar.add(calendarType, addValue); |
| | | // è·åç¸å æè
ç¸åä¹åçæ¶é´å¼ |
| | | Date tempDt = calendar.getTime(); |
| | | // ææ¶é´è½¬ææéè¦çæ ¼å¼ |
| | | String temp = getDateTime(tempDt, COMMON_PATTERN); |
| | | dt = toDateTime(temp); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | return dt; |
| | | } |
| | | |
| | | /** |
| | | * è·å该æ¶é´å±äºå½å¤©ç第å ä¸ªå°æ¶ |
| | | * |
| | | * @param dateTime |
| | | * @return |
| | | */ |
| | | public static int getHourOfDay(Date dateTime) { |
| | | return getDateValue(dateTime, Calendar.HOUR_OF_DAY); |
| | | } |
| | | |
| | | /** |
| | | * è·å该æ¶é´å±äºå½æç第å 天 |
| | | * |
| | | * @param dateTime |
| | | * @return |
| | | */ |
| | | public static int getDayOfMonth(Date dateTime) { |
| | | return getDateValue(dateTime, Calendar.DAY_OF_MONTH); |
| | | } |
| | | |
| | | /** |
| | | * è·å该æ¶é´å±äºå½å¨ç第å 天 |
| | | * ä¸å¨ç第ä¸å¤©æ¯å¨æ¥ |
| | | * |
| | | * @param dateTime |
| | | * @return |
| | | */ |
| | | public static int getDayOfWeek(Date dateTime) { |
| | | return getDateValue(dateTime, Calendar.DAY_OF_WEEK); |
| | | } |
| | | |
| | | /** |
| | | * è·å该æ¶é´å±äºå¹´ç第å 个æ |
| | | * æä»½å¼+1æ¯çå®çå½åæ |
| | | * |
| | | * @param dateTime |
| | | * @return å·²ç»å¨ç³»ç»ä¸è·åå¼çåºç¡ä¸å 1äºï¼ç°å¨æ¯çå®çå½åæä»½å¼ |
| | | */ |
| | | public static int getMonthOfYear(Date dateTime) { |
| | | return getDateValue(dateTime, Calendar.MONTH) + 1; |
| | | } |
| | | |
| | | /** |
| | | * è·åå½å¤©ç第å ä¸ªå°æ¶/彿ç第å 天/å½å¹´ç第å 个æ |
| | | * |
| | | * @param dateTime 妿æ¶é´å¼ä¸ºç©ºï¼é»è®¤å½åæ¶é´ |
| | | * @param calendarType |
| | | * @return |
| | | */ |
| | | private static int getDateValue(Date dateTime, int calendarType) { |
| | | int value = 0; |
| | | try { |
| | | if (ObjectUtil.isEmpty(dateTime)) { |
| | | dateTime = new Date(); |
| | | } |
| | | Calendar calendar = new GregorianCalendar(); |
| | | calendar.setTime(dateTime); |
| | | value = calendar.get(calendarType); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | return value; |
| | | } |
| | | |
| | | /** |
| | | * 对æ¯time1 å time2 çå¤§å° |
| | | * |
| | | * @param time1 |
| | | * @param time2 |
| | | * @return -1:time1å°äºtime2;0:time1çäºtime2;1:time1大äºtime2; |
| | | */ |
| | | public static int compareDateDiff(Date time1, Date time2) { |
| | | long diff = time1.getTime() - time2.getTime(); |
| | | int res = 0; |
| | | if (diff > 0) { |
| | | res = 1; |
| | | } else if (diff < 0) { |
| | | res = -1; |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | /** |
| | | * è·åæ¥è¯¢data_itemæéè¦çtimecodeå¼ |
| | | * |
| | | * @param timeType æ¥æç±»å |
| | | * @param date æ¶é´ |
| | | * @return |
| | | */ |
| | | public static String getTimeCode(String timeType, Date date) { |
| | | String timeCode = CommonConst.EMPTY; |
| | | if (ObjectUtil.isEmpty(date)) { |
| | | date = new Date(); |
| | | } |
| | | timeType = StringUtil.ifEmptyOrNullReturnValue(timeType).toUpperCase(); |
| | | switch (timeType) { |
| | | case TimeTypeConst.TIME_TYPE_HOUR: |
| | | timeCode = CommonConst.WORD_H + getDateTime(date, COMMON_PATTERN_HOUR); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | timeCode = CommonConst.WORD_D + getDateTime(date, COMMON_PATTERN_DAY); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | timeCode = CommonConst.WORD_M + getDateTime(date, COMMON_PATTERN_MONTH); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_YEAR: |
| | | timeCode = CommonConst.WORD_Y + getDateTime(date, COMMON_PATTERN_YEAR); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return timeCode; |
| | | } |
| | | |
| | | /** |
| | | * è·åæ¥è¯¢æ¥æå¹´æ¥è¡¨æéè¦çtimecodeå¼ |
| | | * |
| | | * @param timeType æ¥æç±»å |
| | | * @param date æ¶é´ |
| | | * @return |
| | | */ |
| | | public static String getReportTimeCode(String timeType, Date date) { |
| | | String timeCode = CommonConst.EMPTY; |
| | | if (ObjectUtil.isEmpty(date)) { |
| | | date = new Date(); |
| | | } |
| | | timeType = StringUtil.ifEmptyOrNullReturnValue(timeType).toUpperCase(); |
| | | switch (timeType) { |
| | | case TimeTypeConst.TIME_TYPE_HOUR: |
| | | timeCode = getDateTime(date, COMMON_PATTERN_TO_HOUR); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | timeCode = getDateTime(date, COMMON_PATTERN_TO_DAY); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | timeCode = getDateTime(date, COMMON_PATTERN_TO_MONTH); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_YEAR: |
| | | timeCode = getDateTime(date, COMMON_PATTERN_YEAR); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return timeCode; |
| | | } |
| | | |
| | | /** |
| | | * è·åæ¶é´å¯¹åºçç¯æ¯æ¶é´ |
| | | * |
| | | * @param timeType HOUR/DAY/MONTH/YEAR |
| | | * @param date æ¶é´å¼ |
| | | * @return |
| | | */ |
| | | public static Date getLoopTime(String timeType, Date date) { |
| | | Date dt = null; |
| | | if (ObjectUtil.isEmpty(date)) { |
| | | date = new Date(); |
| | | } |
| | | timeType = StringUtil.ifEmptyOrNullReturnValue(timeType).toUpperCase(); |
| | | switch (timeType) { |
| | | case TimeTypeConst.TIME_TYPE_HOUR: |
| | | dt = addHours(date, CommonConst.DIGIT_MINUS_1); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | dt = addDays(date, CommonConst.DIGIT_MINUS_1); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | dt = addMonths(date, CommonConst.DIGIT_MINUS_1); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_YEAR: |
| | | dt = addYears(date, CommonConst.DIGIT_MINUS_1); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return dt; |
| | | } |
| | | |
| | | /** |
| | | * è·åæ´ç¹æ¶é´ |
| | | * |
| | | * @param timeType HOUR/DAY/MONTH/YEAR |
| | | * @param date æ¶é´å¼ |
| | | * @return |
| | | */ |
| | | public static Date getHourTime(String timeType, Date date) { |
| | | Date dt = null; |
| | | if (ObjectUtil.isEmpty(date)) { |
| | | date = new Date(); |
| | | } |
| | | String tempStr = null; |
| | | timeType = StringUtil.ifEmptyOrNullReturnValue(timeType).toUpperCase(); |
| | | switch (timeType) { |
| | | case TimeTypeConst.TIME_TYPE_HOUR: |
| | | tempStr = getDateTime(date, COMMON_PATTERN_TO_HOUR); |
| | | dt = toDateTime(tempStr, COMMON_PATTERN_TO_HOUR); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | tempStr = getDateTime(date, COMMON_PATTERN_TO_DAY); |
| | | dt = toDateTime(tempStr, COMMON_PATTERN_TO_DAY); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | tempStr = getDateTime(date, COMMON_PATTERN_TO_MONTH); |
| | | dt = toDateTime(tempStr, COMMON_PATTERN_TO_MONTH); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_YEAR: |
| | | tempStr = getDateTime(date, COMMON_PATTERN_YEAR); |
| | | dt = toDateTime(tempStr, COMMON_PATTERN_YEAR); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return dt; |
| | | } |
| | | |
| | | /** |
| | | * 计ç®ä¸¤ä¸ªæ¶é´é´é天æ°ï¼æ¥ææ ¼å¼æ¯è¾ï¼ |
| | | * |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | public static int daysBetween(Date beginTime, Date endTime) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(beginTime); |
| | | long beginStamp = calendar.getTimeInMillis(); |
| | | calendar.setTime(endTime); |
| | | long endStamp = calendar.getTimeInMillis(); |
| | | long betweenDays = (endStamp - beginStamp) / (1000 * 3600 * 24); |
| | | return Integer.parseInt(String.valueOf(betweenDays)); |
| | | } |
| | | |
| | | /** |
| | | * 计ç®ä¸¤ä¸ªæ¶é´é´é天æ°ï¼åç¬¦ä¸²æ ¼å¼æ¯è¾ï¼ |
| | | * |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | public static int daysBetween(String beginTime, String endTime) { |
| | | try { |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Date begin = format.parse(beginTime); |
| | | Date end = format.parse(endTime); |
| | | return daysBetween(begin, end); |
| | | } catch (ParseException exception) { |
| | | log.error("计ç®ä¸¤ä¸ªæ¶é´é´é天æ°" + exception.getMessage()); |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®æ¶é´ç±»åæå符串转æå¯¹åºçæ¶é´ |
| | | * |
| | | * @param timeType æ¶é´ç±»å |
| | | * @param time æ¶é´å符串 |
| | | * @return |
| | | */ |
| | | public static Date getTime(String timeType, String time) { |
| | | Date dt = null; |
| | | timeType = StringUtil.ifEmptyOrNullReturnValue(timeType).toUpperCase(); |
| | | switch (timeType) { |
| | | case TimeTypeConst.TIME_TYPE_HOUR: |
| | | dt = toDateTime(time, COMMON_PATTERN_TO_HOUR); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | dt = toDateTime(time, COMMON_PATTERN_TO_DAY); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | dt = toDateTime(time, COMMON_PATTERN_TO_MONTH); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_YEAR: |
| | | dt = toDateTime(time, COMMON_PATTERN_YEAR); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return dt; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®æ¶é´ç±»åæè¿ç»çæ¥æå符串转æå¯¹åºçæ¶é´ ï¼202303ã20230303ã2023030301ã202303030101ï¼ |
| | | * |
| | | * @param timeType æ¶é´ç±»å |
| | | * @param time æ¶é´å符串 |
| | | * @return |
| | | */ |
| | | public static Date getTimeByContinuousTimeCode(String timeType, String time) { |
| | | Date dt = null; |
| | | timeType = StringUtil.ifEmptyOrNullReturnValue(timeType).toUpperCase(); |
| | | switch (timeType) { |
| | | case TimeTypeConst.TIME_TYPE_HOUR: |
| | | dt = toDateTime(time, COMMON_PATTERN_HOUR); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | dt = toDateTime(time, COMMON_PATTERN_DAY); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | dt = toDateTime(time, COMMON_PATTERN_MONTH); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_YEAR: |
| | | dt = toDateTime(time, COMMON_PATTERN_YEAR); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return dt; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®æ¶é´ç±»åè¿å天ãæãå¹´æåçæ¶é´ |
| | | * |
| | | * @param timeType æ¶é´ç±»å |
| | | * @param time æ¶é´ |
| | | * @return |
| | | */ |
| | | public static Date getEndTimeByType(String timeType, Date time) { |
| | | Date dt = null; |
| | | switch (timeType) { |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | dt = DateUtil.endOfDay(time); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | dt = DateUtil.endOfMonth(time); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_YEAR: |
| | | dt = DateUtil.endOfYear(time); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return dt; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®å¨æç±»å对çäº§å¨æè¿è¡å åè®¡ç® |
| | | * å¡«æ¥å¨æç±»åï¼HOURå°æ¶ãDAY天ãMONTHæãYEARå¹´ï¼ |
| | | * |
| | | * @param date çäº§å¨æ |
| | | * @param cycleType çäº§å¨æç±»å |
| | | * @param cycleType çäº§å¨æç±»å |
| | | * @param val 计ç®å¼ |
| | | * @return |
| | | */ |
| | | public static Date productionCycleCal(Date date, String cycleType,int val) { |
| | | Date momDate = date; |
| | | switch (cycleType) { |
| | | case TimeTypeConst.TIME_TYPE_HOUR: |
| | | momDate = DateUtils.addHours(date, val); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | momDate = DateUtils.addDays(date, val); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | momDate = DateUtils.addMonths(date, val); |
| | | break; |
| | | } |
| | | return momDate; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®å¨æç±»å对çäº§å¨æè¿è¡å åè®¡ç® å¹¶ä¸è¿ä½ ä¾å¦ï¼ HOUR +1è¿ä½å°±æ¯ å ä¸å¤© |
| | | * å¡«æ¥å¨æç±»åï¼HOURå°æ¶ãDAY天ãMONTHæãYEARå¹´ï¼ |
| | | * |
| | | * @param date çäº§å¨æ |
| | | * @param cycleType çäº§å¨æç±»å |
| | | * @param val 计ç®å¼ |
| | | * @return |
| | | */ |
| | | public static Date productionCycleCalCarry(Date date, String cycleType,int val) { |
| | | Date momDate = date; |
| | | switch (cycleType) { |
| | | case TimeTypeConst.TIME_TYPE_HOUR: |
| | | momDate = DateUtils.addDays(date, val); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_DAY: |
| | | momDate = DateUtils.addMonths(date, val); |
| | | break; |
| | | case TimeTypeConst.TIME_TYPE_MONTH: |
| | | momDate = DateUtils.addYears(date, val); |
| | | break; |
| | | } |
| | | return momDate; |
| | | } |
| | | } |
| | |
| | | /** |
| | | * èç¹id |
| | | */ |
| | | @NotBlank(message = "èç¹idä¸è½ä¸ºç©º") |
| | | @ApiModelProperty(value = "èç¹id") |
| | | private String nodeId; |
| | | |
| | | @NotBlank(message = "模åç¼ç ä¸è½ä¸ºç©º") |
| | | @ApiModelProperty(value = "模åç¼ç ") |
| | | private String modelCode; |
| | | |
| | | public TimeType getTimeType() { |
| | | if (ObjectUtils.isEmpty(timeType)) { |
| | | return TimeType.DAY; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.statisticalAnalysis.domain.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | |
| | | /** |
| | | * ææ¬è¶å¿-è½æºç±»å |
| | | * |
| | | * @Author: Zhujw |
| | | * @Date: 2023/2/14 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "ææ¬è¶å¿-è½æºç±»å", description = "ææ¬è¶å¿-è½æºç±»å") |
| | | public class CostTrendEnergyTypeItem implements Serializable { |
| | | |
| | | /** |
| | | * è½æºç±»å |
| | | */ |
| | | @ApiModelProperty(value = "è½æºç±»å") |
| | | private String energyType; |
| | | |
| | | /** |
| | | * è½æºåç§° |
| | | */ |
| | | @ApiModelProperty(value = "è½æºåç§°") |
| | | private String energyName; |
| | | |
| | | /** |
| | | * 累积é |
| | | */ |
| | | @ApiModelProperty(value = "累积é") |
| | | @JsonFormat(shape = JsonFormat.Shape.STRING) |
| | | private BigDecimal accumulation; |
| | | |
| | | /** |
| | | * è´¹ç¨ |
| | | */ |
| | | @ApiModelProperty(value = "è´¹ç¨") |
| | | @JsonFormat(shape = JsonFormat.Shape.STRING) |
| | | private BigDecimal cost; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.statisticalAnalysis.domain.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * è´¹ç¨åæ-ææ¬è¶å¿åæç»è®¡å¾è¿åå¼ä¿¡æ¯ |
| | | * |
| | | * @Author: Zhujw |
| | | * @Date: 2023/2/14 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "è´¹ç¨åæ-ææ¬è¶å¿åæç»è®¡å¾è¿åå¼ä¿¡æ¯", description = "è´¹ç¨åæ-ææ¬è¶å¿åæç»è®¡å¾è¿åå¼ä¿¡æ¯") |
| | | public class EnergyConsumeTrendDetailItem { |
| | | |
| | | /** |
| | | * è½æºç±»å |
| | | */ |
| | | @ApiModelProperty(value = "è½æºç±»å") |
| | | private String energyType; |
| | | |
| | | /** |
| | | * è½æºåä½ |
| | | */ |
| | | @ApiModelProperty(value = "è½æºåä½") |
| | | private String energyUnit; |
| | | |
| | | /** |
| | | * ç´¯ç§¯éæ ç¾ |
| | | */ |
| | | @ApiModelProperty(value = "ç´¯ç§¯éæ ç¾") |
| | | private String accumulationLabel; |
| | | |
| | | /** |
| | | * è´¹ç¨æ ç¾ |
| | | */ |
| | | @ApiModelProperty(value = "è´¹ç¨æ ç¾") |
| | | private String costLabel; |
| | | |
| | | /** |
| | | * 累积é |
| | | */ |
| | | @ApiModelProperty(value = "累积é") |
| | | @JsonFormat(shape = JsonFormat.Shape.STRING) |
| | | private BigDecimal accumulation; |
| | | |
| | | /** |
| | | * è´¹ç¨ |
| | | */ |
| | | @ApiModelProperty(value = "è´¹ç¨") |
| | | @JsonFormat(shape = JsonFormat.Shape.STRING) |
| | | private BigDecimal cost; |
| | | |
| | | /** |
| | | * 累积ékeyéå |
| | | */ |
| | | @ApiModelProperty(value = "累积ékeyéå") |
| | | private List<String> accumulationKeyList; |
| | | |
| | | /** |
| | | * 累积évalueéå |
| | | */ |
| | | @ApiModelProperty(value = "累积évalueéå") |
| | | private List<BigDecimal> accumulationValueList; |
| | | |
| | | /** |
| | | * è´¹ç¨keyéå |
| | | */ |
| | | @ApiModelProperty(value = "è´¹ç¨keyéå") |
| | | private List<String> costKeyList; |
| | | |
| | | /** |
| | | * è´¹ç¨valueéå |
| | | */ |
| | | @ApiModelProperty(value = "è´¹ç¨valueéå") |
| | | private List<BigDecimal> costValueList; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.statisticalAnalysis.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | |
| | | /** |
| | | * è½èå®ä½ç±» |
| | | * |
| | | * @Author: Zhujw |
| | | * @Date: 2023/1/28 |
| | | */ |
| | | @Data |
| | | public class EnergyConsumeVO implements Serializable { |
| | | |
| | | /** |
| | | * 计éå¨å
·id |
| | | */ |
| | | private String deviceId; |
| | | |
| | | /** |
| | | * è½æºç±»å |
| | | */ |
| | | private String energyType; |
| | | |
| | | /** |
| | | * æ¶é´ç¼ç |
| | | */ |
| | | private Date dataTime; |
| | | |
| | | /** |
| | | * è´¹ç¨ |
| | | */ |
| | | private BigDecimal costValue; |
| | | |
| | | /** |
| | | * 累计é |
| | | */ |
| | | private BigDecimal accumulationValue; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.statisticalAnalysis.domain.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ææ¬è¶å¿åæ-è¡¨æ ¼ä¿¡æ¯ |
| | | * |
| | | * @Author: Zhujw |
| | | * @Date: 2023/2/14 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "ææ¬è¶å¿åæ-è¡¨æ ¼ä¿¡æ¯", description = "ææ¬è¶å¿åæ-è¡¨æ ¼ä¿¡æ¯") |
| | | public class EnergyCostTrendItem { |
| | | |
| | | /** |
| | | * ç¨è½åå
id |
| | | */ |
| | | @ApiModelProperty(value = "ç¨è½åå
id") |
| | | private String energyUnitId; |
| | | |
| | | /** |
| | | * ç¨è½åå
åç§° |
| | | */ |
| | | @ApiModelProperty(value = "ç¨è½åå
åç§°") |
| | | private String energyUnitName; |
| | | |
| | | /** |
| | | * æ»è´¹ç¨ |
| | | */ |
| | | @ApiModelProperty(value = "æ»è´¹ç¨") |
| | | @JsonFormat(shape = JsonFormat.Shape.STRING) |
| | | private BigDecimal total; |
| | | |
| | | /** |
| | | * æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "æ¶é´") |
| | | private String dateCode; |
| | | |
| | | /** |
| | | * è½æºç±»å |
| | | */ |
| | | @ApiModelProperty(value = "è½æºç±»å") |
| | | private List<CostTrendEnergyTypeItem> itemList; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.statisticalAnalysis.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: TODO |
| | | * @author: yxw |
| | | * @date: 2022å¹´04æ15æ¥ 10:07 |
| | | */ |
| | | @Data |
| | | public class EnergyCostTrendPage { |
| | | /** |
| | | * æ°æ®å表 |
| | | */ |
| | | private List<EnergyCostTrendItem> itemList; |
| | | /** |
| | | * è®°å½æ»æ°é |
| | | */ |
| | | private long total; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.statisticalAnalysis.service; |
| | | |
| | | import com.zhitan.statisticalAnalysis.domain.vo.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * è½æºæ¶èç»è®¡ç¸å
³æ¥è¯¢ |
| | | */ |
| | | public interface IEnergyConsumeDataService { |
| | | |
| | | /** |
| | | * ææ¬è¶å¿åæï¼è½æºæ¶èææ¬ï¼- è·åè¡¨æ ¼åè¡¨æ°æ® |
| | | * |
| | | * @param pageNo é¡µç æ° |
| | | * @param pageSize æ¯é¡µæ°æ®å¤å° |
| | | * @param timeCode æ¶é´å¼ 䏿¶é´ç±»å对åºï¼2022-03-21/2022-03/2022 |
| | | * @param timeType æ¶é´ç±»å DAY/MONTH/YEAR |
| | | * @param energyType è½æºç±»å |
| | | * @param modelCode 模åCode |
| | | * @return |
| | | */ |
| | | EnergyCostTrendPage listEnergyCostTrend(int pageNo, int pageSize, String timeCode, String timeType,String energyType, String modelCode); |
| | | |
| | | /** |
| | | * ææ¬è¶å¿åæï¼è½æºæ¶èææ¬ï¼ |
| | | * |
| | | * @param timeCode æ¶é´å¼ 䏿¶é´ç±»å对åºï¼2022-03-21/2022-03/2022 |
| | | * @param timeType æ¶é´ç±»å DAY/MONTH/YEAR |
| | | * @param modelCode 模åCode |
| | | * @param energyType è½æºç±»å |
| | | * @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); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | import com.zhitan.basicdata.mapper.SysEnergyMapper; |
| | | import com.zhitan.carbonemission.domain.CarbonEmission; |
| | | import com.zhitan.common.constant.CommonConst; |
| | | import com.zhitan.common.constant.TimeTypeConst; |
| | | import com.zhitan.common.utils.StringUtils; |
| | | import com.zhitan.dataitem.mapper.DataItemMapper; |
| | | import com.zhitan.model.domain.ModelNode; |
| | | import com.zhitan.model.domain.NodeIndex; |
| | | import com.zhitan.model.mapper.ModelNodeMapper; |
| | | import com.zhitan.model.mapper.NodeIndexMapper; |
| | | import com.zhitan.peakvalley.domain.ElectricityDataItem; |
| | | import com.zhitan.peakvalley.mapper.PeakValleyMapper; |
| | | import com.zhitan.statisticalAnalysis.common.DateTimeUtil; |
| | | import lombok.AllArgsConstructor; |
| | | 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; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @Description: TODO |
| | | * @author: yxw |
| | | * @date: 2022å¹´04æ12æ¥ 14:15 |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class EnergyConsumeDataServiceImpl implements IEnergyConsumeDataService { |
| | | |
| | | private DataItemMapper dataItemMapper; |
| | | private ModelNodeMapper modelNodeMapper; |
| | | private NodeIndexMapper nodeIndexMapper; |
| | | private PeakValleyMapper peakValleyMapper; |
| | | private SysEnergyMapper sysEnergyMapper; |
| | | |
| | | /** |
| | | * ææ¬è¶å¿åæï¼è½æºæ¶èææ¬ï¼- è·åè¡¨æ ¼åè¡¨æ°æ® |
| | | * |
| | | * @param pageNo é¡µç æ° |
| | | * @param pageSize æ¯é¡µæ°æ®å¤å° |
| | | * @param timeCode æ¶é´å¼ 䏿¶é´ç±»å对åºï¼2022-03-21/2022-03/2022 |
| | | * @param timeType æ¶é´ç±»å DAY/MONTH/YEAR |
| | | * @param energyType è½æºç±»å |
| | | * @param modelCode 模åCode |
| | | * @return |
| | | */ |
| | | @Override |
| | | public EnergyCostTrendPage listEnergyCostTrend(int pageNo, int pageSize, String timeCode, String timeType, String energyType, |
| | | String modelCode) { |
| | | //è½æºç±»åä¿¡æ¯ |
| | | SysEnergy sysEnergy = new SysEnergy(); |
| | | if (StringUtils.isNotEmpty(energyType)) { |
| | | sysEnergy.setEnersno(energyType); |
| | | } |
| | | List<SysEnergy> sysEnergies = sysEnergyMapper.selectSysEnergyList(sysEnergy); |
| | | if (sysEnergies.isEmpty()) { |
| | | throw new RuntimeException("æªæ¥è¯¢å°è½æºä¿¡æ¯"); |
| | | } |
| | | //èç¹ä¿¡æ¯ |
| | | List<ModelNode> modelNodes = modelNodeMapper.selectList(Wrappers.<ModelNode>lambdaQuery().eq(ModelNode::getModelCode, modelCode) |
| | | .isNull(ModelNode::getParentId)); |
| | | if (ObjectUtils.isEmpty(modelNodes)) { |
| | | throw new RuntimeException("æªæ¥è¯¢å°èç¹ä¿¡æ¯"); |
| | | } |
| | | ModelNode modelNodeInfo = modelNodes.stream().findFirst().get(); |
| | | //ç¹ä½ä¿¡æ¯ |
| | | List<NodeIndex> nodeIndices = nodeIndexMapper.selectList(Wrappers.<NodeIndex>lambdaQuery() |
| | | .eq(NodeIndex::getNodeId, modelNodeInfo.getNodeId())); |
| | | if (nodeIndices.isEmpty()) { |
| | | throw new RuntimeException("æªæ¥è¯¢å°ç¹ä½ä¿¡æ¯"); |
| | | } |
| | | |
| | | // æ»è´¹ç¨ |
| | | BigDecimal totalCost = BigDecimal.ZERO; |
| | | // éåè½æºç±»å |
| | | List<CostTrendEnergyTypeItem> itemList = new ArrayList<>(); |
| | | for (SysEnergy sysEnergyInfo : sysEnergies) { |
| | | CostTrendEnergyTypeItem item = new CostTrendEnergyTypeItem(); |
| | | item.setEnergyType(sysEnergyInfo.getEnersno()); |
| | | item.setEnergyName(sysEnergyInfo.getEnername()); |
| | | // å¤çæ¶é´ |
| | | Date bsTime = DateTimeUtil.getTime(timeType, timeCode); |
| | | Date endTime = DateTimeUtil.getEndTimeByType(timeType, bsTime); |
| | | totalCost = getEnergyUnitCostTrendAnalysisValueInfo(timeType, bsTime, endTime, totalCost, nodeIndices, modelNodeInfo.getNodeId(), sysEnergyInfo, item); |
| | | itemList.add(item); |
| | | } |
| | | // éåç¨è½åå
è·åè¡¨æ ¼ä¸çæ°æ® |
| | | List<EnergyCostTrendItem> trendItemList = new ArrayList<>(); |
| | | EnergyCostTrendItem energyCostTrendItem = new EnergyCostTrendItem(); |
| | | energyCostTrendItem.setDateCode(timeCode); |
| | | energyCostTrendItem.setTotal(totalCost.setScale(CommonConst.DIGIT_2, RoundingMode.HALF_UP)); |
| | | energyCostTrendItem.setItemList(itemList); |
| | | trendItemList.add(energyCostTrendItem); |
| | | |
| | | EnergyCostTrendPage energyCostTrendPage = new EnergyCostTrendPage(); |
| | | energyCostTrendPage.setTotal(1); |
| | | energyCostTrendPage.setItemList(trendItemList); |
| | | return energyCostTrendPage; |
| | | } |
| | | |
| | | /** |
| | | * è·åç¨è½åå
ææ¬è¶å¿åæç´¯ç§¯éãè´¹ç¨ä¿¡æ¯ |
| | | * |
| | | * @param timeType æ¶é´ç±»å |
| | | * @param bsTime å¼å§æ¶é´ |
| | | * @param endTime ç»ææ¶é´ |
| | | * @param totalCost æ»è´¹ç¨ |
| | | * @param nodeIndices èç¹ç¹ä½éå |
| | | * @param nodeId èç¹id |
| | | * @param sysEnergyInfo è½æºç±»åä¿¡æ¯ |
| | | * @param item è¿å对象 |
| | | * @return |
| | | */ |
| | | private BigDecimal getEnergyUnitCostTrendAnalysisValueInfo(String timeType, Date bsTime, Date endTime, BigDecimal totalCost, |
| | | List<NodeIndex> nodeIndices, String nodeId, SysEnergy sysEnergyInfo, |
| | | CostTrendEnergyTypeItem item) { |
| | | BigDecimal costValue = BigDecimal.ZERO; |
| | | BigDecimal accumulationValue = BigDecimal.ZERO; |
| | | //çµï¼åªæHOURæ°æ®ææï¼å
¶ä»è½æºç±»åï¼HOURãDAYææ°æ® |
| | | switch (sysEnergyInfo.getEnersno()) { |
| | | case "electric": |
| | | List<ElectricityDataItem> electricityDataItems = peakValleyMapper.getDataStatistics(nodeIndices.stream().map(NodeIndex::getIndexId).collect(Collectors.toSet()), bsTime, endTime, TimeTypeConst.TIME_TYPE_HOUR); |
| | | costValue = electricityDataItems.stream().map(ElectricityDataItem::getCost).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | accumulationValue = electricityDataItems.stream().map(ElectricityDataItem::getElectricity).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | break; |
| | | default: |
| | | accumulationValue = dataItemMapper.getDataItemTimeRangeValueByNodeId(bsTime, endTime, TimeTypeConst.TIME_TYPE_DAY, nodeId, sysEnergyInfo.getEnersno()); |
| | | costValue = accumulationValue.multiply(sysEnergyInfo.getPrice()); |
| | | break; |
| | | } |
| | | costValue = costValue.setScale(CommonConst.DIGIT_2, RoundingMode.HALF_UP); |
| | | totalCost = totalCost.add(costValue); |
| | | item.setCost(costValue); |
| | | item.setAccumulation(accumulationValue.setScale(CommonConst.DIGIT_2, RoundingMode.HALF_UP)); |
| | | return totalCost; |
| | | } |
| | | |
| | | /** |
| | | * ææ¬è¶å¿åæï¼è½æºæ¶èææ¬ï¼ |
| | | * |
| | | * @param timeCode æ¶é´å¼ 䏿¶é´ç±»å对åºï¼2022-03-21/2022-03/2022 |
| | | * @param timeType æ¶é´ç±»å DAY/MONTH/YEAR |
| | | * @param modelCode 模åCode |
| | | * @param energyType è½æºç±»å |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<EnergyConsumeTrendDetailItem> listEnergyCostTrendDetail(String timeCode, String timeType, String modelCode, String energyType) { |
| | | //è½æºç±»åä¿¡æ¯ |
| | | SysEnergy sysEnergy = new SysEnergy(); |
| | | if (StringUtils.isNotEmpty(energyType)) { |
| | | sysEnergy.setEnersno(energyType); |
| | | } |
| | | List<SysEnergy> sysEnergies = sysEnergyMapper.selectSysEnergyList(sysEnergy); |
| | | if (sysEnergies.isEmpty()) { |
| | | throw new RuntimeException("æªæ¥è¯¢å°è½æºä¿¡æ¯"); |
| | | } |
| | | |
| | | //èç¹ä¿¡æ¯ |
| | | List<ModelNode> modelNodes = modelNodeMapper.selectList(Wrappers.<ModelNode>lambdaQuery().eq(ModelNode::getModelCode, modelCode) |
| | | .isNull(ModelNode::getParentId)); |
| | | if (modelNodes.isEmpty()) { |
| | | throw new RuntimeException("æªæ¥è¯¢å°èç¹ä¿¡æ¯"); |
| | | } |
| | | String nodeId = modelNodes.stream().findFirst().get().getNodeId(); |
| | | |
| | | // è½èä¿¡æ¯ |
| | | List<EnergyConsumeTrendDetailItem> itemList = new ArrayList<>(); |
| | | Date startTime = DateTimeUtil.getTime(timeType, timeCode); |
| | | Date endTime = DateTimeUtil.getEndTimeByType(timeType, startTime); |
| | | //çµï¼åªæHOURæ°æ®ææï¼å
¶ä»è½æºç±»åï¼HOURãDAYææ°æ® |
| | | String queryTimeType = TimeTypeConst.TIME_TYPE_HOUR; |
| | | for (SysEnergy sysEnergyInfo : sysEnergies) { |
| | | List<EnergyConsumeVO> energyConsumeVOList = new ArrayList<>(); |
| | | switch (sysEnergyInfo.getEnersno()) { |
| | | case "electric": |
| | | List<ElectricityDataItem> electricityDataItems = peakValleyMapper.getCostTrends(startTime, endTime, queryTimeType, nodeId, sysEnergyInfo.getEnersno()); |
| | | if (!electricityDataItems.isEmpty()) { |
| | | electricityDataItems.forEach(electricityDataItem -> { |
| | | EnergyConsumeVO temp = new EnergyConsumeVO(); |
| | | temp.setDataTime(electricityDataItem.getDataTime()); |
| | | temp.setCostValue(electricityDataItem.getCost()); |
| | | 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()); |
| | | if (!dataItems.isEmpty()) { |
| | | dataItems.forEach(electricityDataItem -> { |
| | | EnergyConsumeVO temp = new EnergyConsumeVO(); |
| | | temp.setDataTime(electricityDataItem.getDataTime()); |
| | | temp.setCostValue(new BigDecimal(electricityDataItem.getValue())); |
| | | temp.setAccumulationValue(new BigDecimal(electricityDataItem.getValue()).multiply(sysEnergyInfo.getPrice())); |
| | | energyConsumeVOList.add(temp); |
| | | }); |
| | | } |
| | | break; |
| | | } |
| | | BigDecimal cost = energyConsumeVOList.stream().map(EnergyConsumeVO::getCostValue) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add).setScale(CommonConst.DIGIT_2, RoundingMode.HALF_UP); |
| | | BigDecimal accumulation = energyConsumeVOList.stream().map(EnergyConsumeVO::getAccumulationValue) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add).setScale(CommonConst.DIGIT_2, RoundingMode.HALF_UP); |
| | | // ç»è£
ç»è®¡å¾ä¿¡æ¯ |
| | | EnergyConsumeTrendDetailItem item = new EnergyConsumeTrendDetailItem(); |
| | | item.setEnergyType(sysEnergyInfo.getEnersno()); |
| | | item.setEnergyUnit(sysEnergyInfo.getMuid()); |
| | | item.setCostLabel(sysEnergyInfo.getEnername() + "è´¹"); |
| | | item.setAccumulationLabel(sysEnergyInfo.getEnername() + "ç¨é"); |
| | | item.setCost(cost); |
| | | item.setAccumulation(accumulation); |
| | | // ç»è£
å¾è¡¨ä¿¡æ¯ |
| | | getTrendAnalysisCharInfoByEnergyType(startTime, timeType, energyConsumeVOList, item); |
| | | itemList.add(item); |
| | | } |
| | | return itemList; |
| | | } |
| | | |
| | | /** |
| | | * ç»è£
ææ¬è¶å¿åæ-ç»è®¡å¾ä¿¡æ¯ |
| | | * |
| | | * @param bsTime æ¶é´ |
| | | * @param timeType æ¶é´ç±»å |
| | | * @param dataItems è½è |
| | | * @param item è¿å对象 |
| | | */ |
| | | private void getTrendAnalysisCharInfoByEnergyType(Date bsTime, String timeType, |
| | | List<EnergyConsumeVO> dataItems, EnergyConsumeTrendDetailItem item) { |
| | | List<String> costKeyList = new ArrayList<>(); |
| | | List<String> accumulationKeyList = new ArrayList<>(); |
| | | List<BigDecimal> costValueList = new ArrayList<>(); |
| | | List<BigDecimal> accumulationValueList = new ArrayList<>(); |
| | | Map<String, List<EnergyConsumeVO>> energyConsumeVOMap; |
| | | //ææ¶é´ç±»åç»ç»è¿åæ°æ® |
| | | 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++) { |
| | | String formatDate = i + CommonConst.TIME_UNIT_SHOW_HOUR; |
| | | costKeyList.add(formatDate); |
| | | accumulationKeyList.add(formatDate); |
| | | String key = DateUtil.formatDateTime(DateUtil.offsetHour(bsTime, i)); |
| | | calculateCostAndAccumulation(energyConsumeVOMap, key, costValueList, accumulationValueList); |
| | | } |
| | | 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)) { |
| | | String formatDate = DateUtil.formatDate(bsTime); |
| | | costKeyList.add(formatDate); |
| | | accumulationKeyList.add(formatDate); |
| | | calculateCostAndAccumulation(energyConsumeVOMap, formatDate, costValueList, accumulationValueList); |
| | | 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 newDate = DateUtil.offsetMonth(bsTime, i); |
| | | String formatDate = DateUtil.format(newDate, DateTimeUtil.COMMON_PATTERN_TO_MONTH_ZH); |
| | | costKeyList.add(formatDate); |
| | | accumulationKeyList.add(formatDate); |
| | | calculateCostAndAccumulation(energyConsumeVOMap, formatDate, costValueList, accumulationValueList); |
| | | } |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | item.setCostKeyList(costKeyList); |
| | | item.setCostValueList(costValueList); |
| | | item.setAccumulationKeyList(accumulationKeyList); |
| | | item.setAccumulationValueList(accumulationValueList); |
| | | } |
| | | |
| | | /** |
| | | * 计ç®è´¹ç¨åç¨é |
| | | * |
| | | * @param energyConsumeVOMap |
| | | * @param formatDate |
| | | * @param costValueList |
| | | * @param accumulationValueList |
| | | */ |
| | | private static void calculateCostAndAccumulation(Map<String, List<EnergyConsumeVO>> energyConsumeVOMap, String formatDate, List<BigDecimal> costValueList, List<BigDecimal> accumulationValueList) { |
| | | List<EnergyConsumeVO> energyConsumeList = Optional.ofNullable(energyConsumeVOMap.get(formatDate)) |
| | | .orElse(Collections.emptyList()); |
| | | BigDecimal totalCost = energyConsumeList.stream() |
| | | .map(EnergyConsumeVO::getCostValue) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add) |
| | | .setScale(CommonConst.DIGIT_2, RoundingMode.HALF_UP); |
| | | |
| | | BigDecimal totalAccumulation = energyConsumeList.stream() |
| | | .map(EnergyConsumeVO::getAccumulationValue) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add) |
| | | .setScale(CommonConst.DIGIT_2, RoundingMode.HALF_UP); |
| | | 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); |
| | | } |
| | | } |
| | |
| | | import com.zhitan.common.constant.TimeTypeConst; |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.dataitem.service.IDataItemService; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfor; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfo; |
| | | import com.zhitan.model.service.IModelNodeService; |
| | | import com.zhitan.realtimedata.domain.DataItem; |
| | | import com.zhitan.statisticalAnalysis.domain.dto.DataAnalysisMoMDTO; |
| | |
| | | public List<DataAnalysisYoYVO> listElectricDataComparisonYoY(DataAnalysisMoMDTO dto) { |
| | | List<DataAnalysisYoYVO> yoyList = new ArrayList<>(); |
| | | // æ¥è¯¢ç¹ä½ä¸ç¨è½åå
ä¿¡æ¯ |
| | | List<ModelNodeIndexInfor> nodeInforList = listModelNodeIndexIdRelationInfor(dto.getNodeId()); |
| | | List<ModelNodeIndexInfo> nodeInforList = listModelNodeIndexIdRelationInfor(dto.getNodeId()); |
| | | if (CollectionUtils.isEmpty(nodeInforList)) { |
| | | return yoyList; |
| | | } |
| | | List<String> indexIds = nodeInforList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | List<String> indexIds = nodeInforList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toList()); |
| | | // æç
§ç¹ä½è¿è¡åç» |
| | | Map<String, List<ModelNodeIndexInfor>> nodeIndexMap = nodeInforList.stream().collect( |
| | | Collectors.groupingBy(ModelNodeIndexInfor::getNodeId)); |
| | | Map<String, List<ModelNodeIndexInfo>> nodeIndexMap = nodeInforList.stream().collect( |
| | | Collectors.groupingBy(ModelNodeIndexInfo::getNodeId)); |
| | | // è·åæ¥è¯¢æ¶é´ |
| | | Date beginTime = dto.getBeginTime(); |
| | | Date endTime = dto.getEndTime(); |
| | |
| | | BigDecimal multiple = BigDecimal.valueOf(CommonConst.DIGIT_100); |
| | | nodeIndexMap.forEach((key, value) -> { |
| | | DataAnalysisYoYVO yoyVO = new DataAnalysisYoYVO(); |
| | | Optional<ModelNodeIndexInfor> first = value.stream().findFirst(); |
| | | Optional<ModelNodeIndexInfo> first = value.stream().findFirst(); |
| | | first.ifPresent(modelNodeIndexInfor -> yoyVO.setEnergyUnitName(modelNodeIndexInfor.getName())); |
| | | // èµå¼åä½ |
| | | yoyVO.setUnit("kWh"); |
| | | // æ¾åºindexIds |
| | | List<String> indexIdList = value.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | List<String> indexIdList = value.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toList()); |
| | | // æ±å |
| | | BigDecimal sum = BigDecimal.valueOf(dataItemList.stream().filter(li -> indexIdList.contains(li.getIndexId())) |
| | | .mapToDouble(DataItem::getValue).sum()).setScale(CommonConst.DIGIT_2, RoundingMode.HALF_UP); |
| | |
| | | public List<DataAnalysisMoMVO> listElectricDataComparisonMoM(DataAnalysisMoMDTO dto) { |
| | | List<DataAnalysisMoMVO> momList = new ArrayList<>(); |
| | | // æ ¹æ®idæ¥è¯¢ç¹ä½ä¿¡æ¯ |
| | | List<ModelNodeIndexInfor> nodeIndexInforList = listModelNodeIndexIdRelationInfor(dto.getNodeId()); |
| | | List<ModelNodeIndexInfo> nodeIndexInforList = listModelNodeIndexIdRelationInfor(dto.getNodeId()); |
| | | if (CollectionUtils.isEmpty(nodeIndexInforList)) { |
| | | return momList; |
| | | } |
| | | List<String> indexIds = nodeIndexInforList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | List<String> indexIds = nodeIndexInforList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toList()); |
| | | Date beginTime = dto.getBeginTime(); |
| | | Date endTime = dto.getEndTime(); |
| | | Date lastTime; |
| | |
| | | lastEndTime = DateUtil.offset(endTime, DateField.YEAR, CommonConst.DIGIT_MINUS_1); |
| | | } |
| | | // æç
§ç¹ä½è¿è¡åç» |
| | | Map<String, List<ModelNodeIndexInfor>> nodeIndexMap = nodeIndexInforList.stream().collect( |
| | | Collectors.groupingBy(ModelNodeIndexInfor::getNodeId)); |
| | | Map<String, List<ModelNodeIndexInfo>> nodeIndexMap = nodeIndexInforList.stream().collect( |
| | | Collectors.groupingBy(ModelNodeIndexInfo::getNodeId)); |
| | | // æ ¹æ®indexIdæ¥è¯¢dataItem |
| | | List<DataItem> dataItemList = dataItemService.getDataItemHourInforByIndexIds(beginTime, endTime, TimeType.HOUR.name(), indexIds); |
| | | List<DataItem> lastDataItemList = dataItemService.getDataItemHourInforByIndexIds(lastTime, lastEndTime, TimeType.HOUR.name(), indexIds); |
| | |
| | | BigDecimal multiple = BigDecimal.valueOf(CommonConst.DIGIT_100); |
| | | nodeIndexMap.forEach((key, value) -> { |
| | | DataAnalysisMoMVO momVO = new DataAnalysisMoMVO(); |
| | | Optional<ModelNodeIndexInfor> first = value.stream().findFirst(); |
| | | Optional<ModelNodeIndexInfo> first = value.stream().findFirst(); |
| | | first.ifPresent(modelNodeIndexInfor -> momVO.setEnergyUnitName(modelNodeIndexInfor.getName())); |
| | | // èµå¼åä½ |
| | | momVO.setUnit("kWh"); |
| | | // æ¾åºindexIds |
| | | List<String> indexIdList = value.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | List<String> indexIdList = value.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toList()); |
| | | // æ±å |
| | | BigDecimal sum = BigDecimal.valueOf(dataItemList.stream().filter(li -> indexIdList.contains(li.getIndexId())) |
| | | .mapToDouble(DataItem::getValue).sum()).setScale(CommonConst.DIGIT_2, RoundingMode.HALF_UP); |
| | |
| | | public List<DataAnalysisYoYVO> listWaterDataComparisonYoY(DataAnalysisMoMDTO dto) { |
| | | List<DataAnalysisYoYVO> yoyList = new ArrayList<>(); |
| | | // æ¥è¯¢ç¹ä½ä¸ç¨è½åå
ä¿¡æ¯ |
| | | List<ModelNodeIndexInfor> nodeInforList = listModelNodeIndexIdRelationInfor(dto.getNodeId()); |
| | | List<ModelNodeIndexInfo> nodeInforList = listModelNodeIndexIdRelationInfor(dto.getNodeId()); |
| | | if (CollectionUtils.isEmpty(nodeInforList)) { |
| | | return yoyList; |
| | | } |
| | | List<String> indexIds = nodeInforList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | List<String> indexIds = nodeInforList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toList()); |
| | | // æç
§ç¹ä½è¿è¡åç» |
| | | Map<String, List<ModelNodeIndexInfor>> nodeIndexMap = nodeInforList.stream().collect( |
| | | Collectors.groupingBy(ModelNodeIndexInfor::getNodeId)); |
| | | Map<String, List<ModelNodeIndexInfo>> nodeIndexMap = nodeInforList.stream().collect( |
| | | Collectors.groupingBy(ModelNodeIndexInfo::getNodeId)); |
| | | // æ¶é´ç±»å |
| | | // è·åæ¥è¯¢æ¶é´ |
| | | Date beginTime = dto.getBeginTime(); |
| | |
| | | BigDecimal multiple = BigDecimal.valueOf(CommonConst.DIGIT_100); |
| | | nodeIndexMap.forEach((key, value) -> { |
| | | DataAnalysisYoYVO yoyVO = new DataAnalysisYoYVO(); |
| | | Optional<ModelNodeIndexInfor> first = value.stream().findFirst(); |
| | | Optional<ModelNodeIndexInfo> first = value.stream().findFirst(); |
| | | first.ifPresent(modelNodeIndexInfor -> yoyVO.setEnergyUnitName(modelNodeIndexInfor.getName())); |
| | | // èµå¼åä½ |
| | | yoyVO.setUnit("m³"); |
| | | // æ¾åºindexIds |
| | | List<String> indexIdList = value.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | List<String> indexIdList = value.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toList()); |
| | | // æ±å |
| | | BigDecimal sum = BigDecimal.valueOf(dataItemList.stream().filter(li -> indexIdList.contains(li.getIndexId())) |
| | | .mapToDouble(DataItem::getValue).sum()).setScale(CommonConst.DIGIT_2, RoundingMode.HALF_UP); |
| | |
| | | public List<DataAnalysisMoMVO> listWaterDataComparisonMoM(DataAnalysisMoMDTO dto) { |
| | | List<DataAnalysisMoMVO> momList = new ArrayList<>(); |
| | | // æ ¹æ®idæ¥è¯¢ç¹ä½ä¿¡æ¯ |
| | | List<ModelNodeIndexInfor> nodeIndexInforList = listModelNodeIndexIdRelationInfor(dto.getNodeId()); |
| | | List<ModelNodeIndexInfo> nodeIndexInforList = listModelNodeIndexIdRelationInfor(dto.getNodeId()); |
| | | if (CollectionUtils.isEmpty(nodeIndexInforList)) { |
| | | return momList; |
| | | } |
| | | List<String> indexIds = nodeIndexInforList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | List<String> indexIds = nodeIndexInforList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toList()); |
| | | Date beginTime = dto.getBeginTime(); |
| | | Date endTime = dto.getEndTime(); |
| | | Date lastTime; |
| | |
| | | lastEndTime = DateUtil.offset(endTime, DateField.YEAR, CommonConst.DIGIT_MINUS_1); |
| | | } |
| | | // æç
§ç¹ä½è¿è¡åç» |
| | | Map<String, List<ModelNodeIndexInfor>> nodeIndexMap = nodeIndexInforList.stream().collect( |
| | | Collectors.groupingBy(ModelNodeIndexInfor::getNodeId)); |
| | | Map<String, List<ModelNodeIndexInfo>> nodeIndexMap = nodeIndexInforList.stream().collect( |
| | | Collectors.groupingBy(ModelNodeIndexInfo::getNodeId)); |
| | | // æ¥è¯¢å¯¹åºindexIdsï¼æ¾å°å¯¹åºdataItemä¿¡æ¯ |
| | | List<DataItem> dataItemList = dataItemService.getDataItemHourInforByIndexIds(beginTime, endTime, TimeType.HOUR.name(), indexIds); |
| | | List<DataItem> lastDataItemList = dataItemService.getDataItemHourInforByIndexIds(lastTime, lastEndTime, TimeType.HOUR.name(), indexIds); |
| | |
| | | BigDecimal multiple = BigDecimal.valueOf(CommonConst.DIGIT_100); |
| | | nodeIndexMap.forEach((key, value) -> { |
| | | DataAnalysisMoMVO momVO = new DataAnalysisMoMVO(); |
| | | Optional<ModelNodeIndexInfor> first = value.stream().findFirst(); |
| | | Optional<ModelNodeIndexInfo> first = value.stream().findFirst(); |
| | | first.ifPresent(modelNodeIndexInfor -> momVO.setEnergyUnitName(modelNodeIndexInfor.getName())); |
| | | // èµå¼åä½ |
| | | momVO.setUnit("m³"); |
| | | // æ¾åºindexIds |
| | | List<String> indexIdList = value.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | List<String> indexIdList = value.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toList()); |
| | | // æ±å |
| | | BigDecimal sum = BigDecimal.valueOf(dataItemList.stream().filter(li -> indexIdList.contains(li.getIndexId())) |
| | | .mapToDouble(DataItem::getValue).sum()).setScale(CommonConst.DIGIT_2, RoundingMode.HALF_UP); |
| | |
| | | /** |
| | | * æ¥è¯¢ç¹ä½ä¸ç¨è½åå
ä¿¡æ¯ |
| | | */ |
| | | private List<ModelNodeIndexInfor> listModelNodeIndexIdRelationInfor(String nodeId) { |
| | | List<ModelNodeIndexInfor> nodeInforList = modelNodeService.listModelNodeIndexIdRelationInforByParentId(nodeId); |
| | | private List<ModelNodeIndexInfo> listModelNodeIndexIdRelationInfor(String nodeId) { |
| | | List<ModelNodeIndexInfo> nodeInforList = modelNodeService.listModelNodeIndexIdRelationInforByParentId(nodeId); |
| | | // 妿æ¯ç©ºåå¨ä¸¤ç§æ
åµï¼1ï¼idæé®é¢ï¼2ï¼æåºå± |
| | | if (CollectionUtils.isEmpty(nodeInforList)) { |
| | | List<ModelNodeIndexInfor> inforList = modelNodeService.getModelNodeIndexIdRelationInforByNodeId(nodeId); |
| | | List<ModelNodeIndexInfo> inforList = modelNodeService.getModelNodeIndexIdRelationInforByNodeId(nodeId); |
| | | if (CollectionUtils.isNotEmpty(inforList)) { |
| | | nodeInforList.addAll(inforList); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zhitan.system.domain.SysRoleMenu; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * è§è²ä¸èåå
³è表 æ°æ®å± |
| | |
| | | * @param ids éè¦å é¤çæ°æ®ID |
| | | * @return ç»æ |
| | | */ |
| | | int deleteRoleMenu(Long[] ids); |
| | | int deleteRoleMenu(@Param("ids") Long[] ids); |
| | | |
| | | /** |
| | | * æ¹éæ°å¢è§è²èåä¿¡æ¯ |
| | |
| | | * @param roleMenuList è§è²èåå表 |
| | | * @return ç»æ |
| | | */ |
| | | int batchRoleMenu(List<SysRoleMenu> roleMenuList); |
| | | int batchRoleMenu(@Param("list") List<SysRoleMenu> roleMenuList); |
| | | } |
| | |
| | | DateUtils.parseDate(role.getParams().get("beginTime")), |
| | | DateUtils.parseDate(role.getParams().get("endTime"))); |
| | | } |
| | | queryWrapper.eq(SysRole::getDelFlag, 0); |
| | | return roleMapper.selectPage(new Page<SysRole>(pageNum,pageSize),queryWrapper); |
| | | } |
| | | |
| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.zhitan.basicdata.mapper.MeterImplementMapper"> |
| | | |
| | | <resultMap type="MeterImplement" id="MeterImplementResult"> |
| | | <resultMap type="com.zhitan.basicdata.domain.MeterImplement" id="MeterImplementResult"> |
| | | <result property="id" column="id" /> |
| | | <result property="code" column="code" /> |
| | | <result property="meterName" column="meter_name" /> |
| | |
| | | <result property="gatewayId" column="gateway_id" /> |
| | | <result property="gatewayName" column="gateway_name" /> |
| | | </resultMap> |
| | | <resultMap type="MeterImplementExcel" id="MeterImplementResultExcel"> |
| | | <resultMap type="com.zhitan.basicdata.domain.MeterImplementExcel" id="MeterImplementResultExcel"> |
| | | <result property="id" column="id" /> |
| | | <result property="code" column="code" /> |
| | | <result property="meterName" column="meter_name" /> |
| | |
| | | select id,energy_type, code, meter_name, meter_type, model_number, measure_range, manufacturer, person_charge, installaction_location, start_time, check_cycle, reminder_cycle, meter_status, del_flage, remark, putrun_time,create_time, create_by, update_time, update_by,(start_time+check_cycle-reminder_cycle)<=current_date as txflage,wire_diameter,max_allowable_power,gateway_id,gateway_name from meter_implement |
| | | </sql> |
| | | |
| | | <select id="selectMeterImplementList" parameterType="MeterImplement" resultMap="MeterImplementResult"> |
| | | <select id="selectMeterImplementList" parameterType="com.zhitan.basicdata.domain.MeterImplement" resultMap="MeterImplementResult"> |
| | | <include refid="selectMeterImplementVo"/> |
| | | <where> |
| | | del_flage='N' |
| | |
| | | order by code |
| | | </select> |
| | | |
| | | <select id="exectMeterImplementList" parameterType="MeterImplement" resultMap="MeterImplementResultExcel"> |
| | | <select id="exectMeterImplementList" parameterType="com.zhitan.basicdata.domain.MeterImplement" resultMap="MeterImplementResultExcel"> |
| | | select id,energy_type, code, meter_name, fun_getDiceData('sys_device_type',meter_status) as meter_type, model_number, measure_range, manufacturer, |
| | | person_charge, installaction_location, to_char(start_time,'YYYY-MM-DD') start_time, check_cycle, reminder_cycle, fun_getDiceData('meter_status',meter_status) as meter_status, |
| | | del_flage, remark, create_time, create_by, update_time, update_by,wire_diameter,max_allowable_power,gateway_name |
| | |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <select id="selectMeterImplementByCode" parameterType="MeterImplement" resultMap="MeterImplementResult"> |
| | | <select id="selectMeterImplementByCode" parameterType="com.zhitan.basicdata.domain.MeterImplement" resultMap="MeterImplementResult"> |
| | | <include refid="selectMeterImplementVo"/> |
| | | where code = #{code} |
| | | <if test="id != null and id != ''"> and id != #{id} or id is null</if> |
| | |
| | | installaction_location = #{installactionLocation} |
| | | </where> |
| | | </select> |
| | | <select id="selectByNodeId" resultType="com.zhitan.basicdata.domain.MeterImplement"> |
| | | <include refid="selectMeterImplementVo"/> |
| | | mi |
| | | left join node_device nd on mi.id = nd.device_id |
| | | where |
| | | mi.del_flage = 'N' |
| | | AND nd.node_id = #{nodeId} |
| | | </select> |
| | | |
| | | <insert id="insertMeterImplement" parameterType="MeterImplement"> |
| | | <insert id="insertMeterImplement" parameterType="com.zhitan.basicdata.domain.MeterImplement"> |
| | | insert into meter_implement |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null and id != ''">id,</if> |
| | |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="updateMeterImplement" parameterType="MeterImplement"> |
| | | <update id="updateMeterImplement" parameterType="com.zhitan.basicdata.domain.MeterImplement"> |
| | | update meter_implement |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="code != null and code != ''">code = #{code},</if> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.zhitan.branchanalysis.mapper.BranchAnalysisMapper"> |
| | | <resultMap id="dataItemMap" type="com.zhitan.branchanalysis.domain.BranchAnalysisVO"> |
| | | <result column="index_id" property="indexId"/> |
| | | <result column="index_name" property="indexName"/> |
| | | <result column="time_type" property="timeType"/> |
| | | <result column="time_code" property="timeCode"/> |
| | | <result column="unit_id" property="unitId"/> |
| | | <result column="value1" property="value1"/> |
| | | <result column="value2" property="value2"/> |
| | | <result column="value3" property="value3"/> |
| | | <result column="value4" property="value4"/> |
| | | <result column="value5" property="value5"/> |
| | | <result column="value6" property="value6"/> |
| | | <result column="value7" property="value7"/> |
| | | <result column="value8" property="value8"/> |
| | | <result column="value9" property="value9"/> |
| | | <result column="value10" property="value10"/> |
| | | <result column="value11" property="value11"/> |
| | | <result column="value12" property="value12"/> |
| | | </resultMap> |
| | | <!--å
¨åè½èç»è®¡--> |
| | | <select id="getBranchAnalysisList" resultMap="dataItemMap"> |
| | | SELECT |
| | | aa.index_id, |
| | | aa.index_name, |
| | | <foreach item="item" index="index" collection="dataList"> |
| | | MAX ( CASE WHEN data_time = #{item.dateTime} THEN "value" END ) AS ${item.value}, |
| | | </foreach> |
| | | aa.time_type |
| | | FROM |
| | | ( |
| | | SELECT |
| | | ci.index_id, |
| | | ci.NAME AS "index_name", |
| | | di."value", |
| | | di.data_time, |
| | | di.time_type |
| | | FROM |
| | | data_item di LEFT JOIN energy_index ci ON di.index_id = ci.index_id |
| | | LEFT JOIN facility_archives f ON f."id"=ci.equipment |
| | | WHERE |
| | | di.data_time >= #{beginTime} |
| | | AND di.data_time < #{endTime} |
| | | AND di.index_id IN |
| | | <foreach item="indexId" index="index" collection="indexIds" open="(" separator="," close=")"> |
| | | #{indexId} |
| | | </foreach> |
| | | AND di.time_type = #{timeType} |
| | | <if test="indexStorageId !='' and indexStorageId !=null"> |
| | | and ci.energy_id=#{indexStorageId} |
| | | </if> |
| | | ) aa |
| | | GROUP BY |
| | | aa.index_id,aa.index_name,aa.time_type |
| | | </select> |
| | | </mapper> |
| | |
| | | SELECT |
| | | aa.index_id, |
| | | aa.index_name, |
| | | aa.unit_id, |
| | | <foreach item="item" index="index" collection="dataList"> |
| | | COALESCE ( MAX ( CASE WHEN data_time = #{item.dataTime} THEN "value" END ), null ) AS ${item.value}, |
| | | </foreach> |
| | |
| | | SELECT |
| | | ni.index_id, |
| | | ei."name" AS "index_name", |
| | | ei.unit_id, |
| | | di."value", |
| | | di.data_time, |
| | | di.time_type, |
| | |
| | | </if> |
| | | ) aa |
| | | GROUP BY |
| | | aa.index_id, aa.index_name, aa.time_type, aa.order_num |
| | | aa.index_id, aa.index_name, aa.unit_id, aa.time_type, aa.order_num |
| | | ORDER BY aa.order_num ASC |
| | | </select> |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.zhitan.comprehensivestatistics.mapper.MonthlyComprehensiveMapper"> |
| | | <resultMap id="dataItemMap" type="com.zhitan.comprehensivestatistics.domain.MonthlyComprehensive"> |
| | | <result column="index_id" property="indexId"/> |
| | | <result column="index_name" property="indexName"/> |
| | | <result column="time_type" property="timeType"/> |
| | | <result column="time_code" property="timeCode"/> |
| | | <result column="unit_id" property="unitId"/> |
| | | <result column="value1" property="value1"/> |
| | | <result column="value2" property="value2"/> |
| | | <result column="value3" property="value3"/> |
| | | <result column="value4" property="value4"/> |
| | | <result column="value5" property="value5"/> |
| | | <result column="value6" property="value6"/> |
| | | <result column="value7" property="value7"/> |
| | | <result column="value8" property="value8"/> |
| | | <result column="value9" property="value9"/> |
| | | <result column="value10" property="value10"/> |
| | | <result column="value11" property="value11"/> |
| | | <result column="value12" property="value12"/> |
| | | <result column="value13" property="value13"/> |
| | | <result column="value14" property="value14"/> |
| | | <result column="value15" property="value15"/> |
| | | <result column="value16" property="value16"/> |
| | | <result column="value17" property="value17"/> |
| | | <result column="value18" property="value18"/> |
| | | <result column="value19" property="value19"/> |
| | | <result column="value20" property="value20"/> |
| | | <result column="value21" property="value21"/> |
| | | <result column="value22" property="value22"/> |
| | | <result column="value23" property="value23"/> |
| | | <result column="value24" property="value24"/> |
| | | <result column="value25" property="value25"/> |
| | | <result column="value26" property="value26"/> |
| | | <result column="value27" property="value27"/> |
| | | <result column="value28" property="value28"/> |
| | | <result column="value29" property="value29"/> |
| | | <result column="value30" property="value30"/> |
| | | <result column="value31" property="value31"/> |
| | | </resultMap> |
| | | <!--å
¨åè½èç»è®¡--> |
| | | <select id="getMonthlyComprehensiveList" resultMap="dataItemMap"> |
| | | SELECT |
| | | aa.index_id, |
| | | aa.index_name, |
| | | aa.unit_id, |
| | | <foreach item="item" index="index" collection="dataList"> |
| | | COALESCE ( MAX ( CASE WHEN data_time = #{item.dataTime} THEN "value" END ), null ) AS ${item.value}, |
| | | </foreach> |
| | | aa.time_type, |
| | | aa.order_num orderNum |
| | | FROM |
| | | ( |
| | | SELECT |
| | | ni.index_id, |
| | | ei."name" AS "index_name", |
| | | ei.unit_id, |
| | | di."value", |
| | | di.data_time, |
| | | di.time_type, |
| | | mn.order_num |
| | | FROM |
| | | model_node mn |
| | | LEFT JOIN node_index ni ON ni.node_id = mn.node_id |
| | | LEFT JOIN energy_index ei ON ei.index_id = ni.index_id |
| | | LEFT JOIN data_item di ON ni.index_id = di.index_id |
| | | WHERE |
| | | mn.parent_id = #{nodeId} |
| | | AND di.data_time >= #{beginTime} |
| | | AND di.data_time <= #{endTime} |
| | | AND di.time_type = #{timeType} |
| | | <if test="indexStorageId !='' and indexStorageId !=null"> |
| | | and ei.energy_id=#{indexStorageId} |
| | | </if> |
| | | ) aa |
| | | GROUP BY |
| | | aa.index_id, aa.index_name, aa.unit_id, aa.time_type, aa.order_num |
| | | ORDER BY aa.order_num ASC |
| | | </select> |
| | | |
| | | <select id="getListChart" resultMap="dataItemMap"> |
| | | SELECT |
| | | di.index_id, |
| | | ci.name AS "index_name", |
| | | ci.unit_id, |
| | | di."value", |
| | | di.data_time, |
| | | di.time_type, |
| | | di.time_code |
| | | FROM |
| | | data_item di LEFT JOIN energy_index ci ON di.index_id = ci.index_id |
| | | WHERE |
| | | di.index_id =#{indexId} |
| | | AND di.data_time <= #{endTime} |
| | | AND di.data_time >= #{beginTime} |
| | | AND di.time_type = #{timeType} |
| | | ORDER BY |
| | | di.time_code; |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.zhitan.comprehensivestatistics.mapper.YearComprehensiveMapper"> |
| | | <resultMap id="dataItemMap" type="com.zhitan.comprehensivestatistics.domain.YearComperhensive"> |
| | | <result column="index_id" property="indexId"/> |
| | | <result column="index_name" property="indexName"/> |
| | | <result column="time_type" property="timeType"/> |
| | | <result column="time_code" property="timeCode"/> |
| | | <result column="unit_id" property="unitId"/> |
| | | <result column="value1" property="value1"/> |
| | | <result column="value2" property="value2"/> |
| | | <result column="value3" property="value3"/> |
| | | <result column="value4" property="value4"/> |
| | | <result column="value5" property="value5"/> |
| | | <result column="value6" property="value6"/> |
| | | <result column="value7" property="value7"/> |
| | | <result column="value8" property="value8"/> |
| | | <result column="value9" property="value9"/> |
| | | <result column="value10" property="value10"/> |
| | | <result column="value11" property="value11"/> |
| | | <result column="value12" property="value12"/> |
| | | </resultMap> |
| | | <!--å
¨åè½èç»è®¡--> |
| | | <select id="getYearComprehensiveList" resultMap="dataItemMap"> |
| | | SELECT |
| | | aa.index_id, |
| | | aa.index_name, |
| | | aa.unit_id, |
| | | <foreach item="item" index="index" collection="dataList"> |
| | | COALESCE ( MAX ( CASE WHEN data_time = #{item.dataTime} THEN "value" END ), null ) AS ${item.value}, |
| | | </foreach> |
| | | aa.time_type, |
| | | aa.order_num orderNum |
| | | FROM |
| | | ( |
| | | SELECT |
| | | ni.index_id, |
| | | ei."name" AS "index_name", |
| | | ei.unit_id, |
| | | di."value", |
| | | di.data_time, |
| | | di.time_type, |
| | | mn.order_num |
| | | FROM |
| | | model_node mn |
| | | LEFT JOIN node_index ni ON ni.node_id = mn.node_id |
| | | LEFT JOIN energy_index ei ON ei.index_id = ni.index_id |
| | | LEFT JOIN data_item di ON ni.index_id = di.index_id |
| | | WHERE |
| | | mn.parent_id = #{nodeId} |
| | | AND di.data_time >= #{beginTime} |
| | | AND di.data_time <= #{endTime} |
| | | AND di.time_type = #{timeType} |
| | | <if test="indexStorageId !='' and indexStorageId !=null"> |
| | | and ei.energy_id=#{indexStorageId} |
| | | </if> |
| | | ) aa |
| | | GROUP BY aa.index_id, aa.index_name, aa.unit_id, aa.time_type, aa.order_num |
| | | ORDER BY aa.order_num ASC |
| | | </select> |
| | | |
| | | <select id="getListChart" resultMap="dataItemMap"> |
| | | SELECT |
| | | di.index_id, |
| | | ci.name AS "index_name", |
| | | ci.unit_id, |
| | | di."value", |
| | | di.data_time, |
| | | di.time_type, |
| | | di.time_code |
| | | FROM |
| | | data_item di LEFT JOIN energy_index ci ON di.index_id = ci.index_id |
| | | WHERE |
| | | di.index_id =#{indexId} |
| | | AND di.data_time < #{endTime} |
| | | AND di.data_time >= #{beginTime} |
| | | AND di.time_type = #{timeType} |
| | | ORDER BY |
| | | di.time_code; |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.zhitan.processenergy.mapper.DailyProcessEnergyMapper"> |
| | | <resultMap id="dataItemMap" type="com.zhitan.processenergy.domain.DailyProcessEnergy"> |
| | | <result column="index_id" property="indexId"/> |
| | | <result column="index_name" property="indexName"/> |
| | | <result column="time_type" property="timeType"/> |
| | | <result column="time_code" property="timeCode"/> |
| | | <result column="unit_id" property="unitId"/> |
| | | <result column="value1" property="value1"/> |
| | | <result column="value2" property="value2"/> |
| | | <result column="value3" property="value3"/> |
| | | <result column="value4" property="value4"/> |
| | | <result column="value5" property="value5"/> |
| | | <result column="value6" property="value6"/> |
| | | <result column="value7" property="value7"/> |
| | | <result column="value8" property="value8"/> |
| | | <result column="value9" property="value9"/> |
| | | <result column="value10" property="value10"/> |
| | | <result column="value11" property="value11"/> |
| | | <result column="value12" property="value12"/> |
| | | <result column="value13" property="value13"/> |
| | | <result column="value14" property="value14"/> |
| | | <result column="value15" property="value15"/> |
| | | <result column="value16" property="value16"/> |
| | | <result column="value17" property="value17"/> |
| | | <result column="value18" property="value18"/> |
| | | <result column="value19" property="value19"/> |
| | | <result column="value20" property="value20"/> |
| | | <result column="value21" property="value21"/> |
| | | <result column="value22" property="value22"/> |
| | | <result column="value23" property="value23"/> |
| | | <result column="value0" property="value0"/> |
| | | </resultMap> |
| | | <select id="getDailyProcessEnergyList" resultMap="dataItemMap"> |
| | | SELECT |
| | | aa.index_id, |
| | | aa.index_name, |
| | | aa.unit_id, |
| | | <foreach item="item" index="index" collection="dataList"> |
| | | MAX ( CASE WHEN data_time = #{item.dataTime} THEN "value" END ) AS ${item.value}, |
| | | </foreach> |
| | | aa.time_type |
| | | FROM |
| | | ( |
| | | SELECT |
| | | ni.index_id, |
| | | ei.NAME AS "index_name", |
| | | ei.unit_id, |
| | | di."value", |
| | | di.data_time, |
| | | di.time_type |
| | | FROM |
| | | model_node mn |
| | | LEFT JOIN node_index ni ON ni.node_id = mn.node_id |
| | | LEFT JOIN energy_index ei ON ei.index_id = ni.index_id |
| | | LEFT JOIN data_item di ON ni.index_id = di.index_id |
| | | WHERE |
| | | di.data_time >= #{beginTime} |
| | | AND di.data_time < #{endTime} |
| | | AND di.index_id IN |
| | | <foreach item="indexId" index="index" collection="indexIds" open="(" separator="," close=")"> |
| | | #{indexId} |
| | | </foreach> |
| | | AND di.time_type = #{timeType} |
| | | <if test="indexStorageId !='' and indexStorageId !=null"> |
| | | and ei.energy_id=#{indexStorageId} |
| | | </if> |
| | | ) aa |
| | | GROUP BY |
| | | aa.index_id, aa.index_name, aa.unit_id, aa.time_type |
| | | </select> |
| | | |
| | | <select id="getListChart" resultMap="dataItemMap"> |
| | | SELECT |
| | | di.index_id, |
| | | ci.name AS "index_name", |
| | | ci.unit_id, |
| | | di."value", |
| | | di.data_time, |
| | | di.time_type, |
| | | di.time_code |
| | | FROM |
| | | data_item di LEFT JOIN energy_index ci ON di.index_id = ci.index_id |
| | | WHERE |
| | | di.index_id =#{indexId} |
| | | AND di.data_time < #{endTime} |
| | | AND di.data_time >= #{beginTime} |
| | | AND di.time_type = #{timeType} |
| | | order by di.data_time |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.zhitan.processenergy.mapper.MonthlyProcessEnergyMapper"> |
| | | <resultMap id="dataItemMap" type="com.zhitan.processenergy.domain.MonthlyProcessEnergy"> |
| | | <result column="index_id" property="indexId"/> |
| | | <result column="index_name" property="indexName"/> |
| | | <result column="time_type" property="timeType"/> |
| | | <result column="time_code" property="timeCode"/> |
| | | <result column="unit_id" property="unitId"/> |
| | | <result column="value1" property="value1"/> |
| | | <result column="value2" property="value2"/> |
| | | <result column="value3" property="value3"/> |
| | | <result column="value4" property="value4"/> |
| | | <result column="value5" property="value5"/> |
| | | <result column="value6" property="value6"/> |
| | | <result column="value7" property="value7"/> |
| | | <result column="value8" property="value8"/> |
| | | <result column="value9" property="value9"/> |
| | | <result column="value10" property="value10"/> |
| | | <result column="value11" property="value11"/> |
| | | <result column="value12" property="value12"/> |
| | | <result column="value13" property="value13"/> |
| | | <result column="value14" property="value14"/> |
| | | <result column="value15" property="value15"/> |
| | | <result column="value16" property="value16"/> |
| | | <result column="value17" property="value17"/> |
| | | <result column="value18" property="value18"/> |
| | | <result column="value19" property="value19"/> |
| | | <result column="value20" property="value20"/> |
| | | <result column="value21" property="value21"/> |
| | | <result column="value22" property="value22"/> |
| | | <result column="value23" property="value23"/> |
| | | <result column="value24" property="value24"/> |
| | | <result column="value25" property="value25"/> |
| | | <result column="value26" property="value26"/> |
| | | <result column="value27" property="value27"/> |
| | | <result column="value28" property="value28"/> |
| | | <result column="value29" property="value29"/> |
| | | <result column="value30" property="value30"/> |
| | | <result column="value31" property="value31"/> |
| | | </resultMap> |
| | | |
| | | <select id="getMonthlyProcessEnergy" resultMap="dataItemMap"> |
| | | SELECT |
| | | aa.index_id, |
| | | aa.index_name, |
| | | aa.unit_id, |
| | | <foreach item="item" index="index" collection="dataList"> |
| | | MAX ( CASE WHEN data_time = #{item.dataTime} THEN "value" END ) AS ${item.value}, |
| | | </foreach> |
| | | aa.time_type |
| | | FROM |
| | | ( |
| | | SELECT |
| | | ni.index_id, |
| | | ei.NAME AS "index_name", |
| | | ei.unit_id, |
| | | di."value", |
| | | di.data_time, |
| | | di.time_type |
| | | FROM |
| | | model_node mn |
| | | LEFT JOIN node_index ni ON ni.node_id = mn.node_id |
| | | LEFT JOIN energy_index ei ON ei.index_id = ni.index_id |
| | | LEFT JOIN data_item di ON ni.index_id = di.index_id |
| | | WHERE |
| | | di.data_time >= #{beginTime} |
| | | AND di.data_time < #{endTime} |
| | | AND di.index_id IN |
| | | <foreach item="indexId" index="index" collection="indexIds" open="(" separator="," close=")"> |
| | | #{indexId} |
| | | </foreach> |
| | | AND di.time_type = #{timeType} |
| | | <if test="indexStorageId !='' and indexStorageId !=null"> |
| | | and ei.energy_id=#{indexStorageId} |
| | | </if> |
| | | ) aa |
| | | GROUP BY |
| | | aa.index_id, aa.index_name, aa.unit_id, aa.time_type |
| | | </select> |
| | | |
| | | <select id="getListChart" resultMap="dataItemMap"> |
| | | SELECT |
| | | di.index_id, |
| | | ci.name AS "index_name", |
| | | ci.unit_id, |
| | | di."value", |
| | | di.data_time, |
| | | di.time_type, |
| | | di.time_code |
| | | FROM |
| | | data_item di LEFT JOIN energy_index ci ON di.index_id = ci.index_id |
| | | WHERE |
| | | di.index_id =#{indexId} |
| | | AND di.data_time >= #{beginTime} |
| | | AND di.data_time < #{endTime} |
| | | AND di.time_type = #{timeType} |
| | | order by di.data_time |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.zhitan.processenergy.mapper.YearProcessEnergyMapper"> |
| | | <resultMap id="dataItemMap" type="com.zhitan.processenergy.domain.YearProcessEnergy"> |
| | | <result column="index_id" property="indexId"/> |
| | | <result column="index_name" property="indexName"/> |
| | | <result column="time_type" property="timeType"/> |
| | | <result column="time_code" property="timeCode"/> |
| | | <result column="unit_id" property="unitId"/> |
| | | <result column="value1" property="value1"/> |
| | | <result column="value2" property="value2"/> |
| | | <result column="value3" property="value3"/> |
| | | <result column="value4" property="value4"/> |
| | | <result column="value5" property="value5"/> |
| | | <result column="value6" property="value6"/> |
| | | <result column="value7" property="value7"/> |
| | | <result column="value8" property="value8"/> |
| | | <result column="value9" property="value9"/> |
| | | <result column="value10" property="value10"/> |
| | | <result column="value11" property="value11"/> |
| | | <result column="value12" property="value12"/> |
| | | </resultMap> |
| | | |
| | | <select id="getYearProcessEnergy" resultMap="dataItemMap"> |
| | | SELECT |
| | | aa.index_id, |
| | | aa.index_name, |
| | | aa.unit_id, |
| | | <foreach item="item" index="index" collection="dataList"> |
| | | MAX ( CASE WHEN data_time = #{item.dateTime} THEN "value" END ) AS ${item.value}, |
| | | </foreach> |
| | | aa.time_type |
| | | FROM |
| | | ( |
| | | SELECT |
| | | ni.index_id, |
| | | ei.NAME AS "index_name", |
| | | ei.unit_id, |
| | | di."value", |
| | | di.data_time, |
| | | di.time_type |
| | | FROM |
| | | model_node mn |
| | | LEFT JOIN node_index ni ON ni.node_id = mn.node_id |
| | | LEFT JOIN energy_index ei ON ei.index_id = ni.index_id |
| | | LEFT JOIN data_item di ON ni.index_id = di.index_id |
| | | WHERE |
| | | di.data_time >= #{beginTime} |
| | | AND di.data_time < #{endTime} |
| | | AND di.index_id IN |
| | | <foreach item="indexId" index="index" collection="indexIds" open="(" separator="," close=")"> |
| | | #{indexId} |
| | | </foreach> |
| | | AND di.time_type = #{timeType} |
| | | <if test="indexStorageId !='' and indexStorageId !=null"> |
| | | and ei.energy_id=#{indexStorageId} |
| | | </if> |
| | | ) aa |
| | | GROUP BY |
| | | aa.index_id, aa.index_name, aa.unit_id, aa.time_type |
| | | </select> |
| | | |
| | | <select id="getListChart" resultMap="dataItemMap"> |
| | | SELECT |
| | | di.index_id, |
| | | ci.name AS "index_name", |
| | | ci.unit_id, |
| | | di."value", |
| | | di.data_time, |
| | | di.time_type, |
| | | di.time_code |
| | | FROM |
| | | data_item di LEFT JOIN energy_index ci ON di.index_id = ci.index_id |
| | | WHERE |
| | | di.index_id = #{indexId} |
| | | AND di.time_type = #{timeType} |
| | | <if test="endTime != null"> |
| | | AND di.data_time < #{endTime} |
| | | </if> |
| | | <if test="beginTime != null"> |
| | | AND di.data_time >= #{beginTime} |
| | | </if> |
| | | order by di.data_time |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | AND ( begin_time BETWEEN #{beginTime} AND #{endTime} ) |
| | | AND time_type = #{timeType} |
| | | </select> |
| | | |
| | | <select id="getDataItemTimeRangeValueByNodeId" resultType="java.math.BigDecimal"> |
| | | SELECT |
| | | COALESCE (SUM ( "value" ), 0) |
| | | FROM |
| | | "data_item" di |
| | | JOIN energy_index ei ON di.index_id = ei.index_id |
| | | WHERE |
| | | di.index_id IN ( SELECT index_id FROM node_index WHERE node_id = #{nodeId}) |
| | | <if test="energyType !='' and energyType !=null and energyType =='allType'"> |
| | | AND ei.energy_id != '' |
| | | </if> |
| | | <if test="energyType !='' and energyType !=null and energyType !='allType'"> |
| | | AND ei.energy_id = #{energyType} |
| | | </if> |
| | | AND (di.data_time BETWEEN #{beginTime} AND #{endTime}) |
| | | AND di.time_type = #{timeType} |
| | | </select> |
| | | <select id="getHomePageConsumptionRanking" |
| | | resultType="com.zhitan.consumptionanalysis.domain.vo.RankingEnergyData"> |
| | | SELECT |
| | | A.node_Id, |
| | | A."name" AS nodeName, |
| | | A.energy_id AS energyTypeNo, |
| | | A.index_type AS energyTypeName, |
| | | A."value" AS energyConsumption |
| | | FROM |
| | | ( |
| | | SELECT |
| | | mn.node_id, |
| | | mn."name", |
| | | ei.energy_id, |
| | | ei.index_type, |
| | | se.coefficient, |
| | | (SUM ( di."value" ) * se.coefficient) AS "value" |
| | | FROM |
| | | model_node mn |
| | | LEFT JOIN node_index ni ON ni.node_id = mn.node_id |
| | | LEFT JOIN data_item di ON di.index_id = ni.index_id |
| | | LEFT JOIN energy_index ei ON ei.index_id = ni.index_id |
| | | LEFT JOIN sys_energy se ON se.enersno = ei.energy_id |
| | | WHERE |
| | | mn.node_id IN |
| | | <foreach collection="nodeIds" item="nodeId" open="(" separator="," close=")"> |
| | | #{nodeId} |
| | | </foreach> |
| | | AND di.time_type = #{timeType} |
| | | AND di.begin_time between #{beginTime} AND #{endTime} |
| | | AND ei.index_type = 'STATISTIC' |
| | | GROUP BY |
| | | mn.node_id, |
| | | mn."name", |
| | | ei.energy_id, |
| | | ei.index_type, |
| | | se.coefficient |
| | | ) A |
| | | ORDER BY |
| | | A."value" DESC |
| | | LIMIT 5 |
| | | </select> |
| | | </mapper> |
| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.zhitan.energydata.mapper.EnergyDataStatisticMapper"> |
| | | |
| | | <select id="getModelNodeIndexIdByFixedNodeIds" resultType="com.zhitan.model.domain.vo.ModelNodeIndexInfor"> |
| | | <select id="getModelNodeIndexIdByFixedNodeIds" resultType="com.zhitan.model.domain.vo.ModelNodeIndexInfo"> |
| | | SELECT mn.node_id nodeId, |
| | | mn."name" "name", |
| | | ni.index_id indexId, |
| | |
| | | SELECT |
| | | aa.index_id, |
| | | aa.index_name, |
| | | aa.unit_id, |
| | | <foreach item="item" index="index" collection="dataList"> |
| | | MAX ( CASE WHEN data_time = #{item.dataTime} THEN "value" END ) AS ${item.value}, |
| | | </foreach> |
| | |
| | | FROM |
| | | ( |
| | | SELECT |
| | | ci.index_id, |
| | | ci.NAME AS "index_name", |
| | | ni.index_id, |
| | | ei.NAME AS "index_name", |
| | | ei.unit_id, |
| | | di."value", |
| | | di.data_time, |
| | | di.time_type |
| | | FROM |
| | | data_item di LEFT JOIN energy_index ci ON di.index_id = ci.index_id |
| | | LEFT JOIN facility_archives f ON f."id"=ci.equipment |
| | | model_node mn |
| | | LEFT JOIN node_index ni ON ni.node_id = mn.node_id |
| | | LEFT JOIN energy_index ei ON ei.index_id = ni.index_id |
| | | LEFT JOIN data_item di ON ni.index_id = di.index_id |
| | | WHERE |
| | | di.data_time >= #{beginTime} |
| | | AND di.data_time < #{endTime} |
| | | AND di.index_id IN <foreach item="indexId" index="index" collection="indexIds" open="(" separator="," close=")">#{indexId} </foreach> |
| | | AND di.index_id IN |
| | | <foreach item="indexId" index="index" collection="indexIds" open="(" separator="," close=")"> |
| | | #{indexId} |
| | | </foreach> |
| | | AND di.time_type = #{timeType} |
| | | <if test="indexStorageId !='' and indexStorageId !=null"> |
| | | and ci.equipment=#{indexStorageId} |
| | | and ei.energy_id=#{indexStorageId} |
| | | </if> |
| | | ) aa |
| | | GROUP BY |
| | | aa.index_id,aa.index_name,aa.time_type |
| | | aa.index_id, aa.index_name, aa.unit_id, aa.time_type |
| | | </select> |
| | | |
| | | <select id="getListChart" resultMap="dataItemMap"> |
| | |
| | | SELECT |
| | | aa.index_id, |
| | | aa.index_name, |
| | | aa.unit_id, |
| | | <foreach item="item" index="index" collection="dataList"> |
| | | MAX ( CASE WHEN data_time = #{item.dataTime} THEN "value" END ) AS ${item.value}, |
| | | </foreach> |
| | |
| | | FROM |
| | | ( |
| | | SELECT |
| | | ci.index_id, |
| | | ci.NAME AS "index_name", |
| | | ni.index_id, |
| | | ei.NAME AS "index_name", |
| | | ei.unit_id, |
| | | di."value", |
| | | di.data_time, |
| | | di.time_type |
| | | FROM |
| | | data_item di LEFT JOIN energy_index ci ON di.index_id = ci.index_id |
| | | LEFT JOIN facility_archives f ON f."id"=ci.equipment |
| | | model_node mn |
| | | LEFT JOIN node_index ni ON ni.node_id = mn.node_id |
| | | LEFT JOIN energy_index ei ON ei.index_id = ni.index_id |
| | | LEFT JOIN data_item di ON ni.index_id = di.index_id |
| | | WHERE |
| | | di.data_time >= #{beginTime} |
| | | AND di.data_time < #{endTime} |
| | | AND di.index_id IN <foreach item="indexId" index="index" collection="indexIds" open="(" separator="," close=")">#{indexId} </foreach> |
| | | AND di.index_id IN |
| | | <foreach item="indexId" index="index" collection="indexIds" open="(" separator="," close=")"> |
| | | #{indexId} |
| | | </foreach> |
| | | AND di.time_type = #{timeType} |
| | | <if test="indexStorageId !='' and indexStorageId !=null"> |
| | | and ci.equipment=#{indexStorageId} |
| | | and ei.energy_id=#{indexStorageId} |
| | | </if> |
| | | ) aa |
| | | GROUP BY |
| | | aa.index_id,aa.index_name,aa.time_type |
| | | aa.index_id, aa.index_name, aa.unit_id, aa.time_type |
| | | </select> |
| | | |
| | | <select id="getListChart" resultMap="dataItemMap"> |
| | |
| | | SELECT |
| | | aa.index_id, |
| | | aa.index_name, |
| | | aa.unit_id, |
| | | <foreach item="item" index="index" collection="dataList"> |
| | | MAX ( CASE WHEN data_time = #{item.dataTime} THEN "value" END ) AS ${item.value}, |
| | | MAX ( CASE WHEN data_time = #{item.dateTime} THEN "value" END ) AS ${item.value}, |
| | | </foreach> |
| | | aa.time_type |
| | | FROM |
| | | ( |
| | | SELECT |
| | | ci.index_id, |
| | | ci.NAME AS "index_name", |
| | | ni.index_id, |
| | | ei.NAME AS "index_name", |
| | | ei.unit_id, |
| | | di."value", |
| | | di.data_time, |
| | | di.time_type |
| | | FROM |
| | | data_item di LEFT JOIN energy_index ci ON di.index_id = ci.index_id |
| | | LEFT JOIN facility_archives f ON f."id"=ci.equipment |
| | | model_node mn |
| | | LEFT JOIN node_index ni ON ni.node_id = mn.node_id |
| | | LEFT JOIN energy_index ei ON ei.index_id = ni.index_id |
| | | LEFT JOIN data_item di ON ni.index_id = di.index_id |
| | | WHERE |
| | | di.data_time >= #{beginTime} |
| | | di.data_time >= #{beginTime} |
| | | AND di.data_time < #{endTime} |
| | | AND di.index_id IN <foreach item="indexId" index="index" collection="indexIds" open="(" separator="," close=")">#{indexId} </foreach> |
| | | AND di.index_id IN |
| | | <foreach item="indexId" index="index" collection="indexIds" open="(" separator="," close=")"> |
| | | #{indexId} |
| | | </foreach> |
| | | AND di.time_type = #{timeType} |
| | | <if test="indexStorageId !='' and indexStorageId !=null"> |
| | | and ci.equipment=#{indexStorageId} |
| | | and ei.energy_id=#{indexStorageId} |
| | | </if> |
| | | ) aa |
| | | GROUP BY |
| | | aa.index_id,aa.index_name,aa.time_type |
| | | aa.index_id, aa.index_name, aa.unit_id, aa.time_type |
| | | </select> |
| | | |
| | | <select id="getListChart" resultMap="dataItemMap"> |
| | |
| | | WHERE |
| | | di.index_id =#{indexId} |
| | | AND di.data_time < #{endTime} |
| | | AND di.data_time >= #{beginTime} |
| | | <if test="endTime != null"> |
| | | AND di.data_time >= #{beginTime} |
| | | </if> |
| | | <if test="beginTime != null"> |
| | | AND di.time_type = #{timeType} |
| | | </if> |
| | | order by di.data_time |
| | | </select> |
| | | </mapper> |
| | |
| | | <result property="name" column="name"/> |
| | | <result property="deviceType" column="device_type"/> |
| | | <result property="unit" column="unit"/> |
| | | <result property="gatewayKey" column="gateway_key"/> |
| | | </resultMap> |
| | | |
| | | <sql id="selectDaqTemplateVo"> |
| | | select id, code, name, device_type, unit |
| | | select id, code, name, device_type, unit, gateway_key |
| | | from daq_template |
| | | </sql> |
| | | |
| | |
| | | AND device_type = #{deviceType} |
| | | AND id != #{id} |
| | | </select> |
| | | <select id="dapCodeHasExist" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) |
| | | FROM daq_template |
| | | WHERE gateway_key = #{key} |
| | | AND device_type = #{deviceType} |
| | | </select> |
| | | <select id="dapCodeHasExistWhenUpdate" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) |
| | | FROM daq_template |
| | | WHERE gateway_key = #{key} |
| | | AND device_type = #{deviceType} |
| | | AND id != #{id} |
| | | </select> |
| | | <select id="listTemplate" resultType="com.zhitan.model.domain.DaqTemplate"> |
| | | <include refid="selectDaqTemplateVo"/> |
| | | </select> |
| | |
| | | <if test="name != null and name != ''">name,</if> |
| | | <if test="deviceType != null and deviceType != ''">device_type,</if> |
| | | <if test="unit != null and unit != ''">unit,</if> |
| | | <if test="gatewayKey != null and gatewayKey != ''">gateway_key,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null and id != ''">#{id},</if> |
| | |
| | | <if test="name != null and name != ''">#{name},</if> |
| | | <if test="deviceType != null and deviceType != ''">#{deviceType},</if> |
| | | <if test="unit != null and unit != ''">#{unit},</if> |
| | | <if test="gatewayKey != null and gatewayKey != ''">#{gatewayKey},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | |
| | | <if test="name != null and name != ''">name = #{name},</if> |
| | | <if test="deviceType != null and deviceType != ''">device_type = #{deviceType},</if> |
| | | <if test="unit != null and unit != ''">unit = #{unit},</if> |
| | | <if test="gatewayKey != null and gatewayKey != ''">gateway_key = #{gatewayKey},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | |
| | | from energy_index |
| | | where meter_id = #{meterId} |
| | | </delete> |
| | | <delete id="removeNodeIndex"> |
| | | delete from node_index where node_id = #{nodeId} and index_id in |
| | | <foreach item="indexId" collection="indexIds" open="(" separator="," close=")"> |
| | | <delete id="removeEnergyIndex"> |
| | | delete from energy_index where index_id in |
| | | <foreach collection="indexIds" item="indexId" open="(" separator="," close=")"> |
| | | #{indexId} |
| | | </foreach>; |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <select id="getEnergyIndexMeterByCodes" resultMap="EnergyIndexResult"> |
| | |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="getIndexByMeterIdIndexCode" resultType="com.zhitan.model.domain.EnergyIndex"> |
| | | SELECT ei.code,mi.meter_name||'_'||ei.name as name from energy_index ei |
| | | LEFT JOIN node_device nd on ei.meter_id = nd.device_id |
| | | LEFT JOIN meter_implement mi on mi."id" = nd.device_id |
| | | <where> |
| | | <if test="nodeId != null and nodeId != ''">and nd.node_id = #{nodeId}</if> |
| | | <if test="indexCode != null and indexCode != ''"> |
| | | and (mi.meter_name like concat('%', #{indexCode}, '%') |
| | | or ei.code like concat('%', #{indexCode}, '%') |
| | | or ei.name like concat('%', #{indexCode}, '%') |
| | | ) |
| | | </if> |
| | | <if test="meterId != null and meterId != ''"> |
| | | and ei.meter_id = #{meterId} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="getModelNodeIndexInfoListByIndexIds" |
| | | resultType="com.zhitan.model.domain.vo.ModelNodeIndexInfo"> |
| | | SELECT mi.model_name modelName, |
| | | mi.model_code, |
| | | mn."name" "name", |
| | | ei.index_id, |
| | | ei.code indexCode, |
| | | ei."name" indexName, |
| | | ei.energy_id, |
| | | ei.energy_id |
| | | FROM node_index ni |
| | | INNER JOIN energy_index ei ON ni.index_id = ei.index_id |
| | | LEFT JOIN model_node mn ON ni.node_id = mn.node_id |
| | | LEFT JOIN model_info mi ON mn.model_code = mi.model_code |
| | | WHERE ei.index_id IN |
| | | <foreach collection="indexIds" item="indexId" open="(" separator="," close=")"> |
| | | #{indexId} |
| | | </foreach> |
| | | </select> |
| | | </mapper> |
| | |
| | | </select> |
| | | |
| | | <select id="getModelNodeIndexIdRelationInforByCode" |
| | | resultType="com.zhitan.model.domain.vo.ModelNodeIndexInfor"> |
| | | resultType="com.zhitan.model.domain.vo.ModelNodeIndexInfo"> |
| | | SELECT mn.node_id nodeId, |
| | | mn."name" "name", |
| | | ni.index_id indexId |
| | |
| | | </select> |
| | | |
| | | <select id="listModelNodeIndexIdRelationInforByParentId" |
| | | resultType="com.zhitan.model.domain.vo.ModelNodeIndexInfor"> |
| | | resultType="com.zhitan.model.domain.vo.ModelNodeIndexInfo"> |
| | | SELECT mn.node_id nodeId, |
| | | mn."name" "name", |
| | | ni.index_id indexId |
| | |
| | | </select> |
| | | |
| | | <select id="getModelNodeIndexIdRelationInforByNodeId" |
| | | resultType="com.zhitan.model.domain.vo.ModelNodeIndexInfor"> |
| | | resultType="com.zhitan.model.domain.vo.ModelNodeIndexInfo"> |
| | | SELECT mn.node_id nodeId, |
| | | mn."name" "name", |
| | | ni.index_id indexId |
| | |
| | | LIMIT 1; |
| | | </select> |
| | | <select id="selectIndexByModelCodeAndNodeId" |
| | | resultType="com.zhitan.model.domain.vo.ModelNodeIndexInfor"> |
| | | resultType="com.zhitan.model.domain.vo.ModelNodeIndexInfo"> |
| | | SELECT mn.node_id nodeId, |
| | | mn."name", |
| | | ni.index_id indexId |
| | |
| | | </foreach> |
| | | </insert> |
| | | |
| | | <select id="getModelNodeIndexIdByNodeId" resultType="com.zhitan.model.domain.vo.ModelNodeIndexInfor"> |
| | | <select id="getModelNodeIndexIdByNodeId" resultType="com.zhitan.model.domain.vo.ModelNodeIndexInfo"> |
| | | SELECT mn.node_id nodeId, |
| | | mn."name" "name", |
| | | ni.index_id indexId, |
| | | ei.energy_id energyId, |
| | | ei.index_type indexType |
| | | ei.index_type indexType, |
| | | ei.unit_id unitId |
| | | FROM "model_node" mn |
| | | LEFT JOIN "node_index" ni ON mn.node_id = ni.node_id |
| | | LEFT JOIN energy_index ei on ni.index_id = ei.index_id |
| | |
| | | and ei.energy_id = #{energyType} |
| | | </if> |
| | | </select> |
| | | <select id="getModelNodeByParentId" resultType="com.zhitan.model.domain.vo.ModelNodeIndexInfor"> |
| | | <select id="getModelNodeByParentId" resultType="com.zhitan.model.domain.vo.ModelNodeIndexInfo"> |
| | | SELECT mn.node_id nodeId, |
| | | mn."name" "name", |
| | | ni.index_id indexId, |
| | |
| | | where model_code = #{modelCode} AND parent_id is null |
| | | order by order_num |
| | | </select> |
| | | <select id="selectIndexByNodeIds" resultType="com.zhitan.model.domain.vo.ModelNodeIndexInfor"> |
| | | <select id="selectIndexByNodeIds" resultType="com.zhitan.model.domain.vo.ModelNodeIndexInfo"> |
| | | SELECT mn.node_id nodeId, |
| | | mn."name" "name", |
| | | ni.index_id indexId, |
| | |
| | | |
| | | AND time_type = #{timeType} |
| | | </select> |
| | | <select id="getCostTrends" |
| | | resultType="com.zhitan.peakvalley.domain.ElectricityDataItem"> |
| | | SELECT |
| | | di.index_code, |
| | | di.time_code, |
| | | di.electricity_type, |
| | | di.data_time, |
| | | di.electricity, |
| | | di.cost, |
| | | di.time_type, |
| | | di.price, |
| | | di.remark |
| | | FROM |
| | | "electricity_data_item" di |
| | | JOIN energy_index ei ON di.index_id = ei.index_id |
| | | WHERE |
| | | di.index_id IN ( SELECT index_id FROM node_index WHERE node_id = #{nodeId}) |
| | | <if test="energyType !='' and energyType !=null and energyType =='allType'"> |
| | | AND ei.energy_id != '' |
| | | </if> |
| | | <if test="energyType !='' and energyType !=null and energyType !='allType'"> |
| | | AND ei.energy_id = #{energyType} |
| | | </if> |
| | | AND (di.data_time BETWEEN #{beginTime} AND #{endTime}) |
| | | AND di.time_type = #{timeType} |
| | | </select> |
| | | </mapper> |
| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.zhitan.system.mapper.SysConfigMapper"> |
| | | |
| | | <resultMap type="SysConfig" id="SysConfigResult"> |
| | | <resultMap type="com.zhitan.system.domain.SysConfig" id="SysConfigResult"> |
| | | <id property="configId" column="config_id" /> |
| | | <result property="configName" column="config_name" /> |
| | | <result property="configKey" column="config_key" /> |
| | |
| | | <include refid="selectConfigVo"/> |
| | | where config_key = #{configKey} |
| | | </select> |
| | | <select id="selectConfigById" resultType="com.zhitan.system.domain.SysConfig"> |
| | | <include refid="selectConfigVo"/> |
| | | where config_id = #{configId} |
| | | </select> |
| | | |
| | | <insert id="insertConfig" parameterType="SysConfig"> |
| | | insert into sys_config ( |
| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.zhitan.system.mapper.SysRoleMapper"> |
| | | |
| | | <resultMap type="SysRole" id="SysRoleResult"> |
| | | <resultMap type="com.zhitan.common.core.domain.entity.SysRole" id="SysRoleResult"> |
| | | <id property="roleId" column="role_id" /> |
| | | <result property="roleName" column="role_name" /> |
| | | <result property="roleKey" column="role_key" /> |
| | |
| | | left join sys_dept d on u.dept_id = d.dept_id |
| | | </sql> |
| | | |
| | | <select id="selectRoleList" parameterType="SysRole" resultMap="SysRoleResult"> |
| | | <select id="selectRoleList" parameterType="com.zhitan.common.core.domain.entity.SysRole" resultMap="SysRoleResult"> |
| | | <include refid="selectRoleVo"/> |
| | | where r.del_flag = '0' |
| | | <if test="roleId != null and roleId != 0"> |
| | |
| | | where r.role_key=#{roleKey} and r.del_flag = '0' limit 1 |
| | | </select> |
| | | |
| | | <insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId"> |
| | | <insert id="insertRole" parameterType="com.zhitan.common.core.domain.entity.SysRole" useGeneratedKeys="true" keyProperty="roleId"> |
| | | insert into sys_role( |
| | | <if test="roleId != null and roleId != 0">role_id,</if> |
| | | <if test="roleName != null and roleName != ''">role_name,</if> |
| | |
| | | ) |
| | | </insert> |
| | | |
| | | <update id="updateRole" parameterType="SysRole"> |
| | | <update id="updateRole" parameterType="com.zhitan.common.core.domain.entity.SysRole"> |
| | | update sys_role |
| | | <set> |
| | | <if test="roleName != null and roleName != ''">role_name = #{roleName},</if> |
| | |
| | | where role_id = #{roleId} |
| | | </update> |
| | | |
| | | <update id="updateRoleStatus" parameterType="SysRole"> |
| | | <update id="updateRoleStatus" parameterType="com.zhitan.common.core.domain.entity.SysRole"> |
| | | update sys_user set status = #{status} where user_id = #{userId} |
| | | </update> |
| | | |
| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.zhitan.system.mapper.SysRoleMenuMapper"> |
| | | |
| | | <resultMap type="SysRoleMenu" id="SysRoleMenuResult"> |
| | | <resultMap type="com.zhitan.system.domain.SysRoleMenu" id="SysRoleMenuResult"> |
| | | <result property="roleId" column="role_id" /> |
| | | <result property="menuId" column="menu_id" /> |
| | | </resultMap> |
| | |
| | | <delete id="deleteRoleMenuByRoleId" parameterType="Long"> |
| | | delete from sys_role_menu where role_id=#{roleId} |
| | | </delete> |
| | | <delete id="deleteRoleMenu" parameterType="arraylist"> |
| | | delete from sys_role_menu where role_id in ( |
| | | <foreach collection="ids" item="roleId" separator=","> |
| | | #{roleId} |
| | | </foreach> |
| | | ) |
| | | </delete> |
| | | |
| | | <insert id="batchRoleMenu"> |
| | | insert into sys_role_menu(role_id, menu_id) values |
| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.zhitan.system.mapper.SysUserMapper"> |
| | | |
| | | <resultMap type="SysUser" id="SysUserResult"> |
| | | <resultMap type="com.zhitan.common.core.domain.entity.SysUser" id="SysUserResult"> |
| | | <id property="userId" column="user_id"/> |
| | | <result property="deptId" column="dept_id"/> |
| | | <result property="userName" column="user_name"/> |
| | |
| | | <result property="updateTime" column="update_time"/> |
| | | <result property="remark" column="remark"/> |
| | | <result property="singleUser" column="single_user"/> |
| | | <association property="dept" javaType="SysDept" resultMap="deptResult" /> |
| | | <association property="dept" javaType="com.zhitan.common.core.domain.entity.SysDept" resultMap="deptResult"/> |
| | | <collection property="roles" javaType="java.util.List" resultMap="RoleResult"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="deptResult" type="SysDept"> |
| | | <resultMap id="deptResult" type="com.zhitan.common.core.domain.entity.SysDept"> |
| | | <id property="deptId" column="dept_id"/> |
| | | <result property="parentId" column="parent_id"/> |
| | | <result property="deptName" column="dept_name"/> |
| | |
| | | <result property="status" column="dept_status"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="RoleResult" type="SysRole"> |
| | | <resultMap id="RoleResult" type="com.zhitan.common.core.domain.entity.SysRole"> |
| | | <id property="roleId" column="role_id"/> |
| | | <result property="roleName" column="role_name"/> |
| | | <result property="roleKey" column="role_key"/> |
| | |
| | | left join sys_role r on r.role_id = ur.role_id |
| | | </sql> |
| | | |
| | | <select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult"> |
| | | <select id="selectUserList" parameterType="com.zhitan.common.core.domain.entity.SysUser" resultMap="SysUserResult"> |
| | | select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phone_number, u.password, u.sex, |
| | | u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.single_user, d.dept_name, d.leader from |
| | | u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.single_user, d.dept_name, |
| | | d.leader from |
| | | sys_user u |
| | | left join sys_dept d on u.dept_id = d.dept_id |
| | | where u.del_flag = '0' |
| | |
| | | </select> |
| | | |
| | | <select id="checkUserNameUnique" parameterType="String" resultMap="SysUserResult"> |
| | | select user_id, user_name from sys_user where user_name = #{userName} and del_flag = '0' limit 1 |
| | | select user_id, user_name |
| | | from sys_user |
| | | where user_name = #{userName} |
| | | and del_flag = '0' limit 1 |
| | | </select> |
| | | |
| | | <select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult"> |
| | | select user_id, phone_number from sys_user where phone_number = #{phoneNumber} and del_flag = '0' limit 1 |
| | | select user_id, phone_number |
| | | from sys_user |
| | | where phone_number = #{phoneNumber} |
| | | and del_flag = '0' limit 1 |
| | | </select> |
| | | |
| | | <select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult"> |
| | | select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1 |
| | | select user_id, email |
| | | from sys_user |
| | | where email = #{email} |
| | | and del_flag = '0' limit 1 |
| | | </select> |
| | | |
| | | <insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId"> |
| | | <select id="selectAllocatedList" parameterType="com.zhitan.common.core.domain.entity.SysUser" resultMap="SysUserResult"> |
| | | select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phone_number, u.status, u.create_time |
| | | from sys_user u |
| | | left join sys_dept d on u.dept_id = d.dept_id |
| | | left join sys_user_role ur on u.user_id = ur.user_id |
| | | left join sys_role r on r.role_id = ur.role_id |
| | | where u.del_flag = '0' and r.role_id = #{roleId} |
| | | <if test="userName != null and userName != ''"> |
| | | AND u.user_name like concat('%', #{userName}, '%') |
| | | </if> |
| | | <if test="phoneNumber != null and phoneNumber != ''"> |
| | | AND u.phone_number like concat('%', #{phoneNumber}, '%') |
| | | </if> |
| | | <!-- æ°æ®èå´è¿æ»¤ --> |
| | | ${params.dataScope} |
| | | </select> |
| | | |
| | | <select id="selectUnallocatedList" parameterType="com.zhitan.common.core.domain.entity.SysUser" resultMap="SysUserResult"> |
| | | select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phone_number, u.status, u.create_time |
| | | from sys_user u |
| | | left join sys_dept d on u.dept_id = d.dept_id |
| | | left join sys_user_role ur on u.user_id = ur.user_id |
| | | left join sys_role r on r.role_id = ur.role_id |
| | | where u.del_flag = '0' and (r.role_id != #{roleId} or r.role_id IS NULL) |
| | | and u.user_id not in (select u.user_id from sys_user u inner join sys_user_role ur on u.user_id = ur.user_id and |
| | | ur.role_id = #{roleId}) |
| | | <if test="userName != null and userName != ''"> |
| | | AND u.user_name like concat('%', #{userName}, '%') |
| | | </if> |
| | | <if test="phoneNumber != null and phoneNumber != ''"> |
| | | AND u.phone_number like concat('%', #{phoneNumber}, '%') |
| | | </if> |
| | | <!-- æ°æ®èå´è¿æ»¤ --> |
| | | ${params.dataScope} |
| | | </select> |
| | | |
| | | <insert id="insertUser" parameterType="com.zhitan.common.core.domain.entity.SysUser" useGeneratedKeys="true" keyProperty="userId"> |
| | | insert into sys_user( |
| | | <if test="userId != null and userId != 0">user_id,</if> |
| | | <if test="deptId != null and deptId != 0">dept_id,</if> |
| | |
| | | ) |
| | | </insert> |
| | | |
| | | <update id="updateUser" parameterType="SysUser"> |
| | | <update id="updateUser" parameterType="com.zhitan.common.core.domain.entity.SysUser"> |
| | | update sys_user |
| | | <set> |
| | | <if test="deptId != null and deptId != 0">dept_id = #{deptId},</if> |
| | |
| | | where user_id = #{userId} |
| | | </update> |
| | | |
| | | <update id="updateUserStatus" parameterType="SysUser"> |
| | | <update id="updateUserStatus" parameterType="com.zhitan.common.core.domain.entity.SysUser"> |
| | | update sys_user |
| | | set status = #{status} |
| | | where user_id = #{userId} |
| | | </update> |
| | | |
| | | <update id="updateUserAvatar" parameterType="SysUser"> |
| | | <update id="updateUserAvatar" parameterType="com.zhitan.common.core.domain.entity.SysUser"> |
| | | update sys_user |
| | | set avatar = #{avatar} |
| | | where user_name = #{userName} |
| | | </update> |
| | | |
| | | <update id="resetUserPwd" parameterType="SysUser"> |
| | | <update id="resetUserPwd" parameterType="com.zhitan.common.core.domain.entity.SysUser"> |
| | | update sys_user |
| | | set password = #{password} |
| | | where user_name = #{userName} |
| | |
| | | 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 = '/dev-api' |
| | | |
| | |
| | | .DS_Store |
| | | */.DS_Store |
| | | node_modules/ |
| | | dist/ |
| | | npm-debug.log* |
| | |
| | | yarn-error.log* |
| | | **/*.log |
| | | |
| | | |
| | | tests/**/coverage/ |
| | | tests/e2e/reports |
| | | selenium-debug.log |
| | |
| | | { |
| | | "name": "zhitan", |
| | | "version": "3.8.7", |
| | | "version": "2.5.2", |
| | | "description": "管çç³»ç»", |
| | | "author": "admin", |
| | | "license": "MIT", |
| | | "license": "Apache-2.0", |
| | | "type": "module", |
| | | "scripts": { |
| | | "dev": "vite", |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request" |
| | | export default { |
| | | // å项ç¨è½åæ |
| | | itemizedEnergyAnalysis(data) { |
| | | return request({ |
| | | url: "/itemizedEnergyAnalysis/list", |
| | | method: "GET", |
| | | params: data, |
| | | }) |
| | | }, |
| | | // æ¯è·¯ç¨è½åæ |
| | | branchanalysis(data) { |
| | | return request({ |
| | | url: "/branchanalysis/list", |
| | | method: "GET", |
| | | params: data, |
| | | }) |
| | | }, |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | //å
¨å综åè½èç»è®¡ |
| | | export function getDataList(query) { |
| | | return request({ |
| | | url: '/statisticalData/comprehensiveStatistics/list', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | |
| | | //å
¨å综åè½èç»è®¡å¾ |
| | | export function getlistChart(query) { |
| | | return request({ |
| | | url: '/statisticalData/comprehensiveStatistics/listChart', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | export function exportList(query) { |
| | | return request({ |
| | | url: '/statisticalData/comprehensiveStatistics/export', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | export function getEnergyList(query) { |
| | | return request({ |
| | | url: '/statisticalData/comprehensiveStatistics/getList', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | //éç¹è®¾å¤è½èæå |
| | | export function energyList(query) { |
| | | return request({ |
| | | url: '/statisticalData/comprehensiveStatistics/energyList', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | //è®¾å¤ |
| | | export function getFacilityArchives() { |
| | | return request({ |
| | | url: '/statisticalData/comprehensiveStatistics/getFacilityArchives', |
| | | method: 'get' |
| | | }) |
| | | } |
| | | //éç¹è®¾å¤ |
| | | export function getPointFacility() { |
| | | return request({ |
| | | url: '/statisticalData/comprehensiveStatistics/getPointFacility', |
| | | method: 'get' |
| | | }) |
| | | } |
| | | export function getDeviceList(query) { |
| | | return request({ |
| | | url: '/statisticalData/comprehensiveStatistics/getDeviceList', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | //è·å模åä¸çè½æºåç§ |
| | | export function energyDevice(query) { |
| | | return request({ |
| | | url: '/statisticalData/comprehensiveStatistics/energyDevice', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request" |
| | | |
| | | //æ¥è¯¢æ¥æ¥è¡¨ |
| | | export function getDataList(query) { |
| | | return request({ |
| | | url: "/comprehensive/dailyComprehensive/list", |
| | | method: "get", |
| | | params: query, |
| | | }) |
| | | } |
| | | export function getlistChart(query) { |
| | | return request({ |
| | | url: "/comprehensive/dailyComprehensive/listChart", |
| | | method: "get", |
| | | params: query, |
| | | }) |
| | | } |
| | | |
| | | // 导åºç»¼åæ¥è¡¨ |
| | | export function exportList(query) { |
| | | return request({ |
| | | url: "/report/dailyReport/export", |
| | | method: "get", |
| | | params: query, |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | //æ¥è¯¢æ¥æ¥è¡¨ |
| | | export function getDataList(query) { |
| | | return request({ |
| | | url: '/comprehensive/monthlyComprehensive/list', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | export function getlistChart(query) { |
| | | return request({ |
| | | url: '/comprehensive/monthlyComprehensive/listChart', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | //å
¨å综åè½èç»è®¡ |
| | | export function getDataList(query) { |
| | | return request({ |
| | | url: '/statisticalData/processEnergyConsumption/list', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | |
| | | //å
¨å综åè½èç»è®¡å¾ |
| | | export function getlistChart(query) { |
| | | return request({ |
| | | url: '/statisticalData/processEnergyConsumption/listChart', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | //æ¥è¯¢æ¥æ¥è¡¨ |
| | | export function getDataList(query) { |
| | | return request({ |
| | | url: '/comprehensive/yearComprehensive/list', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | export function getlistChart(query) { |
| | | return request({ |
| | | url: '/comprehensive/yearComprehensive/listChart', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request" |
| | | |
| | | export function listEnergyCostTrend(query) { |
| | | return request({ |
| | | url: "/energyTypeAnalysis/listEnergyCostTrend", |
| | | method: "get", |
| | | params: query, |
| | | }) |
| | | } |
| | | export function listEnergyCostTrendDetail(query) { |
| | | return request({ |
| | | url: "/energyTypeAnalysis/listEnergyCostTrendDetail", |
| | | method: "get", |
| | | params: query, |
| | | }) |
| | | } |
| | |
| | | import request from '@/utils/request' |
| | | import request from "@/utils/request" |
| | | |
| | | // è½è对æ¯åæ-åºåè½èåæ-è½èè¶å¿/åºåè½èç»è®¡åæè¡¨-å表 |
| | | // è½è对æ¯åæ-ç§å®¤è½èåæ-è½èè¶å¿/è½èç»è®¡åæè¡¨-å表 |
| | | // è½è对æ¯åæ-设å¤è½èåæ-è½èè¶å¿/è½èç»è®¡åæè¡¨-å表 |
| | | export function listRegion(query) { |
| | | return request({ |
| | | url: '/consumptionanalysis/getByArea', |
| | | method: 'get', |
| | | params: query |
| | | url: "/consumptionanalysis/getByArea", |
| | | method: "get", |
| | | params: query, |
| | | }) |
| | | } |
| | | // è½è对æ¯åæ-ç§å®¤è½èåæ-è½èæå-å表 |
| | | // è½è对æ¯åæ-设å¤è½èåæ-è½èæå-å表 |
| | | export function listDepartment(query) { |
| | | return request({ |
| | | url: '/consumptionanalysis/getByDepartment', |
| | | method: 'get', |
| | | params: query |
| | | url: "/consumptionanalysis/getByDepartment", |
| | | method: "get", |
| | | params: query, |
| | | }) |
| | | } |
| | | // è½è对æ¯åæ-è½èææ èæ ¸-è½èè¶å¿/åºåè½èç»è®¡åæè¡¨ |
| | | export function listIndicatorassessment(query) { |
| | | return request({ |
| | | url: '/consumptionanalysis/getPlanAndProdCount', |
| | | method: 'get', |
| | | params: query |
| | | url: "/consumptionanalysis/getPlanAndProdCount", |
| | | method: "get", |
| | | params: query, |
| | | }) |
| | | } |
| | | // è½è对æ¯åæ-综åè½èåæ-综åè½èè¶å¿/åä»è´¨è½èå æ¯/åºåè½èç»è®¡åæè¡¨-å表 |
| | | export function listComprehensive(query) { |
| | | return request({ |
| | | url: '/consumptionanalysis/getComprehensiveEnergy', |
| | | method: 'get', |
| | | params: query |
| | | url: "/consumptionanalysis/getComprehensiveEnergy", |
| | | method: "get", |
| | | params: query, |
| | | }) |
| | | } |
| | | // è½è对æ¯åæ-综åè½èåæ-è½èåæ¯ç¯æ¯-å表 |
| | | export function listYoY(query) { |
| | | return request({ |
| | | url: '/consumptionanalysis/getYOY', |
| | | method: 'get', |
| | | params: query |
| | | url: "/consumptionanalysis/getYOY", |
| | | method: "get", |
| | | params: query, |
| | | }) |
| | | } |
| | | // è½è对æ¯åæ-综åè½èåæ-ç¨è½åå
è½èæå-å表 |
| | | export function listEnergyRanking(query) { |
| | | return request({ |
| | | url: '/consumptionanalysis/getEnergyRanking', |
| | | method: 'get', |
| | | params: query |
| | | url: "/consumptionanalysis/getEnergyRanking", |
| | | method: "get", |
| | | params: query, |
| | | }) |
| | | } |
| | | |
| | | // statisticsAnalysis/getFlowCharts |
| | | export function getFlowCharts(query) { |
| | | return request({ |
| | | url: "/statisticsAnalysis/getFlowCharts", |
| | | method: "get", |
| | | 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, |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request" |
| | | export default { |
| | | // æ¥è¯¢ææè®¾å¤å表 |
| | | getFacilityArchives(data) { |
| | | return request({ |
| | | url: "/keyEquipment/dailyKeyEquipment/getFacilityArchives", |
| | | method: "GET", |
| | | params: data, |
| | | }) |
| | | }, |
| | | // æ¥è¯¢éç¹è®¾å¤å表 |
| | | getPointFacility(data) { |
| | | return request({ |
| | | url: "/keyEquipment/dailyKeyEquipment/getPointFacility", |
| | | method: "GET", |
| | | params: data, |
| | | }) |
| | | }, |
| | | // éç¹è®¾å¤è½èåæï¼æ¥ï¼å¾è¡¨ |
| | | dailyList(data) { |
| | | return request({ |
| | | url: "/keyEquipment/dailyKeyEquipment/list", |
| | | method: "GET", |
| | | params: data, |
| | | }) |
| | | }, |
| | | // éç¹è®¾å¤è½èåæï¼æ¥ï¼å¾è¡¨ |
| | | dailyChart(data) { |
| | | return request({ |
| | | url: "/keyEquipment/dailyKeyEquipment/listChart", |
| | | method: "GET", |
| | | params: data, |
| | | }) |
| | | }, |
| | | // éç¹è®¾å¤è½èç»è®¡ï¼æï¼å表 |
| | | monthlyList(data) { |
| | | return request({ |
| | | url: "/keyEquipment/MonthlyKeyEquipment/list", |
| | | method: "GET", |
| | | params: data, |
| | | }) |
| | | }, |
| | | // éç¹è®¾å¤è½èç»è®¡ï¼æï¼å¾è¡¨ |
| | | monthlyChart(data) { |
| | | return request({ |
| | | url: "/keyEquipment/MonthlyKeyEquipment/listChart", |
| | | method: "GET", |
| | | params: data, |
| | | }) |
| | | }, |
| | | // éç¹è®¾å¤è½èç»è®¡ï¼å¹´ï¼å表 |
| | | yearList(data) { |
| | | return request({ |
| | | url: "/keyEquipment/YearKeyEquipment/list", |
| | | method: "GET", |
| | | params: data, |
| | | }) |
| | | }, |
| | | // éç¹è®¾å¤è½èç»è®¡ï¼å¹´ï¼å¾è¡¨ |
| | | yearChart(data) { |
| | | return request({ |
| | | url: "/keyEquipment/YearKeyEquipment/listChart", |
| | | method: "GET", |
| | | params: data, |
| | | }) |
| | | }, |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request" |
| | | // è·åç¨è½åå
ä¸çæä¸ªçµè¡¨çåçå æ°æ°æ® |
| | | export function powerFactorAnalysisDetail(params) { |
| | | return request({ |
| | | url: "/powerFactorAnalysis/detail", |
| | | method: "get", |
| | | params, |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request" |
| | | |
| | | // è·åä¸ç¸ä¸å¹³è¡¡åææ°æ® |
| | | export function threePhaseUnbalanceAnalysisDetail(params) { |
| | | return request({ |
| | | url: "/threePhaseUnbalanceAnalysis/detail", |
| | | method: "get", |
| | | params, |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request" |
| | | |
| | | // è·åç¨è½åå
ä¸ççµè¡¨å表 |
| | | export function listElectricityMeter(params) { |
| | | return request({ |
| | | url: "/meter/listElectricityMeter", |
| | | method: "get", |
| | | params, |
| | | }) |
| | | } |
| | | |
| | | // è·åç¨è½åå
ä¸çæä¸ªçµè¡¨çè´è·åææ°æ® |
| | | export function loadAnalysisDetail(params) { |
| | | return request({ |
| | | url: "/loadAnalysis/detail", |
| | | method: "get", |
| | | params, |
| | | }) |
| | | } |
| | | |
| | | // è·åç¨è½åå
ä¸ççµè¡¨å表-å®ä½è¡¨ |
| | | export function listElectricityDeviceMeter(params) { |
| | | return request({ |
| | | url: "/loadAnalysis/listElectricMeter", |
| | | method: "get", |
| | | params, |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request" |
| | | export default { |
| | | // å·¥åºè½èåæï¼æ¥ï¼å¾è¡¨ |
| | | dailyList(data) { |
| | | return request({ |
| | | url: "/processEnergy/dailyProcessEnergy/list", |
| | | method: "GET", |
| | | params: data, |
| | | }) |
| | | }, |
| | | // å·¥åºè½èåæï¼æ¥ï¼å¾è¡¨ |
| | | dailyChart(data) { |
| | | return request({ |
| | | url: "/processEnergy/dailyProcessEnergy/listChart", |
| | | method: "GET", |
| | | params: data, |
| | | }) |
| | | }, |
| | | // å·¥åºè½èç»è®¡ï¼æï¼å表 |
| | | monthlyList(data) { |
| | | return request({ |
| | | url: "/processEnergy/monthlyProcessEnergy/list", |
| | | method: "GET", |
| | | params: data, |
| | | }) |
| | | }, |
| | | // å·¥åºè½èç»è®¡ï¼æï¼å¾è¡¨ |
| | | monthlyChart(data) { |
| | | return request({ |
| | | url: "/processEnergy/monthlyProcessEnergy/listChart", |
| | | method: "GET", |
| | | params: data, |
| | | }) |
| | | }, |
| | | // å·¥åºè½èç»è®¡ï¼å¹´ï¼å表 |
| | | yearList(data) { |
| | | return request({ |
| | | url: "/processEnergy/YearProcessEnergy/list", |
| | | method: "GET", |
| | | params: data, |
| | | }) |
| | | }, |
| | | // å·¥åºè½èç»è®¡ï¼å¹´ï¼å¾è¡¨ |
| | | yearChart(data) { |
| | | return request({ |
| | | url: "/processEnergy/YearProcessEnergy/listChart", |
| | | method: "GET", |
| | | params: data, |
| | | }) |
| | | }, |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request" |
| | | |
| | | export function getHistoricalDataByIndexId(query) { |
| | | return request({ |
| | | url: "/dataMonitoring/historyDataTrend/getHistoricalDataByIndexId", |
| | | method: "get", |
| | | params: query, |
| | | }) |
| | | } |
| | | export function getEnergyIndexByModelId(query) { |
| | | return request({ |
| | | url: "/basicsetting/model/getEnergyIndexByModelId", |
| | | method: "get", |
| | | params: query, |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm0 18a8 8 0 1 1 0-16 8 8 0 0 1 0 16z"></path><path d="M12 6a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm-4 6a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm8 0a2 2 0 1 0 0 4 2 2 0 0 0 0-4z"></path></svg> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path><path d="M13.73 21a2 2 0 0 1-3.46 0"></path></svg> |
| | |
| | | body { |
| | | height: 100%; |
| | | margin: 0; |
| | | padding: 0; |
| | | -moz-osx-font-smoothing: grayscale; |
| | | -webkit-font-smoothing: antialiased; |
| | | text-rendering: optimizeLegibility; |
| | | font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif; |
| | | overflow-x: hidden; /* 鲿¢æ°´å¹³æ»å¨æ¡ */ |
| | | } |
| | | |
| | | label { |
| | |
| | | html { |
| | | height: 100%; |
| | | box-sizing: border-box; |
| | | margin: 0; |
| | | padding: 0; |
| | | overflow-x: hidden; /* 鲿¢æ°´å¹³æ»å¨æ¡ */ |
| | | } |
| | | |
| | | #app { |
| | | height: 100%; |
| | | width: 100%; |
| | | margin: 0; |
| | | padding: 0; |
| | | overflow-x: hidden; /* 鲿¢æ°´å¹³æ»å¨æ¡ */ |
| | | } |
| | | |
| | | *, |
| | |
| | | |
| | | //main-containerå
¨å±æ ·å¼ |
| | | .app-container { |
| | | padding: 20px; |
| | | // padding: 0 12px; |
| | | padding-right: 12px; |
| | | } |
| | | |
| | | .components-container { |
| | |
| | | color: #999 !important; |
| | | } |
| | | } |
| | | |
| | | /* æå èåæ ·å¼è°æ´ï¼ç¡®ä¿å¨æææ
åµä¸èå项å±
ä¸ */ |
| | | .el-menu--collapse { |
| | | width: 54px !important; |
| | | |
| | | .el-sub-menu, .el-menu-item { |
| | | width: 36px !important; |
| | | min-width: 36px !important; |
| | | margin-left: 9px !important; /* å
³é®ï¼è®¾ç½®åºå®ç左边è·9px使èå项å±
ä¸ */ |
| | | margin-right: 9px !important; |
| | | } |
| | | |
| | | .el-menu-item, .el-sub-menu__title { |
| | | display: flex !important; |
| | | justify-content: center !important; |
| | | align-items: center !important; |
| | | padding: 0 !important; |
| | | |
| | | .svg-icon, .el-icon { |
| | | margin: 0 !important; /* éè¦ï¼ç§»é¤å¾æ çææè¾¹è· */ |
| | | } |
| | | |
| | | .el-sub-menu__icon-arrow { |
| | | display: none !important; |
| | | } |
| | | |
| | | > span { |
| | | display: none !important; |
| | | } |
| | | } |
| | | |
| | | /* éä¸ç¶ææ ·å¼ */ |
| | | .el-menu-item.is-active, .el-sub-menu.is-active > .el-sub-menu__title { |
| | | background-color: #3883FA !important; |
| | | color: #fff !important; |
| | | } |
| | | } |
| | |
| | | display: flex; |
| | | |
| | | .page-container-left { |
| | | width: 280px; |
| | | width: 220px; |
| | | min-height: calc(100vh - 148px); |
| | | border-right: 1px solid #1a235d; |
| | | background: #1F1C49; |
| | | background: #08234F; |
| | | |
| | | .el-tree { |
| | | &.el-tree--highlight-current, |
| | | &:not(.el-tree--highlight-current) { |
| | | .el-tree-node { |
| | | .el-tree-node__content { |
| | | .el-tree-node__label, |
| | | span { |
| | | font-size: 14px !important; |
| | | } |
| | | } |
| | | |
| | | .el-tree-node__expand-icon { |
| | | font-size: 14px !important; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | .tree-container, .tree { |
| | | .el-tree-node__label, |
| | | .el-tree-node__content span { |
| | | font-size: 14px !important; |
| | | } |
| | | } |
| | | |
| | | .tree { |
| | | height: calc(100vh - 170px); |
| | |
| | | } |
| | | |
| | | .form-card { |
| | | background: #1a235d; |
| | | border-radius: 0px 0px 0px 0px; |
| | | border: 1px solid #000000; |
| | | padding: 18px 0 0 15px; |
| | | background: #08234F; |
| | | border-radius: 0px; |
| | | height: 52px; |
| | | line-height: 52px; |
| | | margin: 0 16px; |
| | | display: flex; |
| | | align-items: center; |
| | | |
| | | .el-form.el-form--inline { |
| | | margin-left: 10px; |
| | | display: flex; |
| | | align-items: center; |
| | | flex-wrap: nowrap; |
| | | width: 100%; |
| | | |
| | | .el-form-item { |
| | | margin-right: 15px; |
| | | margin-bottom: 0; |
| | | height: 32px; |
| | | display: flex; |
| | | align-items: center; |
| | | |
| | | &.is-required { |
| | | .el-form-item__label::before { |
| | | vertical-align: middle; |
| | | } |
| | | } |
| | | |
| | | .el-form-item__label { |
| | | height: 32px; |
| | | line-height: 32px; |
| | | color: #ffffff; |
| | | } |
| | | |
| | | .el-form-item__content { |
| | | display: flex; |
| | | align-items: center; |
| | | height: 32px; |
| | | line-height: 32px; |
| | | |
| | | .el-input, .el-select, .el-date-editor { |
| | | height: 32px; |
| | | line-height: 32px; |
| | | } |
| | | |
| | | .el-input__wrapper { |
| | | height: 32px; |
| | | } |
| | | |
| | | .el-button { |
| | | height: 32px; |
| | | line-height: 32px; |
| | | padding-top: 0; |
| | | padding-bottom: 0; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | .table-bg-style { |
| | | margin-top: 12px; |
| | | .theme-dark-mt20 { |
| | | margin-top: 20px; |
| | | } |
| | |
| | | .chart-box { |
| | | width: 100%; |
| | | height: 320px; |
| | | padding-top: 12px; |
| | | |
| | | div { |
| | | width: 100%; |
| | |
| | | } |
| | | |
| | | .table-box { |
| | | margin: 20px; |
| | | margin: 0; |
| | | |
| | | .table-title-box { |
| | | font-weight: bold; |
| | |
| | | display: flex; |
| | | |
| | | .page-container-left { |
| | | width: 280px; |
| | | width: 220px; |
| | | min-height: calc(100vh - 148px); |
| | | border-right: 1px solid #fff; |
| | | border-right: 1px solid #e8e8e8; |
| | | background: #f1f4fa; |
| | | |
| | | // border-right: 1px solid #1a235d; |
| | | .el-tree { |
| | | &.el-tree--highlight-current, |
| | | &:not(.el-tree--highlight-current) { |
| | | .el-tree-node { |
| | | .el-tree-node__content { |
| | | .el-tree-node__label, |
| | | span { |
| | | font-size: 14px !important; |
| | | } |
| | | } |
| | | |
| | | .el-tree-node__expand-icon { |
| | | font-size: 14px !important; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | .tree-container, .tree { |
| | | .el-tree-node__label, |
| | | .el-tree-node__content span { |
| | | font-size: 14px !important; |
| | | } |
| | | } |
| | | |
| | | .tree { |
| | | height: calc(100vh - 170px) !important; |
| | | max-height: calc(100vh - 170px) !important; |
| | | height: calc(100vh - 170px); |
| | | max-height: calc(100vh - 170px); |
| | | overflow-y: auto; |
| | | } |
| | | } |
| | |
| | | |
| | | .form-card { |
| | | background: #fff; |
| | | border-radius: 0px 0px 0px 0px; |
| | | // border: 1px solid #000000; |
| | | padding: 18px 0 0 15px; |
| | | border-radius: 0px; |
| | | height: 52px; |
| | | line-height: 52px; |
| | | margin: 0 16px; |
| | | display: flex; |
| | | align-items: center; |
| | | |
| | | .el-form.el-form--inline { |
| | | margin-left: 10px; |
| | | display: flex; |
| | | align-items: center; |
| | | flex-wrap: nowrap; |
| | | width: 100%; |
| | | |
| | | .el-form-item { |
| | | margin-right: 15px; |
| | | margin-bottom: 0; |
| | | height: 32px; |
| | | display: flex; |
| | | align-items: center; |
| | | |
| | | .el-form-item__label { |
| | | height: 32px; |
| | | line-height: 32px; |
| | | } |
| | | |
| | | .el-form-item__content { |
| | | display: flex; |
| | | align-items: center; |
| | | height: 32px; |
| | | line-height: 32px; |
| | | |
| | | .el-input, .el-select, .el-date-editor { |
| | | height: 32px; |
| | | line-height: 32px; |
| | | } |
| | | |
| | | .el-input__wrapper { |
| | | height: 32px; |
| | | } |
| | | |
| | | .el-button { |
| | | height: 32px; |
| | | line-height: 32px; |
| | | padding-top: 0; |
| | | padding-bottom: 0; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | .table-bg-style { |
| | | background-color: #fff; |
| | | padding-top: 12px; |
| | |
| | | .chart-box { |
| | | width: 100%; |
| | | height: 320px; |
| | | padding-top: 12px; |
| | | |
| | | div { |
| | | width: 100%; |
| | |
| | | } |
| | | |
| | | .table-box { |
| | | margin: 20px; |
| | | margin: 10px 20px; |
| | | |
| | | .table-title-box { |
| | | font-weight: bold; |
| | |
| | | |
| | | } |
| | | |
| | | // å é¤ä¹åæ·»å çå
¨å±æ ·å¼è¦çï¼é¿å
å½±åå
¨å± |
| | | // ä¿çè°è¯å»ºè®® |
| | | /* |
| | | æ¨å¯ä»¥å¨æµè§å¨ä¸ä½¿ç¨ä»¥ä¸å
èæ ·å¼è¿è¡è°è¯: |
| | | document.querySelectorAll('.page-container-left .el-tree-node__label').forEach(el => { |
| | | el.style.cssText = 'font-size: 14px !important'; |
| | | }); |
| | | */ |
| | | |
| | | .padding { |
| | | padding: 15px; |
| | | } |
| | |
| | | td { |
| | | word-break: break-word; |
| | | background-color: #1d3778 !important; |
| | | // color: #515a6e; |
| | | color: #515a6e; |
| | | height: 48px !important; |
| | | // font-size: 13px; |
| | | |
| | | border-radius: 0px 0px 0px 0px; |
| | | font-family: OPPOSans, OPPOSans; |
| | | font-weight: 500; |
| | | // font-size: 16px; |
| | | color: #ffffff; |
| | | border-bottom: none !important; |
| | | } |
| | |
| | | // tr:hover > td { |
| | | // background-color: #141E4A; |
| | | // } |
| | | |
| | | .el-table-fixed-column--left { |
| | | background-color: #110f2e !important; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | // æ |
| | | .el-tree { |
| | | background: transparent; |
| | | font-size: 16px; |
| | | font-size: 14px; |
| | | color: #ffffff; |
| | | |
| | | .el-tree-node__content { |
| | |
| | | } |
| | | .el-tabs__item.is-active { |
| | | color: #409EFF; |
| | | } |
| | | |
| | | .el-descriptions__cell { |
| | | background: transparent; |
| | | color: #fff !important; |
| | | } |
| | | .el-descriptions__body { |
| | | background-color: transparent; |
| | | color: #fff; |
| | | } |
| | | .el-descriptions__label { |
| | | color: #fff !important; |
| | | background-color: #1a235d !important; |
| | | } |
| | | } |
| | | |
| | |
| | | background-color: #F7F8FA !important; |
| | | // color: #515a6e; |
| | | height: 48px !important; |
| | | // font-size: 13px; |
| | | |
| | | border-radius: 0px 0px 0px 0px; |
| | | font-family: OPPOSans, OPPOSans; |
| | | font-weight: 500; |
| | | // font-size: 16px; |
| | | color: #222222; |
| | | border-bottom: none !important; |
| | | // border-bottom: none !important; |
| | | } |
| | | } |
| | | |
| | |
| | | // tr:hover > td { |
| | | // background-color: #141E4A; |
| | | // } |
| | | .el-table-fixed-column--left { |
| | | background-color: #fff; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | // è¡¨æ ¼åºé¨ç½çº¿ |
| | | .el-table__inner-wrapper::before { |
| | | background-color: transparent; |
| | | // background-color: transparent; |
| | | } |
| | | |
| | | /** 表åå¸å± **/ |
| | |
| | | .themeDark { |
| | | #app { |
| | | .el-menu-item.is-active { |
| | | background: #3271eb !important; |
| | | // background: #3271eb !important; |
| | | // border-radius: 30px 30px 30px 30px !important; |
| | | color: #fff; |
| | | } |
| | |
| | | |
| | | |
| | | .main-container { |
| | | background-color: #110f2e !important; |
| | | height: 100%; |
| | | transition: margin-left 0.28s; |
| | | margin-left: $base-sidebar-width; |
| | |
| | | transition: width 0.28s; |
| | | width: $base-sidebar-width !important; |
| | | background-color: $base-menu-background; |
| | | height: 100%; |
| | | height: calc(100% - 60px) !important; |
| | | position: fixed; |
| | | top: 0; |
| | | top: 60px; |
| | | bottom: 0; |
| | | left: 0; |
| | | z-index: 1001; |
| | | z-index: 999; |
| | | overflow: hidden; |
| | | background-color: #002866 !important; |
| | | -webkit-box-shadow: 2px 0 6px rgba(0, 21, 41, 0.35); |
| | | box-shadow: 2px 0 6px rgba(0, 21, 41, 0.35); |
| | | font-family: OPPOSans, OPPOSans; |
| | |
| | | |
| | | .scrollbar-wrapper { |
| | | overflow-x: hidden !important; |
| | | height: calc(100% - 290px) !important; |
| | | } |
| | | |
| | | .el-scrollbar__bar.is-vertical { |
| | | right: 0px; |
| | | right: 0 !important; |
| | | } |
| | | |
| | | .el-scrollbar { |
| | |
| | | |
| | | .svg-icon { |
| | | margin-right: 16px; |
| | | font-size: 14px; |
| | | } |
| | | |
| | | .el-menu { |
| | |
| | | .menu-title { |
| | | overflow: hidden !important; |
| | | font-weight: 400 !important; |
| | | font-size: 16px !important; |
| | | font-size: 14px !important; |
| | | } |
| | | |
| | | // @media (min-width: 1440px) { |
| | |
| | | .sub-menu-title-noDropdown, |
| | | .el-sub-menu__title { |
| | | &:hover { |
| | | background-color: rgba(0, 0, 0, 0.06) !important; |
| | | background-color: rgba(0, 0, 0, 0.2) !important; |
| | | } |
| | | } |
| | | |
| | | & .theme-dark .is-active > .el-sub-menu__title { |
| | | color: $base-menu-color-active !important; |
| | | background-color: rgba(0, 0, 0, 0.2) !important; |
| | | } |
| | | |
| | | & .nest-menu .el-sub-menu > .el-sub-menu__title, |
| | |
| | | } |
| | | |
| | | .el-menu--collapse { |
| | | .el-sub-menu { |
| | | & > .el-sub-menu__title { |
| | | & > span { |
| | | height: 0; |
| | | width: 0; |
| | | overflow: hidden; |
| | | visibility: hidden; |
| | | display: inline-block; |
| | | width: 54px !important; |
| | | |
| | | /* æ¸
é¤å代鿩å¨ä¸å¹²æ°å±
ä¸çæ ·å¼ */ |
| | | .el-sub-menu, .el-menu-item { |
| | | margin: 0 !important; |
| | | padding: 0 !important; |
| | | width: 100% !important; |
| | | |
| | | /* è®©å¾æ åèå项å±
ä¸ */ |
| | | .el-menu-item, .el-sub-menu__title { |
| | | width: 36px !important; |
| | | min-width: 36px !important; |
| | | height: 38px !important; |
| | | line-height: 38px !important; |
| | | margin: 4px 9px !important; /* 精确计ç®å±
ä¸è¾¹è· */ |
| | | padding: 0 !important; |
| | | display: flex !important; |
| | | justify-content: center !important; |
| | | align-items: center !important; |
| | | border-radius: 4px !important; |
| | | } |
| | | & > i { |
| | | height: 0; |
| | | width: 0; |
| | | overflow: hidden; |
| | | visibility: hidden; |
| | | display: inline-block; |
| | | } |
| | | |
| | | /* ç¡®ä¿å¾æ å±
ä¸ */ |
| | | .svg-icon, .el-icon { |
| | | margin: 0 !important; |
| | | padding: 0 !important; |
| | | } |
| | | } |
| | | } |
| | |
| | | .themeLight { |
| | | #app { |
| | | .el-menu-item.is-active { |
| | | background: #e0eafc !important; |
| | | |
| | | // border-radius: 30px 30px 30px 30px !important; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | .main-container { |
| | | background-color: #f7f8fa; |
| | | height: 100%; |
| | | transition: margin-left 0.28s; |
| | | margin-left: $base-sidebar-width; |
| | |
| | | transition: width 0.28s; |
| | | width: $base-sidebar-width !important; |
| | | background-color: $base-menu-background; |
| | | height: 100%; |
| | | height: calc(100% - 60px) !important; |
| | | position: fixed; |
| | | top: 0; |
| | | top: 60px; |
| | | bottom: 0; |
| | | left: 0; |
| | | z-index: 1001; |
| | | z-index: 999; |
| | | overflow: hidden; |
| | | -webkit-box-shadow: 2px 0 6px rgba(0, 21, 41, 0.35); |
| | | box-shadow: none; |
| | |
| | | |
| | | .svg-icon { |
| | | margin-right: 16px; |
| | | font-size: 16px; |
| | | font-size: 14px; |
| | | color: #C3C3C3; |
| | | } |
| | | |
| | |
| | | .menu-title { |
| | | overflow: hidden !important; |
| | | font-weight: 400 !important; |
| | | font-size: 16px !important; |
| | | font-size: 14px !important; |
| | | } |
| | | |
| | | // @media (min-width: 1440px) { |
| | |
| | | } |
| | | } |
| | | |
| | | & .theme-dark .is-active > .el-sub-menu__title { |
| | | // color: $base-menu-color-active !important; |
| | | |
| | | & .theme-light .is-active > .el-sub-menu__title { |
| | | color: $--color-primary !important; |
| | | // background-color: #eaeff8 !important; |
| | | } |
| | | |
| | | & .nest-menu .el-sub-menu > .el-sub-menu__title, |
| | |
| | | } |
| | | |
| | | .el-menu--collapse { |
| | | .el-sub-menu { |
| | | & > .el-sub-menu__title { |
| | | & > span { |
| | | height: 0; |
| | | width: 0; |
| | | overflow: hidden; |
| | | visibility: hidden; |
| | | display: inline-block; |
| | | width: 54px !important; |
| | | |
| | | /* æ¸
é¤å代鿩å¨ä¸å¹²æ°å±
ä¸çæ ·å¼ */ |
| | | .el-sub-menu, .el-menu-item { |
| | | margin: 0 !important; |
| | | padding: 0 !important; |
| | | width: 100% !important; |
| | | |
| | | /* è®©å¾æ åèå项å±
ä¸ */ |
| | | .el-menu-item, .el-sub-menu__title { |
| | | width: 36px !important; |
| | | min-width: 36px !important; |
| | | height: 38px !important; |
| | | line-height: 38px !important; |
| | | margin: 4px 9px !important; /* 精确计ç®å±
ä¸è¾¹è· */ |
| | | padding: 0 !important; |
| | | display: flex !important; |
| | | justify-content: center !important; |
| | | align-items: center !important; |
| | | border-radius: 4px !important; |
| | | } |
| | | & > i { |
| | | height: 0; |
| | | width: 0; |
| | | overflow: hidden; |
| | | visibility: hidden; |
| | | display: inline-block; |
| | | } |
| | | |
| | | /* ç¡®ä¿å¾æ å±
ä¸ */ |
| | | .svg-icon, .el-icon { |
| | | margin: 0 !important; |
| | | padding: 0 !important; |
| | | } |
| | | } |
| | | } |
| | |
| | | $--color-danger: #F56C6C; |
| | | $--color-info: #909399; |
| | | |
| | | $base-sidebar-width: 260px; |
| | | $base-sidebar-width: 220px; |
| | | |
| | | // the :export directive is the magic sauce for webpack |
| | | // https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="avatar-container"> |
| | | <el-dropdown @command="handleCommand" class="right-menu-item hover-effect" trigger="click"> |
| | | <div class="avatar-wrapper"> |
| | | <img :src="userStore.avatar" class="user-avatar" /> |
| | | <el-icon><caret-bottom /></el-icon> |
| | | </div> |
| | | <template #dropdown> |
| | | <el-dropdown-menu> |
| | | <router-link to="/user/profile"> |
| | | <el-dropdown-item>个人ä¸å¿</el-dropdown-item> |
| | | </router-link> |
| | | <el-dropdown-item command="toggleTheme"> |
| | | <span>飿 ¼åæ¢</span> |
| | | </el-dropdown-item> |
| | | <el-dropdown-item divided command="logout"> |
| | | <span>éåºç»å½</span> |
| | | </el-dropdown-item> |
| | | </el-dropdown-menu> |
| | | </template> |
| | | </el-dropdown> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ElMessageBox } from "element-plus" |
| | | import useUserStore from "@/store/modules/user" |
| | | import useSettingsStore from "@/store/modules/settings" |
| | | |
| | | const userStore = useUserStore() |
| | | const settingsStore = useSettingsStore() |
| | | |
| | | function handleCommand(command) { |
| | | switch (command) { |
| | | case "toggleTheme": |
| | | const newTheme = settingsStore.sideTheme === "theme-dark" ? "theme-light" : "theme-dark"; |
| | | settingsStore.changeSetting({ key: "sideTheme", value: newTheme }); |
| | | document.querySelector("body").className = newTheme === "theme-dark" ? "themeDark" : "themeLight"; |
| | | break; |
| | | case "logout": |
| | | ElMessageBox.confirm("ç¡®å®æ³¨éå¹¶éåºç³»ç»åï¼", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | userStore.logOut().then(() => { |
| | | location.href = "/index"; |
| | | }); |
| | | }) |
| | | .catch(() => {}); |
| | | break; |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .avatar-container { |
| | | margin-right: 20px; |
| | | |
| | | .avatar-wrapper { |
| | | margin-top: 5px; |
| | | position: relative; |
| | | display: flex; |
| | | align-items: center; |
| | | |
| | | .user-avatar { |
| | | cursor: pointer; |
| | | width: 40px; |
| | | height: 40px; |
| | | border-radius: 10px; |
| | | } |
| | | |
| | | .el-icon { |
| | | cursor: pointer; |
| | | margin-left: 8px; |
| | | font-size: 12px; |
| | | color: #ffffff; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .right-menu-item { |
| | | display: inline-block; |
| | | padding: 0 8px; |
| | | height: 100%; |
| | | font-size: 18px; |
| | | color: #ffffff; |
| | | vertical-align: text-bottom; |
| | | |
| | | &.hover-effect { |
| | | cursor: pointer; |
| | | transition: background 0.3s; |
| | | |
| | | &:hover { |
| | | background: rgba(0, 0, 0, 0.1); |
| | | } |
| | | } |
| | | } |
| | | </style> |
| | |
| | | </div> |
| | | <div class="mycard-content"> |
| | | <div class="data-box" v-if="props.tabArray.length > 0"> |
| | | <div v-for="(item, i) in props.tabArray" :key="i" class="li-box" :class="isActive == item.value ? 'is-li' : ''" |
| | | @click="changeActive(item.value)"> |
| | | <div |
| | | v-for="(item, i) in props.tabArray" |
| | | :key="i" |
| | | class="li-box" |
| | | :class="isActive == item.value ? 'is-li' : ''" |
| | | @click="changeActive(item.value)" |
| | | > |
| | | {{ item.label }} |
| | | </div> |
| | | </div> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | const emit = defineEmits(); |
| | | const emit = defineEmits() |
| | | const props = defineProps({ |
| | | title: { |
| | | type: String, |
| | |
| | | type: Array, |
| | | default: () => [], |
| | | }, |
| | | }); |
| | | }) |
| | | const data = reactive({ |
| | | isActive: "DAY", |
| | | }); |
| | | const { isActive } = toRefs(data); |
| | | changeActive(isActive.value); |
| | | }) |
| | | const { isActive } = toRefs(data) |
| | | changeActive(isActive.value) |
| | | |
| | | function changeActive(value) { |
| | | isActive.value = value; |
| | | emit("changeActive", isActive.value); |
| | | isActive.value = value |
| | | emit("changeActive", isActive.value) |
| | | } |
| | | </script> |
| | | |
| | |
| | | align-items: center; |
| | | height: 3.7037vh; //40 |
| | | padding-left: 2.1354vw; //41px; |
| | | background: url('../../assets/images/basecard/title_bg.png') no-repeat; |
| | | background: url("../../assets/images/basecard/title_bg.png") no-repeat; |
| | | background-size: auto 100%; |
| | | |
| | | .name { |
| | | font-family: YouSheBiaoTiHei; |
| | | font-size: 1.2500vw; //24px; |
| | | font-size: 1.25vw; //24px; |
| | | color: #fff; |
| | | position: relative; |
| | | padding-left: 12px; |
| | | |
| | | &::before { |
| | | content: ''; |
| | | position: absolute; |
| | | left: 0; |
| | | top: 50%; |
| | | transform: translateY(-50%); |
| | | width: 5px; |
| | | height: 18px; |
| | | background-color: #3883FA; |
| | | border-radius: 2px; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .mycard-content { |
| | | border: 1px solid; |
| | | border-image: linear-gradient(0deg, #0A3C86, #000) 1; |
| | | border-image: linear-gradient(0deg, #0a3c86, #000) 1; |
| | | background: linear-gradient(0deg, rgba(18, 111, 216, 0.2) 0%, rgba(18, 111, 216, 0) 100%); |
| | | position: relative; |
| | | |
| | |
| | | z-index: 1; |
| | | |
| | | .li-box { |
| | | border: 1px solid #2E86EA; |
| | | border: 1px solid #2e86ea; |
| | | cursor: pointer; |
| | | text-align: center; |
| | | padding: 0.3704vh 0.3125vw; |
| | |
| | | } |
| | | |
| | | .is-li { |
| | | background: #2E86EA; |
| | | border: 1px solid #2E86EA; |
| | | background: #2e86ea; |
| | | border: 1px solid #2e86ea; |
| | | } |
| | | } |
| | | } |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | defineProps(['title']) |
| | | |
| | | defineProps(["title"]) |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | |
| | | border-radius: 7px 7px 0 0; |
| | | padding: 20px; |
| | | background-color: #22408c; |
| | | |
| | | .name { |
| | | font-family: OPPOSans, OPPOSans; |
| | | font-weight: bold; |
| | | font-size: 18px; |
| | | color: #fff; |
| | | position: relative; |
| | | padding-left: 12px; |
| | | |
| | | &::before { |
| | | content: ''; |
| | | position: absolute; |
| | | left: 0; |
| | | top: 50%; |
| | | transform: translateY(-50%); |
| | | width: 5px; |
| | | height: 18px; |
| | | background-color: #3883FA; |
| | | border-radius: 2px; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | border: 1px solid #ebebeb; |
| | | padding-bottom: 10px; |
| | | background-color: #fff; |
| | | |
| | | .mycard-title { |
| | | display: flex; |
| | | justify-content: flex-start; |
| | |
| | | border-radius: 7px 7px 0 0; |
| | | padding: 20px; |
| | | background-color: #e7eefd; |
| | | |
| | | .name { |
| | | font-family: OPPOSans, OPPOSans; |
| | | font-weight: bold; |
| | | font-size: 18px; |
| | | color: #2d2e31; |
| | | position: relative; |
| | | padding-left: 12px; |
| | | |
| | | &::before { |
| | | content: ''; |
| | | position: absolute; |
| | | left: 0; |
| | | top: 50%; |
| | | transform: translateY(-50%); |
| | | width: 5px; |
| | | height: 18px; |
| | | background-color: #3883FA; |
| | | border-radius: 2px; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | // only show routes with meta.title |
| | | let matched = route.matched.filter(item => item.meta && item.meta.title); |
| | | const first = matched[0] |
| | | // 夿æ¯å¦ä¸ºé¦é¡µ |
| | | if (!isDashboard(first)) { |
| | | matched = [{ path: '/index', meta: { title: 'é¦é¡µ' } }].concat(matched) |
| | | |
| | | // æ·»å è°è¯æ¥å¿ |
| | | console.log('Current route path:', route.path); |
| | | console.log('Route matched:', route.matched); |
| | | console.log('Filtered matched routes:', matched); |
| | | |
| | | // 妿æ¯é¦é¡µçæ¿è·¯ç±ï¼ç¡®ä¿å®è¢«æ·»å å°é¢å
å±ä¸ |
| | | if (route.path === '/index' || route.path === '/index/index') { |
| | | matched = [{ path: '/index', meta: { title: 'é¦é¡µçæ¿' } }].concat(matched) |
| | | console.log('Added index route to matched:', matched); |
| | | } |
| | | |
| | | levelList.value = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false) |
| | | console.log('Final breadcrumb items:', levelList.value); |
| | | } |
| | | |
| | | function isDashboard(route) { |
| | | const name = route && route.name |
| | | if (!name) { |
| | | return false |
| | | } |
| | | return name.trim() === 'Index' |
| | | return name.trim().toLowerCase() === 'index' |
| | | } |
| | | |
| | | function handleLink(item) { |
| | | const { redirect, path } = item |
| | | if (redirect) { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="chart-item"> |
| | | <div :id="domId" style="width: 100%; height: 100%"></div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import * as echarts from "echarts" |
| | | const { proxy } = getCurrentInstance() |
| | | import useSettingsStore from "@/store/modules/settings" |
| | | const settingsStore = useSettingsStore() |
| | | const emit = defineEmits() |
| | | const props = defineProps({ |
| | | chartData: { |
| | | type: Object, |
| | | default: () => {}, |
| | | }, |
| | | chartType: { |
| | | type: String, |
| | | default: "line", // bar |
| | | }, |
| | | domId: { |
| | | type: String, |
| | | default: "ChartDom", |
| | | }, |
| | | }) |
| | | |
| | | watch( |
| | | () => props.chartData, |
| | | (val) => { |
| | | console.log("watch", val) |
| | | initChart() |
| | | } |
| | | ) |
| | | watch( |
| | | () => settingsStore.sideTheme, |
| | | (val) => { |
| | | initChart() |
| | | } |
| | | ) |
| | | |
| | | onMounted(() => { |
| | | initChart() |
| | | }) |
| | | |
| | | function initChart(value) { |
| | | console.log("initChart", props.chartData) |
| | | if (!props.chartData.xAxis) { |
| | | return |
| | | } |
| | | const chartDom = document.getElementById(props.domId) |
| | | if (echarts.getInstanceByDom(chartDom)) { |
| | | echarts.dispose(chartDom) |
| | | } |
| | | const myChart = echarts.init(chartDom) |
| | | // å¤çå¤ç³»åæ°æ® |
| | | const series = props.chartData.series.map((item) => ({ |
| | | ...item, |
| | | name: item.name, |
| | | type: props.chartType, // æ ¹æ®ä¼ å
¥ç±»å渲æ |
| | | data: item.data, |
| | | barWidth: props.chartData.barWidth || "16", |
| | | itemStyle: { |
| | | borderRadius: [15, 15, 0, 0], |
| | | }, |
| | | smooth: true, // å¯ç¨å¹³æ»æ²çº¿ |
| | | })) |
| | | console.log("initChart", series) |
| | | let option = { |
| | | title: { |
| | | text: props.chartData.title || "", |
| | | left: "40", |
| | | textStyle: { |
| | | color: "#2979ff", |
| | | }, |
| | | }, |
| | | color: ["#4dadf8", "#19be6b", "#ff9900", "#3d8a32", "#e8463a", "#ff4e3f"], |
| | | // color: ["#2979ff", "#19be6b", "#ff9900", "#fa3534"], |
| | | tooltip: { |
| | | trigger: "axis", |
| | | axisPointer: { |
| | | type: "shadow", |
| | | }, |
| | | }, |
| | | legend: { |
| | | data: props.chartData.series.map((item) => item.name), // å¾ä¾æ°æ® |
| | | icon: "rect", |
| | | right: 40, |
| | | itemWidth: 14, |
| | | itemHeight: 10, |
| | | textStyle: { |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | grid: { |
| | | top: "40", |
| | | left: "40", |
| | | right: "40", |
| | | bottom: "20", |
| | | containLabel: true, |
| | | }, |
| | | 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: props.chartData.xAxis, |
| | | }, |
| | | yAxis: [ |
| | | { |
| | | type: "value", |
| | | 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, |
| | | }, |
| | | }, |
| | | ], |
| | | series: series, |
| | | } |
| | | setTimeout(() => { |
| | | myChart.setOption(option) |
| | | }, 200) |
| | | |
| | | window.addEventListener( |
| | | "resize", |
| | | () => { |
| | | myChart.resize() |
| | | }, |
| | | { passive: true } |
| | | ) |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .chart-item { |
| | | width: 100%; |
| | | height: 360px !important; |
| | | margin-top: 0px; |
| | | padding-top: 20px; |
| | | } |
| | | </style> |
| | |
| | | </svg> --> |
| | | |
| | | <img src="/src/assets/images/nav-btn.png" width="26" v-if="settingsStore.sideTheme == 'theme-dark'"> |
| | | <img src="/src/assets/images/nav-btn2.png" width="26" v-else> |
| | | <img src="/src/assets/images/nav-btn.png" width="26" v-else> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | window.open(path.substr(pindex, path.length), "_blank"); |
| | | } else { |
| | | if (query) { |
| | | router.push({ path: path, query: JSON.parse(query) }); |
| | | router.push({ path: path, query: query }); |
| | | } else { |
| | | router.push(path) |
| | | } |
| | |
| | | getTree(); |
| | | /** æ¥è¯¢é¨é¨ä¸ææ ç»æ */ |
| | | function getTree() { |
| | | // ç¡®ä¿query.valueæåå§å¼ |
| | | query.value = query.value || {}; |
| | | |
| | | // ä¼å
使ç¨propsä¸ä¼ å
¥çParentModelCode |
| | | if (props.ParentModelCode) { |
| | | query.value = { modelCode: props.ParentModelCode }; |
| | | query.value.modelCode = props.ParentModelCode; |
| | | } else if (useRoute().query.modelCode) { |
| | | // å
¶æ¬¡ä½¿ç¨è·¯ç±ä¸çmodelCode |
| | | query.value.modelCode = useRoute().query.modelCode; |
| | | } else { |
| | | query.value = { ...useRoute().query }; |
| | | // æå使ç¨é»è®¤å¼ |
| | | query.value.modelCode = 'JCZBK_CODE'; |
| | | } |
| | | |
| | | console.log('LeftTree getTree modelCode:', query.value.modelCode); |
| | | |
| | | treeList(query.value).then((response) => { |
| | | nodeOptions.value = response.data; |
| | | if (response.data.length > 0) { |
| | | defaultExpandedKeys.value = []; // æ¸
空已æçkeyï¼é¿å
éå¤ |
| | | response.data.map((item) => { |
| | | defaultExpandedKeys.value.push(item.id); |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | function isTags(route) { |
| | | return !route.hidden && route.name && |
| | | route.name !== 'login' && |
| | | route.name !== '404' && |
| | | route.name !== '401' && |
| | | route.name !== 'index' && |
| | | route.path !== '/index' && |
| | | route.path !== '/'; |
| | | } |
| | | |
| | | function addTags() { |
| | | const { name } = route; |
| | | if (name) { |
| | | // æ£æ¥æ¯å¦ä¸ºé¦é¡µ |
| | | if (name === 'index' || route.path === '/index' || route.path === '/') { |
| | | return; |
| | | } |
| | | store.dispatch('tagsView/addView', route); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | // åå§åæ ç¾ï¼ç¡®ä¿é¦é¡µä¸è¢«æ·»å 为åºå®æ ç¾ |
| | | function initTags() { |
| | | const affixTags = filterAffixTags(routes); |
| | | for (const tag of affixTags) { |
| | | // æé¤é¦é¡µ |
| | | if (tag.path === '/index' || tag.path === '/' || tag.name === 'Index') { |
| | | continue; |
| | | } |
| | | // æ·»å åºå®æ ç¾ |
| | | if (tag.name) { |
| | | store.dispatch('tagsView/addVisitedView', tag); |
| | | } |
| | | } |
| | | } |
| | |
| | | <template> |
| | | <div class="top-nav-container"> |
| | | <div class="scroll-arrow left-arrow" @click="scrollLeft" v-show="canScrollLeft"> |
| | | <el-icon><arrow-left /></el-icon> |
| | | </div> |
| | | |
| | | <div class="menu-container" ref="menuContainer"> |
| | | <el-menu |
| | | :default-active="activeMenu" |
| | | mode="horizontal" |
| | | @select="handleSelect" |
| | | :ellipsis="false" |
| | | class="top-menu" |
| | | :class="{ 'theme-dark': theme === 'dark' }" |
| | | > |
| | | <template v-for="(item, index) in topMenus"> |
| | | <el-menu-item :style="{'--theme': theme}" :index="item.path" :key="index" v-if="index < visibleNumber"> |
| | | <svg-icon |
| | | v-if="item.meta && item.meta.icon && item.meta.icon !== '#'" |
| | | :icon-class="item.meta.icon"/> |
| | | <template v-for="(item, index) in topMenus" :key="index"> |
| | | <el-menu-item :style="{'--theme': theme}" :index="item.path"> |
| | | {{ item.meta.title }} |
| | | </el-menu-item> |
| | | </template> |
| | | |
| | | <!-- é¡¶é¨èåè¶
åºæ°éæå --> |
| | | <el-sub-menu :style="{'--theme': theme}" index="more" v-if="topMenus.length > visibleNumber"> |
| | | <template #title>æ´å¤èå</template> |
| | | <template v-for="(item, index) in topMenus"> |
| | | <el-menu-item |
| | | :index="item.path" |
| | | :key="index" |
| | | v-if="index >= visibleNumber"> |
| | | <svg-icon |
| | | v-if="item.meta && item.meta.icon && item.meta.icon !== '#'" |
| | | :icon-class="item.meta.icon"/> |
| | | {{ item.meta.title }} |
| | | </el-menu-item> |
| | | </template> |
| | | </el-sub-menu> |
| | | </el-menu> |
| | | </div> |
| | | |
| | | <div class="scroll-arrow right-arrow" @click="scrollRight" v-show="canScrollRight"> |
| | | <el-icon><arrow-right /></el-icon> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | |
| | | import useAppStore from '@/store/modules/app' |
| | | import useSettingsStore from '@/store/modules/settings' |
| | | import usePermissionStore from '@/store/modules/permission' |
| | | import { ArrowLeft, ArrowRight } from '@element-plus/icons-vue' |
| | | |
| | | // 顶鍿 åå§æ° |
| | | const visibleNumber = ref(null); |
| | | // æ»å¨ç¸å
³ |
| | | const menuContainer = ref(null); |
| | | const canScrollLeft = ref(false); |
| | | const canScrollRight = ref(false); |
| | | |
| | | // å½åæ¿æ´»èåç index |
| | | const currentIndex = ref(null); |
| | | // éèä¾§è¾¹æ è·¯ç± |
| | |
| | | if (!route.meta.link) { |
| | | appStore.toggleSideBarHide(false); |
| | | } |
| | | } else if (path === '/index' || path === '/') { |
| | | // é¦é¡µæ¶éèä¾§è¾¹æ |
| | | activePath = path; |
| | | appStore.toggleSideBarHide(true); |
| | | } else if(!route.children) { |
| | | activePath = path; |
| | | appStore.toggleSideBarHide(true); |
| | |
| | | return activePath; |
| | | }) |
| | | |
| | | function setVisibleNumber() { |
| | | const width = document.body.getBoundingClientRect().width / 3; |
| | | visibleNumber.value = parseInt(width / 85); |
| | | function updateScrollButtons() { |
| | | if (!menuContainer.value) return; |
| | | |
| | | const container = menuContainer.value; |
| | | canScrollLeft.value = container.scrollLeft > 10; |
| | | canScrollRight.value = container.scrollLeft < (container.scrollWidth - container.clientWidth - 10); |
| | | } |
| | | |
| | | function scrollLeft() { |
| | | if (!menuContainer.value) return; |
| | | menuContainer.value.scrollBy({ left: -200, behavior: 'smooth' }); |
| | | setTimeout(updateScrollButtons, 300); |
| | | } |
| | | |
| | | function scrollRight() { |
| | | if (!menuContainer.value) return; |
| | | menuContainer.value.scrollBy({ left: 200, behavior: 'smooth' }); |
| | | setTimeout(updateScrollButtons, 300); |
| | | } |
| | | |
| | | /** |
| | | * æ¥æ¾ææ·±å±çåèåï¼å¶åèç¹ï¼ |
| | | * é彿¥æ¾ç¬¬ä¸ä¸ªæ²¡æchildrençåèå |
| | | */ |
| | | function findDeepestLeafMenu(route) { |
| | | if (!route) return null; |
| | | |
| | | // å¦ææ²¡æåèåæåèå为空ï¼åè¿åå½åè·¯ç± |
| | | if (!route.children || route.children.length === 0) { |
| | | return route; |
| | | } |
| | | |
| | | // æ¾å°ç¬¬ä¸ä¸ªééèçåèå |
| | | const firstVisibleChild = route.children.find(child => !child.hidden); |
| | | if (!firstVisibleChild) { |
| | | return route; // 妿ææåèå齿¯éèçï¼è¿åå½åè·¯ç± |
| | | } |
| | | |
| | | // é彿¥æ¾è¿ä¸ªåèåçææ·±å±åèå |
| | | return findDeepestLeafMenu(firstVisibleChild); |
| | | } |
| | | |
| | | function handleSelect(key, keyPath) { |
| | | currentIndex.value = key; |
| | | const route = routers.value.find(item => item.path === key); |
| | | |
| | | if (isHttp(key)) { |
| | | // http(s):// è·¯å¾æ°çªå£æå¼ |
| | | window.open(key, "_blank"); |
| | | } else if (!route || !route.children) { |
| | | // 没æåè·¯ç±è·¯å¾å
é¨æå¼ |
| | | return; |
| | | } |
| | | |
| | | |
| | | |
| | | // æ£æ¥æ¯å¦æåè·¯ç± |
| | | if (route && route.children && route.children.length > 0) { |
| | | // æåè·¯ç±ï¼æ¾ç¤ºä¾§è¾¹æ |
| | | activeRoutes(key); |
| | | |
| | | // æç
§æ£ç¡®çè·¯å¾æå»ºå±çº§ï¼è¿éæ¯ç¹æ®å¤ç |
| | | let targetPath = key; // ä»å½åç¹å»çèåè·¯å¾å¼å§ |
| | | let targetQuery = null; |
| | | let currentNode = route; |
| | | let pathSegments = []; |
| | | |
| | | // å½åè·¯å¾æ¯ç¬¬ä¸æ®µ |
| | | pathSegments.push(currentNode.path); |
| | | |
| | | // é屿·»å åè·¯å¾ |
| | | while (currentNode.children && currentNode.children.length > 0) { |
| | | const firstChild = currentNode.children.find(child => !child.hidden); |
| | | if (!firstChild) break; |
| | | |
| | | // è·³è¿ParentViewç±»åçä¸é´èç¹ï¼ç´æ¥ä½¿ç¨å
¶åèç¹çpath |
| | | if (firstChild.component === 'ParentView' || firstChild.component.name === 'ParentView') { |
| | | currentNode = firstChild; |
| | | pathSegments.push(firstChild.path); |
| | | continue; |
| | | } |
| | | |
| | | // æ®éèç¹å¤ç |
| | | currentNode = firstChild; |
| | | // å¦æè·¯å¾ä¸æ¯ä»¥/å¼å¤´ï¼åæ·»å å°è·¯å¾çæ®µä¸ |
| | | if (!firstChild.path.startsWith('/')) { |
| | | pathSegments.push(firstChild.path); |
| | | } else { |
| | | // 妿æ¯ç»å¯¹è·¯å¾ï¼åæ¿æ¢ä¹åææè·¯å¾ |
| | | pathSegments = [firstChild.path]; |
| | | } |
| | | |
| | | targetQuery = firstChild.query; |
| | | |
| | | // 妿å°è¾¾å¶åèç¹ï¼æ²¡æåèç¹ï¼ï¼åç»ææ¥æ¾ |
| | | if (!firstChild.children || firstChild.children.length === 0) { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | // æå»ºæç»è·¯å¾ |
| | | if (pathSegments.length > 0) { |
| | | // å¦æç¬¬ä¸æ®µä¸æ¯ä»¥/å¼å¤´ï¼æ·»å / |
| | | if (!pathSegments[0].startsWith('/')) { |
| | | pathSegments[0] = '/' + pathSegments[0]; |
| | | } |
| | | |
| | | // ç»åè·¯å¾ - ææ°ç»ä¸ææè·¯å¾æ¼æ¥èµ·æ¥ï¼å¦æææ®µå
å«å®æ´è·¯å¾ï¼ä»¥/å¼å¤´ï¼åä»è¯¥æ®µéæ°å¼å§ |
| | | targetPath = pathSegments.reduce((fullPath, segment, index) => { |
| | | if (segment.startsWith('/')) { |
| | | return segment; |
| | | } else if (index === 0) { |
| | | return segment; |
| | | } else { |
| | | return `${fullPath}/${segment}`; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // 导èªå°ç®æ è·¯ç± |
| | | if (targetQuery) { |
| | | router.push({ path: targetPath, query: targetQuery }); |
| | | } else { |
| | | router.push({ path: targetPath }); |
| | | } |
| | | } else { |
| | | // 没æåè·¯ç±ï¼éèä¾§è¾¹æ |
| | | const routeMenu = childrenMenus.value.find(item => item.path === key); |
| | | if (routeMenu && routeMenu.query) { |
| | | let query = JSON.parse(routeMenu.query); |
| | | router.push({ path: key, query: query }); |
| | | // query å·²ç»å¨ permission.js ä¸è¢«å¤çä¸ºå¯¹è±¡ï¼æ é忬¡è§£æ |
| | | router.push({ path: key, query: routeMenu.query }); |
| | | } else { |
| | | router.push({ path: key }); |
| | | } |
| | | appStore.toggleSideBarHide(true); |
| | | } else { |
| | | // æ¾ç¤ºå·¦ä¾§èå¨èå |
| | | activeRoutes(key); |
| | | appStore.toggleSideBarHide(false); |
| | | } |
| | | } |
| | | |
| | | function activeRoutes(key) { |
| | | let routes = []; |
| | | |
| | | |
| | | // æ¥æ¾å¹é
çè·¯ç± |
| | | if (childrenMenus.value && childrenMenus.value.length > 0) { |
| | | childrenMenus.value.map((item) => { |
| | | if (key == item.parentPath || (key == "index" && "" == item.path)) { |
| | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | if(routes.length > 0) { |
| | | // æåè·¯ç±ï¼åæ¾ç¤ºä¾§è¾¹æ |
| | | permissionStore.setSidebarRouters(routes); |
| | | appStore.toggleSideBarHide(false); |
| | | } else { |
| | | // 没æåè·¯ç±ï¼éèä¾§è¾¹æ |
| | | appStore.toggleSideBarHide(true); |
| | | } |
| | | return routes; |
| | | } |
| | | |
| | | onMounted(() => { |
| | | window.addEventListener('resize', setVisibleNumber) |
| | | }) |
| | | onBeforeUnmount(() => { |
| | | window.removeEventListener('resize', setVisibleNumber) |
| | | // æ ¹æ®å½åè·¯ç±å³å®æ¯å¦æ¾ç¤ºä¾§è¾¹æ ï¼è䏿¯ç´æ¥éè |
| | | const currentPath = route.path; |
| | | if (currentPath === '/index' || currentPath === '/') { |
| | | // 妿å½åæ¯é¦é¡µï¼èªå¨è·³è½¬å°ç¬¬ä¸ä¸ªå¨æè·¯ç± |
| | | if (topMenus.value.length > 0) { |
| | | const firstRoute = topMenus.value[0]; |
| | | handleSelect(firstRoute.path); |
| | | } |
| | | } else { |
| | | // æ£æ¥å½åè·¯ç±æ¯å¦éè¦æ¾ç¤ºä¾§è¾¹æ |
| | | const routeConfig = routers.value.find(item => currentPath.startsWith(item.path) && item.path !== '/'); |
| | | if (routeConfig && routeConfig.children && routeConfig.children.length > 0) { |
| | | // æåèåï¼æ¾ç¤ºä¾§è¾¹æ |
| | | activeRoutes(routeConfig.path); |
| | | appStore.toggleSideBarHide(false); |
| | | } else { |
| | | // æ åèåï¼å¯ä»¥éèä¾§è¾¹æ |
| | | appStore.toggleSideBarHide(true); |
| | | } |
| | | } |
| | | |
| | | // ç嬿»å¨ç¶æ |
| | | if (menuContainer.value) { |
| | | menuContainer.value.addEventListener('scroll', updateScrollButtons); |
| | | nextTick(() => { |
| | | updateScrollButtons(); |
| | | }); |
| | | } |
| | | |
| | | window.addEventListener('resize', () => { |
| | | updateScrollButtons(); |
| | | }); |
| | | }) |
| | | |
| | | onMounted(() => { |
| | | setVisibleNumber() |
| | | onBeforeUnmount(() => { |
| | | if (menuContainer.value) { |
| | | menuContainer.value.removeEventListener('scroll', updateScrollButtons); |
| | | } |
| | | window.removeEventListener('resize', updateScrollButtons); |
| | | }) |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | | .topmenu-container.el-menu--horizontal > .el-menu-item { |
| | | float: left; |
| | | height: 50px !important; |
| | | line-height: 50px !important; |
| | | color: #999093 !important; |
| | | padding: 0 5px !important; |
| | | margin: 0 10px !important; |
| | | .top-nav-container { |
| | | display: flex; |
| | | align-items: center; |
| | | flex: 1; |
| | | position: relative; |
| | | height: 60px; |
| | | overflow: hidden; |
| | | padding: 0 40px; /* Increase padding for arrows */ |
| | | |
| | | .scroll-arrow { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | width: 28px; |
| | | height: 28px; |
| | | background: rgba(255, 255, 255, 0.2); |
| | | border-radius: 50%; |
| | | cursor: pointer; |
| | | color: #ffffff; |
| | | z-index: 20; |
| | | opacity: 0; |
| | | transition: opacity 0.3s; |
| | | position: absolute; |
| | | box-shadow: 0 0 5px rgba(0, 0, 0, 0.2); |
| | | |
| | | &:hover { |
| | | background: rgba(255, 255, 255, 0.3); |
| | | } |
| | | |
| | | .topmenu-container.el-menu--horizontal > .el-menu-item.is-active, .el-menu--horizontal > .el-sub-menu.is-active .el-submenu__title { |
| | | border-bottom: 2px solid #{'var(--theme)'} !important; |
| | | color: #303133; |
| | | &.left-arrow { |
| | | left: 8px; |
| | | } |
| | | |
| | | /* sub-menu item */ |
| | | .topmenu-container.el-menu--horizontal > .el-sub-menu .el-sub-menu__title { |
| | | float: left; |
| | | height: 50px !important; |
| | | line-height: 50px !important; |
| | | color: #999093 !important; |
| | | padding: 0 5px !important; |
| | | margin: 0 10px !important; |
| | | &.right-arrow { |
| | | right: 8px; |
| | | } |
| | | } |
| | | |
| | | /* èæ¯è²éè */ |
| | | .topmenu-container.el-menu--horizontal>.el-menu-item:not(.is-disabled):focus, .topmenu-container.el-menu--horizontal>.el-menu-item:not(.is-disabled):hover, .topmenu-container.el-menu--horizontal>.el-submenu .el-submenu__title:hover { |
| | | background-color: #ffffff !important; |
| | | &:hover { |
| | | .scroll-arrow { |
| | | opacity: 1; |
| | | } |
| | | } |
| | | |
| | | .menu-container { |
| | | width: 100%; |
| | | height: 100%; |
| | | overflow-x: auto; |
| | | overflow-y: hidden; |
| | | scrollbar-width: none; /* Firefox */ |
| | | -ms-overflow-style: none; /* IE and Edge */ |
| | | |
| | | &::-webkit-scrollbar { |
| | | display: none; /* Chrome, Safari, Opera */ |
| | | } |
| | | } |
| | | } |
| | | |
| | | .top-menu { |
| | | height: 60px; |
| | | border-bottom: none !important; |
| | | white-space: nowrap; |
| | | background: transparent !important; |
| | | |
| | | &.theme-dark { |
| | | background: #002866 !important; |
| | | } |
| | | } |
| | | |
| | | .el-menu--horizontal { |
| | | border-bottom: none !important; |
| | | |
| | | > .el-menu-item { |
| | | display: inline-block; |
| | | float: none; |
| | | height: 60px !important; |
| | | line-height: 60px !important; |
| | | color: #ffffff !important; |
| | | padding: 0 20px !important; |
| | | margin: 0 !important; |
| | | border-bottom: none !important; |
| | | position: relative; |
| | | font-size: 16px; |
| | | |
| | | &.is-active { |
| | | background-color: transparent !important; |
| | | color: #ffffff !important; |
| | | font-weight: bold; |
| | | |
| | | &::after { |
| | | content: ''; |
| | | position: absolute; |
| | | bottom: 10px; |
| | | left: 50%; |
| | | transform: translateX(-50%); |
| | | width: calc(100% - 40px); |
| | | height: 2px; |
| | | background-color: #ffffff; |
| | | } |
| | | } |
| | | |
| | | &:hover { |
| | | background-color: rgba(255, 255, 255, 0.1) !important; |
| | | color: #ffffff !important; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /* 徿 å³é´è· */ |
| | | .topmenu-container .svg-icon { |
| | | margin-right: 4px; |
| | | .svg-icon { |
| | | margin-right: 8px; |
| | | color: #ffffff; |
| | | } |
| | | |
| | | /* topmenu more arrow */ |
| | | .topmenu-container .el-sub-menu .el-sub-menu__icon-arrow { |
| | | position: static; |
| | | vertical-align: middle; |
| | | margin-left: 8px; |
| | | margin-top: 0px; |
| | | /* é¦é¡µæé®æ ·å¼ */ |
| | | .el-menu-item:first-child { |
| | | margin-left: 0 !important; |
| | | font-weight: bold; |
| | | |
| | | .svg-icon { |
| | | font-size: 18px; |
| | | } |
| | | } |
| | | </style> |
| | |
| | | position: relative; |
| | | overflow: hidden; |
| | | background: #110f2e; |
| | | padding: 14px 0 0 14px; |
| | | padding: 14px; |
| | | box-sizing: border-box; |
| | | padding-top: 8px; |
| | | } |
| | | |
| | | .fixed-header + .app-main { |
| | |
| | | .hasTagsView { |
| | | .app-main { |
| | | /* 84 = navbar + tags-view + padding = 70 + 56 + 14 */ |
| | | min-height: calc(100vh - 125px); |
| | | // padding: 20px; |
| | | min-height: calc(100vh - 110px); |
| | | } |
| | | |
| | | .fixed-header + .app-main { |
| | | padding-top: 130px; |
| | | padding-top: 108px; /* 60px(navbar) + 34px(tagsview) + 14px(å
è¾¹è·) */ |
| | | } |
| | | } |
| | | } |
| | |
| | | position: relative; |
| | | overflow: hidden; |
| | | background: #f7f8fa; |
| | | padding: 14px 0 0 14px; |
| | | padding: 14px; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .fixed-header + .app-main { |
| | |
| | | .hasTagsView { |
| | | .app-main { |
| | | /* 84 = navbar + tags-view + padding = 70 + 56 + 14 */ |
| | | min-height: calc(100vh - 125px); |
| | | // padding: 20px; |
| | | min-height: calc(100vh - 110px); |
| | | } |
| | | |
| | | .fixed-header + .app-main { |
| | | padding-top: 130px; |
| | | padding-top: 108px; /* 60px(navbar) + 34px(tagsview) + 14px(å
è¾¹è·) */ |
| | | } |
| | | } |
| | | } |
| | | |
| | | /* ç¨æ·ä¸ªäººèµæé¡µç¹æ®é«åº¦å¤ç */ |
| | | .user-profile-container { |
| | | min-height: calc(100vh - 50px) !important; |
| | | } |
| | | </style> |
| | | |
| | | <style lang="scss"> |
| | |
| | | </div> |
| | | |
| | | <div class="right-menu"> |
| | | <!-- <template v-if="appStore.device !== 'mobile'"> |
| | | <header-search id="header-search" class="right-menu-item" /> |
| | | |
| | | <screenfull id="screenfull" class="right-menu-item hover-effect" /> |
| | | |
| | | <el-tooltip content="å¸å±å¤§å°" effect="dark" placement="bottom"> |
| | | <size-select id="size-select" class="right-menu-item hover-effect" /> |
| | | </el-tooltip> |
| | | </template> --> |
| | | <!-- <el-button @click="toggleTheme">忢</el-button> --> |
| | | <div class="avatar-container"> |
| | | <el-dropdown @command="handleCommand" class="right-menu-item hover-effect" trigger="click"> |
| | | <div class="avatar-wrapper"> |
| | | <img :src="userStore.avatar" class="user-avatar" /> |
| | | <el-icon><caret-bottom /></el-icon> |
| | | <!-- æ¥è¦æé® --> |
| | | <div class="right-menu-item hover-effect nav-btn-item"> |
| | | <el-tooltip content="æ¥è¦" effect="dark" placement="bottom"> |
| | | <div class="nav-btn" @click="handleAlarm"> |
| | | <img src="@/assets/images/alarm.png" alt="æ¥è¦" /> |
| | | <span>æ¥è¦</span> |
| | | </div> |
| | | <template #dropdown> |
| | | <el-dropdown-menu> |
| | | <router-link to="/user/profile"> |
| | | <el-dropdown-item>个人ä¸å¿</el-dropdown-item> |
| | | </router-link> |
| | | <el-dropdown-item command="toggleTheme"> |
| | | <span>飿 ¼åæ¢</span> |
| | | </el-dropdown-item> |
| | | <!-- |
| | | <el-dropdown-item command="setLayout" v-if="settingsStore.showSettings"> |
| | | <span>å¸å±è®¾ç½®</span> |
| | | </el-dropdown-item> --> |
| | | <el-dropdown-item divided command="logout"> |
| | | <span>éåºç»å½</span> |
| | | </el-dropdown-item> |
| | | </el-dropdown-menu> |
| | | </template> |
| | | </el-dropdown> |
| | | </el-tooltip> |
| | | </div> |
| | | |
| | | <!-- 大模åæé® --> |
| | | <div class="right-menu-item hover-effect nav-btn-item"> |
| | | <el-tooltip content="大模å" effect="dark" placement="bottom"> |
| | | <div class="nav-btn" @click="handleRobot"> |
| | | <img src="@/assets/images/robot.png" alt="大模å" /> |
| | | <span>大模å</span> |
| | | </div> |
| | | </el-tooltip> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ElMessageBox } from "element-plus" |
| | | import Breadcrumb from "@/components/Breadcrumb" |
| | | import TopNav from "@/components/TopNav" |
| | | import Hamburger from "@/components/Hamburger" |
| | | import Screenfull from "@/components/Screenfull" |
| | | import SizeSelect from "@/components/SizeSelect" |
| | | import HeaderSearch from "@/components/HeaderSearch" |
| | | import useAppStore from "@/store/modules/app" |
| | | import useUserStore from "@/store/modules/user" |
| | | import useSettingsStore from "@/store/modules/settings" |
| | | import { useRouter } from "vue-router" |
| | | |
| | | const appStore = useAppStore() |
| | | const userStore = useUserStore() |
| | | const settingsStore = useSettingsStore() |
| | | |
| | | function toggleTheme() { |
| | | if (settingsStore.sideTheme == "theme-dark") { |
| | | settingsStore.sideTheme = "theme-light" |
| | | document.querySelector("body").className = "themeLight" |
| | | } else { |
| | | settingsStore.sideTheme = "theme-dark" |
| | | document.querySelector("body").className = "themeDark" |
| | | } |
| | | } |
| | | const router = useRouter() |
| | | |
| | | function toggleSideBar() { |
| | | appStore.toggleSideBar() |
| | | } |
| | | |
| | | function handleCommand(command) { |
| | | switch (command) { |
| | | case "toggleTheme": |
| | | toggleTheme() |
| | | break |
| | | case "setLayout": |
| | | setLayout() |
| | | break |
| | | case "logout": |
| | | logout() |
| | | break |
| | | default: |
| | | break |
| | | } |
| | | function handleAlarm() { |
| | | // è·³è½¬å°æ¥è¦ç®¡çé¡µé¢ |
| | | router.push('/alarmmanage/measuremen?modelCode=BJGL') |
| | | } |
| | | |
| | | function logout() { |
| | | ElMessageBox.confirm("ç¡®å®æ³¨éå¹¶éåºç³»ç»åï¼", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | userStore.logOut().then(() => { |
| | | location.href = "/index" |
| | | }) |
| | | }) |
| | | .catch(() => {}) |
| | | } |
| | | |
| | | const emits = defineEmits(["setLayout"]) |
| | | function setLayout() { |
| | | emits("setLayout") |
| | | function handleRobot() { |
| | | // è·³è½¬å°æºè½å©æé¡µé¢ |
| | | window.open('https://deepseek.tan-zhonghe.com/chat', '_blank') |
| | | } |
| | | </script> |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | .avatar-container { |
| | | margin-right: 40px; |
| | | .nav-btn-item { |
| | | display: flex; |
| | | align-items: center; |
| | | margin-right: 20px; |
| | | height: 70px; |
| | | |
| | | .avatar-wrapper { |
| | | margin-top: 5px; |
| | | position: relative; |
| | | |
| | | .user-avatar { |
| | | .nav-btn { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | cursor: pointer; |
| | | width: 40px; |
| | | height: 40px; |
| | | border-radius: 10px; |
| | | color: #fff; |
| | | background-color: rgba(255, 255, 255, 0.1); |
| | | border-radius: 4px; |
| | | padding: 8px 16px; |
| | | |
| | | &:hover { |
| | | background-color: rgba(255, 255, 255, 0.2); |
| | | } |
| | | |
| | | i { |
| | | cursor: pointer; |
| | | position: absolute; |
| | | right: -20px; |
| | | top: 25px; |
| | | font-size: 12px; |
| | | img { |
| | | width: 20px; |
| | | height: 20px; |
| | | margin-right: 6px; |
| | | } |
| | | |
| | | span { |
| | | font-size: 14px; |
| | | font-weight: 500; |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | .avatar-container { |
| | | margin-right: 40px; |
| | | .nav-btn-item { |
| | | display: flex; |
| | | align-items: center; |
| | | margin-right: 20px; |
| | | height: 70px; |
| | | |
| | | .avatar-wrapper { |
| | | margin-top: 5px; |
| | | position: relative; |
| | | |
| | | .user-avatar { |
| | | .nav-btn { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | cursor: pointer; |
| | | width: 40px; |
| | | height: 40px; |
| | | border-radius: 10px; |
| | | color: #333; |
| | | background-color: rgba(0, 0, 0, 0.05); |
| | | border-radius: 4px; |
| | | padding: 8px 16px; |
| | | |
| | | &:hover { |
| | | background-color: rgba(0, 0, 0, 0.1); |
| | | } |
| | | |
| | | i { |
| | | cursor: pointer; |
| | | position: absolute; |
| | | right: -20px; |
| | | top: 25px; |
| | | font-size: 12px; |
| | | img { |
| | | width: 20px; |
| | | height: 20px; |
| | | margin-right: 6px; |
| | | } |
| | | |
| | | span { |
| | | font-size: 14px; |
| | | font-weight: 500; |
| | | } |
| | | } |
| | | } |
| | |
| | | <div class="setting-drawer-block-checbox"> |
| | | <div class="setting-drawer-block-checbox-item" @click="handleTheme('theme-dark')"> |
| | | <img src="@/assets/images/dark.svg" alt="dark" /> |
| | | <div v-if="sideTheme === 'theme-dark'" class="setting-drawer-block-checbox-selectIcon" style="display: block;"> |
| | | <div v-if="sideTheme === 'theme-dark'" class="setting-drawer-block-checbox-selectIcon" style="display: block"> |
| | | <i aria-label="徿 : check" class="anticon anticon-check"> |
| | | <svg viewBox="64 64 896 896" data-icon="check" width="1em" height="1em" :fill="theme" aria-hidden="true" focusable="false" class> |
| | | <path d="M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 0 0-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z" /> |
| | | <svg |
| | | viewBox="64 64 896 896" |
| | | data-icon="check" |
| | | width="1em" |
| | | height="1em" |
| | | :fill="theme" |
| | | aria-hidden="true" |
| | | focusable="false" |
| | | class |
| | | > |
| | | <path |
| | | d="M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 0 0-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z" |
| | | /> |
| | | </svg> |
| | | </i> |
| | | </div> |
| | | </div> |
| | | <div class="setting-drawer-block-checbox-item" @click="handleTheme('theme-light')"> |
| | | <img src="@/assets/images/light.svg" alt="light" /> |
| | | <div v-if="sideTheme === 'theme-light'" class="setting-drawer-block-checbox-selectIcon" style="display: block;"> |
| | | <div v-if="sideTheme === 'theme-light'" class="setting-drawer-block-checbox-selectIcon" style="display: block"> |
| | | <i aria-label="徿 : check" class="anticon anticon-check"> |
| | | <svg viewBox="64 64 896 896" data-icon="check" width="1em" height="1em" :fill="theme" aria-hidden="true" focusable="false" class> |
| | | <path d="M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 0 0-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z" /> |
| | | <svg |
| | | viewBox="64 64 896 896" |
| | | data-icon="check" |
| | | width="1em" |
| | | height="1em" |
| | | :fill="theme" |
| | | aria-hidden="true" |
| | | focusable="false" |
| | | class |
| | | > |
| | | <path |
| | | d="M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 0 0-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z" |
| | | /> |
| | | </svg> |
| | | </i> |
| | | </div> |
| | |
| | | <el-button type="primary" plain icon="DocumentAdd" @click="saveSetting">ä¿åé
ç½®</el-button> |
| | | <el-button plain icon="Refresh" @click="resetSetting">éç½®é
ç½®</el-button> |
| | | </el-drawer> |
| | | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import variables from '@/assets/styles/variables.module.scss' |
| | | import axios from 'axios' |
| | | import { ElLoading, ElMessage } from 'element-plus' |
| | | import { useDynamicTitle } from '@/utils/dynamicTitle' |
| | | import useAppStore from '@/store/modules/app' |
| | | import useSettingsStore from '@/store/modules/settings' |
| | | import usePermissionStore from '@/store/modules/permission' |
| | | import { handleThemeStyle } from '@/utils/theme' |
| | | import variables from "@/assets/styles/variables.module.scss" |
| | | import axios from "axios" |
| | | import { ElLoading, ElMessage } from "element-plus" |
| | | import { useDynamicTitle } from "@/utils/dynamicTitle" |
| | | import useAppStore from "@/store/modules/app" |
| | | import useSettingsStore from "@/store/modules/settings" |
| | | import usePermissionStore from "@/store/modules/permission" |
| | | import { handleThemeStyle } from "@/utils/theme" |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | const { proxy } = getCurrentInstance() |
| | | const appStore = useAppStore() |
| | | const settingsStore = useSettingsStore() |
| | | const permissionStore = usePermissionStore() |
| | | const showSettings = ref(false); |
| | | const theme = ref(settingsStore.theme); |
| | | const sideTheme = ref(settingsStore.sideTheme); |
| | | const storeSettings = computed(() => settingsStore); |
| | | const predefineColors = ref(["#409EFF", "#ff4500", "#ff8c00", "#ffd700", "#90ee90", "#00ced1", "#1e90ff", "#c71585"]); |
| | | const showSettings = ref(false) |
| | | const theme = ref(settingsStore.theme) |
| | | const sideTheme = ref(settingsStore.sideTheme) |
| | | const storeSettings = computed(() => settingsStore) |
| | | const predefineColors = ref(["#409EFF", "#ff4500", "#ff8c00", "#ffd700", "#90ee90", "#00ced1", "#1e90ff", "#c71585"]) |
| | | |
| | | /** æ¯å¦éè¦topnav */ |
| | | function topNavChange(val) { |
| | | if (!val) { |
| | | appStore.toggleSideBarHide(false); |
| | | permissionStore.setSidebarRouters(permissionStore.defaultRoutes); |
| | | appStore.toggleSideBarHide(false) |
| | | permissionStore.setSidebarRouters(permissionStore.defaultRoutes) |
| | | } |
| | | } |
| | | |
| | | function themeChange(val) { |
| | | settingsStore.theme = val; |
| | | handleThemeStyle(val); |
| | | settingsStore.theme = val |
| | | handleThemeStyle(val) |
| | | } |
| | | function handleTheme(val) { |
| | | settingsStore.sideTheme = val; |
| | | sideTheme.value = val; |
| | | settingsStore.sideTheme = val |
| | | sideTheme.value = val |
| | | // Update body class to match the theme |
| | | document.querySelector("body").className = val === 'theme-dark' ? "themeDark" : "themeLight" |
| | | } |
| | | function saveSetting() { |
| | | proxy.$modal.loading("æ£å¨ä¿åå°æ¬å°ï¼è¯·ç¨å..."); |
| | | proxy.$modal.loading("æ£å¨ä¿åå°æ¬å°ï¼è¯·ç¨å...") |
| | | let layoutSetting = { |
| | | "topNav": storeSettings.value.topNav, |
| | | "tagsView": storeSettings.value.tagsView, |
| | | "fixedHeader": storeSettings.value.fixedHeader, |
| | | "sidebarLogo": storeSettings.value.sidebarLogo, |
| | | "dynamicTitle": storeSettings.value.dynamicTitle, |
| | | "sideTheme": storeSettings.value.sideTheme, |
| | | "theme": storeSettings.value.theme |
| | | }; |
| | | localStorage.setItem("layout-setting", JSON.stringify(layoutSetting)); |
| | | topNav: storeSettings.value.topNav, |
| | | tagsView: storeSettings.value.tagsView, |
| | | fixedHeader: storeSettings.value.fixedHeader, |
| | | sidebarLogo: storeSettings.value.sidebarLogo, |
| | | dynamicTitle: storeSettings.value.dynamicTitle, |
| | | sideTheme: storeSettings.value.sideTheme, |
| | | theme: storeSettings.value.theme, |
| | | } |
| | | localStorage.setItem("layout-setting", JSON.stringify(layoutSetting)) |
| | | setTimeout(proxy.$modal.closeLoading(), 1000) |
| | | } |
| | | function resetSetting() { |
| | | proxy.$modal.loading("æ£å¨æ¸
é¤è®¾ç½®ç¼åå¹¶å·æ°ï¼è¯·ç¨å..."); |
| | | proxy.$modal.loading("æ£å¨æ¸
é¤è®¾ç½®ç¼åå¹¶å·æ°ï¼è¯·ç¨å...") |
| | | localStorage.removeItem("layout-setting") |
| | | setTimeout("window.location.reload()", 1000) |
| | | } |
| | | function openSetting() { |
| | | showSettings.value = true; |
| | | showSettings.value = true |
| | | } |
| | | |
| | | defineExpose({ |
| | |
| | | }) |
| | | </script> |
| | | |
| | | <style lang='scss' scoped> |
| | | <style lang="scss" scoped> |
| | | .setting-drawer-title { |
| | | margin-bottom: 12px; |
| | | color: rgba(0, 0, 0, 0.85); |
| | |
| | | </app-link> |
| | | </template> |
| | | |
| | | <el-sub-menu v-else ref="subMenu" :index="resolvePath(item.path)" teleported> |
| | | <el-sub-menu v-else ref="subMenu" :index="resolvePath(item.path)" teleported @click="handleSubMenuClick"> |
| | | <template v-if="item.meta" #title> |
| | | <svg-icon :icon-class="item.meta && item.meta.icon" /> |
| | | <span class="menu-title" :title="hasTitle(item.meta.title)">{{ item.meta.title }}</span> |
| | |
| | | import { isExternal } from '@/utils/validate' |
| | | import AppLink from './Link' |
| | | import { getNormalPath } from '@/utils/ruoyi' |
| | | import { useRouter } from 'vue-router' |
| | | |
| | | const router = useRouter(); |
| | | |
| | | const props = defineProps({ |
| | | // route object |
| | |
| | | |
| | | const onlyOneChild = ref({}); |
| | | |
| | | /** |
| | | * æ¥æ¾ææ·±å±çåèåï¼å¶åèç¹ï¼ |
| | | * é彿¥æ¾ç¬¬ä¸ä¸ªæ²¡æchildrençåèå |
| | | */ |
| | | function findDeepestLeafMenu(route) { |
| | | if (!route) return null; |
| | | |
| | | // å¦ææ²¡æåèåæåèå为空ï¼åè¿åå½åè·¯ç± |
| | | if (!route.children || route.children.length === 0) { |
| | | return route; |
| | | } |
| | | |
| | | // æ¾å°ç¬¬ä¸ä¸ªééèçåèå |
| | | const firstVisibleChild = route.children.find(child => !child.hidden); |
| | | if (!firstVisibleChild) { |
| | | return route; // 妿ææåèå齿¯éèçï¼è¿åå½åè·¯ç± |
| | | } |
| | | |
| | | // é彿¥æ¾è¿ä¸ªåèåçææ·±å±åèå |
| | | return findDeepestLeafMenu(firstVisibleChild); |
| | | } |
| | | |
| | | // å¤çåèåç¹å» |
| | | function handleSubMenuClick(e) { |
| | | // 黿¢äºä»¶å泡 |
| | | e.stopPropagation(); |
| | | |
| | | // 妿ç¹å»çæ¯åèåæ é¢ï¼åèªå¨å¯¼èªå°ææ·±å±çåèå |
| | | if (e.target.closest('.el-sub-menu__title')) { |
| | | // æç
§æ£ç¡®çè·¯å¾æå»ºå±çº§ |
| | | let currentNode = props.item; |
| | | |
| | | console.log('å½åç¹å»çèå项:', JSON.stringify(currentNode, null, 2)); |
| | | console.log('basePath:', props.basePath); |
| | | |
| | | // è·å第ä¸ä¸ªå¯è§åèåï¼å¦ææ²¡æå¯è§åèåï¼ä¸è¿è¡è·³è½¬ |
| | | if (!currentNode.children || currentNode.children.length === 0) { |
| | | return; |
| | | } |
| | | |
| | | const firstVisibleChild = currentNode.children.find(child => !child.hidden); |
| | | if (!firstVisibleChild) { |
| | | return; |
| | | } |
| | | |
| | | console.log('第ä¸ä¸ªå¯è§åèå:', JSON.stringify(firstVisibleChild, null, 2)); |
| | | |
| | | // æ¥å¿ç®¡ççä¸çº§èåç¹æ®å¤ç |
| | | // æ£æ¥æ¯å¦æé¢å
åå
¥ç宿´è·¯å¾ï¼å¦ææåç´æ¥ä½¿ç¨ |
| | | if (firstVisibleChild.fullPath) { |
| | | console.log('使ç¨é¢å
设置ç宿´è·¯å¾:', firstVisibleChild.fullPath); |
| | | router.push({ path: firstVisibleChild.fullPath }); |
| | | return; |
| | | } |
| | | |
| | | // 夿æ¯å¦æ¯ç³»ç»/æ¥å¿ç®¡çç±»åçä¸çº§èåï¼ä¾å¦ï¼/system/log/operlogï¼ |
| | | // è¿ç§æ
åµä¸ï¼ç´æ¥è·³è½¬å°ç¬¬ä¸ä¸ªåèåç宿´è·¯å¾ |
| | | if (firstVisibleChild.component === 'ParentView' || |
| | | (typeof firstVisibleChild.component === 'object' && |
| | | firstVisibleChild.component.name === 'ParentView')) { |
| | | console.log('æ£æµå°ParentViewç»ä»¶ï¼å¤çä¸çº§èå'); |
| | | |
| | | // æ¯æä¸çº§èåçæ
åµ |
| | | if (firstVisibleChild.children && firstVisibleChild.children.length > 0) { |
| | | const grandChild = firstVisibleChild.children.find(child => !child.hidden); |
| | | if (grandChild) { |
| | | console.log('æ¾å°ç¬¬ä¸çº§èå:', JSON.stringify(grandChild, null, 2)); |
| | | |
| | | // 夿æ¯å¦åºè¯¥ä½¿ç¨parentPath |
| | | if (firstVisibleChild.parentPath && grandChild.path.startsWith('/')) { |
| | | console.log('使ç¨parentPath屿§:', firstVisibleChild.parentPath); |
| | | // 妿åè忝ç»å¯¹è·¯å¾ï¼ä½æparentPathï¼ååºè¯¥ä½¿ç¨parentPathä½ä¸ºåºç¡ |
| | | let fullPath = firstVisibleChild.parentPath; |
| | | if (!fullPath.startsWith('/')) { |
| | | fullPath = '/' + fullPath; |
| | | } |
| | | |
| | | // 第äºçº§è·¯å¾åºäºæ ¹è·¯å¾ |
| | | if (firstVisibleChild.path.startsWith('/')) { |
| | | // 第äºçº§å·²ç»æ¯ç»å¯¹è·¯å¾ï¼æªåæåé¨å |
| | | const pathParts = firstVisibleChild.path.split('/'); |
| | | const lastPart = pathParts[pathParts.length - 1]; |
| | | fullPath = fullPath + '/' + lastPart; |
| | | } else { |
| | | fullPath = buildFullPath(fullPath, firstVisibleChild.path); |
| | | } |
| | | console.log('äºçº§è·¯å¾:', fullPath); |
| | | |
| | | // 第ä¸çº§è·¯å¾åºäºäºçº§è·¯å¾ |
| | | if (grandChild.path.startsWith('/')) { |
| | | // 第ä¸çº§æ¯ç»å¯¹è·¯å¾ï¼æªåæåé¨å |
| | | const pathParts = grandChild.path.split('/'); |
| | | const lastPart = pathParts[pathParts.length - 1]; |
| | | fullPath = fullPath + '/' + lastPart; |
| | | } else { |
| | | fullPath = buildFullPath(fullPath, grandChild.path); |
| | | } |
| | | console.log('ä¸çº§è·¯å¾ (æç»):', fullPath); |
| | | |
| | | // 导èªå°ç¬¬ä¸çº§èå |
| | | if (grandChild.query) { |
| | | router.push({ path: fullPath, query: grandChild.query }); |
| | | } else { |
| | | router.push({ path: fullPath }); |
| | | } |
| | | return; |
| | | } |
| | | |
| | | // 常è§è·¯å¾æå»º |
| | | let fullPath; |
| | | |
| | | // 第ä¸çº§è·¯å¾å¿
é¡»æ¯å®æ´çï¼ä¾å¦/systemï¼ |
| | | if (currentNode.path.startsWith('/')) { |
| | | fullPath = currentNode.path; |
| | | } else { |
| | | fullPath = '/' + currentNode.path; |
| | | } |
| | | console.log('ä¸çº§è·¯å¾:', fullPath); |
| | | |
| | | // 第äºçº§è·¯å¾å¿
é¡»åºäºç¬¬ä¸çº§è·¯å¾ï¼ä¾å¦/system/logï¼ |
| | | fullPath = buildFullPath(fullPath, firstVisibleChild.path); |
| | | console.log('äºçº§è·¯å¾:', fullPath); |
| | | |
| | | // 第ä¸çº§è·¯å¾å¿
é¡»åºäºäºçº§è·¯å¾ï¼ä¾å¦/system/log/operlogï¼ |
| | | fullPath = buildFullPath(fullPath, grandChild.path); |
| | | console.log('ä¸çº§è·¯å¾ (æç»):', fullPath); |
| | | |
| | | // 导èªå°ç¬¬ä¸çº§èå |
| | | if (grandChild.query) { |
| | | console.log('跳转å°:', fullPath, '另忰:', grandChild.query); |
| | | router.push({ path: fullPath, query: grandChild.query }); |
| | | } else { |
| | | console.log('跳转å°:', fullPath); |
| | | router.push({ path: fullPath }); |
| | | } |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | |
| | | console.log('å¤çæ åäºçº§èå'); |
| | | |
| | | // æ£æ¥æ¯å¦éè¦ä½¿ç¨parentPath |
| | | if (firstVisibleChild.parentPath && firstVisibleChild.path.startsWith('/')) { |
| | | console.log('使ç¨parentPath屿§:', firstVisibleChild.parentPath); |
| | | // 妿åè忝ç»å¯¹è·¯å¾ï¼ä½æparentPathï¼ååºè¯¥ä½¿ç¨parentPathä½ä¸ºåºç¡ |
| | | let fullPath = firstVisibleChild.parentPath; |
| | | if (!fullPath.startsWith('/')) { |
| | | fullPath = '/' + fullPath; |
| | | } |
| | | |
| | | // æå»ºå®æ´è·¯å¾ |
| | | if (firstVisibleChild.path.startsWith('/')) { |
| | | // æªååè·¯å¾çæåé¨å |
| | | const pathParts = firstVisibleChild.path.split('/'); |
| | | const lastPart = pathParts[pathParts.length - 1]; |
| | | fullPath = fullPath + '/' + lastPart; |
| | | } else { |
| | | fullPath = buildFullPath(fullPath, firstVisibleChild.path); |
| | | } |
| | | console.log('æå»ºçæç»è·¯å¾:', fullPath); |
| | | |
| | | // 导èªå°ç®æ è·¯ç± |
| | | if (firstVisibleChild.query) { |
| | | router.push({ path: fullPath, query: firstVisibleChild.query }); |
| | | } else { |
| | | router.push({ path: fullPath }); |
| | | } |
| | | return; |
| | | } |
| | | |
| | | // æ åçäºçº§èåå¤ç |
| | | // æå»ºæ£ç¡®çè·¯å¾ |
| | | let fullPath; |
| | | |
| | | // å¤ç第ä¸çº§è·¯å¾ï¼ä¾å¦/systemï¼- å¿
é¡»æ¯å®æ´çè·¯å¾ |
| | | if (currentNode.path.startsWith('/')) { |
| | | fullPath = currentNode.path; |
| | | } else { |
| | | fullPath = '/' + currentNode.path; |
| | | } |
| | | console.log('ä¸çº§è·¯å¾:', fullPath); |
| | | |
| | | // å¤ç第äºçº§è·¯å¾ï¼ä¾å¦/system/userï¼- å¿
é¡»åºäºç¬¬ä¸çº§è·¯å¾ |
| | | fullPath = buildFullPath(fullPath, firstVisibleChild.path); |
| | | console.log('äºçº§è·¯å¾ (æç»):', fullPath); |
| | | |
| | | // 导èªå°ç®æ è·¯ç± |
| | | if (firstVisibleChild.query) { |
| | | console.log('跳转å°:', fullPath, '另忰:', firstVisibleChild.query); |
| | | router.push({ path: fullPath, query: firstVisibleChild.query }); |
| | | } else { |
| | | console.log('跳转å°:', fullPath); |
| | | router.push({ path: fullPath }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | function hasOneShowingChild(children = [], parent) { |
| | | if (!children) { |
| | | children = []; |
| | |
| | | }) |
| | | |
| | | // When there is only one child router, the child router is displayed by default |
| | | if (showingChildren.length === 1) { |
| | | if (showingChildren.length === 1 && !showingChildren[0].children) { |
| | | return true |
| | | } |
| | | |
| | | // If the single child also has children, don't treat it as a single showing child |
| | | if (showingChildren.length === 1 && showingChildren[0].children && showingChildren[0].children.length > 0) { |
| | | return false |
| | | } |
| | | |
| | | // Show parent if there are no child router to display |
| | |
| | | return props.basePath |
| | | } |
| | | if (routeQuery) { |
| | | let query = JSON.parse(routeQuery); |
| | | let query = routeQuery; |
| | | // 妿 routeQuery æ¯å符串ï¼åå°è¯è§£æå® |
| | | if (typeof routeQuery === 'string') { |
| | | try { |
| | | query = JSON.parse(routeQuery); |
| | | } catch (error) { |
| | | console.error('Error parsing query string:', routeQuery, error); |
| | | } |
| | | } |
| | | return { path: getNormalPath(props.basePath + '/' + routePath), query: query } |
| | | } |
| | | return getNormalPath(props.basePath + '/' + routePath) |
| | | } |
| | | |
| | | // æ£ç¡®æå»ºè·¯å¾ |
| | | function buildFullPath(base, segment) { |
| | | // 妿segmentæ¯ç»å¯¹è·¯å¾ï¼ç´æ¥è¿å |
| | | if (segment.startsWith('/')) { |
| | | return segment; |
| | | } |
| | | |
| | | // ç¡®ä¿baseææ£ç¡®çå¼å¤´ææ |
| | | const normalizedBase = base.startsWith('/') ? base : '/' + base; |
| | | |
| | | // æ¼æ¥è·¯å¾ï¼é¿å
åææ |
| | | return normalizedBase.endsWith('/') ? normalizedBase + segment : normalizedBase + '/' + segment; |
| | | } |
| | | |
| | | function hasTitle(title){ |
| | | if (title.length > 5) { |
| | | return title; |
| | |
| | | <div |
| | | :class="{ 'has-logo': showLogo }" |
| | | :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground }" |
| | | class="sidebar-container-wrapper" |
| | | > |
| | | <logo v-if="showLogo" :collapse="isCollapse" /> |
| | | <el-scrollbar :class="sideTheme" wrap-class="scrollbar-wrapper"> |
| | | <el-scrollbar :class="sideTheme" wrap-class="scrollbar-wrapper" view-class="scrollbar-view"> |
| | | <!-- å§ç»æ¾ç¤ºèå项ï¼ä¸åæ ¹æ®è·¯å¾å¤æ --> |
| | | <el-menu |
| | | :default-active="activeMenu" |
| | | :collapse="isCollapse" |
| | | :background-color="sideTheme === 'theme-dark' ? '#232D70' : '#fff'" |
| | | :background-color="'transparent'" |
| | | :text-color="sideTheme === 'theme-dark' ? '#fff' : '#000'" |
| | | :unique-opened="true" |
| | | :active-text-color="theme" |
| | | :collapse-transition="false" |
| | | mode="vertical" |
| | | class="custom-menu" |
| | | > |
| | | <!-- å½åæ¯é¦é¡µçæ¿åè·¯ç±æ¶ï¼æ¸²æä¸ç¨è·¯ç± --> |
| | | <template v-if="isIndexSubRoute"> |
| | | <sidebar-item |
| | | v-for="(route, index) in indexPageRouters" |
| | | :key="route.path + index" |
| | | :item="route" |
| | | :base-path="route.path" |
| | | /> |
| | | </template> |
| | | <template v-else> |
| | | <sidebar-item |
| | | v-for="(route, index) in sidebarRouters" |
| | | :key="route.path + index" |
| | | :item="route" |
| | | :base-path="route.path" |
| | | /> |
| | | </template> |
| | | </el-menu> |
| | | </el-scrollbar> |
| | | |
| | | <!-- åºé¨ç¨æ·åºå --> |
| | | <div class="sidebar-footer" :class="{ 'collapsed': isCollapse, 'theme-light': sideTheme === 'theme-light' }"> |
| | | <div class="user-avatar-container"> |
| | | <img :src="userStore.avatar" class="user-avatar" /> |
| | | </div> |
| | | |
| | | <!-- å±å¼ç¶æä¸æ¾ç¤ºå®æ´å
容 --> |
| | | <div class="user-info" v-if="!isCollapse"> |
| | | <div class="username">{{ userStore.name || 'admin' }}</div> |
| | | |
| | | <div class="action-buttons"> |
| | | <div class="action-button" :class="{'theme-light': sideTheme === 'theme-light'}" @click="toUserProfile"> |
| | | <el-icon><User /></el-icon> |
| | | <span>个人ä¸å¿</span> |
| | | </div> |
| | | |
| | | <div class="action-button" :class="{'theme-light': sideTheme === 'theme-light'}" @click="toggleTheme"> |
| | | <el-icon><Brush /></el-icon> |
| | | <span>忢䏻é¢</span> |
| | | </div> |
| | | |
| | | <div class="action-button" :class="{'theme-light': sideTheme === 'theme-light'}" @click="handleLogout"> |
| | | <el-icon><SwitchButton /></el-icon> |
| | | <span>éåºç»å½</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- æå ç¶æä¸åªæ¾ç¤ºå¾æ æé® --> |
| | | <div class="collapsed-actions" v-if="isCollapse"> |
| | | <div class="action-icon" :class="{'theme-light': sideTheme === 'theme-light'}" @click="toUserProfile" title="个人ä¸å¿"> |
| | | <el-icon><User /></el-icon> |
| | | </div> |
| | | |
| | | <div class="action-icon" :class="{'theme-light': sideTheme === 'theme-light'}" @click="toggleTheme" title="忢䏻é¢"> |
| | | <el-icon><Brush /></el-icon> |
| | | </div> |
| | | |
| | | <div class="action-icon" :class="{'theme-light': sideTheme === 'theme-light'}" @click="handleLogout" title="éåºç»å½"> |
| | | <el-icon><SwitchButton /></el-icon> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import Logo from "./Logo" |
| | | import SidebarItem from "./SidebarItem" |
| | | import variables from "@/assets/styles/variables.module.scss" |
| | | import useAppStore from "@/store/modules/app" |
| | | import useSettingsStore from "@/store/modules/settings" |
| | | import usePermissionStore from "@/store/modules/permission" |
| | | import useUserStore from "@/store/modules/user" |
| | | import { User, Brush, SwitchButton } from '@element-plus/icons-vue' |
| | | import { ElMessageBox } from 'element-plus' |
| | | import { useRouter } from 'vue-router' |
| | | |
| | | const router = useRouter() |
| | | const route = useRoute() |
| | | const appStore = useAppStore() |
| | | const settingsStore = useSettingsStore() |
| | | const permissionStore = usePermissionStore() |
| | | const userStore = useUserStore() |
| | | |
| | | const sidebarRouters = computed(() => permissionStore.sidebarRouters) |
| | | |
| | | // 夿å½åæ¯å¦ä¸ºé¦é¡µåè·¯ç±(/index/index) |
| | | const isIndexSubRoute = computed(() => { |
| | | return route.path === '/index/index' |
| | | }) |
| | | |
| | | // 夿å½åæ¯å¦ä¸ºä¸»é¦é¡µè·¯ç±(/indexæ/) |
| | | const isMainIndexRoute = computed(() => { |
| | | return route.path === '/index' || route.path === '/' |
| | | }) |
| | | |
| | | // é¦é¡µä¸ç¨è·¯ç±ï¼é¦é¡µçæ¿ç¸å
³èå |
| | | const indexPageRouters = computed(() => { |
| | | // æ¥æ¾name为Indexçè·¯ç± |
| | | const indexRoute = sidebarRouters.value.find(route => route.name === 'Index') |
| | | return indexRoute ? [indexRoute] : [] |
| | | }) |
| | | |
| | | const showLogo = computed(() => settingsStore.sidebarLogo) |
| | | const sideTheme = computed(() => settingsStore.sideTheme) |
| | | const theme = computed(() => settingsStore.theme) |
| | |
| | | } |
| | | return path |
| | | }) |
| | | |
| | | function toUserProfile() { |
| | | router.push('/user/profile') |
| | | } |
| | | |
| | | function toggleTheme() { |
| | | if (settingsStore.sideTheme == "theme-dark") { |
| | | settingsStore.sideTheme = "theme-light" |
| | | document.querySelector("body").className = "themeLight" |
| | | } else { |
| | | settingsStore.sideTheme = "theme-dark" |
| | | document.querySelector("body").className = "themeDark" |
| | | } |
| | | } |
| | | |
| | | function handleLogout() { |
| | | ElMessageBox.confirm("ç¡®å®æ³¨éå¹¶éåºç³»ç»åï¼", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | userStore.logOut().then(() => { |
| | | location.href = "/index" |
| | | }) |
| | | }) |
| | | .catch(() => {}) |
| | | } |
| | | </script> |
| | | <style lang="scss" scoped></style> |
| | | <style lang="scss" scoped> |
| | | .sidebar-container-wrapper { |
| | | position: relative; |
| | | height: 100%; |
| | | overflow: hidden; |
| | | display: flex; |
| | | flex-direction: column; |
| | | } |
| | | |
| | | :deep(.scrollbar-wrapper) { |
| | | height: calc(100% - 220px) !important; |
| | | overflow-x: hidden !important; |
| | | } |
| | | |
| | | :deep(.scrollbar-view) { |
| | | height: 100%; |
| | | padding-bottom: 20px; |
| | | } |
| | | |
| | | :deep(.el-scrollbar__bar.is-vertical) { |
| | | right: 0; |
| | | width: 6px; |
| | | } |
| | | |
| | | :deep(.el-scrollbar__thumb) { |
| | | background-color: rgba(144, 147, 153, 0.3); |
| | | &:hover { |
| | | background-color: rgba(144, 147, 153, 0.5); |
| | | } |
| | | } |
| | | |
| | | .custom-menu { |
| | | width: 100%; |
| | | padding: 6px 0; |
| | | height: auto !important; // æ¹ä¸ºèªéåºé«åº¦ï¼é¿å
åºå®é«åº¦å¯¼è´å
å®¹æº¢åº |
| | | transition: all 0.3s ease; |
| | | |
| | | // Override Element Plus default menu styles |
| | | .el-menu-item { |
| | | height: 38px !important; |
| | | line-height: 38px !important; |
| | | border-radius: 4px; |
| | | margin: 4px 10px; |
| | | width: calc(100% - 20px); |
| | | transition: all 0.2s ease; |
| | | |
| | | &.is-active { |
| | | background-color: #3883FA !important; |
| | | color: #fff !important; |
| | | font-weight: bold; |
| | | position: relative; |
| | | box-shadow: 0 2px 8px rgba(56, 131, 250, 0.5); |
| | | |
| | | // 左侧æç¤ºæ¡ |
| | | |
| | | } |
| | | |
| | | &:hover { |
| | | background-color: rgba(56, 131, 250, 0.1) !important; |
| | | } |
| | | } |
| | | |
| | | .el-sub-menu { |
| | | .el-sub-menu__title { |
| | | height: 38px !important; |
| | | line-height: 38px !important; |
| | | border-radius: 4px; |
| | | margin: 4px 10px; |
| | | width: calc(100% - 20px); |
| | | transition: all 0.2s ease; |
| | | |
| | | &:hover { |
| | | background-color: rgba(56, 131, 250, 0.1) !important; |
| | | } |
| | | } |
| | | |
| | | &.is-active { |
| | | > .el-sub-menu__title { |
| | | color: #3883FA !important; |
| | | font-weight: bold; |
| | | } |
| | | } |
| | | |
| | | .el-menu-item { |
| | | padding-left: 45px !important; |
| | | min-width: auto !important; |
| | | |
| | | &.is-active { |
| | | padding-left: 45px !important; |
| | | } |
| | | } |
| | | |
| | | // For nested submenus |
| | | .el-menu { |
| | | .el-menu-item, |
| | | .el-sub-menu__title { |
| | | height: 38px !important; |
| | | line-height: 38px !important; |
| | | } |
| | | |
| | | // Add styling for deeply nested submenus (level 3+) |
| | | .el-sub-menu { |
| | | .el-menu-item { |
| | | padding-left: 65px !important; |
| | | |
| | | &.is-active { |
| | | padding-left: 65px !important; |
| | | } |
| | | } |
| | | |
| | | // Level 4 |
| | | .el-menu { |
| | | .el-menu-item { |
| | | padding-left: 85px !important; |
| | | |
| | | &.is-active { |
| | | padding-left: 85px !important; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // é¦é¡µç©ºç½èååºåæ ·å¼ |
| | | .home-empty-menu { |
| | | height: auto; |
| | | min-height: 100px; |
| | | } |
| | | |
| | | // åºé¨ç¨æ·åºåæ ·å¼ |
| | | .sidebar-footer { |
| | | position: absolute; |
| | | bottom: 0; |
| | | left: 0; |
| | | width: 100%; |
| | | border-top: 1px solid rgba(255, 255, 255, 0.1); |
| | | padding: 16px; |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | |
| | | &.collapsed { |
| | | padding: 10px; |
| | | |
| | | .user-avatar-container { |
| | | margin-bottom: 10px; |
| | | } |
| | | } |
| | | |
| | | &.theme-light { |
| | | background-color: rgba(255, 255, 255, 0.6); |
| | | border-top: 1px solid rgba(0, 0, 0, 0.1); |
| | | |
| | | .user-avatar-container { |
| | | border-color: rgba(0, 0, 0, 0.1); |
| | | } |
| | | |
| | | .user-info { |
| | | .username { |
| | | color: #333; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .user-avatar-container { |
| | | margin-bottom: 10px; |
| | | border: 2px dashed rgba(255, 255, 255, 0.3); |
| | | border-radius: 4px; |
| | | width: 54px; |
| | | height: 54px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | |
| | | .user-avatar { |
| | | width: 38px; |
| | | height: 38px; |
| | | border-radius: 4px; |
| | | } |
| | | } |
| | | |
| | | .user-info { |
| | | width: 100%; |
| | | text-align: center; |
| | | |
| | | .username { |
| | | color: #fff; |
| | | font-size: 16px; |
| | | font-weight: 500; |
| | | margin-bottom: 16px; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | white-space: nowrap; |
| | | } |
| | | |
| | | .action-buttons { |
| | | .action-button { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | background: rgba(56, 131, 250, 0.11); |
| | | border-radius: 9px; |
| | | border: 1px solid rgba(255, 255, 255, 0.3); |
| | | color: #fff; |
| | | padding: 10px; |
| | | margin-bottom: 10px; |
| | | border-radius: 4px; |
| | | cursor: pointer; |
| | | transition: background-color 0.3s; |
| | | |
| | | &:hover { |
| | | background: rgba(56, 131, 250, 0.2); |
| | | } |
| | | |
| | | .el-icon { |
| | | margin-right: 8px; |
| | | font-size: 16px; |
| | | } |
| | | |
| | | span { |
| | | font-size: 14px; |
| | | } |
| | | |
| | | &.theme-light { |
| | | background-color: rgba(56, 131, 250, 1); |
| | | color: #fff; |
| | | border: 1px solid rgba(56, 131, 250, 0.8); |
| | | |
| | | &:hover { |
| | | background-color: rgba(56, 131, 250, 0.9); |
| | | } |
| | | |
| | | .el-icon { |
| | | color: #fff; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | .collapsed-actions { |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | width: 100%; |
| | | |
| | | .action-icon { |
| | | width: 40px; |
| | | height: 40px; |
| | | margin-bottom: 8px; |
| | | background: rgba(56, 131, 250, 0.11); |
| | | border: 1px solid rgba(255, 255, 255, 0.3); |
| | | border-radius: 4px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | cursor: pointer; |
| | | |
| | | &:hover { |
| | | background: rgba(56, 131, 250, 0.2); |
| | | } |
| | | |
| | | .el-icon { |
| | | font-size: 20px; |
| | | color: #fff; |
| | | } |
| | | |
| | | &.theme-light { |
| | | background: rgba(56, 131, 250, 1); |
| | | border: 1px solid rgba(56, 131, 250, 0.8); |
| | | |
| | | &:hover { |
| | | background: rgba(56, 131, 250, 0.9); |
| | | } |
| | | |
| | | .el-icon { |
| | | color: #fff; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | .theme-light { |
| | | :deep(.custom-menu) { |
| | | // Override Element Plus menu styles for light theme |
| | | .el-menu-item { |
| | | &.is-active { |
| | | background-color: #3883FA !important; |
| | | color: #fff !important; |
| | | } |
| | | |
| | | &:hover { |
| | | background-color: rgba(56, 131, 250, 0.1) !important; |
| | | } |
| | | } |
| | | |
| | | .el-sub-menu { |
| | | .el-sub-menu__title { |
| | | &:hover { |
| | | background-color: rgba(56, 131, 250, 0.1) !important; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // æ·»å æ·±è²æ¨¡å¼ä¸ç¨æ ·å¼ |
| | | .theme-dark { |
| | | :deep(.custom-menu) { |
| | | // Override Element Plus menu styles for dark theme |
| | | .el-menu-item { |
| | | &.is-active { |
| | | background-color: #4e77f8 !important; |
| | | color: #ffffff !important; |
| | | font-weight: bold; |
| | | box-shadow: 0 2px 10px rgba(78, 119, 248, 0.6); |
| | | position: relative; |
| | | |
| | | // 左侧æç¤ºæ¡ |
| | | |
| | | } |
| | | |
| | | &:hover { |
| | | background-color: rgba(78, 119, 248, 0.2) !important; |
| | | } |
| | | } |
| | | |
| | | .el-sub-menu { |
| | | &.is-active { |
| | | > .el-sub-menu__title { |
| | | color: #4e77f8 !important; |
| | | font-weight: bold; |
| | | } |
| | | } |
| | | |
| | | .el-sub-menu__title { |
| | | &:hover { |
| | | background-color: rgba(78, 119, 248, 0.2) !important; |
| | | } |
| | | } |
| | | |
| | | // åµå¥åèåæ ·å¼ |
| | | .el-menu { |
| | | .el-menu-item { |
| | | &.is-active { |
| | | background-color: #4e77f8 !important; |
| | | color: #ffffff !important; |
| | | } |
| | | } |
| | | |
| | | .el-sub-menu { |
| | | &.is-active { |
| | | > .el-sub-menu__title { |
| | | color: #4e77f8 !important; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // Add global style to override Element Plus defaults |
| | | :global(.el-menu--vertical .el-menu-item), |
| | | :global(.el-menu--vertical .el-sub-menu__title) { |
| | | height: 38px !important; |
| | | line-height: 38px !important; |
| | | } |
| | | |
| | | // Add styles for collapsed menu items |
| | | :deep(.custom-menu.el-menu--collapse) { |
| | | width: 54px !important; |
| | | |
| | | .el-menu-item, .el-sub-menu__title { |
| | | width: 36px !important; |
| | | min-width: 36px !important; |
| | | margin: 4px 9px !important; /* 9pxæ¯ä¸ºäºç¡®ä¿å±
ä¸ï¼(54px宽 - 36pxèå项) / 2 = 9px */ |
| | | padding: 0 !important; |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | border-radius: 4px; |
| | | |
| | | &.is-active { |
| | | background-color: #3883FA !important; |
| | | color: #fff !important; |
| | | box-shadow: 0 2px 6px rgba(56, 131, 250, 0.4); |
| | | transform: scale(0.95); |
| | | transition: all 0.2s ease; |
| | | } |
| | | |
| | | .el-icon, .svg-icon { |
| | | margin: 0 !important; |
| | | font-size: 18px !important; |
| | | |
| | | svg { |
| | | width: 1.2em; |
| | | height: 1.2em; |
| | | } |
| | | } |
| | | |
| | | // ç¡®ä¿æå æ¶åèåçæ é¢ä¹å±
ä¸å¯¹é½ |
| | | .el-sub-menu__icon-arrow { |
| | | display: none; |
| | | } |
| | | } |
| | | |
| | | // ç¡®ä¿æå æ¶å¼¹åºçåèåææ£ç¡®æ ·å¼ |
| | | .el-tooltip__trigger:focus:not(.focusing) { |
| | | outline: none; |
| | | } |
| | | } |
| | | |
| | | // æ·±è²æ¨¡å¼ä¸æå èåçæ ·å¼ |
| | | .theme-dark { |
| | | :deep(.custom-menu.el-menu--collapse) { |
| | | .el-menu-item, .el-sub-menu__title { |
| | | &.is-active { |
| | | background-color: #4e77f8 !important; |
| | | color: #ffffff !important; |
| | | box-shadow: 0 2px 8px rgba(78, 119, 248, 0.6); |
| | | } |
| | | |
| | | &:hover { |
| | | background-color: rgba(78, 119, 248, 0.2) !important; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </style> |
| | |
| | | bottom: 0px; |
| | | } |
| | | :deep(.el-scrollbar__wrap) { |
| | | height: 39px; |
| | | height: 34px !important; |
| | | } |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <div id="tags-view-container" class="tags-view-container"> |
| | | <div id="tags-view-container" class="tags-view-container" :class="{'theme-dark': sideTheme === 'theme-dark', 'theme-light': sideTheme === 'theme-light'}"> |
| | | <scroll-pane ref="scrollPaneRef" class="tags-view-wrapper" @scroll="handleScroll"> |
| | | <router-link |
| | | v-for="tag in visitedViews" |
| | |
| | | const visitedViews = computed(() => useTagsViewStore().visitedViews) |
| | | const routes = computed(() => usePermissionStore().routes) |
| | | const theme = computed(() => useSettingsStore().theme) |
| | | const sideTheme = computed(() => useSettingsStore().sideTheme) |
| | | |
| | | watch(route, () => { |
| | | addTags() |
| | |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .themeDark { |
| | | .tags-view-container { |
| | | height: 56px; |
| | | width: 100%; |
| | | background: #1a235d; |
| | | // border-bottom: 1px solid #d8dce5; |
| | | box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 0 3px 0 rgba(0, 0, 0, 0.04); |
| | | .tags-view-wrapper { |
| | | .tags-view-item { |
| | | display: inline-block; |
| | | position: relative; |
| | | cursor: pointer; |
| | | height: 36px; |
| | | line-height: 36px; |
| | | border: 1px solid #5278f5; |
| | | color: #fff; |
| | | // background: #3271eb; |
| | | padding: 0 14px; |
| | | font-size: 14px; |
| | | margin-left: 6px; |
| | | height: 34px; |
| | | width: calc(100% - 42px); |
| | | margin-top: 10px; |
| | | border-radius: 4px; |
| | | font-family: OPPOSans, OPPOSans; |
| | | &:first-of-type { |
| | | margin-left: 16px; |
| | | } |
| | | &:last-of-type { |
| | | margin-right: 15px; |
| | | } |
| | | &.active { |
| | | background-color: #4e77f8 !important; |
| | | margin-left: 14px; |
| | | box-sizing: border-box; |
| | | box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 0 3px 0 rgba(0, 0, 0, 0.04); |
| | | |
| | | &.theme-dark { |
| | | background: #0A3465; |
| | | .tags-view-item { |
| | | color: #fff; |
| | | border-color: #4e77f8 !important; |
| | | &::before { |
| | | content: ""; |
| | | background: #fff; |
| | | display: inline-block; |
| | | width: 8px; |
| | | height: 8px; |
| | | border-radius: 50%; |
| | | position: relative; |
| | | margin-right: 5px; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | .contextmenu { |
| | | margin: 0; |
| | | background: #fff; |
| | | z-index: 3000; |
| | | position: absolute; |
| | | list-style-type: none; |
| | | padding: 5px 0; |
| | | border-radius: 4px; |
| | | font-size: 12px; |
| | | font-weight: 400; |
| | | color: #333; |
| | | box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, 0.3); |
| | | li { |
| | | margin: 0; |
| | | padding: 7px 16px; |
| | | cursor: pointer; |
| | | &:hover { |
| | | background: #eee; |
| | | } |
| | | } |
| | | border: 1px solid #0c4685; |
| | | background: rgba(10, 52, 101, .48); |
| | | border-radius: 5px; |
| | | |
| | | &.active { |
| | | background-color: var(--el-color-primary) !important; |
| | | color: #fff !important; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .themeLight { |
| | | .tags-view-container { |
| | | height: 56px; |
| | | width: 100%; |
| | | &.theme-light { |
| | | background: #fff; |
| | | // border-bottom: 1px solid #d8dce5; |
| | | box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 0 3px 0 rgba(0, 0, 0, 0.04); |
| | | .tags-view-item { |
| | | color: #495060; |
| | | background: #fff; |
| | | border: 1px solid #d8dce5; |
| | | |
| | | &.active { |
| | | background-color: var(--el-color-primary) !important; |
| | | color: #fff !important; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .tags-view-wrapper { |
| | | .tags-view-item { |
| | | display: inline-block; |
| | | position: relative; |
| | | cursor: pointer; |
| | | height: 36px; |
| | | line-height: 36px; |
| | | border: 1px solid #d8dce5; |
| | | color: #495060; |
| | | background: #fff; |
| | | padding: 0 14px; |
| | | font-size: 14px; |
| | | margin-left: 6px; |
| | | margin-top: 10px; |
| | | border-radius: 4px; |
| | | font-family: OPPOSans, OPPOSans; |
| | | height: 26px; |
| | | line-height: 26px; |
| | | border-radius: 3px; |
| | | padding: 0 10px; |
| | | font-size: 12px; |
| | | margin-left: 5px; |
| | | margin-top: 4px; |
| | | &:first-of-type { |
| | | margin-left: 16px; |
| | | margin-left: 5px; |
| | | } |
| | | &:last-of-type { |
| | | margin-right: 15px; |
| | | margin-right: 5px; |
| | | } |
| | | &.active { |
| | | background-color: #42b983; |
| | |
| | | height: 8px; |
| | | border-radius: 50%; |
| | | position: relative; |
| | | margin-right: 5px; |
| | | margin-right: 2px; |
| | | } |
| | | } |
| | | } |
| | |
| | | cursor: pointer; |
| | | &:hover { |
| | | background: #eee; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | .scroll-container .el-scrollbar__wrap { |
| | | height: 50px !important; |
| | | height: 34px !important; |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <div :class="classObj" class="app-wrapper" :style="{ '--current-color': theme }"> |
| | | <div v-if="device === 'mobile' && sidebar.opened" class="drawer-bg" @click="handleClickOutside"/> |
| | | <div class="navbar-container"> |
| | | <div class="navbar"> |
| | | <div class="left"> |
| | | <div class="sidebar-logo-container" :class="{ collapse: !sidebar.opened }"> |
| | | <div class="logo" v-if="systemInfo && systemInfo.leftLogo"> |
| | | <img v-if="sideTheme === 'theme-dark'" :src="systemInfo.leftLogo" class="sidebar-logo" /> |
| | | <img v-else :src="systemInfo.leftLogo" class="sidebar-logo" /> |
| | | </div> |
| | | <div class="name" v-if="sidebar.opened" :style="{ color: sideTheme === 'theme-dark' ? '#fff' : '#333' }"> |
| | | {{ title }} |
| | | </div> |
| | | </div> |
| | | <hamburger |
| | | id="hamburger-container" |
| | | :is-active="appStore.sidebar.opened" |
| | | class="hamburger-container" |
| | | @toggleClick="toggleSideBar" |
| | | /> |
| | | </div> |
| | | <top-nav /> |
| | | <div class="right"> |
| | | <!-- æ¥è¦å大模åæé® --> |
| | | <div class="right-menu"> |
| | | <!-- æ¥è¦æé® --> |
| | | <div class="right-menu-item alarm-btn" @click="goToAlarm"> |
| | | <el-badge :value="alarmCount" :max="99" class="alarm-badge"> |
| | | <svg-icon icon-class="bell" class="right-menu-icon" /> |
| | | </el-badge> |
| | | <span class="right-menu-text">æ¥è¦</span> |
| | | </div> |
| | | |
| | | <!-- 大模åæé® --> |
| | | <div class="right-menu-item ai-btn" @click="openAIModel"> |
| | | <svg-icon icon-class="ai" class="right-menu-icon" /> |
| | | <span class="right-menu-text">æºè½å©æ</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="content-container"> |
| | | <sidebar v-if="!sidebar.hide" class="sidebar-container" /> |
| | | <div :class="{ hasTagsView: needTagsView, sidebarHide: sidebar.hide }" class="main-container"> |
| | | <div :class="{ 'fixed-header': fixedHeader }"> |
| | | <navbar @setLayout="setLayout" v-if="!sidebar.hide"/> |
| | | <tags-view v-if="needTagsView" v-show="!sidebar.hide"/> |
| | | </div> |
| | | <app-main /> |
| | | <settings ref="settingRef" /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, computed, watchEffect, onMounted } from 'vue' |
| | | import { useWindowSize } from '@vueuse/core' |
| | | import { useRoute, useRouter } from 'vue-router' |
| | | import Sidebar from './components/Sidebar/index.vue' |
| | | import { AppMain, Navbar, Settings, TagsView } from './components' |
| | | import { AppMain, Settings, TagsView } from './components' |
| | | import TopNav from '@/components/TopNav' |
| | | import Hamburger from '@/components/Hamburger' |
| | | import defaultSettings from '@/settings' |
| | | import Cookies from "js-cookie" |
| | | |
| | | import useAppStore from '@/store/modules/app' |
| | | import useSettingsStore from '@/store/modules/settings' |
| | | |
| | | const route = useRoute() |
| | | const router = useRouter() |
| | | const appStore = useAppStore() |
| | | const settingsStore = useSettingsStore() |
| | | const theme = computed(() => settingsStore.theme); |
| | | const sideTheme = computed(() => settingsStore.sideTheme); |
| | | const sidebar = computed(() => useAppStore().sidebar); |
| | | const device = computed(() => useAppStore().device); |
| | | const sidebar = computed(() => appStore.sidebar); |
| | | const device = computed(() => appStore.device); |
| | | const needTagsView = computed(() => settingsStore.tagsView); |
| | | const fixedHeader = computed(() => settingsStore.fixedHeader); |
| | | const systemInfo = JSON.parse(Cookies.get("SystemInfo") || '{"systemName":"æºæ±è½æºç®¡çç³»ç»","leftLogo":""}') |
| | | const title = systemInfo.systemName || import.meta.env.VITE_APP_TITLE |
| | | |
| | | // æ¥è¦æ°éï¼å¯ä»¥ä»æ¥å£è·å |
| | | const alarmCount = ref(5) |
| | | |
| | | // è·³è½¬å°æ¥è¦é¡µé¢ |
| | | function goToAlarm() { |
| | | router.push('/alarmmanage/measuremen?modelCode=BJGL') |
| | | } |
| | | |
| | | // æå¼AI大模åå¯¹è¯æ¡ |
| | | function openAIModel() { |
| | | // è·³è½¬å°æå®çURL |
| | | window.open('https://deepseek.tan-zhonghe.com/chat', '_blank') |
| | | } |
| | | |
| | | const classObj = computed(() => ({ |
| | | hideSidebar: !sidebar.value.opened, |
| | |
| | | })) |
| | | |
| | | const { width, height } = useWindowSize(); |
| | | const WIDTH = 992; // refer to Bootstrap's responsive design |
| | | const WIDTH = 992; |
| | | |
| | | watchEffect(() => { |
| | | if (device.value === 'mobile' && sidebar.value.opened) { |
| | | useAppStore().closeSideBar({ withoutAnimation: false }) |
| | | appStore.closeSideBar({ withoutAnimation: false }) |
| | | } |
| | | if (width.value - 1 < WIDTH) { |
| | | useAppStore().toggleDevice('mobile') |
| | | useAppStore().closeSideBar({ withoutAnimation: true }) |
| | | appStore.toggleDevice('mobile') |
| | | appStore.closeSideBar({ withoutAnimation: true }) |
| | | } else { |
| | | useAppStore().toggleDevice('desktop') |
| | | appStore.toggleDevice('desktop') |
| | | } |
| | | }) |
| | | |
| | | // çå¬è·¯ç±ååï¼å¤çé¦é¡µçä¾§è¾¹æ æ¾ç¤º |
| | | watchEffect(() => { |
| | | // æ£æ¥æ¯å¦æ¯é¦é¡µè·¯ç±ï¼ä½æé¤/index/indexåè·¯ç± |
| | | if ((route.path === '/index' || route.path === '/') && route.path !== '/index/index') { |
| | | // é¦é¡µè·¯ç±ï¼ç¡®ä¿ä¾§è¾¹æ ä¸éèï¼ä½ç¶ææ¯æå ç |
| | | appStore.toggleSideBarHide(false) // æ¹ä¸ºä¸éèä¾§è¾¹æ |
| | | } else if (route.meta && route.meta.showSidebar === false) { |
| | | // å¦æè·¯ç±æç¡®æå®éèä¾§è¾¹æ |
| | | appStore.toggleSideBarHide(true) |
| | | } else { |
| | | // å
¶ä»è·¯ç±ï¼ç¡®ä¿ä¾§è¾¹æ å¯è§ |
| | | appStore.toggleSideBarHide(false) |
| | | } |
| | | }) |
| | | |
| | | // ç»ä»¶æè½½æ¶ï¼ç¡®ä¿é¦é¡µä¾§è¾¹æ ç¶ææ£ç¡® |
| | | onMounted(() => { |
| | | // 妿å½åæ¯é¦é¡µå页é¢ï¼åªç¡®ä¿ä¾§è¾¹æ ä¸è¢«éèï¼ä½ä¿ææå /å±å¼ç¶æä¸å |
| | | if (route.path === '/index/index') { |
| | | // åªè®¾ç½®ä¸éèä¾§è¾¹æ ï¼ä½ä¸æ¹åå
¶å±å¼/æå ç¶æ |
| | | appStore.toggleSideBarHide(false) |
| | | // ä¸å强å¶è®¾ç½®opened为trueï¼ä¿æç¨æ·ä¹åç设置 |
| | | } |
| | | }) |
| | | |
| | | function handleClickOutside() { |
| | | useAppStore().closeSideBar({ withoutAnimation: false }) |
| | | appStore.closeSideBar({ withoutAnimation: false }) |
| | | } |
| | | |
| | | function toggleSideBar() { |
| | | appStore.toggleSideBar() |
| | | } |
| | | |
| | | const settingRef = ref(null); |
| | |
| | | .app-wrapper { |
| | | @include clearfix; |
| | | position: relative; |
| | | height: 100%; |
| | | width: 100%; |
| | | height: 100vh; |
| | | width: 100vw; |
| | | display: flex; |
| | | flex-direction: column; |
| | | overflow-x: hidden; |
| | | |
| | | &.mobile.openSidebar { |
| | | position: fixed; |
| | |
| | | z-index: 999; |
| | | } |
| | | |
| | | .fixed-header { |
| | | .navbar-container { |
| | | position: fixed; |
| | | top: 0; |
| | | left: 0; |
| | | right: 0; |
| | | height: 60px; |
| | | z-index: 1000; |
| | | width: 100%; |
| | | } |
| | | |
| | | .navbar { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | background-color: var(--current-color); |
| | | height: 60px; |
| | | width: 100%; |
| | | padding: 0; |
| | | |
| | | .left { |
| | | display: flex; |
| | | align-items: center; |
| | | padding-left: 16px; |
| | | |
| | | .sidebar-logo-container { |
| | | display: flex; |
| | | align-items: center; |
| | | height: 60px; |
| | | padding: 0 15px; |
| | | min-width: 220px; |
| | | |
| | | .logo { |
| | | width: 40px; |
| | | height: 40px; |
| | | margin-right: 10px; |
| | | flex-shrink: 0; |
| | | |
| | | .sidebar-logo { |
| | | width: 100%; |
| | | height: 100%; |
| | | } |
| | | } |
| | | |
| | | .name { |
| | | font-family: OPPOSans, OPPOSans; |
| | | font-weight: bold; |
| | | font-size: 20px; |
| | | white-space: nowrap; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | } |
| | | |
| | | &.collapse { |
| | | min-width: 70px; |
| | | |
| | | .name { |
| | | display: none; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | .right { |
| | | display: flex; |
| | | align-items: center; |
| | | padding-right: 20px; |
| | | |
| | | .right-menu { |
| | | display: flex; |
| | | align-items: center; |
| | | |
| | | .right-menu-item { |
| | | display: flex; |
| | | align-items: center; |
| | | margin-left: 20px; |
| | | cursor: pointer; |
| | | color: #fff; |
| | | font-size: 14px; |
| | | transition: all 0.3s; |
| | | |
| | | &:hover { |
| | | opacity: 0.8; |
| | | } |
| | | |
| | | .right-menu-icon { |
| | | font-size: 18px; |
| | | margin-right: 5px; |
| | | } |
| | | |
| | | .right-menu-text { |
| | | margin-left: 5px; |
| | | } |
| | | } |
| | | |
| | | .alarm-badge { |
| | | :deep(.el-badge__content) { |
| | | background-color: #f56c6c; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | .content-container { |
| | | display: flex; |
| | | position: relative; |
| | | margin-top: 60px; |
| | | height: calc(100vh - 60px); |
| | | width: 100%; |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .sidebar-container { |
| | | position: relative; |
| | | height: 100%; |
| | | z-index: 900; |
| | | flex-shrink: 0; |
| | | width: $base-sidebar-width; |
| | | |
| | | } |
| | | |
| | | .fixed-header { |
| | | position: fixed; |
| | | top: 60px; |
| | | right: 0; |
| | | z-index: 9; |
| | | width: calc(100% - #{$base-sidebar-width}); |
| | | transition: width 0.28s; |
| | | display: flex; |
| | | flex-direction: column; |
| | | box-sizing: border-box; |
| | | padding: 0; |
| | | } |
| | | |
| | | .hideSidebar .fixed-header { |
| | |
| | | .mobile .fixed-header { |
| | | width: 100%; |
| | | } |
| | | |
| | | .main-container { |
| | | flex: 1; |
| | | position: relative; |
| | | height: 100%; |
| | | overflow-y: auto; |
| | | overflow-x: hidden; |
| | | transition: margin-left 0.28s; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .hideSidebar .main-container { |
| | | margin-left: 0; |
| | | } |
| | | |
| | | .sidebarHide .main-container { |
| | | margin-left: 0; |
| | | } |
| | | |
| | | .mobile .main-container { |
| | | margin-left: 0; |
| | | } |
| | | |
| | | .hideSidebar .sidebar-container { |
| | | width: 54px; |
| | | } |
| | | |
| | | .sidebarHide .sidebar-container { |
| | | display: none; |
| | | } |
| | | |
| | | .themeDark { |
| | | .navbar { |
| | | background: #002866 !important; |
| | | } |
| | | |
| | | .sidebar-container { |
| | | background-color: #002866 !important; |
| | | } |
| | | } |
| | | </style> |
| | |
| | | import useUserStore from '@/store/modules/user' |
| | | import useSettingsStore from '@/store/modules/settings' |
| | | import usePermissionStore from '@/store/modules/permission' |
| | | import useTagsViewStore from '@/store/modules/tagsView' |
| | | |
| | | NProgress.configure({ showSpinner: false }); |
| | | |
| | | const whiteList = ['/login', '/register', '/energy'] |
| | | |
| | | /** |
| | | * æ¥æ¾ææ·±å±çåèåå¹¶æå»ºå®æ´è·¯å¾ |
| | | */ |
| | | function findDeepestPath(route) { |
| | | if (!route) return { path: null, query: null }; |
| | | |
| | | // é¦å
æ·»å å½åèç¹çè·¯å¾ |
| | | let currentNode = route; |
| | | let pathSegments = []; |
| | | |
| | | if (currentNode.path) { |
| | | pathSegments.push(currentNode.path); |
| | | } |
| | | |
| | | // é屿·»å åè·¯å¾ |
| | | while (currentNode.children && currentNode.children.length > 0) { |
| | | const firstChild = currentNode.children.find(child => !child.hidden); |
| | | if (!firstChild) break; |
| | | |
| | | // è·³è¿ParentViewç±»åçä¸é´èç¹ |
| | | if (firstChild.component === 'ParentView' || |
| | | (typeof firstChild.component === 'object' && |
| | | firstChild.component.name === 'ParentView')) { |
| | | currentNode = firstChild; |
| | | // å¦æè·¯å¾ä¸æ¯ä»¥/å¼å¤´ï¼åæ·»å å°è·¯å¾çæ®µä¸ |
| | | if (!firstChild.path.startsWith('/')) { |
| | | pathSegments.push(firstChild.path); |
| | | } else { |
| | | // 妿æ¯ç»å¯¹è·¯å¾ï¼åæ¿æ¢ä¹åææè·¯å¾ |
| | | pathSegments = [firstChild.path]; |
| | | } |
| | | continue; |
| | | } |
| | | |
| | | // æ®éèç¹å¤ç |
| | | currentNode = firstChild; |
| | | // å¦æè·¯å¾ä¸æ¯ä»¥/å¼å¤´ï¼åæ·»å å°è·¯å¾çæ®µä¸ |
| | | if (!firstChild.path.startsWith('/')) { |
| | | pathSegments.push(firstChild.path); |
| | | } else { |
| | | // 妿æ¯ç»å¯¹è·¯å¾ï¼åæ¿æ¢ä¹åææè·¯å¾ |
| | | pathSegments = [firstChild.path]; |
| | | } |
| | | |
| | | // 妿å°è¾¾å¶åèç¹ï¼åç»ææ¥æ¾ |
| | | if (!firstChild.children || firstChild.children.length === 0) { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | // æå»ºæç»è·¯å¾ |
| | | let targetPath = ''; |
| | | if (pathSegments.length > 0) { |
| | | // å¦æç¬¬ä¸æ®µä¸æ¯ä»¥/å¼å¤´ï¼æ·»å / |
| | | if (!pathSegments[0].startsWith('/')) { |
| | | pathSegments[0] = '/' + pathSegments[0]; |
| | | } |
| | | |
| | | // ç»åè·¯å¾ |
| | | targetPath = pathSegments.reduce((fullPath, segment, index) => { |
| | | if (segment.startsWith('/')) { |
| | | return segment; |
| | | } else if (index === 0) { |
| | | return segment; |
| | | } else { |
| | | // ç¡®ä¿è·¯å¾ä¹é´ä¸ä¼åºç°éå¤çææ |
| | | const base = fullPath.endsWith('/') ? fullPath.slice(0, -1) : fullPath; |
| | | const part = segment.startsWith('/') ? segment : '/' + segment; |
| | | return `${base}${part}`; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | return { |
| | | path: targetPath, |
| | | query: currentNode.query |
| | | }; |
| | | } |
| | | |
| | | router.beforeEach((to, from, next) => { |
| | | NProgress.start() |
| | |
| | | router.addRoute(route) // å¨ææ·»å å¯è®¿é®è·¯ç±è¡¨ |
| | | } |
| | | }) |
| | | |
| | | // 妿æ¯é¦é¡µï¼èªå¨éå®åå°ç¬¬ä¸ä¸ªèå |
| | | if (to.path === '/' || to.path === '/index') { |
| | | const permissionStore = usePermissionStore() |
| | | const topMenus = permissionStore.topbarRouters.filter(menu => !menu.hidden) |
| | | if (topMenus.length > 0) { |
| | | // 跳转å°ç¬¬ä¸ä¸ªèå |
| | | const firstMenu = topMenus[0] |
| | | |
| | | // æ¥æ¾ææ·±å±çåèåå¹¶æå»ºè·¯å¾ |
| | | const { path, query } = findDeepestPath(firstMenu); |
| | | |
| | | if (path) { |
| | | // æææ·±å±åèåï¼è·³è½¬å°è¯¥èå |
| | | if (query) { |
| | | next({ path, query, replace: true }); |
| | | } else { |
| | | next({ path, replace: true }); |
| | | } |
| | | return; |
| | | } else if (firstMenu.children && firstMenu.children.length > 0) { |
| | | // 使ç¨åæé»è¾ |
| | | const firstChild = firstMenu.children[0] |
| | | const childPath = firstMenu.path.endsWith('/') ? firstMenu.path + firstChild.path : `${firstMenu.path}/${firstChild.path}` |
| | | next({ path: childPath, replace: true }) |
| | | return |
| | | } else { |
| | | // 没æåèåï¼ç´æ¥è·³è½¬ |
| | | next({ path: firstMenu.path, replace: true }) |
| | | return |
| | | } |
| | | } |
| | | } |
| | | |
| | | next({ ...to, replace: true }) // hackæ¹æ³ ç¡®ä¿addRoutes已宿 |
| | | }) |
| | | }).catch(err => { |
| | |
| | | }) |
| | | }) |
| | | } else { |
| | | // 妿æ¯é¦é¡µï¼èªå¨éå®åå°ç¬¬ä¸ä¸ªèå |
| | | if (to.path === '/' || to.path === '/index') { |
| | | const permissionStore = usePermissionStore() |
| | | const topMenus = permissionStore.topbarRouters.filter(menu => !menu.hidden) |
| | | if (topMenus.length > 0) { |
| | | // 跳转å°ç¬¬ä¸ä¸ªèå |
| | | const firstMenu = topMenus[0] |
| | | |
| | | // æ¥æ¾ææ·±å±çåèåå¹¶æå»ºè·¯å¾ |
| | | const { path, query } = findDeepestPath(firstMenu); |
| | | |
| | | if (path) { |
| | | // æææ·±å±åèåï¼è·³è½¬å°è¯¥èå |
| | | if (query) { |
| | | next({ path, query, replace: true }); |
| | | } else { |
| | | next({ path, replace: true }); |
| | | } |
| | | return; |
| | | } else if (firstMenu.children && firstMenu.children.length > 0) { |
| | | // 使ç¨åæé»è¾ |
| | | const firstChild = firstMenu.children[0] |
| | | const childPath = firstMenu.path.endsWith('/') ? firstMenu.path + firstChild.path : `${firstMenu.path}/${firstChild.path}` |
| | | next({ path: childPath, replace: true }) |
| | | return |
| | | } else { |
| | | // 没æåèåï¼ç´æ¥è·³è½¬ |
| | | next({ path: firstMenu.path, replace: true }) |
| | | return |
| | | } |
| | | } |
| | | } |
| | | |
| | | // èªå¨å¤ç带æéå®åçè·¯ç± |
| | | if (to.matched.length > 0 && to.matched[0].path === to.path) { |
| | | const currentRouteConfig = router.getRoutes().find(r => r.path === to.path); |
| | | |
| | | if (currentRouteConfig && currentRouteConfig.children && currentRouteConfig.children.length > 0) { |
| | | // æåè·¯ç±ï¼èªå¨å¯¼èªå°ææ·±å±åèå |
| | | const { path, query } = findDeepestPath(currentRouteConfig); |
| | | |
| | | if (path && path !== to.path) { |
| | | if (query) { |
| | | next({ path, query, replace: true }); |
| | | } else { |
| | | next({ path, replace: true }); |
| | | } |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | |
| | | next() |
| | | } |
| | | } |
| | |
| | | |
| | | router.afterEach(() => { |
| | | NProgress.done() |
| | | |
| | | // ç§»é¤ææå¯è½çé¦é¡µæ ç¾ |
| | | const tagsViewStore = useTagsViewStore(); |
| | | if (tagsViewStore && tagsViewStore.visitedViews) { |
| | | tagsViewStore.visitedViews = tagsViewStore.visitedViews.filter( |
| | | tag => tag.path !== '/index' && tag.path !== '/' && tag.name !== 'Index' |
| | | ); |
| | | } |
| | | }) |
| | |
| | | import { createWebHistory, createRouter } from 'vue-router' |
| | | /* Layout */ |
| | | import Layout from '@/layout' |
| | | import useAppStore from '@/store/modules/app' |
| | | |
| | | /** |
| | | * Note: è·¯ç±é
置项 |
| | |
| | | path: '/index', |
| | | component: () => import('@/views/index'), |
| | | name: 'Index', |
| | | meta: { title: 'é¦é¡µ', icon: 'dashboard', affix: true } |
| | | meta: { title: 'é¦é¡µ', icon: 'dashboard', affix: true, showSidebar: true, breadcrumb: false } |
| | | } |
| | | ] |
| | | }, |
| | |
| | | sidebar: { |
| | | opened: sessionStorage.getItem('sidebarStatus') ? !!+sessionStorage.getItem('sidebarStatus') : true, |
| | | withoutAnimation: false, |
| | | hide: false |
| | | hide: sessionStorage.getItem('sidebarHide') ? JSON.parse(sessionStorage.getItem('sidebarHide')) : false |
| | | }, |
| | | device: 'desktop', |
| | | size: sessionStorage.getItem('size') || 'default' |
| | |
| | | }, |
| | | toggleSideBarHide(status) { |
| | | this.sidebar.hide = status |
| | | sessionStorage.setItem('sidebarHide', status) |
| | | }, |
| | | openMenu() { |
| | | this.sidebar.hide = false |
| | | this.sidebar.opened = true |
| | | sessionStorage.setItem('sidebarHide', 'false') |
| | | sessionStorage.setItem('sidebarStatus', 1) |
| | | }, |
| | | showCollapsedSidebar() { |
| | | this.sidebar.hide = false |
| | | this.sidebar.opened = false |
| | | this.sidebar.withoutAnimation = false |
| | | sessionStorage.setItem('sidebarHide', 'false') |
| | | sessionStorage.setItem('sidebarStatus', 0) |
| | | } |
| | | } |
| | | }) |
| | |
| | | }) |
| | | |
| | | // éååå°ä¼ æ¥çè·¯ç±å符串ï¼è½¬æ¢ä¸ºç»ä»¶å¯¹è±¡ |
| | | function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) { |
| | | function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false, parentRoute = null) { |
| | | return asyncRouterMap.filter(route => { |
| | | // ä¸åè¿æ»¤æé¦é¡µçæ¿ç¸å
³è·¯ç± |
| | | /* |
| | | // è¿æ»¤æé¦é¡µçæ¿ç¸å
³è·¯ç± |
| | | if (route.name === 'Index' && route.meta && route.meta.title === 'é¦é¡µçæ¿') { |
| | | return false; |
| | | } |
| | | |
| | | // 妿æ¯é¦é¡µçæ¿çåèåï¼ä¹è¿æ»¤æ |
| | | if (route.path === '/index' || route.path === 'index' || |
| | | (route.meta && route.meta.title === 'é¦é¡µçæ¿')) { |
| | | return false; |
| | | } |
| | | */ |
| | | |
| | | // 设置ç¶è·¯ç±å¼ç¨ |
| | | if (parentRoute) { |
| | | route.parent = parentRoute; |
| | | } |
| | | |
| | | if (type && route.children) { |
| | | route.children = filterChildren(route.children) |
| | | } |
| | |
| | | route.component = loadView(route.component) |
| | | } |
| | | } |
| | | // å¤ç query åæ°ï¼å°å符串转æ¢ä¸ºå¯¹è±¡ |
| | | if (route.query && typeof route.query === 'string') { |
| | | try { |
| | | route.query = JSON.parse(route.query); |
| | | } catch (error) { |
| | | console.error('Error parsing query string:', route.query, error); |
| | | } |
| | | } |
| | | if (route.children != null && route.children && route.children.length) { |
| | | route.children = filterAsyncRouter(route.children, route, type) |
| | | // å°å½åè·¯ç±ä½ä¸ºç¶è·¯ç±ä¼ éç»åè·¯ç± |
| | | route.children = filterAsyncRouter(route.children, route, type, route) |
| | | } else { |
| | | delete route['children'] |
| | | delete route['redirect'] |
| | |
| | | if (el.children && el.children.length) { |
| | | if (el.component === 'ParentView' && !lastRouter) { |
| | | el.children.forEach(c => { |
| | | c.path = el.path + '/' + c.path |
| | | // 设置ç¶è·¯ç±å¼ç¨ |
| | | c.parent = el; |
| | | |
| | | // ç¡®ä¿è·¯å¾æ ¼å¼æ£ç¡®æ¼æ¥ |
| | | if (el.path) { |
| | | if (c.path.startsWith('/')) { |
| | | // ç»å¯¹è·¯å¾ä¿æä¸å |
| | | // ä½ä¹è®¾ç½®åå§ç¶è·¯å¾ç¨äºèåå¯¼èª |
| | | c.parentPath = el.path; |
| | | } else { |
| | | // ç¸å¯¹è·¯å¾éè¦æ¼æ¥ |
| | | c.path = el.path.endsWith('/') ? el.path + c.path : el.path + '/' + c.path; |
| | | } |
| | | } |
| | | |
| | | if (c.children && c.children.length) { |
| | | children = children.concat(filterChildren(c.children, c)) |
| | | return |
| | |
| | | } |
| | | } |
| | | if (lastRouter) { |
| | | el.path = lastRouter.path + '/' + el.path |
| | | // 设置ç¶è·¯ç±å¼ç¨ |
| | | el.parent = lastRouter; |
| | | |
| | | // ç¡®ä¿è·¯å¾æ ¼å¼æ£ç¡®æ¼æ¥ |
| | | if (lastRouter.path) { |
| | | if (el.path.startsWith('/')) { |
| | | // ç»å¯¹è·¯å¾ä¿æä¸å |
| | | // ä½ä¹è®¾ç½®åå§ç¶è·¯å¾ç¨äºèåå¯¼èª |
| | | el.parentPath = lastRouter.path; |
| | | } else { |
| | | // ç¸å¯¹è·¯å¾éè¦æ¼æ¥ |
| | | el.path = lastRouter.path.endsWith('/') ? lastRouter.path + el.path : lastRouter.path + '/' + el.path; |
| | | } |
| | | } |
| | | |
| | | if (el.children && el.children.length) { |
| | | children = children.concat(filterChildren(el.children, el)) |
| | | return |
| | |
| | | // ä¿®æ¹å¸å±è®¾ç½® |
| | | changeSetting(data) { |
| | | const { key, value } = data |
| | | if (this.hasOwnProperty(key)) { |
| | | if (key in this.$state) { |
| | | this[key] = value |
| | | } |
| | | }, |
| | |
| | | ) |
| | | }, |
| | | addVisitedView(view) { |
| | | // è¿æ»¤é¦é¡µæ ç¾ |
| | | if (view.path === '/index' || view.path === '/' || view.name === 'Index') { |
| | | return; |
| | | } |
| | | |
| | | if (this.visitedViews.some(v => v.path === view.path)) return |
| | | this.visitedViews.push( |
| | | Object.assign({}, view, { |
| | |
| | | }, |
| | | delAllVisitedViews(view) { |
| | | return new Promise(resolve => { |
| | | const affixTags = this.visitedViews.filter(tag => tag.meta.affix) |
| | | // è¿æ»¤æé¦é¡µæ ç¾ï¼åªä¿çå
¶ä»åºå®æ ç¾ |
| | | const affixTags = this.visitedViews.filter(tag => tag.meta.affix && tag.path !== '/index' && tag.path !== '/' && tag.name !== 'Index') |
| | | this.visitedViews = affixTags |
| | | this.iframeViews = [] |
| | | resolve([...this.visitedViews]) |
| | |
| | | |
| | | |
| | | /** |
| | | * éç¨jsæ¹æ³å°è£
å¤ç |
| | | * Copyright (c) 2019 ruoyi |
| | |
| | | if (arguments.length === 0 || !time) { |
| | | return null |
| | | } |
| | | const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}' |
| | | const format = pattern || "{y}-{m}-{d} {h}:{i}:{s}" |
| | | let date |
| | | if (typeof time === 'object') { |
| | | if (typeof time === "object") { |
| | | date = time |
| | | } else { |
| | | if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { |
| | | if (typeof time === "string" && /^[0-9]+$/.test(time)) { |
| | | time = parseInt(time) |
| | | } else if (typeof time === 'string') { |
| | | time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.[\d]{3}/gm), ''); |
| | | } else if (typeof time === "string") { |
| | | time = time |
| | | .replace(new RegExp(/-/gm), "/") |
| | | .replace("T", " ") |
| | | .replace(new RegExp(/\.[\d]{3}/gm), "") |
| | | } |
| | | if ((typeof time === 'number') && (time.toString().length === 10)) { |
| | | if (typeof time === "number" && time.toString().length === 10) { |
| | | time = time * 1000 |
| | | } |
| | | date = new Date(time) |
| | |
| | | h: date.getHours(), |
| | | i: date.getMinutes(), |
| | | s: date.getSeconds(), |
| | | a: date.getDay() |
| | | a: date.getDay(), |
| | | } |
| | | const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => { |
| | | let value = formatObj[key] |
| | | // Note: getDay() returns 0 on Sunday |
| | | if (key === 'a') { return ['æ¥', 'ä¸', 'äº', 'ä¸', 'å', 'äº', 'å
'][value] } |
| | | if (key === "a") { |
| | | return ["æ¥", "ä¸", "äº", "ä¸", "å", "äº", "å
"][value] |
| | | } |
| | | if (result.length > 0 && value < 10) { |
| | | value = '0' + value |
| | | value = "0" + value |
| | | } |
| | | return value || 0 |
| | | }) |
| | |
| | | // 表åéç½® |
| | | export function resetForm(refName) { |
| | | if (this.$refs[refName]) { |
| | | this.$refs[refName].resetFields(); |
| | | this.$refs[refName].resetFields() |
| | | } |
| | | } |
| | | |
| | | // æ·»å æ¥æèå´ |
| | | export function addDateRange(params, dateRange, propName) { |
| | | let search = params; |
| | | search.params = typeof (search.params) === 'object' && search.params !== null && !Array.isArray(search.params) ? search.params : {}; |
| | | dateRange = Array.isArray(dateRange) ? dateRange : []; |
| | | if (typeof (propName) === 'undefined') { |
| | | search.params['beginTime'] = dateRange[0]; |
| | | search.params['endTime'] = dateRange[1]; |
| | | let search = params |
| | | search.params = |
| | | typeof search.params === "object" && search.params !== null && !Array.isArray(search.params) ? search.params : {} |
| | | dateRange = Array.isArray(dateRange) ? dateRange : [] |
| | | if (typeof propName === "undefined") { |
| | | search.params["beginTime"] = dateRange[0] |
| | | search.params["endTime"] = dateRange[1] |
| | | } else { |
| | | search.params['begin' + propName] = dateRange[0]; |
| | | search.params['end' + propName] = dateRange[1]; |
| | | search.params["begin" + propName] = dateRange[0] |
| | | search.params["end" + propName] = dateRange[1] |
| | | } |
| | | return search; |
| | | return search |
| | | } |
| | | |
| | | // åæ¾æ°æ®åå
¸ |
| | | export function selectDictLabel(datas, value) { |
| | | if (value === undefined) { |
| | | return ""; |
| | | return "" |
| | | } |
| | | var actions = []; |
| | | var actions = [] |
| | | Object.keys(datas).some((key) => { |
| | | if (datas[key].value == ('' + value)) { |
| | | actions.push(datas[key].label); |
| | | return true; |
| | | if (datas[key].value == "" + value) { |
| | | actions.push(datas[key].label) |
| | | return true |
| | | } |
| | | }) |
| | | if (actions.length === 0) { |
| | | actions.push(value); |
| | | actions.push(value) |
| | | } |
| | | return actions.join(''); |
| | | return actions.join("") |
| | | } |
| | | |
| | | // åæ¾æ°æ®åå
¸ï¼å符串æ°ç»ï¼ |
| | | export function selectDictLabels(datas, value, separator) { |
| | | if (value === undefined || value.length ===0) { |
| | | return ""; |
| | | return "" |
| | | } |
| | | if (Array.isArray(value)) { |
| | | value = value.join(","); |
| | | value = value.join(",") |
| | | } |
| | | var actions = []; |
| | | var currentSeparator = undefined === separator ? "," : separator; |
| | | var temp = value.split(currentSeparator); |
| | | var actions = [] |
| | | var currentSeparator = undefined === separator ? "," : separator |
| | | var temp = value.split(currentSeparator) |
| | | Object.keys(value.split(currentSeparator)).some((val) => { |
| | | var match = false; |
| | | var match = false |
| | | Object.keys(datas).some((key) => { |
| | | if (datas[key].value == ('' + temp[val])) { |
| | | actions.push(datas[key].label + currentSeparator); |
| | | match = true; |
| | | if (datas[key].value == "" + temp[val]) { |
| | | actions.push(datas[key].label + currentSeparator) |
| | | match = true |
| | | } |
| | | }) |
| | | if (!match) { |
| | | actions.push(temp[val] + currentSeparator); |
| | | actions.push(temp[val] + currentSeparator) |
| | | } |
| | | }) |
| | | return actions.join('').substring(0, actions.join('').length - 1); |
| | | return actions.join("").substring(0, actions.join("").length - 1) |
| | | } |
| | | |
| | | // åç¬¦ä¸²æ ¼å¼å(%s ) |
| | | export function sprintf(str) { |
| | | var args = arguments, flag = true, i = 1; |
| | | var args = arguments, |
| | | flag = true, |
| | | i = 1 |
| | | str = str.replace(/%s/g, function () { |
| | | var arg = args[i++]; |
| | | if (typeof arg === 'undefined') { |
| | | flag = false; |
| | | return ''; |
| | | var arg = args[i++] |
| | | if (typeof arg === "undefined") { |
| | | flag = false |
| | | return "" |
| | | } |
| | | return arg; |
| | | }); |
| | | return flag ? str : ''; |
| | | return arg |
| | | }) |
| | | return flag ? str : "" |
| | | } |
| | | |
| | | // 转æ¢å符串ï¼undefined,nullç转å为"" |
| | | export function parseStrEmpty(str) { |
| | | if (!str || str == "undefined" || str == "null") { |
| | | return ""; |
| | | return "" |
| | | } |
| | | return str; |
| | | return str |
| | | } |
| | | |
| | | // æ°æ®åå¹¶ |
| | |
| | | for (var p in target) { |
| | | try { |
| | | if (target[p].constructor == Object) { |
| | | source[p] = mergeRecursive(source[p], target[p]); |
| | | source[p] = mergeRecursive(source[p], target[p]) |
| | | } else { |
| | | source[p] = target[p]; |
| | | source[p] = target[p] |
| | | } |
| | | } catch (e) { |
| | | source[p] = target[p]; |
| | | source[p] = target[p] |
| | | } |
| | | } |
| | | return source; |
| | | }; |
| | | return source |
| | | } |
| | | |
| | | /** |
| | | * æé æ åç»ææ°æ® |
| | |
| | | */ |
| | | export function handleTree(data, id, parentId, children) { |
| | | let config = { |
| | | id: id || 'id', |
| | | parentId: parentId || 'parentId', |
| | | childrenList: children || 'children' |
| | | }; |
| | | id: id || "id", |
| | | parentId: parentId || "parentId", |
| | | childrenList: children || "children", |
| | | } |
| | | |
| | | var childrenListMap = {}; |
| | | var nodeIds = {}; |
| | | var tree = []; |
| | | var childrenListMap = {} |
| | | var nodeIds = {} |
| | | var tree = [] |
| | | |
| | | for (let d of data) { |
| | | let parentId = d[config.parentId]; |
| | | let parentId = d[config.parentId] |
| | | if (childrenListMap[parentId] == null) { |
| | | childrenListMap[parentId] = []; |
| | | childrenListMap[parentId] = [] |
| | | } |
| | | nodeIds[d[config.id]] = d; |
| | | childrenListMap[parentId].push(d); |
| | | nodeIds[d[config.id]] = d |
| | | childrenListMap[parentId].push(d) |
| | | } |
| | | |
| | | for (let d of data) { |
| | | let parentId = d[config.parentId]; |
| | | let parentId = d[config.parentId] |
| | | if (nodeIds[parentId] == null) { |
| | | tree.push(d); |
| | | tree.push(d) |
| | | } |
| | | } |
| | | |
| | | for (let t of tree) { |
| | | adaptToChildrenList(t); |
| | | adaptToChildrenList(t) |
| | | } |
| | | |
| | | function adaptToChildrenList(o) { |
| | | if (childrenListMap[o[config.id]] !== null) { |
| | | o[config.childrenList] = childrenListMap[o[config.id]]; |
| | | o[config.childrenList] = childrenListMap[o[config.id]] |
| | | } |
| | | if (o[config.childrenList]) { |
| | | for (let c of o[config.childrenList]) { |
| | | adaptToChildrenList(c); |
| | | adaptToChildrenList(c) |
| | | } |
| | | } |
| | | } |
| | | return tree; |
| | | return tree |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param {*} params åæ° |
| | | */ |
| | | export function tansParams(params) { |
| | | let result = '' |
| | | let result = "" |
| | | for (const propName of Object.keys(params)) { |
| | | const value = params[propName]; |
| | | var part = encodeURIComponent(propName) + "="; |
| | | if (value !== null && value !== "" && typeof (value) !== "undefined") { |
| | | if (typeof value === 'object') { |
| | | const value = params[propName] |
| | | var part = encodeURIComponent(propName) + "=" |
| | | if (value !== null && value !== "" && typeof value !== "undefined") { |
| | | if (typeof value === "object") { |
| | | for (const key of Object.keys(value)) { |
| | | if (value[key] !== null && value[key] !== "" && typeof (value[key]) !== 'undefined') { |
| | | let params = propName + '[' + key + ']'; |
| | | var subPart = encodeURIComponent(params) + "="; |
| | | result += subPart + encodeURIComponent(value[key]) + "&"; |
| | | if (value[key] !== null && value[key] !== "" && typeof value[key] !== "undefined") { |
| | | let params = propName + "[" + key + "]" |
| | | var subPart = encodeURIComponent(params) + "=" |
| | | result += subPart + encodeURIComponent(value[key]) + "&" |
| | | } |
| | | } |
| | | } else { |
| | | result += part + encodeURIComponent(value) + "&"; |
| | | result += part + encodeURIComponent(value) + "&" |
| | | } |
| | | } |
| | | } |
| | | return result |
| | | } |
| | | |
| | | |
| | | // è¿å项ç®è·¯å¾ |
| | | export function getNormalPath(p) { |
| | | if (p.length === 0 || !p || p == 'undefined') { |
| | | if (p.length === 0 || !p || p == "undefined") { |
| | | return p |
| | | }; |
| | | let res = p.replace('//', '/') |
| | | if (res[res.length - 1] === '/') { |
| | | } |
| | | let res = p.replace("//", "/") |
| | | if (res[res.length - 1] === "/") { |
| | | return res.slice(0, res.length - 1) |
| | | } |
| | | return res; |
| | | return res |
| | | } |
| | | |
| | | // éªè¯æ¯å¦ä¸ºblobæ ¼å¼ |
| | | export function blobValidate(data) { |
| | | return data.type !== 'application/json' |
| | | return data.type !== "application/json" |
| | | } |
| | | |
| | | // éç¨ä¸è½½æ¹æ³ |
| | | const baseURL = import.meta.env.VITE_APP_BASE_API |
| | | export function download(fileName) { |
| | | window.location.href = baseURL + "/common/download?fileName=" + encodeURI(fileName) + "&delete=" + true |
| | | } |
| | | |
| | | // éç¨ä¸è½½æ¹æ³ showfileNameï¼ä¸è½½åçæä»¶å称带æ©å±å;filePath:è¦ä¸è½½æä»¶çç»å¯¹è·¯å¾,带çæä»¶ååæ©å±åï¼deleteflageä¸è½½å®æåæ¯å¦å 餿件 |
| | | export function fileDownload(showfileName, filePath, deleteflage) { |
| | | window.location.href = |
| | | baseURL + |
| | | "/common/downloadAssign?showFileName=" + |
| | | encodeURI(showfileName) + |
| | | "&filePath=" + |
| | | encodeURI(filePath) + |
| | | "&delete=" + |
| | | deleteflage |
| | | } |
| | |
| | | </div> |
| | | <div class="page-container-right"> |
| | | <div class="form-card"> |
| | | <el-form :model="form" ref="queryRef" :inline="true" label-width="85px"> |
| | | <el-form :model="form" ref="queryRef" :inline="true" label-width="68px"> |
| | | <el-form-item prop="eierarchyFlag"> |
| | | <el-radio-group v-model="form.eierarchyFlag"> |
| | | <el-radio label="B" name="eierarchyFlag">æ¬çº§</el-radio> |
| | |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="æ¶é´éæ©"> |
| | | <el-date-picker v-model="form.dataTime" type="datetimerange" format="YYYY-MM-DD HH:mm:ss" |
| | | value-format="YYYY-MM-DD HH:mm:ss" placeholder="æ¶é´" style="width: 370px" unlink-panels |
| | | time-format="HH:mm:ss" /> |
| | | <el-date-picker |
| | | v-model="form.dataTime" |
| | | type="datetimerange" |
| | | format="YYYY-MM-DD HH:mm:ss" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | placeholder="æ¶é´" |
| | | style="width: 340px" |
| | | unlink-panels |
| | | time-format="HH:mm:ss" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="æ¥è¦ç±»å«" prop="indexType"> |
| | | <el-select v-model="form.indexType" placeholder="è¯·éæ©æ¥è¦ç±»å«" style="width: 200px"> |
| | | <el-option v-for="dict in alarm_record_category" :key="dict.value" :label="dict.label" |
| | | :value="dict.value" /> |
| | | <el-option |
| | | v-for="dict in alarm_record_category" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- <el-form-item label="è½æºç±»å" prop="energyType"> |
| | |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <BaseCard :title="currentNode ? currentNode.label + '--èç¹é
ç½®' : 'ææ èç¹é
ç½®' |
| | | "> |
| | | <BaseCard :title="currentNode ? currentNode.label + '--èç¹é
ç½®' : 'ææ èç¹é
ç½®'"> |
| | | <div class="table-box"> |
| | | <el-table :data="tableData" v-loading="loading" height="calc(100vh - 450px)"> |
| | | <el-table-column type="index" label="åºå·" width="70" /> |
| | | <el-table-column label="ç¨è½åå
" prop="modelName" align="center" show-overflow-tooltip /> |
| | | <el-table-column label="ææ åç§°" prop="indexName" align="center" show-overflow-tooltip /> |
| | | <el-table-column label="æ¥è¦ç±»å«" prop="indexType" align="center" show-overflow-tooltip :formatter="(row, column) => |
| | | proxy.selectDictLabel(alarm_record_category, row.indexType) |
| | | " /> |
| | | <el-table-column label="è½æºç±»å" prop="energyId" align="center" show-overflow-tooltip :formatter="(row, column) => formatterLabel(energyTypeList, row.energyId) |
| | | " /> |
| | | <el-table-column |
| | | label="æ¥è¦ç±»å«" |
| | | prop="indexType" |
| | | align="center" |
| | | show-overflow-tooltip |
| | | :formatter="(row, column) => proxy.selectDictLabel(alarm_record_category, row.indexType)" |
| | | /> |
| | | <el-table-column |
| | | label="è½æºç±»å" |
| | | prop="energyId" |
| | | align="center" |
| | | show-overflow-tooltip |
| | | :formatter="(row, column) => formatterLabel(energyTypeList, row.energyId)" |
| | | /> |
| | | <el-table-column label="é¢è®¾å¼" prop="energyType" align="center" show-overflow-tooltip /> |
| | | <el-table-column label="æ¥è¦å¼" prop="alarmValue" align="center" show-overflow-tooltip /> |
| | | <el-table-column label="æ¥è¦æ¶é´" prop="alarmBeginTime" align="center" show-overflow-tooltip /> |
| | |
| | | </div> |
| | | </BaseCard> |
| | | |
| | | <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" |
| | | v-model:limit="queryParams.pageSize" @pagination="getList(currentNode)" /> |
| | | <pagination |
| | | v-show="total > 0" |
| | | :total="total" |
| | | v-model:page="queryParams.pageNum" |
| | | v-model:limit="queryParams.pageSize" |
| | | @pagination="getList(currentNode)" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | <script setup name="alarmRecord"> |
| | | import { listEnergyTypeList } from "@/api/modelConfiguration/energyType"; |
| | | const { proxy } = getCurrentInstance(); |
| | | let { alarm_record_category } = proxy.useDict("alarm_record_category"); |
| | | import { historicalAlarm } from "@/api/alarmManage/alarmManage"; |
| | | import { listEnergyTypeList } from "@/api/modelConfiguration/energyType" |
| | | const { proxy } = getCurrentInstance() |
| | | let { alarm_record_category } = proxy.useDict("alarm_record_category") |
| | | import { historicalAlarm } from "@/api/alarmManage/alarmManage" |
| | | let form = ref({ |
| | | eierarchyFlag: "B", |
| | | dataTime: [ |
| | |
| | | indexType: "", |
| | | // energyType: '', |
| | | indexName: "", |
| | | }); |
| | | const energyTypeList = ref(); |
| | | }) |
| | | const energyTypeList = ref() |
| | | function getEnergyTypeList() { |
| | | listEnergyTypeList().then((res) => { |
| | | energyTypeList.value = res.data; |
| | | form.value.indexType = alarm_record_category.value[0].value; |
| | | energyTypeList.value = res.data |
| | | form.value.indexType = alarm_record_category.value[0].value |
| | | // form.value.energyType = energyTypeList.value[0].enersno |
| | | getList(); |
| | | }); |
| | | getList() |
| | | }) |
| | | } |
| | | // getEnergyTypeList() |
| | | let currentNode = ref(); |
| | | let currentNode = ref() |
| | | function handleNodeClick(data) { |
| | | currentNode.value = data; |
| | | getEnergyTypeList(); |
| | | currentNode.value = data |
| | | getEnergyTypeList() |
| | | } |
| | | |
| | | let tableData = ref([]); |
| | | let total = ref(0); |
| | | let loading = ref(false); |
| | | let tableData = ref([]) |
| | | let total = ref(0) |
| | | let loading = ref(false) |
| | | let queryParams = ref({ |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | }); |
| | | }) |
| | | |
| | | function formatterLabel(list, value) { |
| | | let dict = list.find((item) => item.enersno == value); |
| | | return dict ? dict.enername : ""; |
| | | let dict = list.find((item) => item.enersno == value) |
| | | return dict ? dict.enername : "" |
| | | } |
| | | |
| | | function getList() { |
| | | form.value.nodeId = currentNode.value.id; |
| | | loading.value = true; |
| | | form.value.nodeId = currentNode.value.id |
| | | loading.value = true |
| | | historicalAlarm({ |
| | | ...form.value, |
| | | ...queryParams.value, |
| | | beginTime: form.value.dataTime[0], |
| | | endTime: form.value.dataTime[1], |
| | | }).then((response) => { |
| | | console.log(11, response); |
| | | console.log(11, response) |
| | | if (response.code === 200) { |
| | | tableData.value = response.rows; |
| | | total.value = response.total; |
| | | loading.value = false; |
| | | tableData.value = response.rows |
| | | total.value = response.total |
| | | loading.value = false |
| | | } else { |
| | | proxy.$modal.msgError(response.msg); |
| | | proxy.$modal.msgError(response.msg) |
| | | } |
| | | }); |
| | | }) |
| | | } |
| | | |
| | | function handleQuery() { |
| | | queryParams.value.pageNum = 1; |
| | | getList(); |
| | | queryParams.value.pageNum = 1 |
| | | getList() |
| | | } |
| | | function resetQuery() { |
| | | form.value = { |
| | | eierarchyFlag: 'B', |
| | | dataTime: [proxy.dayjs(new Date()).format("YYYY-MM-DD 00:00:00"), proxy.dayjs(new Date()).format("YYYY-MM-DD 23:59:59")], |
| | | nodeId: '', |
| | | eierarchyFlag: "B", |
| | | dataTime: [ |
| | | proxy.dayjs(new Date()).format("YYYY-MM-DD 00:00:00"), |
| | | proxy.dayjs(new Date()).format("YYYY-MM-DD 23:59:59"), |
| | | ], |
| | | nodeId: "", |
| | | indexType: alarm_record_category.value[0].value, |
| | | // energyType: '', |
| | | indexName: '', |
| | | indexName: "", |
| | | } |
| | | queryParams.value = { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | }; |
| | | getList(); |
| | | } |
| | | getList() |
| | | } |
| | | </script> |
| | | |
| | |
| | | <div class="form-card"> |
| | | <el-form :model="form" ref="queryRef" :inline="true" label-width="85px"> |
| | | <el-form-item label="æé´" prop="timeType"> |
| | | <el-select v-model="queryParams.timeType" placeholder="æé´" clearable style="width: 100%" |
| | | @change="handleTimeType"> |
| | | <el-select |
| | | v-model="queryParams.timeType" |
| | | placeholder="æé´" |
| | | clearable |
| | | style="width: 100%" |
| | | @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" :clearable="false" |
| | | <el-date-picker |
| | | v-model="queryParams.dataTime" |
| | | :clearable="false" |
| | | :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%" /> |
| | | :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> |
| | | <el-button type="primary" icon="Search" @click="handleQuery">æç´¢</el-button> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import * as echarts from 'echarts'; |
| | | import { onMounted, reactive, ref } from 'vue'; |
| | | import { listEnergyTypeList } from "@/api/modelConfiguration/energyType"; |
| | | const { proxy } = getCurrentInstance(); |
| | | const { period } = proxy.useDict("period"); |
| | | let { alarm_record_category } = proxy.useDict("alarm_record_category"); |
| | | import * as echarts from "echarts" |
| | | import { onMounted, reactive, ref } from "vue" |
| | | import { listEnergyTypeList } from "@/api/modelConfiguration/energyType" |
| | | const { proxy } = getCurrentInstance() |
| | | const { period } = proxy.useDict("period") |
| | | let { alarm_record_category } = proxy.useDict("alarm_record_category") |
| | | let energyTypeList = ref([]) |
| | | function getEnergyTypeList() { |
| | | listEnergyTypeList().then((res) => { |
| | | energyTypeList.value = res.data; |
| | | }); |
| | | energyTypeList.value = res.data |
| | | }) |
| | | } |
| | | getEnergyTypeList() |
| | | function formatterLabel(list, value) { |
| | | console.log(list, value); |
| | | console.log(list, value) |
| | | |
| | | let dict = list.find(item => item.enersno == value) |
| | | return dict ? dict.enername : '' |
| | | let dict = list.find((item) => item.enersno == value) |
| | | return dict ? dict.enername : "" |
| | | } |
| | | |
| | | |
| | | let queryParams = ref({ |
| | | timeType: null, |
| | | dataTime: null, |
| | | nodeId: null |
| | | nodeId: null, |
| | | }) |
| | | |
| | | import { getByNodeId, getCountInfo } from "@/api/alarmManage/alarmManage"; |
| | | import { el } from 'element-plus/es/locales.mjs'; |
| | | let form = ref({}); |
| | | import { getByNodeId, getCountInfo } from "@/api/alarmManage/alarmManage" |
| | | import { el } from "element-plus/es/locales.mjs" |
| | | let form = ref({}) |
| | | let currentNode = ref() |
| | | |
| | | function handleTimeType(e) { |
| | | queryParams.value.timeType = e; |
| | | queryParams.value.dataTime = proxy.dayjs(new Date()).format("YYYY-MM-DD"); |
| | | queryParams.value.timeType = e |
| | | queryParams.value.dataTime = proxy.dayjs(new Date()).format("YYYY-MM-DD") |
| | | } |
| | | function handleNodeClick(e) { |
| | | currentNode.value = e |
| | | queryParams.value.nodeId = e.id |
| | | handleTimeType('YEAR') |
| | | handleTimeType("YEAR") |
| | | getByNodeIdFun() |
| | | } |
| | | |
| | | function getByNodeIdFun() { |
| | | getByNodeId(queryParams.value).then(res => { |
| | | getByNodeId(queryParams.value).then((res) => { |
| | | let alarmList = [] |
| | | let energyList = [] |
| | | let alarmNumberList = { |
| | | data: [], |
| | | xAxisData: [] |
| | | xAxisData: [], |
| | | } |
| | | console.log(111, res); |
| | | console.log(111, res) |
| | | if (res.code == 200) { |
| | | let { data } = res |
| | | alarmList = data.alarmProportion.map(item => { |
| | | alarmList = data.alarmProportion.map((item) => { |
| | | return { |
| | | name: proxy.selectDictLabel(alarm_record_category.value, item.energyName), |
| | | value: item.percentage |
| | | value: item.percentage, |
| | | } |
| | | }) |
| | | energyList = data.energyProportion.map(item => { |
| | | energyList = data.energyProportion.map((item) => { |
| | | return { |
| | | name: formatterLabel(energyTypeList.value, item.energyName), |
| | | value: item.percentage |
| | | value: item.percentage, |
| | | } |
| | | }) |
| | | for (const item of data.chartDataList) { |
| | |
| | | alarmNumberList.data.push(item.yvalue) |
| | | } |
| | | |
| | | pieChart('Chart1', alarmList, 'æ¥è¦ç±»åå æ¯') |
| | | pieChart('Chart2', energyList, 'è½æºç±»åå æ¯') |
| | | getChart('Chart3', alarmNumberList) |
| | | pieChart("Chart1", alarmList, "æ¥è¦ç±»åå æ¯") |
| | | pieChart("Chart2", energyList, "è½æºç±»åå æ¯") |
| | | getChart("Chart3", alarmNumberList) |
| | | } |
| | | }) |
| | | } |
| | |
| | | getByNodeIdFun() |
| | | } |
| | | function resetQuery() { |
| | | handleTimeType('YEAR') |
| | | handleTimeType("YEAR") |
| | | getByNodeIdFun() |
| | | } |
| | | |
| | | |
| | | function pieChart(Id, data, name) { |
| | | let total = 0; |
| | | let total = 0 |
| | | data.forEach(function (val, idx, arr) { |
| | | total += val.value; |
| | | total += val.value |
| | | }) |
| | | const myChart = echarts.init(document.getElementById(Id)); |
| | | const myChart = echarts.init(document.getElementById(Id)) |
| | | myChart.setOption({ |
| | | color: ['#4D94FF', '#00C27C', '#F0142F', '#F2D261', '#0E7CE2', '#FF8352', '#E271DE', '#F8456B', '#00FFFF', '#4AEAB0'], |
| | | color: [ |
| | | "#4D94FF", |
| | | "#00C27C", |
| | | "#F0142F", |
| | | "#F2D261", |
| | | "#0E7CE2", |
| | | "#FF8352", |
| | | "#E271DE", |
| | | "#F8456B", |
| | | "#00FFFF", |
| | | "#4AEAB0", |
| | | ], |
| | | grid: { |
| | | top: '20%', |
| | | left: '1%', |
| | | right: '1%', |
| | | bottom: '0%', |
| | | containLabel: true |
| | | top: "20%", |
| | | left: "1%", |
| | | right: "1%", |
| | | bottom: "0%", |
| | | containLabel: true, |
| | | }, |
| | | tooltip: { |
| | | trigger: 'item' |
| | | trigger: "item", |
| | | }, |
| | | legend: { |
| | | orient: 'vertical', |
| | | top: 'center', |
| | | icon: 'circle', |
| | | orient: "vertical", |
| | | top: "center", |
| | | icon: "circle", |
| | | itemWidth: 14, |
| | | itemHeight: 14, |
| | | right: '2%', |
| | | right: "2%", |
| | | itemGap: 10, |
| | | textStyle: { |
| | | align: 'left', |
| | | verticalAlign: 'middle', |
| | | align: "left", |
| | | verticalAlign: "middle", |
| | | rich: { |
| | | name: { |
| | | color: '#999', |
| | | color: "#999", |
| | | fontSize: 14, |
| | | }, |
| | | value: { |
| | | color: '#999', |
| | | color: "#999", |
| | | fontSize: 14, |
| | | }, |
| | | rate: { |
| | | color: '#999', |
| | | color: "#999", |
| | | fontSize: 14, |
| | | }, |
| | | }, |
| | | }, |
| | | formatter: (name) => { |
| | | if (data.length) { |
| | | let target, percent; |
| | | let target, percent |
| | | for (let i = 0; i < data.length; i++) { |
| | | if (data[i].name === name) { |
| | | target = data[i].value; |
| | | percent = ((target / total) * 100).toFixed(2); |
| | | target = data[i].value |
| | | percent = ((target / total) * 100).toFixed(2) |
| | | } |
| | | } |
| | | return `{name|${name} }{value| ${target}} {rate| ${percent}%}`; |
| | | |
| | | return `{name|${name} }{value| ${target}} {rate| ${percent}%}` |
| | | } else { |
| | | return `{name|${name} }{value| ${0}} {rate| ${0}%}`; |
| | | |
| | | return `{name|${name} }{value| ${0}} {rate| ${0}%}` |
| | | } |
| | | }, |
| | | }, |
| | | series: [{ |
| | | series: [ |
| | | { |
| | | name, |
| | | type: 'pie', |
| | | radius: ['45%', '70%'], |
| | | center: ['35%', '50%'], |
| | | type: "pie", |
| | | radius: ["45%", "70%"], |
| | | center: ["35%", "50%"], |
| | | avoidLabelOverlap: false, |
| | | label: { |
| | | show: false, |
| | | overflow: 'none', |
| | | formatter: '{b} {d}% \n {c} tce', |
| | | overflow: "none", |
| | | formatter: "{b} {d}% \n {c} tce", |
| | | }, |
| | | data, |
| | | }] |
| | | }, |
| | | ], |
| | | }) |
| | | } |
| | | function getChart(Id, dataList) { |
| | | const myChart3 = echarts.init(document.getElementById(Id)); |
| | | myChart3.setOption( |
| | | { |
| | | |
| | | const myChart3 = echarts.init(document.getElementById(Id)) |
| | | myChart3.setOption({ |
| | | grid: { |
| | | left: '3%', |
| | | right: '2%', |
| | | bottom: '2%', |
| | | containLabel: true |
| | | left: "3%", |
| | | right: "2%", |
| | | bottom: "2%", |
| | | containLabel: true, |
| | | }, |
| | | tooltip: { |
| | | trigger: 'axis', |
| | | |
| | | trigger: "axis", |
| | | }, |
| | | xAxis: { |
| | | type: 'category', |
| | | type: "category", |
| | | // boundaryGap: false, |
| | | data: dataList.xAxisData, |
| | | axisPointer: { |
| | | type: 'shadow' |
| | | type: "shadow", |
| | | }, |
| | | axisTick: { |
| | | show: false, |
| | | alignWithLabel: true, |
| | | length: 5 |
| | | length: 5, |
| | | }, |
| | | // åæ è½´å»åº¦çº¿æ ·å¼ |
| | | axisTick: { |
| | | show: false, |
| | | length: 5, |
| | | lineStyle: { |
| | | color: '#ddd' |
| | | } |
| | | color: "#ddd", |
| | | }, |
| | | }, |
| | | |
| | | // åå²çº¿ |
| | | splitLine: { |
| | | show: false, |
| | | lineStyle: { |
| | | type: 'dashed', |
| | | color: 'rgba(220,222,226,0.4)' |
| | | } |
| | | type: "dashed", |
| | | color: "rgba(220,222,226,0.4)", |
| | | }, |
| | | }, |
| | | axisLabel: { |
| | | color: '#999', |
| | | color: "#999", |
| | | fontSize: 14, |
| | | padding: [5, 0, 0, 0], |
| | | // formatter: '{value} ml' |
| | | } |
| | | }, |
| | | }, |
| | | yAxis: { |
| | | type: 'value', |
| | | name: 'ï¼æ¬¡ï¼', |
| | | type: "value", |
| | | name: "ï¼æ¬¡ï¼", |
| | | // 设置åç§°æ ·å¼ |
| | | nameTextStyle: { |
| | | color: ' #CEE3FF', |
| | | color: " #CEE3FF", |
| | | fontSize: 14, |
| | | padding: [0, 0, 5, 0], |
| | | }, |
| | |
| | | axisTick: { |
| | | show: false, |
| | | alignWithLabel: true, |
| | | length: 5 |
| | | length: 5, |
| | | }, |
| | | // åæ è½´å»åº¦çº¿æ ·å¼ |
| | | axisTick: { |
| | | show: false, |
| | | length: 5, |
| | | lineStyle: { |
| | | color: '' |
| | | } |
| | | color: "", |
| | | }, |
| | | }, |
| | | |
| | | // åå²çº¿ |
| | | splitLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | type: 'dashed', |
| | | color: 'rgba(220,222,226,0.4)' |
| | | } |
| | | type: "dashed", |
| | | color: "rgba(220,222,226,0.4)", |
| | | }, |
| | | }, |
| | | |
| | | // åæ è½´å»åº¦é´é |
| | |
| | | // // åæ è½´å»åº¦ææ¬çå¸å±æå |
| | | // position: 'left' |
| | | axisLabel: { |
| | | color: '#B2B8C2', |
| | | color: "#B2B8C2", |
| | | fontSize: 14, |
| | | // formatter: '{value} ml' |
| | | } |
| | | }, |
| | | }, |
| | | series: [ |
| | | { |
| | | name: "æ¥è¦æ¬¡æ°", |
| | | type: "bar", |
| | | barWidth: '17', |
| | | stack: 'number', |
| | | barWidth: "12", |
| | | stack: "number", |
| | | data: dataList.data, |
| | | tooltip: { |
| | | show: false, |
| | | } |
| | | }, |
| | | }, |
| | | { |
| | | name: 'æ¥è¦æ¬¡æ°', |
| | | type: 'line', |
| | | symbol: 'none', // 设置为 'none' 廿åç¹ |
| | | name: "æ¥è¦æ¬¡æ°", |
| | | type: "line", |
| | | symbol: "none", // 设置为 'none' 廿åç¹ |
| | | lineStyle: { |
| | | color: '#EE0303' |
| | | color: "#EE0303", |
| | | }, |
| | | data: dataList.data, |
| | | }, |
| | | ] |
| | | ], |
| | | }) |
| | | |
| | | window.addEventListener("resize", () => { |
| | | myChart1.resize(); |
| | | myChart2.resize(); |
| | | myChart3.resize(); |
| | | }, { passive: true }); |
| | | window.addEventListener( |
| | | "resize", |
| | | () => { |
| | | myChart1.resize() |
| | | myChart2.resize() |
| | | myChart3.resize() |
| | | }, |
| | | { passive: true } |
| | | ) |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | @import "@/assets/styles/page.scss"; |
| | | |
| | | |
| | | .chart-box { |
| | | height: calc((100vh - 410px)/2) !important; |
| | |
| | | <div class="form-card"> |
| | | <el-form :model="form" ref="queryRef" :inline="true" label-width="85px"> |
| | | <el-form-item label="æé´" prop="timeType"> |
| | | <el-select v-model="queryParams.timeType" placeholder="æé´" clearable style="width: 120px" |
| | | @change="handleTimeType"> |
| | | <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" :clearable="false" |
| | | <el-date-picker |
| | | v-model="queryParams.dataTime" |
| | | :clearable="false" |
| | | :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%" /> |
| | | :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> |
| | | <el-button type="primary" icon="Search" @click="handleQuery">æç´¢</el-button> |
| | |
| | | </div> |
| | | |
| | | <div class="mt20 mb20 text-center data-item"> |
| | | æ¬ç¨è½åå
ææ <span>{{ dataArray.indexCount }}</span>ä¸ªï¼ |
| | | æ¬å¹´åº¦æ¥è¦<span>{{ dataArray.yearCount }}</span>æ¬¡ï¼æ¬æ<span>{{ dataArray.monthCount }}</span>次 |
| | | æ¬ç¨è½åå
ææ <span>{{ dataArray.indexCount }}</span |
| | | >ä¸ªï¼ æ¬å¹´åº¦æ¥è¦<span>{{ dataArray.yearCount }}</span |
| | | >æ¬¡ï¼æ¬æ<span>{{ dataArray.monthCount }}</span |
| | | >次 |
| | | </div> |
| | | <el-row :gutter="24" class="mb20"> |
| | | <el-col :span="12"> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import * as echarts from 'echarts'; |
| | | import { onMounted, reactive, ref } from 'vue'; |
| | | import { listEnergyTypeList } from "@/api/modelConfiguration/energyType"; |
| | | const { proxy } = getCurrentInstance(); |
| | | const { period } = proxy.useDict("period"); |
| | | let { alarm_record_category } = proxy.useDict("alarm_record_category"); |
| | | import * as echarts from "echarts" |
| | | import { onMounted, reactive, ref } from "vue" |
| | | import { listEnergyTypeList } from "@/api/modelConfiguration/energyType" |
| | | const { proxy } = getCurrentInstance() |
| | | const { period } = proxy.useDict("period") |
| | | let { alarm_record_category } = proxy.useDict("alarm_record_category") |
| | | let energyTypeList = ref([]) |
| | | function getEnergyTypeList() { |
| | | listEnergyTypeList().then((res) => { |
| | | energyTypeList.value = res.data; |
| | | queryParams.value.energyType = energyTypeList.value[0].enersno; |
| | | }); |
| | | energyTypeList.value = res.data |
| | | queryParams.value.energyType = energyTypeList.value[0].enersno |
| | | }) |
| | | } |
| | | getEnergyTypeList() |
| | | function formatterLabel(list, value) { |
| | | let dict = list.find(item => item.enersno == value) |
| | | return dict ? dict.enername : '' |
| | | let dict = list.find((item) => item.enersno == value) |
| | | return dict ? dict.enername : "" |
| | | } |
| | | |
| | | |
| | | let queryParams = ref({ |
| | | timeType: null, |
| | | dataTime: null, |
| | | nodeId: null |
| | | nodeId: null, |
| | | }) |
| | | |
| | | import { getByNodeId, getCountInfo } from "@/api/alarmManage/alarmManage"; |
| | | import { el } from 'element-plus/es/locales.mjs'; |
| | | let form = ref({}); |
| | | import { getByNodeId, getCountInfo } from "@/api/alarmManage/alarmManage" |
| | | import { el } from "element-plus/es/locales.mjs" |
| | | let form = ref({}) |
| | | let currentNode = ref() |
| | | |
| | | function handleTimeType(e) { |
| | | queryParams.value.timeType = e; |
| | | queryParams.value.dataTime = proxy.dayjs(new Date()).format("YYYY-MM-DD"); |
| | | queryParams.value.timeType = e |
| | | queryParams.value.dataTime = proxy.dayjs(new Date()).format("YYYY-MM-DD") |
| | | } |
| | | function handleNodeClick(e) { |
| | | currentNode.value = e |
| | | queryParams.value.nodeId = e.id |
| | | handleTimeType(period.value[0].value); |
| | | handleTimeType(period.value[0].value) |
| | | |
| | | getByNodeIdFun() |
| | | } |
| | | |
| | | function getByNodeIdFun() { |
| | | getByNodeId(queryParams.value).then(res => { |
| | | getByNodeId(queryParams.value).then((res) => { |
| | | let alarmList = [] |
| | | let energyList = [] |
| | | let alarmNumberList = { |
| | | data: [], |
| | | xAxisData: [] |
| | | xAxisData: [], |
| | | } |
| | | if (res.code == 200) { |
| | | let { data } = res |
| | | alarmList = data.alarmProportion.map(item => { |
| | | alarmList = data.alarmProportion.map((item) => { |
| | | return { |
| | | name: proxy.selectDictLabel(alarm_record_category.value, item.energyName), |
| | | value: item.count, |
| | | percentage: item.percentage |
| | | percentage: item.percentage, |
| | | } |
| | | }) |
| | | energyList = data.energyProportion.map(item => { |
| | | energyList = data.energyProportion.map((item) => { |
| | | return { |
| | | name: formatterLabel(energyTypeList.value, item.energyName), |
| | | value: item.count, |
| | | percentage: item.percentage |
| | | percentage: item.percentage, |
| | | } |
| | | }) |
| | | for (const item of data.chartDataList) { |
| | |
| | | alarmNumberList.data.push(item.yvalue) |
| | | } |
| | | |
| | | pieChart('Chart1', alarmList, 'æ¥è¦ç±»åå æ¯') |
| | | pieChart('Chart2', energyList, 'è½æºç±»åå æ¯') |
| | | getChart('Chart3', alarmNumberList) |
| | | pieChart("Chart1", alarmList, "æ¥è¦ç±»åå æ¯") |
| | | pieChart("Chart2", energyList, "è½æºç±»åå æ¯") |
| | | getChart("Chart3", alarmNumberList) |
| | | } |
| | | }) |
| | | } |
| | |
| | | getByNodeIdFun() |
| | | } |
| | | function resetQuery() { |
| | | handleTimeType('YEAR') |
| | | handleTimeType("YEAR") |
| | | getByNodeIdFun() |
| | | } |
| | | let dataArray = ref({ |
| | | indexCount: 0, |
| | | yearCount: 0, |
| | | monthCount: 0 |
| | | monthCount: 0, |
| | | }) |
| | | function getCountInfoFun() { |
| | | getCountInfo(queryParams.value).then(res => { |
| | | getCountInfo(queryParams.value).then((res) => { |
| | | if (res.code == 200) { |
| | | dataArray.value = res.data |
| | | } |
| | |
| | | getCountInfoFun() |
| | | function pieChart(Id, data, name) { |
| | | console.log(data) |
| | | let total = 0; |
| | | let total = 0 |
| | | data.forEach(function (val, idx, arr) { |
| | | total += val.value; |
| | | total += val.value |
| | | }) |
| | | const myChart = echarts.init(document.getElementById(Id)); |
| | | const myChart = echarts.init(document.getElementById(Id)) |
| | | myChart.setOption({ |
| | | color: ['#4D94FF', '#00C27C', '#F0142F', '#F2D261', '#0E7CE2', '#FF8352', '#E271DE', '#F8456B', '#00FFFF', '#4AEAB0'], |
| | | color: [ |
| | | "#4D94FF", |
| | | "#00C27C", |
| | | "#F0142F", |
| | | "#F2D261", |
| | | "#0E7CE2", |
| | | "#FF8352", |
| | | "#E271DE", |
| | | "#F8456B", |
| | | "#00FFFF", |
| | | "#4AEAB0", |
| | | ], |
| | | grid: { |
| | | top: '20%', |
| | | left: '1%', |
| | | right: '1%', |
| | | bottom: '0%', |
| | | containLabel: true |
| | | top: "20%", |
| | | left: "1%", |
| | | right: "1%", |
| | | bottom: "0%", |
| | | containLabel: true, |
| | | }, |
| | | tooltip: { |
| | | trigger: 'item' |
| | | trigger: "item", |
| | | }, |
| | | legend: { |
| | | orient: 'vertical', |
| | | top: 'center', |
| | | icon: 'circle', |
| | | orient: "vertical", |
| | | top: "center", |
| | | icon: "circle", |
| | | itemWidth: 14, |
| | | itemHeight: 14, |
| | | right: '2%', |
| | | right: "2%", |
| | | itemGap: 10, |
| | | textStyle: { |
| | | align: 'left', |
| | | verticalAlign: 'middle', |
| | | align: "left", |
| | | verticalAlign: "middle", |
| | | rich: { |
| | | name: { |
| | | color: '#999', |
| | | color: "#999", |
| | | fontSize: 14, |
| | | }, |
| | | value: { |
| | | color: '#999', |
| | | color: "#999", |
| | | fontSize: 14, |
| | | }, |
| | | rate: { |
| | | color: '#999', |
| | | color: "#999", |
| | | fontSize: 14, |
| | | }, |
| | | }, |
| | |
| | | formatter: (name) => { |
| | | for (let i = 0; i < data.length; i++) { |
| | | if (data[i].name === name) { |
| | | return `{name|${data[i].name} }{value| ${data[i].value}} {rate| ${data[i].percentage}%}`; |
| | | return `{name|${data[i].name} }{value| ${data[i].value}} {rate| ${data[i].percentage}%}` |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | series: [{ |
| | | series: [ |
| | | { |
| | | name, |
| | | type: 'pie', |
| | | radius: ['45%', '70%'], |
| | | center: ['35%', '50%'], |
| | | type: "pie", |
| | | radius: ["45%", "70%"], |
| | | center: ["35%", "50%"], |
| | | avoidLabelOverlap: false, |
| | | label: { |
| | | show: false, |
| | | overflow: 'none', |
| | | formatter: '{b} {d}% \n {c} tce', |
| | | overflow: "none", |
| | | formatter: "{b} {d}% \n {c} tce", |
| | | }, |
| | | data, |
| | | }] |
| | | }, |
| | | ], |
| | | }) |
| | | } |
| | | function getChart(Id, dataList) { |
| | | const myChart3 = echarts.init(document.getElementById(Id)); |
| | | myChart3.setOption( |
| | | { |
| | | |
| | | const myChart3 = echarts.init(document.getElementById(Id)) |
| | | myChart3.setOption({ |
| | | grid: { |
| | | left: '3%', |
| | | right: '2%', |
| | | bottom: '2%', |
| | | containLabel: true |
| | | left: "3%", |
| | | right: "2%", |
| | | bottom: "2%", |
| | | containLabel: true, |
| | | }, |
| | | tooltip: { |
| | | trigger: 'axis', |
| | | |
| | | trigger: "axis", |
| | | }, |
| | | xAxis: { |
| | | type: 'category', |
| | | type: "category", |
| | | // boundaryGap: false, |
| | | data: dataList.xAxisData, |
| | | axisPointer: { |
| | | type: 'shadow' |
| | | type: "shadow", |
| | | }, |
| | | axisTick: { |
| | | show: false, |
| | | alignWithLabel: true, |
| | | length: 5 |
| | | length: 5, |
| | | }, |
| | | // åæ è½´å»åº¦çº¿æ ·å¼ |
| | | axisTick: { |
| | | show: false, |
| | | length: 5, |
| | | lineStyle: { |
| | | color: '#ddd' |
| | | } |
| | | color: "#ddd", |
| | | }, |
| | | }, |
| | | |
| | | // åå²çº¿ |
| | | splitLine: { |
| | | show: false, |
| | | lineStyle: { |
| | | type: 'dashed', |
| | | color: 'rgba(220,222,226,0.4)' |
| | | } |
| | | type: "dashed", |
| | | color: "rgba(220,222,226,0.4)", |
| | | }, |
| | | }, |
| | | axisLabel: { |
| | | color: '#999', |
| | | color: "#999", |
| | | fontSize: 14, |
| | | padding: [5, 0, 0, 0], |
| | | // formatter: '{value} ml' |
| | | } |
| | | }, |
| | | }, |
| | | yAxis: { |
| | | type: 'value', |
| | | name: 'ï¼æ¬¡ï¼', |
| | | type: "value", |
| | | name: "ï¼æ¬¡ï¼", |
| | | // 设置åç§°æ ·å¼ |
| | | nameTextStyle: { |
| | | color: ' #CEE3FF', |
| | | color: " #CEE3FF", |
| | | fontSize: 14, |
| | | padding: [0, 0, 5, 0], |
| | | }, |
| | |
| | | axisTick: { |
| | | show: false, |
| | | alignWithLabel: true, |
| | | length: 5 |
| | | length: 5, |
| | | }, |
| | | // åæ è½´å»åº¦çº¿æ ·å¼ |
| | | axisTick: { |
| | | show: false, |
| | | length: 5, |
| | | lineStyle: { |
| | | color: '' |
| | | } |
| | | color: "", |
| | | }, |
| | | }, |
| | | |
| | | // åå²çº¿ |
| | | splitLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | type: 'dashed', |
| | | color: 'rgba(220,222,226,0.4)' |
| | | } |
| | | type: "dashed", |
| | | color: "rgba(220,222,226,0.4)", |
| | | }, |
| | | }, |
| | | |
| | | // åæ è½´å»åº¦é´é |
| | |
| | | // // åæ è½´å»åº¦ææ¬çå¸å±æå |
| | | // position: 'left' |
| | | axisLabel: { |
| | | color: '#B2B8C2', |
| | | color: "#B2B8C2", |
| | | fontSize: 14, |
| | | // formatter: '{value} ml' |
| | | } |
| | | }, |
| | | }, |
| | | series: [ |
| | | { |
| | | name: "æ¥è¦æ¬¡æ°", |
| | | type: "bar", |
| | | barWidth: '17', |
| | | stack: 'number', |
| | | barWidth: "12", |
| | | stack: "number", |
| | | data: dataList.data, |
| | | tooltip: { |
| | | show: false, |
| | | } |
| | | }, |
| | | }, |
| | | { |
| | | name: 'æ¥è¦æ¬¡æ°', |
| | | type: 'line', |
| | | symbol: 'none', // 设置为 'none' 廿åç¹ |
| | | name: "æ¥è¦æ¬¡æ°", |
| | | type: "line", |
| | | symbol: "none", // 设置为 'none' 廿åç¹ |
| | | lineStyle: { |
| | | color: '#EE0303' |
| | | color: "#EE0303", |
| | | }, |
| | | data: dataList.data, |
| | | }, |
| | | ] |
| | | ], |
| | | }) |
| | | |
| | | window.addEventListener("resize", () => { |
| | | myChart1.resize(); |
| | | myChart2.resize(); |
| | | myChart3.resize(); |
| | | }, { passive: true }); |
| | | window.addEventListener( |
| | | "resize", |
| | | () => { |
| | | myChart1.resize() |
| | | myChart2.resize() |
| | | myChart3.resize() |
| | | }, |
| | | { passive: true } |
| | | ) |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | @import "@/assets/styles/page.scss"; |
| | | |
| | | |
| | | .chart-box { |
| | | height: calc((100vh - 410px)/2) !important; |
| | |
| | | font-weight: bold; |
| | | |
| | | span { |
| | | color: #397AEE; |
| | | color: #397aee; |
| | | margin: 0 5px; |
| | | } |
| | | } |
| | |
| | | font-weight: bold; |
| | | |
| | | span { |
| | | color: #397AEE; |
| | | color: #397aee; |
| | | margin: 0 5px; |
| | | } |
| | | } |
| | | |
| | | } |
| | | </style> |
| | |
| | | <el-button type="primary" icon="Search" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | <el-form-item style="float: right"> |
| | | <el-button type="primary" icon="Plus" @click="handleAdd"> æ°å¢ </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div class="table-bg-style"> |
| | | <div class="theme-dark-mt20 mb20 ml20"> |
| | | <el-button type="primary" icon="Plus" @click="handleAdd">æ°å¢</el-button> |
| | | </div> |
| | | <div class="table-box"> |
| | | <el-table :data="tableData" v-loading="loading"> |
| | | <el-table-column prop="time" label="æ¶é´" show-overflow-tooltip align="center" /> |
| | |
| | | </div> |
| | | <div class="page-container-right"> |
| | | <div class="form-card"> |
| | | <el-form |
| | | :model="queryParams" |
| | | ref="queryRef" |
| | | :inline="true" |
| | | v-show="showSearch" |
| | | > |
| | | <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch"> |
| | | <el-form-item label="æé´" prop="timeType"> |
| | | <el-select |
| | | v-model="queryParams.timeType" |
| | |
| | | style="width: 120px" |
| | | @change="handleTimeType" |
| | | > |
| | | <el-option |
| | | v-for="dict in period" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | <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-form-item> |
| | | <el-form-item label="产åç±»å"> |
| | | <el-select |
| | | v-model="queryParams.productType" |
| | | placeholder="产åç±»å" |
| | | style="width: 100%" |
| | | > |
| | | <el-option |
| | | v-for="dict in product_type" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | <el-select v-model="queryParams.productType" placeholder="产åç±»å" style="width: 100%"> |
| | | <el-option v-for="dict in product_type" :key="dict.value" :label="dict.label" :value="dict.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Search" @click="handleQuery"> |
| | | æç´¢ |
| | | </el-button> |
| | | <el-button type="primary" icon="Search" @click="handleQuery"> æç´¢ </el-button> |
| | | <el-button icon="Refresh" @click="resetQuery"> éç½® </el-button> |
| | | </el-form-item> |
| | | <el-form-item style="float: right"> |
| | | <el-button type="primary" icon="Plus" @click="handleAdd"> æ°å¢ </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div class="table-box"> |
| | | <div class="mt20 mb20"> |
| | | <el-button type="primary" icon="Plus" @click="handleAdd"> |
| | | æ°å¢ |
| | | </el-button> |
| | | </div> |
| | | <el-table v-loading="loading" :data="productoutputList"> |
| | | <el-table-column |
| | | label="ç¨è½åå
" |
| | |
| | | prop="nodeName" |
| | | :show-overflow-tooltip="true" |
| | | /> |
| | | <el-table-column |
| | | label="æé´" |
| | | align="center" |
| | | key="timeType" |
| | | prop="timeType" |
| | | :show-overflow-tooltip="true" |
| | | > |
| | | <el-table-column label="æé´" align="center" key="timeType" prop="timeType" :show-overflow-tooltip="true"> |
| | | <template #default="scope"> |
| | | <dict-tag :options="period" :value="scope.row.timeType" /> |
| | | </template> |
| | |
| | | :show-overflow-tooltip="true" |
| | | > |
| | | <template #default="scope"> |
| | | <dict-tag |
| | | :options="product_type" |
| | | :value="scope.row.productType" |
| | | /> |
| | | <dict-tag :options="product_type" :value="scope.row.productType" /> |
| | | </template> |
| | | </el-table-column> |
| | | <!-- <el-table-column |
| | |
| | | prop="name" |
| | | :show-overflow-tooltip="true" |
| | | /> --> |
| | | <el-table-column |
| | | label="åä½" |
| | | align="center" |
| | | key="unit" |
| | | prop="unit" |
| | | :show-overflow-tooltip="true" |
| | | > |
| | | <el-table-column label="åä½" align="center" key="unit" prop="unit" :show-overflow-tooltip="true"> |
| | | <template #default="scope"> |
| | | <dict-tag :options="sys_unit" :value="scope.row.unit" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="产é" |
| | | align="center" |
| | | key="number" |
| | | prop="number" |
| | | :show-overflow-tooltip="true" |
| | | /> |
| | | <el-table-column label="产é" align="center" key="number" prop="number" :show-overflow-tooltip="true" /> |
| | | <el-table-column |
| | | label="æäº¤æ¶é´" |
| | | align="center" |
| | |
| | | :show-overflow-tooltip="true" |
| | | width="200" |
| | | /> |
| | | <el-table-column |
| | | label="æä½" |
| | | align="center" |
| | | class-name="small-padding fixed-width" |
| | | width="200" |
| | | > |
| | | <el-table-column label="æä½" align="center" class-name="small-padding fixed-width" width="200"> |
| | | <template #default="scope"> |
| | | <el-tooltip content="ç¼è¾" placement="top"> |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | icon="Edit" |
| | | @click="handleUpdate(scope.row)" |
| | | > |
| | | ç¼è¾ |
| | | </el-button> |
| | | <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"> ç¼è¾ </el-button> |
| | | </el-tooltip> |
| | | <el-tooltip content="å é¤" placement="top"> |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | icon="Delete" |
| | | @click="handleDelete(scope.row)" |
| | | > |
| | | å é¤ |
| | | </el-button> |
| | | <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"> å é¤ </el-button> |
| | | </el-tooltip> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç¨è½åå
" prop="nodeName"> |
| | | <el-input |
| | | v-model="form.nodeName" |
| | | placeholder="请è¾å
¥ç¨è½åå
" |
| | | disabled |
| | | /> |
| | | <el-input v-model="form.nodeName" placeholder="请è¾å
¥ç¨è½åå
" disabled /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | |
| | | style="width: 100%" |
| | | @change="handleTimeTypeAdd" |
| | | > |
| | | <el-option |
| | | v-for="dict in period" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | <el-option v-for="dict in period" :key="dict.value" :label="dict.label" :value="dict.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="产åç±»å" prop="productType"> |
| | | <el-select |
| | | v-model="form.productType" |
| | | placeholder="产åç±»å" |
| | | clearable |
| | | style="width: 100%" |
| | | > |
| | | <el-option |
| | | v-for="dict in product_type" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | <el-select v-model="form.productType" placeholder="产åç±»å" clearable style="width: 100%"> |
| | | <el-option v-for="dict in product_type" :key="dict.value" :label="dict.label" :value="dict.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | </el-col> --> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åä½" prop="unit"> |
| | | <el-select |
| | | v-model="form.unit" |
| | | placeholder="è¯·éæ©åä½" |
| | | clearable |
| | | style="width: 100%" |
| | | > |
| | | <el-option |
| | | v-for="dict in sys_unit" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | <el-select v-model="form.unit" placeholder="è¯·éæ©åä½" clearable style="width: 100%"> |
| | | <el-option v-for="dict in sys_unit" :key="dict.value" :label="dict.label" :value="dict.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | addProductoutput, |
| | | updateProductoutput, |
| | | delProductoutput, |
| | | } from "@/api/auxiliaryEntry/productOutput"; |
| | | const { proxy } = getCurrentInstance(); |
| | | import { useRoute } from "vue-router"; |
| | | const { period, sys_unit, product_type } = proxy.useDict( |
| | | "period", |
| | | "sys_unit", |
| | | "product_type" |
| | | ); |
| | | const productoutputList = ref([]); |
| | | const open = ref(false); |
| | | const loading = ref(false); |
| | | const showSearch = ref(true); |
| | | const title = ref(""); |
| | | } from "@/api/auxiliaryEntry/productOutput" |
| | | const { proxy } = getCurrentInstance() |
| | | import { useRoute } from "vue-router" |
| | | const { period, sys_unit, product_type } = proxy.useDict("period", "sys_unit", "product_type") |
| | | const productoutputList = ref([]) |
| | | const open = ref(false) |
| | | const loading = ref(false) |
| | | const showSearch = ref(true) |
| | | const title = ref("") |
| | | const data = reactive({ |
| | | form: {}, |
| | | queryParams: { |
| | |
| | | }, |
| | | query: { ...useRoute().query }, |
| | | rules: { |
| | | timeType: [ |
| | | { required: true, message: "æé´ä¸è½ä¸ºç©º", trigger: ["blur", "change"] }, |
| | | ], |
| | | dataTime: [ |
| | | { required: true, message: "æ¶é´ä¸è½ä¸ºç©º", trigger: ["blur", "change"] }, |
| | | ], |
| | | timeType: [{ required: true, message: "æé´ä¸è½ä¸ºç©º", trigger: ["blur", "change"] }], |
| | | dataTime: [{ required: true, message: "æ¶é´ä¸è½ä¸ºç©º", trigger: ["blur", "change"] }], |
| | | productType: [ |
| | | { |
| | | required: true, |
| | |
| | | ], |
| | | // name: [{ required: true, message: "产ååç§°ä¸è½ä¸ºç©º", trigger: "blur" }], |
| | | unit: [{ required: true, message: "åä½ä¸è½ä¸ºç©º", trigger: "blur" }], |
| | | number: [ |
| | | { required: true, message: "产éä¸è½ä¸ºç©º", trigger: ["blur", "change"] }, |
| | | ], |
| | | number: [{ required: true, message: "产éä¸è½ä¸ºç©º", trigger: ["blur", "change"] }], |
| | | }, |
| | | }); |
| | | const { queryParams, query, form, rules } = toRefs(data); |
| | | }) |
| | | const { queryParams, query, form, rules } = toRefs(data) |
| | | /** èç¹åå»äºä»¶ */ |
| | | function handleNodeClick(data) { |
| | | queryParams.value.nodeId = data.id; |
| | | queryParams.value.nodeName = data.label; |
| | | queryParams.value.productType = null; |
| | | handleTimeType(period.value[0].value); |
| | | handleQuery(); |
| | | queryParams.value.nodeId = data.id |
| | | queryParams.value.nodeName = data.label |
| | | queryParams.value.productType = null |
| | | handleTimeType(period.value[0].value) |
| | | handleQuery() |
| | | } |
| | | function handleTimeType(e) { |
| | | queryParams.value.timeType = e; |
| | | queryParams.value.timeType = e |
| | | queryParams.value.dataTime = proxy |
| | | .dayjs(new Date()) |
| | | .format(e == "YEAR" ? "YYYY" : e == "MONTH" ? "YYYY-MM" : "YYYY-MM-DD"); |
| | | .format(e == "YEAR" ? "YYYY" : e == "MONTH" ? "YYYY-MM" : "YYYY-MM-DD") |
| | | } |
| | | // è¾
å©å½å
¥-产å产éå½å
¥-å表 |
| | | function getList() { |
| | | loading.value = true; |
| | | loading.value = true |
| | | listProductoutput( |
| | | proxy.addDateRange({ |
| | | ...queryParams.value, |
| | | ...query.value, |
| | | }) |
| | | ).then((res) => { |
| | | loading.value = false; |
| | | productoutputList.value = res.rows; |
| | | queryParams.value.total = res.total; |
| | | }); |
| | | loading.value = false |
| | | productoutputList.value = res.rows |
| | | queryParams.value.total = res.total |
| | | }) |
| | | } |
| | | // è¾
å©å½å
¥-产å产éå½å
¥-æç´¢ |
| | | function handleQuery() { |
| | | queryParams.value.pageNum = 1; |
| | | getList(); |
| | | queryParams.value.pageNum = 1 |
| | | getList() |
| | | } |
| | | // è¾
å©å½å
¥-产å产éå½å
¥-éç½® |
| | | function resetQuery() { |
| | | proxy.resetForm("queryRef"); |
| | | queryParams.value.pageNum = 1; |
| | | queryParams.value.pageSize = 10; |
| | | queryParams.value.total = 0; |
| | | queryParams.value.timeType = null; |
| | | queryParams.value.dataTime = null; |
| | | queryParams.value.productType = null; |
| | | handleTimeType(period.value[0].value); |
| | | handleQuery(); |
| | | proxy.resetForm("queryRef") |
| | | queryParams.value.pageNum = 1 |
| | | queryParams.value.pageSize = 10 |
| | | queryParams.value.total = 0 |
| | | queryParams.value.timeType = null |
| | | queryParams.value.dataTime = null |
| | | queryParams.value.productType = null |
| | | handleTimeType(period.value[0].value) |
| | | handleQuery() |
| | | } |
| | | // è¾
å©å½å
¥-产å产éå½å
¥-æ°å¢ |
| | | function handleAdd() { |
| | | reset(); |
| | | form.value.nodeId = queryParams.value.nodeId; |
| | | form.value.nodeName = queryParams.value.nodeName; |
| | | handleTimeTypeAdd(period.value[0].value); |
| | | title.value = "æ°å¢äº§å产éå½å
¥"; |
| | | open.value = true; |
| | | reset() |
| | | form.value.nodeId = queryParams.value.nodeId |
| | | form.value.nodeName = queryParams.value.nodeName |
| | | handleTimeTypeAdd(period.value[0].value) |
| | | title.value = "æ°å¢äº§å产éå½å
¥" |
| | | open.value = true |
| | | } |
| | | function handleTimeTypeAdd(e) { |
| | | form.value.timeType = e; |
| | | form.value.dataTime = proxy |
| | | .dayjs(new Date()) |
| | | .format(e == "YEAR" ? "YYYY" : e == "MONTH" ? "YYYY-MM" : "YYYY-MM-DD"); |
| | | form.value.timeType = e |
| | | form.value.dataTime = proxy.dayjs(new Date()).format(e == "YEAR" ? "YYYY" : e == "MONTH" ? "YYYY-MM" : "YYYY-MM-DD") |
| | | } |
| | | // è¾
å©å½å
¥-产å产éå½å
¥-ç¼è¾ |
| | | function handleUpdate(row) { |
| | | reset(); |
| | | form.value = { ...row }; |
| | | open.value = true; |
| | | title.value = "ç¼è¾äº§å产éå½å
¥"; |
| | | reset() |
| | | form.value = { ...row } |
| | | open.value = true |
| | | title.value = "ç¼è¾äº§å产éå½å
¥" |
| | | } |
| | | // è¾
å©å½å
¥-产å产éå½å
¥-æ°å¢/ç¼è¾-ä¿å |
| | | function submitForm() { |
| | |
| | | if (valid) { |
| | | if (form.value.productOutputId != undefined) { |
| | | updateProductoutput(form.value).then((response) => { |
| | | proxy.$modal.msgSuccess("ä¿®æ¹æå"); |
| | | open.value = false; |
| | | getList(); |
| | | }); |
| | | proxy.$modal.msgSuccess("ä¿®æ¹æå") |
| | | open.value = false |
| | | getList() |
| | | }) |
| | | } else { |
| | | addProductoutput(form.value).then((response) => { |
| | | proxy.$modal.msgSuccess("æ°å¢æå"); |
| | | open.value = false; |
| | | getList(); |
| | | }); |
| | | proxy.$modal.msgSuccess("æ°å¢æå") |
| | | open.value = false |
| | | getList() |
| | | }) |
| | | } |
| | | } |
| | | }); |
| | | }) |
| | | } |
| | | // è¾
å©å½å
¥-产å产éå½å
¥-æ°å¢/ç¼è¾-åæ¶ |
| | | function cancel() { |
| | | open.value = false; |
| | | reset(); |
| | | open.value = false |
| | | reset() |
| | | } |
| | | // è¾
å©å½å
¥-产å产éå½å
¥-æ°å¢/ç¼è¾-表åéç½® |
| | | function reset() { |
| | |
| | | number: "1", |
| | | timeType: "", |
| | | unit: "", |
| | | }; |
| | | proxy.resetForm("formRef"); |
| | | } |
| | | proxy.resetForm("formRef") |
| | | } |
| | | // è¾
å©å½å
¥-产å产éå½å
¥-å é¤ |
| | | function handleDelete(row) { |
| | |
| | | .confirm('æ¯å¦ç¡®è®¤å 餿¶é´ä¸º"' + row.dataTime + '"çæ°æ®é¡¹ï¼') |
| | | // .confirm('æ¯å¦ç¡®è®¤å é¤äº§åå称为"' + row.name + '"çæ°æ®é¡¹ï¼') |
| | | .then(function () { |
| | | return delProductoutput(row.productOutputId); |
| | | return delProductoutput(row.productOutputId) |
| | | }) |
| | | .then(() => { |
| | | getList(); |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getList() |
| | | proxy.$modal.msgSuccess("å 餿å") |
| | | }) |
| | | .catch(() => {}); |
| | | .catch(() => {}) |
| | | } |
| | | </script> |
| | | <style scoped lang="scss"> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <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="è½æºç±»å" 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="warning" 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=""> |
| | | <!-- <div id="Chart1" /> --> |
| | | <line-chart ref="LineChartRef" :chartData="lineChartData" :chartType="'bar'" /> |
| | | </div> |
| | | </BaseCard> |
| | | <BaseCard :title="queryParams.nodeName + '-æ¯è·¯ç¨è½è¯¦æ
-' + queryParams.enername"> |
| | | <div class="table-box"> |
| | | <!-- show-summary --> |
| | | <el-table :data="departmentList"> |
| | | <el-table-column label="èç¹" align="center" key="nodeName" prop="nodeName" fixed="left" /> |
| | | <el-table-column label="å计" align="center" key="total" prop="total" width="100" fixed="left" /> |
| | | <template v-if="queryParams.timeType == 'DAY'"> |
| | | <el-table-column |
| | | v-for="index in 24" |
| | | :key="index" |
| | | :label="index - 1 + 'æ¶'" |
| | | align="center" |
| | | min-width="130" |
| | | > |
| | | <template #default="scope">{{ scope.row[`value${index - 1}`] }}</template> |
| | | </el-table-column> |
| | | </template> |
| | | <template v-if="queryParams.timeType == 'MONTH'"> |
| | | <el-table-column |
| | | v-for="index in 31" |
| | | :key="index" |
| | | :label="index + 'æ¥'" |
| | | align="center" |
| | | min-width="130" |
| | | > |
| | | <template #default="scope">{{ scope.row[`value${index - 1}`] }}</template> |
| | | </el-table-column> |
| | | </template> |
| | | <template v-if="queryParams.timeType == 'YEAR'"> |
| | | <el-table-column |
| | | v-for="index in 12" |
| | | :key="index" |
| | | :label="index + 'æ'" |
| | | align="center" |
| | | min-width="130" |
| | | > |
| | | <template #default="scope">{{ scope.row[`value${index - 1}`] }}</template> |
| | | </el-table-column> |
| | | </template> |
| | | </el-table> |
| | | </div> |
| | | </BaseCard> |
| | | <!-- </el-col> |
| | | </el-row> --> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup name="branchanalysis"> |
| | | import buildApi from "@/api/buildingConsumption/api" |
| | | import { listEnergyTypeList } from "@/api/modelConfiguration/energyType" |
| | | import LineChart from "@/components/Echarts/LineChart.vue" |
| | | 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, |
| | | energyType: null, |
| | | }, |
| | | query: { |
| | | modelCode: null, |
| | | }, |
| | | }) |
| | | const { queryParams, query } = toRefs(data) |
| | | const itemBuildData = ref({}) |
| | | const LineChartRef = ref() |
| | | const lineChartData = ref({}) |
| | | /** èç¹åå»äºä»¶ */ |
| | | function handleNodeClick(data) { |
| | | queryParams.value.nodeId = data.id |
| | | queryParams.value.nodeName = data.label |
| | | handleTimeType(period.value[0].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 |
| | | queryParams.value.dataTime = proxy.dayjs(new Date()).format("YYYY-MM-DD") |
| | | handleQuery() |
| | | } |
| | | function handleEnergyType(item) { |
| | | queryParams.value.enername = item.enername |
| | | queryParams.value.muid = item.muid |
| | | handleQuery() |
| | | } |
| | | function getList() { |
| | | loading.value = true |
| | | buildApi |
| | | .branchanalysis( |
| | | proxy.addDateRange({ |
| | | ...queryParams.value, |
| | | ...query.value, |
| | | }) |
| | | ) |
| | | .then((res) => { |
| | | if (!!res.code && res.code == 200) { |
| | | loading.value = false |
| | | let yData = [] |
| | | let xData = [] |
| | | if (!!res.data) { |
| | | departmentList.value = [res.data] || [] |
| | | } |
| | | let dataList = res.data || {} |
| | | if (queryParams.value.timeType == "DAY") { |
| | | for (let i = 0; i < 24; i++) { |
| | | xData.push(i + "æ¶") |
| | | yData.push(dataList[`value${i}`]) |
| | | } |
| | | } else if (queryParams.value.timeType == "MONTH") { |
| | | for (let i = 0; i < 31; i++) { |
| | | xData.push(i + 1 + "æ¥") |
| | | yData.push(dataList[`value${i}`]) |
| | | } |
| | | } else { |
| | | for (let i = 0; i < 12; i++) { |
| | | xData.push(i + 1 + "æ") |
| | | yData.push(dataList[`value${i}`]) |
| | | } |
| | | } |
| | | |
| | | lineChartData.value = { |
| | | title: queryParams.value.muid, |
| | | xAxis: xData, |
| | | series: [ |
| | | { |
| | | name: queryParams.value.enername, |
| | | data: yData, |
| | | }, |
| | | ], |
| | | } |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | loading.value = false |
| | | }) |
| | | } |
| | | function numFilter(value) { |
| | | // æªåå½åæ°æ®å°å°æ°ç¹åçå ä½ |
| | | let realVal = "" |
| | | if (!isNaN(value) && value !== "" && value !== null) { |
| | | realVal = parseFloat(value).toFixed(2) |
| | | } else { |
| | | realVal = "--" |
| | | } |
| | | return realVal |
| | | } |
| | | // è½è对æ¯åæ-ç§å®¤è½èåæ-æç´¢ |
| | | function handleQuery() { |
| | | getList() |
| | | } |
| | | // è½è对æ¯åæ-ç§å®¤è½èåæ-éç½® |
| | | function resetQuery() { |
| | | proxy.resetForm("queryRef") |
| | | handleTimeType(period.value[0].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"; |
| | | .el-tabs { |
| | | padding: 0 12px; |
| | | margin-top: 12px; |
| | | :deep(.el-tabs__header) { |
| | | margin: 0; |
| | | } |
| | | } |
| | | |
| | | .themeDark { |
| | | .build-sum { |
| | | border: 1px solid #8c8b8b; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | color: #fff; |
| | | .build-sum-item { |
| | | width: 25%; |
| | | text-align: center; |
| | | padding: 12px 0; |
| | | .count { |
| | | font-size: 24px; |
| | | font-weight: 600; |
| | | margin-top: 8px; |
| | | color: #409eff; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | .themeLight { |
| | | .build-sum { |
| | | border: 1px solid #eaeaea; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | color: #333; |
| | | .build-sum-item { |
| | | width: 25%; |
| | | text-align: center; |
| | | padding: 12px 0; |
| | | .count { |
| | | font-size: 24px; |
| | | font-weight: 600; |
| | | margin-top: 8px; |
| | | color: #409eff; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <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="è½æºç±»å" 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="warning" 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="build-sum"> |
| | | <div class="build-sum-item"> |
| | | <div>æ»ç¨é/{{ queryParams.muid }}</div> |
| | | <div class="count">{{ itemBuildData.total || 0 }}</div> |
| | | </div> |
| | | <div class="build-sum-item"> |
| | | <div>æå¤§ç¨é/{{ queryParams.muid }}</div> |
| | | <div class="count">{{ itemBuildData.max || 0 }}</div> |
| | | </div> |
| | | <div class="build-sum-item"> |
| | | <div>æå°ç¨é/{{ queryParams.muid }}</div> |
| | | <div class="count">{{ itemBuildData.min || 0 }}</div> |
| | | </div> |
| | | <div class="build-sum-item"> |
| | | <div>å¹³åç¨é/{{ queryParams.muid }}</div> |
| | | <div class="count">{{ itemBuildData.avg || 0 }}</div> |
| | | </div> |
| | | </div> |
| | | <div class=""> |
| | | <!-- <div id="Chart1" /> --> |
| | | <line-chart ref="LineChartRef" :chartData="lineChartData" /> |
| | | </div> |
| | | </BaseCard> |
| | | <BaseCard :title="queryParams.nodeName + '-å项ç¨è½è¯¦æ
-' + queryParams.enername"> |
| | | <div class="table-box"> |
| | | <!-- show-summary --> |
| | | <el-table :data="departmentList"> |
| | | <el-table-column label="èç¹" align="center" key="nodeName" prop="nodeName" fixed="left" /> |
| | | <el-table-column label="å计" align="center" key="total" prop="total" width="100" fixed="left" /> |
| | | <template v-if="queryParams.timeType == 'DAY'"> |
| | | <el-table-column |
| | | v-for="index in 24" |
| | | :key="index" |
| | | :label="index - 1 + 'æ¶'" |
| | | align="center" |
| | | min-width="130" |
| | | > |
| | | <template #default="scope">{{ scope.row[`value${index - 1}`] }}</template> |
| | | </el-table-column> |
| | | </template> |
| | | <template v-if="queryParams.timeType == 'MONTH'"> |
| | | <el-table-column |
| | | v-for="index in 31" |
| | | :key="index" |
| | | :label="index + 'æ¥'" |
| | | align="center" |
| | | min-width="130" |
| | | > |
| | | <template #default="scope">{{ scope.row[`value${index - 1}`] }}</template> |
| | | </el-table-column> |
| | | </template> |
| | | <template v-if="queryParams.timeType == 'YEAR'"> |
| | | <el-table-column |
| | | v-for="index in 12" |
| | | :key="index" |
| | | :label="index + 'æ'" |
| | | align="center" |
| | | min-width="130" |
| | | > |
| | | <template #default="scope">{{ scope.row[`value${index - 1}`] }}</template> |
| | | </el-table-column> |
| | | </template> |
| | | </el-table> |
| | | </div> |
| | | </BaseCard> |
| | | <!-- </el-col> |
| | | </el-row> --> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup name="itemBuild"> |
| | | import buildApi from "@/api/buildingConsumption/api" |
| | | import { listEnergyTypeList } from "@/api/modelConfiguration/energyType" |
| | | import LineChart from "@/components/Echarts/LineChart.vue" |
| | | 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, |
| | | energyType: null, |
| | | }, |
| | | query: { |
| | | modelCode: null, |
| | | }, |
| | | }) |
| | | const { queryParams, query } = toRefs(data) |
| | | const itemBuildData = ref({}) |
| | | const LineChartRef = ref() |
| | | const lineChartData = ref({}) |
| | | /** èç¹åå»äºä»¶ */ |
| | | function handleNodeClick(data) { |
| | | queryParams.value.nodeId = data.id |
| | | queryParams.value.nodeName = data.label |
| | | handleTimeType(period.value[0].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 |
| | | queryParams.value.dataTime = proxy.dayjs(new Date()).format("YYYY-MM-DD") |
| | | handleQuery() |
| | | } |
| | | function handleEnergyType(item) { |
| | | queryParams.value.enername = item.enername |
| | | queryParams.value.muid = item.muid |
| | | handleQuery() |
| | | } |
| | | function getList() { |
| | | loading.value = true |
| | | buildApi |
| | | .itemizedEnergyAnalysis( |
| | | proxy.addDateRange({ |
| | | ...queryParams.value, |
| | | ...query.value, |
| | | }) |
| | | ) |
| | | .then((res) => { |
| | | if (!!res.code && res.code == 200) { |
| | | loading.value = false |
| | | itemBuildData.value = res.data |
| | | let yData = [] |
| | | let xData = [] |
| | | let title = [] |
| | | if (!!res.data.dataList) { |
| | | departmentList.value = res.data.dataList || [] |
| | | } |
| | | let dataList = res.data.dataList || [] |
| | | if (queryParams.value.timeType == "DAY") { |
| | | for (let i = 0; i < 24; i++) { |
| | | xData.push(i + "æ¶") |
| | | yData.push(dataList[0][`value${i}`]) |
| | | } |
| | | } else if (queryParams.value.timeType == "MONTH") { |
| | | for (let i = 0; i < 31; i++) { |
| | | xData.push(i + 1 + "æ¥") |
| | | yData.push(dataList[0][`value${i}`]) |
| | | } |
| | | } else { |
| | | for (let i = 0; i < 12; i++) { |
| | | xData.push(i + 1 + "æ") |
| | | yData.push(dataList[0][`value${i}`]) |
| | | } |
| | | } |
| | | |
| | | lineChartData.value = { |
| | | title: queryParams.value.muid, |
| | | xAxis: xData, |
| | | series: [ |
| | | { |
| | | name: queryParams.value.enername, |
| | | data: yData, |
| | | }, |
| | | ], |
| | | } |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | loading.value = false |
| | | }) |
| | | } |
| | | function numFilter(value) { |
| | | // æªåå½åæ°æ®å°å°æ°ç¹åçå ä½ |
| | | let realVal = "" |
| | | if (!isNaN(value) && value !== "" && value !== null) { |
| | | realVal = parseFloat(value).toFixed(2) |
| | | } else { |
| | | realVal = "--" |
| | | } |
| | | return realVal |
| | | } |
| | | // è½è对æ¯åæ-ç§å®¤è½èåæ-æç´¢ |
| | | function handleQuery() { |
| | | getList() |
| | | } |
| | | // è½è对æ¯åæ-ç§å®¤è½èåæ-éç½® |
| | | function resetQuery() { |
| | | proxy.resetForm("queryRef") |
| | | handleTimeType(period.value[0].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"; |
| | | .el-tabs { |
| | | padding: 0 12px; |
| | | margin-top: 12px; |
| | | :deep(.el-tabs__header) { |
| | | margin: 0; |
| | | } |
| | | } |
| | | |
| | | .themeDark { |
| | | .build-sum { |
| | | border: 1px solid #8c8b8b; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | color: #fff; |
| | | .build-sum-item { |
| | | width: 25%; |
| | | text-align: center; |
| | | padding: 12px 0; |
| | | .count { |
| | | font-size: 24px; |
| | | font-weight: 600; |
| | | margin-top: 8px; |
| | | color: #409eff; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | .themeLight { |
| | | .build-sum { |
| | | border: 1px solid #eaeaea; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | color: #333; |
| | | .build-sum-item { |
| | | width: 25%; |
| | | text-align: center; |
| | | padding: 12px 0; |
| | | .count { |
| | | font-size: 24px; |
| | | font-weight: 600; |
| | | margin-top: 8px; |
| | | color: #409eff; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </style> |
| | |
| | | <el-button type="primary" icon="Search" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | <el-form-item style="float: right"> |
| | | <el-button type="primary" icon="plus" @click="handleAdd">æ°å¢</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | |
| | | <div class="table-bg-style"> |
| | | <div class="theme-dark-mt20 mb20 ml20"> |
| | | <el-button type="primary" icon="plus" @click="handleAdd">æ°å¢</el-button> |
| | | <!-- <el-button type="primary" icon="Delete">å é¤</el-button> --> |
| | | </div> |
| | | <div class="table-box"> |
| | | <el-table :data="tableData" v-loading="loading"> |
| | | <el-table-column prop="limitName" label="éå¼ç±»ååç§°" show-overflow-tooltip align="center" /> |
| | |
| | | <div class="form-card"> |
| | | <el-form :inline="true"> |
| | | <el-form-item label="ç½å
³æ°é:" class="header-box"> |
| | | {{ total }} |
| | | <span class="count">{{ total || 0 }}</span> |
| | | </el-form-item> |
| | | <el-form-item label="计éå¨å
·æ°é:" class="header-box"> |
| | | {{ statistics.deviceNum }} |
| | | <span class="count">{{ deviceNum || 0 }}</span> |
| | | </el-form-item> |
| | | <el-form-item label="æµç¹æ°é:" class="header-box"> |
| | | {{ statistics.ptNum }} |
| | | <span class="count">{{ ptNum || 0 }}</span> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div class="table-box"> |
| | | <div class="mt20 mb20"> |
| | | <div class="mb20 ml20 mr20" style="float: right"> |
| | | <el-button type="primary" icon="plus" @click="handleAdd">æ°å¢</el-button> |
| | | <el-button type="primary" icon="Download" @click="handleExport">导åº</el-button> |
| | | </div> |
| | | </el-form> |
| | | </div> |
| | | <div class="table-bg-style"> |
| | | <div class="table-box"> |
| | | <el-table :data="tableData" v-loading="loading"> |
| | | <el-table-column prop="gatewayNum" label="ç½å
³ç¼å·" show-overflow-tooltip align="center" /> |
| | | <el-table-column prop="gatewayName" label="ç½å
³åç§°" show-overflow-tooltip align="center" /> |
| | |
| | | <el-table-column prop="ptNum" label="ééæµç¹æ°é" show-overflow-tooltip align="center" /> |
| | | <el-table-column label="æä½" width="300" align="center"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" icon="Edit" @click="handleAdd(scope.row)"> |
| | | ä¿®æ¹ |
| | | </el-button> |
| | | <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"> |
| | | å é¤ |
| | | </el-button> |
| | | <el-button link type="primary" icon="Edit" @click="handleAdd(scope.row)"> ä¿®æ¹ </el-button> |
| | | <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"> å é¤ </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" |
| | | v-model:limit="queryParams.pageSize" @pagination="getList" /> |
| | | <pagination |
| | | v-show="total > 0" |
| | | :total="total" |
| | | v-model:page="queryParams.pageNum" |
| | | v-model:limit="queryParams.pageSize" |
| | | @pagination="getList" |
| | | /> |
| | | </div> |
| | | </div> |
| | | |
| | | <edit-modal ref="EditModalRef" @getList="getList(1)" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import EditModal from './components/EditModal.vue' |
| | | import { gatewayStatistics, gatewayList, gatewayDel } from "@/api/businessConfiguration/gatewayLedger"; |
| | | import EditModal from "./components/EditModal.vue" |
| | | import { gatewayStatistics, gatewayList, gatewayDel } from "@/api/businessConfiguration/gatewayLedger" |
| | | let { proxy } = getCurrentInstance() |
| | | |
| | | let statistics = ref({ |
| | | deviceNum: 0, |
| | | ptNum: 0 |
| | | ptNum: 0, |
| | | }) |
| | | function getGatewayStatisticsFun() { |
| | | gatewayStatistics().then(res => { |
| | | gatewayStatistics().then((res) => { |
| | | if (res.code == 200) { |
| | | if (res.data) { |
| | | statistics.value = res.data |
| | |
| | | } |
| | | getGatewayStatisticsFun() |
| | | |
| | | |
| | | let loading = ref(false); |
| | | let total = ref(0); |
| | | let loading = ref(false) |
| | | let total = ref(0) |
| | | let tableData = ref([]) |
| | | let queryParams = ref({ |
| | | pageNum: 1, |
| | |
| | | queryParams.value.pageNum = 1 |
| | | } |
| | | loading.value = true |
| | | gatewayList(queryParams.value).then(res => { |
| | | gatewayList(queryParams.value).then((res) => { |
| | | tableData.value = res.rows |
| | | total.value = res.total |
| | | loading.value = false |
| | |
| | | getList() |
| | | |
| | | function handleExport() { |
| | | proxy.download( |
| | | "gatewaySetting/export", |
| | | queryParams.value, |
| | | `ç½å
³å°è´¦${new Date().getTime()}.xlsx` |
| | | ); |
| | | proxy.download("gatewaySetting/export", queryParams.value, `ç½å
³å°è´¦${new Date().getTime()}.xlsx`) |
| | | } |
| | | |
| | | let EditModalRef = ref('') |
| | | let EditModalRef = ref("") |
| | | function handleAdd(row) { |
| | | if (EditModalRef.value) { |
| | | EditModalRef.value.handleOpen(row) |
| | | } |
| | | |
| | | } |
| | | |
| | | function handleDelete(row) { |
| | | proxy.$modal |
| | | .confirm('æ¯å¦ç¡®è®¤å é¤ç½å
³ä¸º"' + row.gatewayName + '"çæ°æ®é¡¹ï¼') |
| | | .then(function () { |
| | | return gatewayDel(row.id); |
| | | return gatewayDel(row.id) |
| | | }) |
| | | .then(() => { |
| | | getList(1); |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getList(1) |
| | | proxy.$modal.msgSuccess("å 餿å") |
| | | }) |
| | | .catch(() => { }); |
| | | .catch(() => {}) |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | @import "@/assets/styles/page.scss"; |
| | | |
| | | |
| | | .header-box { |
| | | :deep .el-form-item__content { |
| | | color: #fff; |
| | | font-size: 16px; |
| | | } |
| | | } |
| | | |
| | | .themeDark { |
| | | .count { |
| | | color: #fff; |
| | | } |
| | | } |
| | | |
| | | .themeLight { |
| | | .count { |
| | | color: #333; |
| | | } |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <div class="page"> |
| | | <div class="page-title"> |
| | | <div class="title-bar"> |
| | | <span class="title-text">ç½å
³ç¶æçæµ</span> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="table-box"> |
| | | <div class="border"> |
| | | <div class="table" v-for="(item, index) in dataList" :key="index"> |
| | |
| | | ]) |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | <style scoped lang="scss"> |
| | | @import "@/assets/styles/page.scss"; |
| | | |
| | | .page { |
| | | background: #08234F; |
| | | min-height: calc(100vh - 145px) |
| | | } |
| | | |
| | | .page-title { |
| | | position: relative; |
| | | |
| | | .title-bar { |
| | | position: relative; |
| | | padding: 14px 0; |
| | | padding-left: 16px; |
| | | |
| | | .title-text { |
| | | font-size: 18px; |
| | | font-weight: 600; |
| | | position: relative; |
| | | padding-left: 22px; |
| | | color: #fff; |
| | | |
| | | &::before { |
| | | content: ''; |
| | | position: absolute; |
| | | left: 0; |
| | | top: 50%; |
| | | transform: translateY(-50%); |
| | | width: 5px; |
| | | height: 18px; |
| | | background-color: #3883FA; |
| | | border-radius: 2px; |
| | | } |
| | | } |
| | | } |
| | | |
| | | &::after { |
| | | content: ''; |
| | | position: absolute; |
| | | bottom: -4px; |
| | | opacity: 0.12; |
| | | left: 0; |
| | | width: 100%; |
| | | height: 1px; |
| | | background-color: #E6E6E6; |
| | | } |
| | | } |
| | | |
| | | .themeDark { |
| | | .border { |
| | | border: 1px solid #fff; |
| | | color: #fff; |
| | | |
| | | .table { |
| | | margin-top: 10px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: flex-start; |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | .table-box { |
| | | margin: 20px 25px; |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | .table-box { |
| | | margin: 10px 25px; |
| | | } |
| | | } |
| | | |
| | | .page { |
| | | .table-box { |
| | | // ... ä¿æç°ææ ·å¼ |
| | | } |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <div class="table-box"> |
| | | <div class="form-card"> |
| | | <div class="form-card" style="padding: 16px 16px 0 16px"> |
| | | <el-form :model="queryParams" ref="queryRef" :inline="true"> |
| | | <el-form-item label="ééç¹åç§°"> |
| | | <el-input v-model="queryParams.name" placeholder="请è¾å
¥ééç¹åç§°" maxlength="30" /> |
| | |
| | | <el-input v-model="queryParams.code" placeholder="请è¾å
¥ééç¹ç¼ç " maxlength="30" /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Search" @click="getTabList"> |
| | | æç´¢ |
| | | </el-button> |
| | | <el-button type="primary" icon="Search" @click="getTabList"> æç´¢ </el-button> |
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | <el-form-item> |
| | |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <el-table v-loading="loading" row-key="indexId" :data="tableData" @selection-change="handleSelectionChange" |
| | | height="calc(100vh - 430px)" :default-sort="{ prop: 'date', order: 'descending' }"> |
| | | <el-table |
| | | v-loading="loading" |
| | | row-key="indexId" |
| | | :data="tableData" |
| | | @selection-change="handleSelectionChange" |
| | | height="calc(100vh - 430px)" |
| | | :default-sort="{ prop: 'date', order: 'descending' }" |
| | | > |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="ééç¹åç§°" align="center" prop="name" /> |
| | | <el-table-column label="ééç¹ç¼ç " align="center" prop="code" /> |
| | | <el-table-column label="å¯åç¶æ" align="center" prop="indexCategory" /> |
| | | <el-table-column label="æä½" width="150" align="center"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" @click="handleAlarm(scope.row)"> |
| | | æ¥è¦ |
| | | </el-button> |
| | | <el-button link type="primary" @click="handleAlarm(scope.row)"> æ¥è¦ </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination v-show="queryParams.total > 0" :total="queryParams.total" v-model:page="queryParams.pageNum" |
| | | v-model:limit="queryParams.pageSize" @pagination="getTabList" /> |
| | | <pagination |
| | | v-show="queryParams.total > 0" |
| | | :total="queryParams.total" |
| | | v-model:page="queryParams.pageNum" |
| | | v-model:limit="queryParams.pageSize" |
| | | @pagination="getTabList" |
| | | /> |
| | | <CollectAlarmModal ref="collectAlarmModalRef" /> |
| | | </div> |
| | | </template> |
| | | <script setup> |
| | | import CollectAlarmModal from './CollectAlarmModal.vue' |
| | | import { getSettingIndex, getStartStop, getSettingCount, updateSet } from '@/api/businessConfiguration/preAlarmManage' |
| | | import CollectAlarmModal from "./CollectAlarmModal.vue" |
| | | import { getSettingIndex, getStartStop, getSettingCount, updateSet } from "@/api/businessConfiguration/preAlarmManage" |
| | | |
| | | let { proxy } = getCurrentInstance() |
| | | const data = reactive({ |
| | |
| | | pageSize: 10, |
| | | total: 0, |
| | | }, |
| | | }); |
| | | const { queryParams } = toRefs(data); |
| | | }) |
| | | const { queryParams } = toRefs(data) |
| | | let ids = ref([]) |
| | | let names = ref([]) |
| | | let single = ref(true) |
| | |
| | | function getList(modelNode) { |
| | | currentNode.value = modelNode |
| | | queryParams.value.nodeId = modelNode.id |
| | | queryParams.value.indexType = 'COLLECT', |
| | | getTabList() |
| | | ;(queryParams.value.indexType = "COLLECT"), getTabList() |
| | | } |
| | | function getTabList() { |
| | | loading.value = true; |
| | | getSettingIndex(queryParams.value).then(res => { |
| | | tableData.value = res.data.records; |
| | | loading.value = true |
| | | getSettingIndex(queryParams.value).then((res) => { |
| | | tableData.value = res.data.records |
| | | queryParams.value.total = res.data.total |
| | | loading.value = false; |
| | | loading.value = false |
| | | initStartStop() |
| | | }) |
| | | } |
| | | function resetQuery() { |
| | | proxy.resetForm("queryRef"); |
| | | queryParams.value.code = null; |
| | | queryParams.value.name = null; |
| | | queryParams.value.pageNum = 1; |
| | | queryParams.value.pageSize = 10; |
| | | queryParams.value.total = 0; |
| | | getTabList(); |
| | | proxy.resetForm("queryRef") |
| | | queryParams.value.code = null |
| | | queryParams.value.name = null |
| | | queryParams.value.pageNum = 1 |
| | | queryParams.value.pageSize = 10 |
| | | queryParams.value.total = 0 |
| | | getTabList() |
| | | } |
| | | function initStartStop() { |
| | | for (let i = 0; i < tableData.value.length; i++) { |
| | | let ndy = '' |
| | | getStartStop(tableData.value[i].indexId).then(response => { |
| | | if (response.code == '200') { |
| | | if (response.msg == '1') { |
| | | tableData.value[i].indexCategory = 'å¯å¨' |
| | | } else if (response.msg == '2') { |
| | | tableData.value[i].indexCategory = '忢' |
| | | let ndy = "" |
| | | getStartStop(tableData.value[i].indexId).then((response) => { |
| | | if (response.code == "200") { |
| | | if (response.msg == "1") { |
| | | tableData.value[i].indexCategory = "å¯å¨" |
| | | } else if (response.msg == "2") { |
| | | tableData.value[i].indexCategory = "忢" |
| | | } else { |
| | | tableData.value[i].indexCategory = 'å°æªè®¾ç½®' |
| | | tableData.value[i].indexCategory = "å°æªè®¾ç½®" |
| | | } |
| | | } else { |
| | | tableData.value[i].indexCategory = '' |
| | | tableData.value[i].indexCategory = "" |
| | | } |
| | | }) |
| | | } |
| | |
| | | |
| | | // å¤éæ¡é䏿°æ® |
| | | function handleSelectionChange(selection) { |
| | | ids.value = selection.map(item => item.indexId) |
| | | names.value = selection.map(item => item.name) |
| | | ids.value = selection.map((item) => item.indexId) |
| | | names.value = selection.map((item) => item.name) |
| | | single.value = selection.length !== 1 |
| | | multiple.value = !selection.length |
| | | startStopOptions.value = selection.map(item => item.indexCategory) |
| | | codeOptions.value = selection.map(item => item.code) |
| | | startStopOptions.value = selection.map((item) => item.indexCategory) |
| | | codeOptions.value = selection.map((item) => item.code) |
| | | } |
| | | |
| | | function handleUpdateState(flag) { |
| | | let stateName = '' |
| | | if (flag == '1') { |
| | | stateName = 'å¯å¨' |
| | | let stateName = "" |
| | | if (flag == "1") { |
| | | stateName = "å¯å¨" |
| | | } else { |
| | | stateName = '忢' |
| | | stateName = "忢" |
| | | } |
| | | getSettingCount(ids.value).then(response => { |
| | | getSettingCount(ids.value).then((response) => { |
| | | let unStartStopArrName = [] |
| | | let startStopArrIds = [] |
| | | for (let i = 0; i < response.data.length; i++) { |
| | |
| | | } |
| | | } |
| | | if (unStartStopArrName.length > 0) { |
| | | var bh = unStartStopArrName.join('ï¼') |
| | | proxy.$modal.confirm('éä¸å卿ªè®¾ç½®éå¼ç仪å¨è®¾å¤' + bh + 'ï¼ææ æ³' + stateName + 'ï¼', 'è¦å', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }).catch(function () { |
| | | var bh = unStartStopArrName.join("ï¼") |
| | | proxy.$modal |
| | | .confirm("éä¸å卿ªè®¾ç½®éå¼ç仪å¨è®¾å¤" + bh + "ï¼ææ æ³" + stateName + "ï¼", "è¦å", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .catch(function () {}) |
| | | } else { |
| | | if (startStopArrIds.length > 0) { |
| | | updateSet(startStopArrIds || '', flag).then(response => { |
| | | updateSet(startStopArrIds || "", flag).then((response) => { |
| | | if (response.code === 200) { |
| | | initStartStop() |
| | | proxy.$modal.msgSuccess('æå') |
| | | proxy.$modal.msgSuccess("æå") |
| | | } else { |
| | | proxy.$modal.msgError(response.msg) |
| | | } |
| | |
| | | }) |
| | | } |
| | | defineExpose({ |
| | | getList |
| | | }); |
| | | getList, |
| | | }) |
| | | </script> |
| | | |
| | | <style lang='scss' scoped></style> |
| | | <style lang="scss" scoped></style> |
| | |
| | | <template> |
| | | <div class="table-box"> |
| | | <div class="form-card"> |
| | | <div class="form-card" style="padding: 16px 16px 0 16px"> |
| | | <el-form :model="queryParams" ref="queryRef" :inline="true"> |
| | | <el-form-item label="ééç¹åç§°"> |
| | | <el-input v-model="queryParams.name" placeholder="请è¾å
¥ééç¹åç§°" maxlength="30" /> |
| | |
| | | <el-input v-model="queryParams.code" placeholder="请è¾å
¥ééç¹ç¼ç " maxlength="30" /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Search" @click="getTabList"> |
| | | æç´¢ |
| | | </el-button> |
| | | <el-button type="primary" icon="Search" @click="getTabList"> æç´¢ </el-button> |
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | <el-form-item> |
| | |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <el-table v-loading="loading" row-key="indexId" ref="tableRef" :data="tableData" |
| | | @selection-change="handleSelectionChange" height="calc(100vh - 430px)" |
| | | :default-sort="{ prop: 'date', order: 'descending' }"> |
| | | <el-table |
| | | v-loading="loading" |
| | | row-key="indexId" |
| | | ref="tableRef" |
| | | :data="tableData" |
| | | @selection-change="handleSelectionChange" |
| | | height="calc(100vh - 430px)" |
| | | :default-sort="{ prop: 'date', order: 'descending' }" |
| | | > |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="ééç¹åç§°" align="center" prop="name" /> |
| | | <el-table-column label="ééç¹ç¼ç " align="center" prop="code" /> |
| | | <el-table-column label="å¯åç¶æ" align="center" prop="indexCategory" /> |
| | | <el-table-column label="æä½" width="150" align="center"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" @click="handleAlarm(scope.row)"> |
| | | æ¥è¦ |
| | | </el-button> |
| | | <el-button link type="primary" @click="handleAlarm(scope.row)"> æ¥è¦ </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination v-show="queryParams.total > 0" :total="queryParams.total" v-model:page="queryParams.pageNum" |
| | | v-model:limit="queryParams.pageSize" @pagination="getTabList" /> |
| | | <pagination |
| | | v-show="queryParams.total > 0" |
| | | :total="queryParams.total" |
| | | v-model:page="queryParams.pageNum" |
| | | v-model:limit="queryParams.pageSize" |
| | | @pagination="getTabList" |
| | | /> |
| | | <StatisticsAlarmModal ref="statisticsAlarmModalRef" /> |
| | | </div> |
| | | </template> |
| | | <script setup> |
| | | import StatisticsAlarmModal from './StatisticsAlarmModal.vue' |
| | | import { getSettingIndex, getStartStop, getSettingCount, updateSet } from '@/api/businessConfiguration/preAlarmManage' |
| | | import StatisticsAlarmModal from "./StatisticsAlarmModal.vue" |
| | | import { getSettingIndex, getStartStop, getSettingCount, updateSet } from "@/api/businessConfiguration/preAlarmManage" |
| | | |
| | | let { proxy } = getCurrentInstance() |
| | | const data = reactive({ |
| | |
| | | pageSize: 10, |
| | | total: 0, |
| | | }, |
| | | }); |
| | | const { queryParams } = toRefs(data); |
| | | }) |
| | | const { queryParams } = toRefs(data) |
| | | let ids = ref([]) |
| | | let names = ref([]) |
| | | let single = ref(true) |
| | |
| | | function getList(modelNode) { |
| | | currentNode.value = modelNode |
| | | queryParams.value.nodeId = modelNode.id |
| | | queryParams.value.indexType = 'STATISTIC', |
| | | getTabList() |
| | | ;(queryParams.value.indexType = "STATISTIC"), getTabList() |
| | | } |
| | | function getTabList() { |
| | | loading.value = true; |
| | | getSettingIndex(queryParams.value).then(res => { |
| | | tableData.value = res.data.records; |
| | | loading.value = true |
| | | getSettingIndex(queryParams.value).then((res) => { |
| | | tableData.value = res.data.records |
| | | queryParams.value.total = res.data.total |
| | | loading.value = false; |
| | | loading.value = false |
| | | initStartStop() |
| | | }) |
| | | } |
| | | function resetQuery() { |
| | | proxy.resetForm("queryRef"); |
| | | queryParams.value.code = null; |
| | | queryParams.value.name = null; |
| | | queryParams.value.pageNum = 1; |
| | | queryParams.value.pageSize = 10; |
| | | queryParams.value.total = 0; |
| | | getTabList(); |
| | | proxy.resetForm("queryRef") |
| | | queryParams.value.code = null |
| | | queryParams.value.name = null |
| | | queryParams.value.pageNum = 1 |
| | | queryParams.value.pageSize = 10 |
| | | queryParams.value.total = 0 |
| | | getTabList() |
| | | } |
| | | function initStartStop() { |
| | | for (let i = 0; i < tableData.value.length; i++) { |
| | | let ndy = '' |
| | | getStartStop(tableData.value[i].indexId).then(response => { |
| | | if (response.code == '200') { |
| | | if (response.msg == '1') { |
| | | tableData.value[i].indexCategory = 'å¯å¨' |
| | | } else if (response.msg == '2') { |
| | | tableData.value[i].indexCategory = '忢' |
| | | let ndy = "" |
| | | getStartStop(tableData.value[i].indexId).then((response) => { |
| | | if (response.code == "200") { |
| | | if (response.msg == "1") { |
| | | tableData.value[i].indexCategory = "å¯å¨" |
| | | } else if (response.msg == "2") { |
| | | tableData.value[i].indexCategory = "忢" |
| | | } else { |
| | | tableData.value[i].indexCategory = 'å°æªè®¾ç½®' |
| | | tableData.value[i].indexCategory = "å°æªè®¾ç½®" |
| | | } |
| | | } else { |
| | | tableData.value[i].indexCategory = '' |
| | | tableData.value[i].indexCategory = "" |
| | | } |
| | | }) |
| | | } |
| | |
| | | |
| | | // å¤éæ¡é䏿°æ® |
| | | function handleSelectionChange(selection) { |
| | | ids.value = selection.map(item => item.indexId) |
| | | names.value = selection.map(item => item.name) |
| | | ids.value = selection.map((item) => item.indexId) |
| | | names.value = selection.map((item) => item.name) |
| | | single.value = selection.length !== 1 |
| | | multiple.value = !selection.length |
| | | startStopOptions.value = selection.map(item => item.indexCategory) |
| | | codeOptions.value = selection.map(item => item.code) |
| | | startStopOptions.value = selection.map((item) => item.indexCategory) |
| | | codeOptions.value = selection.map((item) => item.code) |
| | | } |
| | | |
| | | function handleUpdateState(flag) { |
| | | let stateName = '' |
| | | if (flag == '1') { |
| | | stateName = 'å¯å¨' |
| | | let stateName = "" |
| | | if (flag == "1") { |
| | | stateName = "å¯å¨" |
| | | } else { |
| | | stateName = '忢' |
| | | stateName = "忢" |
| | | } |
| | | getSettingCount(ids.value).then(response => { |
| | | getSettingCount(ids.value).then((response) => { |
| | | let unStartStopArrName = [] |
| | | let startStopArrIds = [] |
| | | for (let i = 0; i < response.data.length; i++) { |
| | |
| | | } |
| | | } |
| | | if (unStartStopArrName.length > 0) { |
| | | var bh = unStartStopArrName.join('ï¼') |
| | | proxy.$modal.confirm('éä¸å卿ªè®¾ç½®éå¼ç仪å¨è®¾å¤' + bh + 'ï¼ææ æ³' + stateName + 'ï¼', 'è¦å', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }).catch(function () { |
| | | var bh = unStartStopArrName.join("ï¼") |
| | | proxy.$modal |
| | | .confirm("éä¸å卿ªè®¾ç½®éå¼ç仪å¨è®¾å¤" + bh + "ï¼ææ æ³" + stateName + "ï¼", "è¦å", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .catch(function () {}) |
| | | } else { |
| | | if (startStopArrIds.length > 0) { |
| | | updateSet(startStopArrIds || '', flag).then(response => { |
| | | updateSet(startStopArrIds || "", flag).then((response) => { |
| | | if (response.code === 200) { |
| | | initStartStop() |
| | | proxy.$modal.msgSuccess('æå') |
| | | proxy.$modal.msgSuccess("æå") |
| | | } else { |
| | | proxy.$modal.msgError(response.msg) |
| | | } |
| | |
| | | }) |
| | | } |
| | | defineExpose({ |
| | | getList |
| | | }); |
| | | getList, |
| | | }) |
| | | </script> |
| | | |
| | | <style lang='scss' scoped></style> |
| | | <style lang="scss" scoped></style> |
| | |
| | | </div> |
| | | <div class="page-container-right"> |
| | | <div class="page-container-right"> |
| | | <div class="mb20 mt20 ml20 tab-box"> |
| | | <div class="tab-li" :class="tab == 1 ? 'is-tab' : ''" @click="handleTab('1')"> |
| | | ééç¹ç®¡ç |
| | | </div> |
| | | <div class="tab-li" :class="tab == 2 ? 'is-tab' : ''" @click="handleTab('2')"> |
| | | ç»è®¡ææ 管ç |
| | | </div> |
| | | <div class="tab-box"> |
| | | <div class="tab-li" :class="tab == 1 ? 'is-tab' : ''" @click="handleTab('1')">ééç¹ç®¡ç</div> |
| | | <div class="tab-li" :class="tab == 2 ? 'is-tab' : ''" @click="handleTab('2')">ç»è®¡ææ 管ç</div> |
| | | </div> |
| | | <BaseCard :title="currentNode ? currentNode.label + '--èç¹é
ç½®' : 'ææ èç¹é
ç½®'"> |
| | | <div> |
| | |
| | | </BaseCard> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </template> |
| | | <script setup name="preAlarmManage"> |
| | | import CollectionPointManage from './components/collectionpointmanage/CollectionPointManage.vue' |
| | | import StatisticalIndicatorsManage from './components/statisticalindicatorsmanage/StatisticalIndicatorsManage.vue' |
| | | import CollectionPointManage from "./components/collectionpointmanage/CollectionPointManage.vue" |
| | | import StatisticalIndicatorsManage from "./components/statisticalindicatorsmanage/StatisticalIndicatorsManage.vue" |
| | | |
| | | let currentNode = ref() |
| | | let tab = ref('1') |
| | | let tab = ref("1") |
| | | let collectionPointManageRef = ref() |
| | | let statisticalIndicatorsManageRef = ref('1') |
| | | let statisticalIndicatorsManageRef = ref("1") |
| | | |
| | | function handleTab(value) { |
| | | tab.value = value |
| | |
| | | if (value == 2 && statisticalIndicatorsManageRef.value) { |
| | | statisticalIndicatorsManageRef.value.getList(currentNode.value) |
| | | } |
| | | }); |
| | | |
| | | }) |
| | | } |
| | | |
| | | function handleNodeClick(data) { |
| | |
| | | handleTab(tab.value) |
| | | // handleQuery(); |
| | | } |
| | | |
| | | </script> |
| | | <style scoped lang="scss"> |
| | | @import "@/assets/styles/page.scss"; |
| | | |
| | | |
| | | .page-box { |
| | | height: calc(100vh - 145px); |
| | |
| | | margin-right: 5px; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | :deep .el-tabs__nav-wrap:after { |
| | |
| | | |
| | | :deep .el-tabs__item { |
| | | color: #fff; |
| | | font-size: 20px; |
| | | // font-size: 20px; |
| | | padding: 0 20px; |
| | | |
| | | &.is-active, |
| | |
| | | display: flex; |
| | | align-items: center; |
| | | color: #fff; |
| | | border-bottom: 1px solid #3371EB; |
| | | border-bottom: 1px solid #3371eb; |
| | | margin-right: 20px; |
| | | font-size: 15px; |
| | | margin-left: 15px; |
| | | |
| | | .tab-li { |
| | | cursor: pointer; |
| | | border: 1px solid #3371EB; |
| | | padding: 10px 25px; |
| | | border: 1px solid #3371eb; |
| | | padding: 8px 20px; |
| | | border-radius: 5px 5px 0 0; |
| | | } |
| | | |
| | | .is-tab { |
| | | background: #3371EB; |
| | | background: #3371eb; |
| | | color: #fff; |
| | | } |
| | | } |
| | | .themeDark { |
| | | .tab-box { |
| | | color: #fff; |
| | | } |
| | | } |
| | | |
| | | .themeLight { |
| | | .tab-box { |
| | | color: #333; |
| | | } |
| | | } |
| | | |
| | | .content-box { |
| | | height: calc(100vh - 317px) !important; |
| | | |
| | | } |
| | | </style> |
| | |
| | | <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-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-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> |
| | | <el-button type="primary" icon="Search" @click="handleQuery"> |
| | | æç´¢ |
| | | </el-button> |
| | | <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="primary" icon="Download" @click="handleExport"> |
| | | å¯¼åº |
| | | </el-button> |
| | | <el-button type="warning" 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; |
| | | "> |
| | | <div class="card-list" v-if="listTop.length > 1"> |
| | | <div |
| | | style="height: calc(100vh - 220px) !important; max-height: calc(100vh - 220px) !important; overflow-y: auto" |
| | | > |
| | | <!-- <div class="" v-if="listTop.length > 1" style="margin: 12px 0 0 18px"> |
| | | <el-button @click="dialogVisible = true"> æ¥çæ´å¤ </el-button> |
| | | </div> |
| | | </div> --> |
| | | <template v-for="(row, rowIndex) in listTop" :key="rowIndex" v-loading="loading"> |
| | | <div class="card-list" v-if="rowIndex == 0"> |
| | | <template v-for="(item, index) in row" :key="index"> |
| | | <div class="card-list-item"> |
| | | <div class="item-top"> |
| | | <div class="top-icon" :style="{ |
| | | <div |
| | | class="top-icon" |
| | | :style="{ |
| | | backgroundImage: 'url(' + bgList[index].icon + ')', |
| | | }" /> |
| | | }" |
| | | /> |
| | | <div class="top-right"> |
| | | {{ item.allEneryType }} |
| | | </div> |
| | |
| | | <div class="bottom-left">忝</div> |
| | | <div class="bottom-right" :style="{ color: bgList[index].color }"> |
| | | {{ Math.abs(item.yoyEnery) }}% |
| | | <el-icon v-if="!!item.yoyEnery" :color="item.yoyEnery > 0 |
| | | ? 'green' |
| | | : item.yoyEnery < 0 |
| | | ? 'red' |
| | | : '' |
| | | "> |
| | | <el-icon |
| | | v-if="!!item.yoyEnery" |
| | | :color="item.yoyEnery > 0 ? 'green' : item.yoyEnery < 0 ? 'red' : ''" |
| | | > |
| | | <Top v-if="item.yoyEnery > 0" /> |
| | | <Bottom v-if="item.yoyEnery < 0" /> |
| | | </el-icon> |
| | |
| | | </template> |
| | | </div> |
| | | </template> |
| | | <BaseCard :title="queryParams.nodeName + |
| | | '-ç¢³ææ¾éåç¯æ¯(' + |
| | | queryParams.dataTime + |
| | | ')' |
| | | "> |
| | | <BaseCard :title="queryParams.nodeName + '-ç¢³ææ¾éåç¯æ¯(' + queryParams.dataTime + ')'"> |
| | | <div class="chart-box" v-loading="loading"> |
| | | <div id="Chart1" /> |
| | | </div> |
| | | </BaseCard> |
| | | <BaseCard :title="queryParams.nodeName + |
| | | '-ç¢³ææ¾éç»è®¡åæè¡¨(' + |
| | | queryParams.dataTime + |
| | | ')' |
| | | "> |
| | | <BaseCard :title="queryParams.nodeName + '-ç¢³ææ¾éç»è®¡åæè¡¨(' + queryParams.dataTime + ')'"> |
| | | <div class="table-box"> |
| | | <el-table :data="listBottom" v-loading="loading"> |
| | | <el-table-column label="æ¶é´" align="center" key="xaxis" prop="xaxis" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="ç ´ææ¾é(tCOâe) |
| | | " align="center" key="yaxis" prop="yaxis" :show-overflow-tooltip="true" /> |
| | | <el-table-column |
| | | label="ç ´ææ¾é(tCOâe) |
| | | " |
| | | align="center" |
| | | key="yaxis" |
| | | prop="yaxis" |
| | | :show-overflow-tooltip="true" |
| | | /> |
| | | <el-table-column label="忝" align="center" key="yoy" prop="yoy" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="ç¯æ¯" align="center" key="qoq" prop="qoq" :show-overflow-tooltip="true" /> |
| | | </el-table> |
| | |
| | | <template v-for="(item, index) in row" :key="index"> |
| | | <div class="card-list-item"> |
| | | <div class="item-top"> |
| | | <div class="top-icon" :style="{ |
| | | <div |
| | | class="top-icon" |
| | | :style="{ |
| | | backgroundImage: 'url(' + bgList[index].icon + ')', |
| | | }" /> |
| | | }" |
| | | /> |
| | | <div class="top-right"> |
| | | {{ item.allEneryType }} |
| | | </div> |
| | |
| | | <div class="bottom-left">忝</div> |
| | | <div class="bottom-right" :style="{ color: bgList[index].color }"> |
| | | {{ Math.abs(item.yoyEnery) }}% |
| | | <el-icon v-if="!!item.yoyEnery" :color="item.yoyEnery > 0 |
| | | ? 'green' |
| | | : item.yoyEnery < 0 |
| | | ? 'red' |
| | | : '' |
| | | "> |
| | | <el-icon v-if="!!item.yoyEnery" :color="item.yoyEnery > 0 ? 'green' : item.yoyEnery < 0 ? 'red' : ''"> |
| | | <Top v-if="item.yoyEnery > 0" /> |
| | | <Bottom v-if="item.yoyEnery < 0" /> |
| | | </el-icon> |
| | |
| | | </div> |
| | | </template> |
| | | <script setup name="carbonEmission"> |
| | | import { |
| | | listUpCarbonemission, |
| | | listMiddleCarbonemission, |
| | | } from "@/api/carbonemission/carbonemission"; |
| | | import * as echarts from "echarts"; |
| | | const { proxy } = getCurrentInstance(); |
| | | import { useRoute } from "vue-router"; |
| | | const { period } = proxy.useDict("period"); |
| | | import useSettingsStore from "@/store/modules/settings"; |
| | | const settingsStore = useSettingsStore(); |
| | | import { listUpCarbonemission, listMiddleCarbonemission } from "@/api/carbonemission/carbonemission" |
| | | import * as echarts from "echarts" |
| | | const { proxy } = getCurrentInstance() |
| | | import { useRoute } from "vue-router" |
| | | const { period } = proxy.useDict("period") |
| | | import useSettingsStore from "@/store/modules/settings" |
| | | const settingsStore = useSettingsStore() |
| | | watch( |
| | | () => settingsStore.sideTheme, |
| | | (val) => { |
| | | getList(); |
| | | getList() |
| | | } |
| | | ); |
| | | const loading = ref(false); |
| | | const dialogVisible = ref(false); |
| | | import icon1 from "@/assets/images/period/icon1.png"; |
| | | import icon2 from "@/assets/images/period/icon2.png"; |
| | | import icon3 from "@/assets/images/period/icon3.png"; |
| | | import icon4 from "@/assets/images/period/icon4.png"; |
| | | import icon5 from "@/assets/images/period/icon5.png"; |
| | | ) |
| | | const loading = ref(false) |
| | | const dialogVisible = ref(false) |
| | | import icon1 from "@/assets/images/period/icon1.png" |
| | | import icon2 from "@/assets/images/period/icon2.png" |
| | | import icon3 from "@/assets/images/period/icon3.png" |
| | | import icon4 from "@/assets/images/period/icon4.png" |
| | | import icon5 from "@/assets/images/period/icon5.png" |
| | | const bgList = ref([ |
| | | { |
| | | icon: icon1, |
| | |
| | | icon: icon5, |
| | | color: "#78e801", |
| | | }, |
| | | ]); |
| | | const listTop = ref([]); |
| | | const listBottom = ref([]); |
| | | ]) |
| | | const listTop = ref([]) |
| | | const listBottom = ref([]) |
| | | const data = reactive({ |
| | | queryParams: { |
| | | nodeId: null, |
| | |
| | | dataTime: null, |
| | | }, |
| | | query: { ...useRoute().query }, |
| | | }); |
| | | const { queryParams, query } = toRefs(data); |
| | | }) |
| | | const { queryParams, query } = toRefs(data) |
| | | /** èç¹åå»äºä»¶ */ |
| | | function handleNodeClick(data) { |
| | | queryParams.value.nodeId = data.id; |
| | | queryParams.value.nodeName = data.label; |
| | | handleTimeType(period.value[0].value); |
| | | handleQuery(); |
| | | queryParams.value.nodeId = data.id |
| | | queryParams.value.nodeName = data.label |
| | | handleTimeType(period.value[0].value) |
| | | handleQuery() |
| | | } |
| | | function handleTimeType(e) { |
| | | queryParams.value.timeType = e; |
| | | queryParams.value.dataTime = proxy.dayjs(new Date()).format("YYYY-MM-DD"); |
| | | queryParams.value.timeType = e |
| | | queryParams.value.dataTime = proxy.dayjs(new Date()).format("YYYY-MM-DD") |
| | | } |
| | | // ç¢³ææ¾ç®¡ç-ç¢³ææ¾éæ ¸ç®-å表 |
| | | function getList() { |
| | | loading.value = true; |
| | | listTop.value = []; |
| | | loading.value = true |
| | | listTop.value = [] |
| | | listUpCarbonemission( |
| | | proxy.addDateRange({ |
| | | ...queryParams.value, |
| | |
| | | ).then((res) => { |
| | | res.data.upData.map((item, index) => { |
| | | if (index % 5 === 0) { |
| | | listTop.value.push(res.data.upData.slice(index, index + 5)); |
| | | listTop.value.push(res.data.upData.slice(index, index + 5)) |
| | | } |
| | | }); |
| | | }); |
| | | }) |
| | | }) |
| | | // å¨åå§åä¹åï¼å
disposeæ§çå®ä¾ |
| | | if (echarts.getInstanceByDom(document.getElementById("Chart1"))) { |
| | | echarts.dispose(document.getElementById("Chart1")); |
| | | echarts.dispose(document.getElementById("Chart1")) |
| | | } |
| | | const myChart1 = echarts.init(document.getElementById("Chart1")); |
| | | const myChart1 = echarts.init(document.getElementById("Chart1")) |
| | | listMiddleCarbonemission( |
| | | proxy.addDateRange({ |
| | | emissionType: "allType", |
| | |
| | | }) |
| | | ).then((res) => { |
| | | if (!!res.code && res.code == 200) { |
| | | loading.value = false; |
| | | let xaxis = []; |
| | | let yaxis = []; |
| | | let yoy = []; |
| | | let qoq = []; |
| | | loading.value = false |
| | | let xaxis = [] |
| | | let yaxis = [] |
| | | let yoy = [] |
| | | let qoq = [] |
| | | if (!!res.data) { |
| | | res.data.map((item) => { |
| | | xaxis.push(item.xaxis); |
| | | yaxis.push(!!item.yaxis ? item.yaxis : 0); |
| | | yoy.push(!!item.yoy ? item.yoy : 0); |
| | | qoq.push(!!item.qoq ? item.qoq : 0); |
| | | }); |
| | | listBottom.value = res.data; |
| | | xaxis.push(item.xaxis) |
| | | yaxis.push(!!item.yaxis ? item.yaxis : 0) |
| | | yoy.push(!!item.yoy ? item.yoy : 0) |
| | | qoq.push(!!item.qoq ? item.qoq : 0) |
| | | }) |
| | | listBottom.value = res.data |
| | | } |
| | | setTimeout(() => { |
| | | myChart1.setOption({ |
| | |
| | | type: "shadow", |
| | | textStyle: { |
| | | fontSize: 14, |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | }, |
| | |
| | | itemWidth: 14, |
| | | itemHeight: 10, |
| | | textStyle: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | xAxis: { |
| | |
| | | axisLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | axisTick: { |
| | |
| | | show: false, |
| | | }, |
| | | axisLabel: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | fontSize: 14, |
| | | padding: [5, 0, 0, 0], |
| | | // formatter: '{value} ml' |
| | |
| | | name: "tCOâe", |
| | | type: "value", |
| | | nameTextStyle: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | fontSize: 14, |
| | | padding: [0, 0, 5, 0], |
| | | }, |
| | |
| | | show: true, |
| | | lineStyle: { |
| | | type: "dashed", |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | axisTick: { |
| | |
| | | show: false, |
| | | }, |
| | | axisLabel: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | fontSize: 14, |
| | | }, |
| | | }, |
| | |
| | | name: "%", |
| | | alignTicks: true, |
| | | nameTextStyle: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | fontSize: 14, |
| | | padding: [0, 0, 5, 0], |
| | | }, |
| | |
| | | show: true, |
| | | lineStyle: { |
| | | type: "dashed", |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | splitArea: { |
| | | show: false, |
| | | }, |
| | | axisLabel: { |
| | | color: |
| | | settingsStore.sideTheme == "theme-dark" |
| | | ? "#FFFFFF" |
| | | : "#222222", |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | fontSize: 14, |
| | | }, |
| | | }, |
| | |
| | | { |
| | | name: "ç¢³ææ¾é", |
| | | type: "bar", |
| | | barWidth: "27", |
| | | barWidth: "12", |
| | | itemStyle: { |
| | | borderRadius: [15, 15, 0, 0], |
| | | }, |
| | |
| | | data: qoq, |
| | | }, |
| | | ], |
| | | }); |
| | | }, 100); |
| | | }) |
| | | }, 100) |
| | | window.addEventListener( |
| | | "resize", |
| | | () => { |
| | | myChart1.resize(); |
| | | myChart1.resize() |
| | | }, |
| | | { passive: true } |
| | | ); |
| | | ) |
| | | } |
| | | }); |
| | | }) |
| | | } |
| | | // ç¢³ææ¾ç®¡ç-ç¢³ææ¾éæ ¸ç®-æç´¢ |
| | | function handleQuery() { |
| | | getList(); |
| | | getList() |
| | | } |
| | | // ç¢³ææ¾ç®¡ç-ç¢³ææ¾éæ ¸ç®-éç½® |
| | | function resetQuery() { |
| | | proxy.resetForm("queryRef"); |
| | | queryParams.value.timeType = null; |
| | | queryParams.value.dataTime = null; |
| | | handleTimeType(period.value[0].value); |
| | | handleQuery(); |
| | | proxy.resetForm("queryRef") |
| | | queryParams.value.timeType = null |
| | | queryParams.value.dataTime = null |
| | | handleTimeType(period.value[0].value) |
| | | handleQuery() |
| | | } |
| | | // ç¢³ææ¾ç®¡ç-ç¢³ææ¾éæ ¸ç®-å¯¼åº |
| | | function handleExport() { |
| | |
| | | ...query.value, |
| | | }, |
| | | `${queryParams.value.nodeName}-ç¢³ææ¾éæ ¸ç®_${new Date().getTime()}.xlsx` |
| | | ); |
| | | ) |
| | | } |
| | | </script> |
| | | <style scoped lang="scss"> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="chart-box"> |
| | | <div id="ChartDom" style="width: 100%; height: 100%"></div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import * as echarts from "echarts" |
| | | const { proxy } = getCurrentInstance() |
| | | import useSettingsStore from "@/store/modules/settings" |
| | | const settingsStore = useSettingsStore() |
| | | const emit = defineEmits() |
| | | const props = defineProps({ |
| | | chartData: { |
| | | type: Object, |
| | | default: () => {}, |
| | | }, |
| | | }) |
| | | |
| | | watch( |
| | | () => props.chartData, |
| | | (val) => { |
| | | console.log("watch", val) |
| | | initChart() |
| | | } |
| | | ) |
| | | watch( |
| | | () => settingsStore.sideTheme, |
| | | (val) => { |
| | | initChart() |
| | | } |
| | | ) |
| | | |
| | | onMounted(() => { |
| | | initChart() |
| | | }) |
| | | |
| | | function initChart(value) { |
| | | const chartDom = document.getElementById("ChartDom") |
| | | if (echarts.getInstanceByDom(chartDom)) { |
| | | echarts.dispose(chartDom) |
| | | } |
| | | const myChart = echarts.init(chartDom) |
| | | let option = { |
| | | title: { |
| | | text: props.chartData.title, |
| | | left: "40", |
| | | textStyle: { |
| | | color: "#2979ff", |
| | | }, |
| | | }, |
| | | color: ["#40c2ff", "#2979ff", "#ff9900", "#fa3534"], |
| | | tooltip: { |
| | | trigger: "axis", |
| | | axisPointer: { |
| | | type: "shadow", |
| | | }, |
| | | }, |
| | | legend: { |
| | | icon: "rect", |
| | | itemWidth: 14, |
| | | itemHeight: 10, |
| | | textStyle: { |
| | | color: settingsStore.sideTheme == "theme-dark" ? "#FFFFFF" : "#222222", |
| | | }, |
| | | }, |
| | | grid: { |
| | | top: "60", |
| | | left: "50", |
| | | right: "40", |
| | | bottom: "20", |
| | | containLabel: true, |
| | | }, |
| | | 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: props.chartData.xData, |
| | | }, |
| | | yAxis: [ |
| | | { |
| | | type: "value", |
| | | 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, |
| | | }, |
| | | }, |
| | | ], |
| | | series: [ |
| | | { |
| | | name: props.chartData.title, |
| | | type: "bar", |
| | | barWidth: "16", |
| | | // tooltip: { |
| | | // valueFormatter: function (value) { |
| | | // return value + "tce" |
| | | // }, |
| | | // }, |
| | | itemStyle: { |
| | | borderRadius: [15, 15, 0, 0], |
| | | }, |
| | | data: props.chartData.yData, |
| | | markPoint: { |
| | | data: [ |
| | | { type: "max", name: "Max" }, |
| | | { type: "min", name: "Min" }, |
| | | ], |
| | | }, |
| | | }, |
| | | ], |
| | | } |
| | | setTimeout(() => { |
| | | myChart.setOption(option) |
| | | }, 200) |
| | | |
| | | window.addEventListener( |
| | | "resize", |
| | | () => { |
| | | myChart.resize() |
| | | }, |
| | | { passive: true } |
| | | ) |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .chart-box { |
| | | width: 100%; |
| | | height: 400px; |
| | | border: 1px solid #eaeaea; |
| | | margin-top: 20px; |
| | | padding-top: 20px; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="page"> |
| | | <div class="form-card"> |
| | | <el-form :model="queryParams" ref="queryRef" :inline="true" label-width="68px"> |
| | | <el-form-item label="è½æºç±»å" prop="energyType"> |
| | | <el-select v-model="queryParams.energyType" placeholder="è¯·éæ©è½æºç±»å"> |
| | | <el-option |
| | | :label="item.enername" |
| | | :value="item.enersno" |
| | | v-for="item in energyTypeList" |
| | | :key="item.enersno" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ç»è®¡æ¶é´"> |
| | | <el-date-picker |
| | | v-model="queryParams.dataTime" |
| | | type="date" |
| | | format="YYYY-MM-DD" |
| | | value-format="YYYY-MM-DD" |
| | | placeholder="éæ©æ¥æ" |
| | | style="width: 100%" |
| | | :clearable="false" |
| | | /> |
| | | </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="warning" icon="Download" @click="handleExport"> å¯¼åº </el-button> |
| | | </el-form-item> --> |
| | | </el-form> |
| | | </div> |
| | | |
| | | <div class="table-bg-style" style="padding-bottom: 12px"> |
| | | <div class="table-box"> |
| | | <el-table :data="energyList" v-loading="loading" border max-height="380px"> |
| | | <el-table-column fixed prop="indexName" label="ææ åç§°" width="210px"> |
| | | <template #default="scope"> |
| | | <div style="width: 100%; text-align: left"> |
| | | <el-button |
| | | v-if="scope.row.indexId == queryParams.indexId" |
| | | icon="search" |
| | | circle |
| | | @click="selectChange(scope.row)" |
| | | style="color: #fff; background: #409eff; margin-right: 8px" |
| | | ></el-button> |
| | | <el-button |
| | | v-else |
| | | icon="search" |
| | | circle |
| | | @click="selectChange(scope.row)" |
| | | style="margin-right: 8px" |
| | | ></el-button> |
| | | <el-tooltip |
| | | v-if="scope.row.indexName && scope.row.indexName.length > 9" |
| | | class="item" |
| | | effect="dark" |
| | | :content="scope.row.indexName" |
| | | placement="top-end" |
| | | > |
| | | <span> |
| | | {{ scope.row.indexName.substr(0, 9) + "..." }} |
| | | </span> |
| | | </el-tooltip> |
| | | <span v-else>{{ scope.row.indexName }}</span> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-for="index in 24" :key="index" :label="index - 1 + 'æ¶'" align="center" min-width="100"> |
| | | <template #default="scope">{{ numFilter(scope.row[`value${index - 1}`]) }}</template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <div> |
| | | <line-chart ref="LineChartRef" :chartData="lineChartData" /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { |
| | | getDataList, |
| | | getlistChart, |
| | | exportList, |
| | | } from "@/api/comprehensiveStatistics/dailyComprehensive/dailyComprehensive" |
| | | import { listEnergyTypeList } from "@/api/modelConfiguration/energyType" |
| | | import LineChart from "../comps/LineChart.vue" |
| | | let { proxy } = getCurrentInstance() |
| | | const energyTypeList = ref() |
| | | function getEnergyTypeList() { |
| | | listEnergyTypeList().then((res) => { |
| | | energyTypeList.value = res.data |
| | | // form.value.indexType = alarm_record_category.value[0].value |
| | | // form.value.energyType = energyTypeList.value[0].enersno |
| | | getList() |
| | | }) |
| | | } |
| | | getEnergyTypeList() |
| | | function numFilter(value) { |
| | | // æªåå½åæ°æ®å°å°æ°ç¹åçå ä½ |
| | | let realVal = "" |
| | | if (!isNaN(value) && value !== "" && value !== null) { |
| | | realVal = parseFloat(value).toFixed(2) |
| | | } else { |
| | | realVal = "--" |
| | | } |
| | | return realVal |
| | | } |
| | | let loading = ref(false) |
| | | let total = ref(0) |
| | | let queryParams = ref({ |
| | | indexStorageId: "", |
| | | indexCode: "", |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | dataTime: "", |
| | | }) |
| | | |
| | | const energyList = ref([]) |
| | | const lineChartData = ref({}) |
| | | function getList() { |
| | | queryParams.value.indexCode = proxy.$route.query.modelCode |
| | | getDataList({ |
| | | ...queryParams.value, |
| | | timeType: "HOUR", |
| | | }).then((response) => { |
| | | energyList.value = response.data |
| | | if (response.data && response.data.length !== 0) { |
| | | selectChange(response.data[0]) |
| | | } else { |
| | | lineChartData.value = {} |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const LineChartRef = ref() |
| | | function selectChange(row) { |
| | | queryParams.value.indexId = row ? row.indexId : undefined |
| | | queryParams.value.timeType = "HOUR" |
| | | getlistChart(queryParams.value).then((response) => { |
| | | let actualData = [] |
| | | let expectedData = [] |
| | | let title = "" |
| | | response.data.forEach((item) => { |
| | | expectedData.push(numFilter(item.value)) |
| | | actualData.push(item.timeCode.slice(item.timeCode.length - 2, item.timeCode.length) + "æ¶") |
| | | title = item.indexName + "(" + (item.unitId || "") + ")" |
| | | }) |
| | | |
| | | console.log(response) |
| | | console.log(actualData) |
| | | console.log(expectedData) |
| | | |
| | | lineChartData.value = { |
| | | xData: actualData, |
| | | yData: expectedData, |
| | | title, |
| | | } |
| | | // LineChartRef.value.initChart() |
| | | // this.lineChartData.actualData = actualData; |
| | | // this.lineChartData.expectedData = expectedData; |
| | | // this.lineChartData.title = title; |
| | | // this.$refs.LineChart.initChart(this.lineChartData); |
| | | // this.$refs.BarChart.initChart(this.lineChartData); |
| | | }) |
| | | } |
| | | |
| | | function getTime() { |
| | | var date = new Date() |
| | | var year = date.getFullYear() |
| | | var month = date.getMonth() + 1 |
| | | var date = date.getDate() |
| | | month = month < 10 ? "0" + month : month |
| | | date = date < 10 ? "0" + date : date |
| | | queryParams.value.dataTime = year + "-" + month + "-" + date |
| | | } |
| | | getTime() |
| | | |
| | | // å¯¼åºæé®æä½ |
| | | function handleExport() { |
| | | exportList(queryParams.value).then((response) => { |
| | | console.log(response) |
| | | // download(response.msg); |
| | | }) |
| | | } |
| | | |
| | | function handleQuery() { |
| | | queryParams.value.pageNum = 1 |
| | | getList() |
| | | } |
| | | |
| | | function resetQuery() { |
| | | queryParams.value = { |
| | | limitName: "", |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | dataTime: null, |
| | | } |
| | | getTime() |
| | | getList() |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | @import "@/assets/styles/page.scss"; |
| | | |
| | | .header-box { |
| | | :deep .el-form-item__content { |
| | | color: #fff; |
| | | font-size: 16px; |
| | | } |
| | | } |
| | | |
| | | :deep .el-table--fit { |
| | | border-bottom: 1px solid #eaeaea; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="page"> |
| | | <div class="form-card"> |
| | | <el-form :model="queryParams" ref="queryRef" :inline="true" label-width="68px"> |
| | | <el-form-item label="è½æºç±»å" prop="energyType"> |
| | | <el-select v-model="queryParams.energyType" placeholder="è¯·éæ©è½æºç±»å"> |
| | | <el-option |
| | | :label="item.enername" |
| | | :value="item.enersno" |
| | | v-for="item in energyTypeList" |
| | | :key="item.enersno" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ç»è®¡æ¶é´"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="queryParams.dataTime" |
| | | type="month" |
| | | :clearable="false" |
| | | value-format="YYYY-MM" |
| | | placeholder="éæ©æ¥æ" |
| | | > |
| | | </el-date-picker> |
| | | </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="warning" icon="Download" @click="handleExport"> å¯¼åº </el-button> |
| | | </el-form-item> --> |
| | | </el-form> |
| | | </div> |
| | | |
| | | <div class="table-bg-style" style="padding-bottom: 12px"> |
| | | <div class="table-box"> |
| | | <el-table :data="energyList" v-loading="loading" border max-height="380px" height="380"> |
| | | <el-table-column fixed prop="indexName" label="ææ åç§°" width="210px"> |
| | | <template #default="scope"> |
| | | <div style="width: 100%; text-align: left"> |
| | | <el-button |
| | | v-if="scope.row.indexId == queryParams.indexId" |
| | | icon="search" |
| | | circle |
| | | @click="selectChange(scope.row)" |
| | | style="color: #fff; background: #409eff; margin-right: 8px" |
| | | ></el-button> |
| | | <el-button |
| | | v-else |
| | | icon="search" |
| | | circle |
| | | @click="selectChange(scope.row)" |
| | | style="margin-right: 8px" |
| | | ></el-button> |
| | | <el-tooltip |
| | | v-if="scope.row.indexName && scope.row.indexName.length > 9" |
| | | class="item" |
| | | effect="dark" |
| | | :content="scope.row.indexName" |
| | | placement="top-end" |
| | | > |
| | | <span> |
| | | {{ scope.row.indexName.substr(0, 9) + "..." }} |
| | | </span> |
| | | </el-tooltip> |
| | | <span v-else>{{ scope.row.indexName }}</span> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-for="index in 31" :key="index" :label="index + 'æ¥'" align="center" min-width="100px"> |
| | | <template #default="scope">{{ numFilter(scope.row[`value${index}`]) }}</template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <div> |
| | | <line-chart ref="LineChartRef" :chartData="lineChartData" /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { getDataList, getlistChart } from "@/api/comprehensiveStatistics/monthlyComprehensive/monthlyComprehensive" |
| | | import { listEnergyTypeList } from "@/api/modelConfiguration/energyType" |
| | | import LineChart from "../comps/LineChart.vue" |
| | | let { proxy } = getCurrentInstance() |
| | | const energyTypeList = ref() |
| | | function getEnergyTypeList() { |
| | | listEnergyTypeList().then((res) => { |
| | | energyTypeList.value = res.data |
| | | // form.value.indexType = alarm_record_category.value[0].value |
| | | // form.value.energyType = energyTypeList.value[0].enersno |
| | | getList() |
| | | }) |
| | | } |
| | | getEnergyTypeList() |
| | | function numFilter(value) { |
| | | // æªåå½åæ°æ®å°å°æ°ç¹åçå ä½ |
| | | let realVal = "" |
| | | if (!isNaN(value) && value !== "" && value !== null) { |
| | | realVal = parseFloat(value).toFixed(2) |
| | | } else { |
| | | realVal = "--" |
| | | } |
| | | return realVal |
| | | } |
| | | let loading = ref(false) |
| | | let total = ref(0) |
| | | let queryParams = ref({ |
| | | indexStorageId: "", |
| | | indexCode: "", |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | dataTime: "", |
| | | timeType: "DAY", |
| | | }) |
| | | |
| | | const energyList = ref([]) |
| | | const lineChartData = ref({}) |
| | | function getList() { |
| | | queryParams.value.indexCode = proxy.$route.query.modelCode |
| | | getDataList({ |
| | | ...queryParams.value, |
| | | }).then((response) => { |
| | | console.log("1111111111", response) |
| | | energyList.value = response.data.tabledata |
| | | if (energyList.value && energyList.value.length !== 0) { |
| | | selectChange(energyList.value[0]) |
| | | } else { |
| | | lineChartData.value = {} |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const LineChartRef = ref() |
| | | function selectChange(row) { |
| | | queryParams.value.indexId = row ? row.indexId : undefined |
| | | getlistChart(queryParams.value).then((response) => { |
| | | let actualData = [] |
| | | let expectedData = [] |
| | | let title = "" |
| | | response.data.forEach((item) => { |
| | | expectedData.push(numFilter(item.value)) |
| | | actualData.push(item.timeCode.slice(item.timeCode.length - 2, item.timeCode.length) + "æ¥") |
| | | title = item.indexName + "(" + (item.unitId || "") + ")" |
| | | }) |
| | | |
| | | console.log(response) |
| | | console.log(actualData) |
| | | console.log(expectedData) |
| | | |
| | | lineChartData.value = { |
| | | xData: actualData, |
| | | yData: expectedData, |
| | | title, |
| | | } |
| | | // LineChartRef.value.initChart() |
| | | // this.lineChartData.actualData = actualData; |
| | | // this.lineChartData.expectedData = expectedData; |
| | | // this.lineChartData.title = title; |
| | | // this.$refs.LineChart.initChart(this.lineChartData); |
| | | // this.$refs.BarChart.initChart(this.lineChartData); |
| | | }) |
| | | } |
| | | |
| | | function getTime() { |
| | | var date = new Date() |
| | | var year = date.getFullYear() |
| | | var month = date.getMonth() + 1 |
| | | var date = date.getDate() |
| | | month = month < 10 ? "0" + month : month |
| | | date = date < 10 ? "0" + date : date |
| | | queryParams.value.dataTime = year + "-" + month |
| | | } |
| | | getTime() |
| | | |
| | | // å¯¼åºæé®æä½ |
| | | function handleExport() { |
| | | exportList(queryParams.value).then((response) => { |
| | | console.log(response) |
| | | // download(response.msg); |
| | | }) |
| | | } |
| | | |
| | | function handleQuery() { |
| | | queryParams.value.pageNum = 1 |
| | | getList() |
| | | } |
| | | |
| | | function resetQuery() { |
| | | queryParams.value = { |
| | | limitName: "", |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | dataTime: null, |
| | | timeType: "DAY", |
| | | } |
| | | getTime() |
| | | getList() |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | @import "@/assets/styles/page.scss"; |
| | | |
| | | .header-box { |
| | | :deep .el-form-item__content { |
| | | color: #fff; |
| | | font-size: 16px; |
| | | } |
| | | } |
| | | |
| | | :deep .el-table--fit { |
| | | border-bottom: 1px solid #eaeaea; |
| | | } |
| | | </style> |
zhitan-vue/src/views/comprehensive/yearComprehensive/index.vue
zhitan-vue/src/views/costAnalysis/cost-trend-analysis.vue
zhitan-vue/src/views/costAnalysis/energy-trend-analysis.vue
zhitan-vue/src/views/dataMonitoring/historyDataTrend/index.vue
zhitan-vue/src/views/deepanalysis/deepAnalysis.vue
zhitan-vue/src/views/energy/energy.vue
zhitan-vue/src/views/energyanalysis/comprehensive/comprehensive.vue
zhitan-vue/src/views/energyanalysis/department/department.vue
zhitan-vue/src/views/energyanalysis/equipment/equipment.vue
zhitan-vue/src/views/energyconservation/policyrule/components/EditModal copy.vue (已删除)
zhitan-vue/src/views/energyconservation/policyrule/policyRule.vue
zhitan-vue/src/views/energyconservation/projectmanage/projectmanage/projectManage.vue
zhitan-vue/src/views/energyefficiency/benchmarkmanage/benchmarkmanage.vue
zhitan-vue/src/views/index.vue
zhitan-vue/src/views/keyEquipment/comps/LineChart.vue
zhitan-vue/src/views/keyEquipment/daily/index.vue
zhitan-vue/src/views/keyEquipment/monthly/index.vue
zhitan-vue/src/views/keyEquipment/year/index.vue
zhitan-vue/src/views/login.vue
zhitan-vue/src/views/measuringinstruments/distributionroom/distributionroom.vue
zhitan-vue/src/views/measuringinstruments/maintain/maintain.vue
zhitan-vue/src/views/modelconfiguration/businessmodel/businessModel.vue
zhitan-vue/src/views/modelconfiguration/businessmodel/components/collectIndicators/CollectIndicators.vue
zhitan-vue/src/views/modelconfiguration/businessmodel/components/deviceConfig/DeviceConfig.vue
zhitan-vue/src/views/modelconfiguration/businessmodel/components/statisticalIndicators/StatisticModal.vue
zhitan-vue/src/views/modelconfiguration/businessmodel/components/statisticalIndicators/statisticalIndicators.vue
zhitan-vue/src/views/modelconfiguration/calculationformula/calculationFormula.vue
zhitan-vue/src/views/modelconfiguration/collectindicator/collectIndicator.vue
zhitan-vue/src/views/modelconfiguration/energytype/energyType.vue
zhitan-vue/src/views/modelconfiguration/energyvarieties/energyVarieties.vue
zhitan-vue/src/views/modelconfiguration/indexwarehouse/components/deviceConfig/DeviceConfig.vue
zhitan-vue/src/views/modelconfiguration/indexwarehouse/components/statisticalIndicatorManagement/statisticalIndicatorManagement.vue
zhitan-vue/src/views/modelconfiguration/indexwarehouse/indexWarehouse.vue
zhitan-vue/src/views/modelconfiguration/setpeakvalley/setPeakValley.vue
zhitan-vue/src/views/monitor/job/index.vue
zhitan-vue/src/views/monitor/logininfor/index.vue
zhitan-vue/src/views/monitor/online/index.vue
zhitan-vue/src/views/monitor/operlog/index.vue
zhitan-vue/src/views/peakvalley/period/period.vue
zhitan-vue/src/views/peakvalley/timeSharing/timeSharing.vue
zhitan-vue/src/views/policy/knowledgebase/knowledgeBase.vue
zhitan-vue/src/views/poweranalysis/pariPassu/index.vue
zhitan-vue/src/views/poweranalysis/perPassu/index.vue
zhitan-vue/src/views/powerquality/load/index.vue
zhitan-vue/src/views/powerquality/power/index.vue
zhitan-vue/src/views/powerquality/threephase/index.vue
zhitan-vue/src/views/processEnergy/comps/LineChart.vue
zhitan-vue/src/views/processEnergy/daily/index.vue
zhitan-vue/src/views/processEnergy/monthly/index.vue
zhitan-vue/src/views/processEnergy/year/index.vue
zhitan-vue/src/views/realtimemonitor/gatewaystatus/index.vue
zhitan-vue/src/views/realtimemonitor/realtimemonitor/components/chart-modal.vue
zhitan-vue/src/views/realtimemonitor/realtimemonitor/realtimemonitor.vue
zhitan-vue/src/views/register.vue
zhitan-vue/src/views/svg/components/configure.vue
zhitan-vue/src/views/system/config/index.vue
zhitan-vue/src/views/system/dept/index.vue
zhitan-vue/src/views/system/dict/index.vue
zhitan-vue/src/views/system/menu/index.vue
zhitan-vue/src/views/system/name/name.vue
zhitan-vue/src/views/system/post/index.vue
zhitan-vue/src/views/system/role/index.vue
zhitan-vue/src/views/system/user/index.vue
zhitan-vue/src/views/system/user/profile/index.vue
zhitan-vue/src/views/system/user/profile/resetPwd.vue
zhitan-vue/src/views/system/user/profile/userAvatar.vue
zhitan-vue/src/views/system/user/profile/userInfo.vue
zhitan-vue/src/views/tool/gen/index.vue
zhitan-vue/vite.config.js |